From cce855bc5b117cb7ae70064131120687bc69fac0 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Fri, 17 Apr 1998 19:52:44 +0000 Subject: Imported from ../bash-2.02.tar.gz. --- eval.c | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'eval.c') 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 +# endif # include #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); +} -- cgit v1.2.3