aboutsummaryrefslogtreecommitdiffstats
path: root/eval.c
diff options
context:
space:
mode:
authorJari Aalto <jari.aalto@cante.net>1998-04-17 19:52:44 +0000
committerJari Aalto <jari.aalto@cante.net>2009-09-12 16:46:51 +0000
commitcce855bc5b117cb7ae70064131120687bc69fac0 (patch)
tree39c7a4ec8f6d22ef03df74f2684e6a04fef10399 /eval.c
parente8ce775db824de329b81293b4e5d8fbd65624528 (diff)
downloadandroid_external_bash-cce855bc5b117cb7ae70064131120687bc69fac0.tar.gz
android_external_bash-cce855bc5b117cb7ae70064131120687bc69fac0.tar.bz2
android_external_bash-cce855bc5b117cb7ae70064131120687bc69fac0.zip
Imported from ../bash-2.02.tar.gz.
Diffstat (limited to 'eval.c')
-rw-r--r--eval.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/eval.c b/eval.c
index 1203394..28d38e1 100644
--- a/eval.c
+++ b/eval.c
@@ -23,6 +23,9 @@
#include "config.h"
#if defined (HAVE_UNISTD_H)
+# ifdef _MINIX
+# include <sys/types.h>
+# endif
# include <unistd.h>
#endif
@@ -257,3 +260,38 @@ read_command ()
return (result);
}
+
+/* Take a string and run it through the shell parser, returning the
+ resultant word list. Used by compound array assignment. */
+WORD_LIST *
+parse_string_to_word_list (s, whom)
+ char *s, *whom;
+{
+ WORD_LIST *wl;
+ COMMAND *saved_global;
+
+ push_stream (1);
+
+ saved_global = global_command;
+ global_command = (COMMAND *)0;
+
+ with_input_from_string (s, whom);
+ if (parse_command () != 0 || global_command == 0 || global_command->type != cm_simple)
+ {
+ if (global_command)
+ dispose_command (global_command);
+ wl = (WORD_LIST *)NULL;
+ }
+ else
+ {
+ wl = global_command->value.Simple->words;
+ free (global_command->value.Simple);
+ free (global_command);
+ }
+
+ global_command = saved_global;
+
+ pop_stream ();
+
+ return (wl);
+}