Imported from ../bash-2.05.tar.gz.

This commit is contained in:
Jari Aalto 2001-04-06 19:14:31 +00:00
commit 28ef6c316f
251 changed files with 22319 additions and 12413 deletions

View file

@ -67,15 +67,20 @@ extern int restricted;
/* If non-zero, `.' uses $PATH to look up the script to be sourced. */
int source_uses_path = 1;
/* If non-zero, `.' looks in the current directory if the filename argument
is not found in the $PATH. */
int source_searches_cwd = 1;
/* If this . script is supplied arguments, we save the dollar vars and
replace them with the script arguments for the duration of the script's
execution. If the script does not change the dollar vars, we restore
what we saved. If the dollar vars are changed in the script, we leave
the new values alone and free the saved values. */
what we saved. If the dollar vars are changed in the script, and we are
not executing a shell function, we leave the new values alone and free
the saved values. */
static void
maybe_pop_dollar_vars ()
{
if (dollar_vars_changed ())
if (variable_context == 0 && dollar_vars_changed ())
{
dispose_saved_dollar_vars ();
set_dollar_vars_unchanged ();
@ -117,7 +122,15 @@ source_builtin (list)
if (source_uses_path)
filename = find_path_file (list->word->word);
if (filename == 0)
filename = savestring (list->word->word);
{
if (source_searches_cwd == 0)
{
builtin_error ("%s: file not found", list->word->word);
return (EXECUTION_FAILURE);
}
else
filename = savestring (list->word->word);
}
begin_unwind_frame ("source");
add_unwind_protect ((Function *)xfree, filename);