This file is shopt.def, from which is created shopt.c.
It implements the Bash `shopt' builtin.
-Copyright (C) 1994 Free Software Foundation, Inc.
+Copyright (C) 1994-2002 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
$PRODUCES shopt.c
$BUILTIN shopt
-$DOCNAME shopt_builtin
$FUNCTION shopt_builtin
$SHORT_DOC shopt [-pqsu] [-o long-option] optname [optname...]
Toggle the values of variables controlling optional behavior.
extern int allow_null_glob_expansion, glob_dot_filenames;
extern int cdable_vars, mail_warning, source_uses_path;
extern int no_exit_on_failed_exec, print_shift_error;
-extern int check_hashed_filenames, promptvars, interactive_comments;
+extern int check_hashed_filenames, promptvars;
extern int cdspelling, expand_aliases;
extern int check_window_size;
extern int glob_ignore_case;
#endif
#if defined (RESTRICTED_SHELL)
-extern int restricted_shell;
extern char *shell_name;
#endif
+static void shopt_error __P((char *));
+
static int set_interactive_comments __P((int));
#if defined (RESTRICTED_SHELL)
return -1;
}
-#define SHOPT_ERROR(str) builtin_error ("%s: unknown shell option name", str)
+static void
+shopt_error (s)
+ char *s;
+{
+ builtin_error ("%s: invalid shell option name", s);
+}
static int
toggle_shopts (mode, list, quiet)
ind = find_shopt (l->word->word);
if (ind < 0)
{
- SHOPT_ERROR (l->word->word);
+ shopt_error (l->word->word);
rval = EXECUTION_FAILURE;
}
else
i = find_shopt (l->word->word);
if (i < 0)
{
- SHOPT_ERROR (l->word->word);
+ shopt_error (l->word->word);
rval = EXECUTION_FAILURE;
continue;
}
val = minus_o_option_value (l->word->word);
if (val == -1)
{
- builtin_error ("%s: unknown option name", l->word->word);
+ sh_invalidoptname (l->word->word);
rval = EXECUTION_FAILURE;
continue;
}
int n, i;
n = sizeof (shopt_vars) / sizeof (shopt_vars[0]);
- ret = alloc_array (n + 1);
+ ret = strvec_create (n + 1);
for (i = 0; shopt_vars[i].name; i++)
ret[i] = savestring (shopt_vars[i].name);
ret[i] = (char *)NULL;
i = find_shopt (name);
if (i < 0)
{
- SHOPT_ERROR (name);
+ shopt_error (name);
return (EXECUTION_FAILURE);
}