-
-/* 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;
-#if defined (HISTORY)
- int old_remember_on_history, old_history_expansion_inhibited;
-#endif
-
-#if defined (HISTORY)
- old_remember_on_history = remember_on_history;
-# if defined (BANG_HISTORY)
- old_history_expansion_inhibited = history_expansion_inhibited;
-# endif
- bash_history_disable ();
-#endif
-
- 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 ();
-
-#if defined (HISTORY)
- remember_on_history = old_remember_on_history;
-# if defined (BANG_HISTORY)
- history_expansion_inhibited = old_history_expansion_inhibited;
-# endif /* BANG_HISTORY */
-#endif /* HISTORY */
-
- return (wl);
-}