It implements the builtin "mapfile" in Bash.
Copyright (C) 2005-2006 Rocky Bernstein for Free Software Foundation, Inc.
-Copyright (C) 2008-2010 Free Software Foundation, Inc.
+Copyright (C) 2008-2012 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
#endif
snprintf (execstr, execlen, "%s %d %s", callback, curindex, qline);
free (qline);
- return parse_and_execute (execstr, NULL, flags);
+ return evalstring (execstr, NULL, flags);
}
static void
builtin_error (_("%s: not an indexed array"), array_name);
return (EXECUTION_FAILURE);
}
+ else if (invisible_p (entry))
+ VUNSETATTR (entry, att_invisible); /* no longer invisible */
if (flags & MAPF_CLEARARRAY)
array_flush (array_cell (entry));
line_length = 0;
/* Reset the buffer for bash own stream */
- interrupt_immediately++;
for (array_index = origin, line_count = 1;
zgetline (fd, &line, &line_length, unbuffered_read) != -1;
array_index++)
zsyncfd (fd);
}
+ /* XXX - bad things can happen if the callback modifies ENTRY, e.g.,
+ unsetting it or changing it to a non-indexed-array type. */
bind_array_element (entry, array_index, line, 0);
/* Have we exceeded # of lines to store? */
if (unbuffered_read == 0)
zsyncfd (fd);
- interrupt_immediately--;
return EXECUTION_SUCCESS;
}