mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-08-11 20:50:42 +02:00
experimental change to use groff instead of man2html for HTML man pages; man page updates for reserved words; fix for pattern matching bracket expression ranges; readline changes to disallow defining some recursive keyboard macros
This commit is contained in:
@@ -35,7 +35,7 @@
|
||||
|
||||
#define ISOPT(s) (((*(s) == '-') || (plus && *(s) == '+')) && (s)[1])
|
||||
#define NOTOPT(s) (((*(s) != '-') && (!plus || *(s) != '+')) || (s)[1] == '\0')
|
||||
|
||||
|
||||
static int sp;
|
||||
|
||||
char *list_optarg;
|
||||
|
||||
+11
-9
@@ -1,7 +1,7 @@
|
||||
This file is declare.def, from which is created declare.c.
|
||||
It implements the builtins "declare" and "local" in Bash.
|
||||
|
||||
Copyright (C) 1987-2024 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2025 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -39,8 +39,10 @@ Options:
|
||||
-p display the attributes and value of each NAME
|
||||
|
||||
Options which set attributes:
|
||||
#ifdef ARRAY_VARS
|
||||
-a to make NAMEs indexed arrays (if supported)
|
||||
-A to make NAMEs associative arrays (if supported)
|
||||
#endif
|
||||
-i to make NAMEs have the `integer' attribute
|
||||
-l to convert the value of each NAME to lower case on assignment
|
||||
-n make NAME a reference to the variable named by its value
|
||||
@@ -131,7 +133,7 @@ local_builtin (WORD_LIST *list)
|
||||
builtin_help ();
|
||||
return (EX_USAGE);
|
||||
}
|
||||
|
||||
|
||||
if (variable_context)
|
||||
return (declare_internal (list, 1));
|
||||
else
|
||||
@@ -199,7 +201,7 @@ declare_transform_name (char *name, int flags_on, int flags_off)
|
||||
{
|
||||
SHELL_VAR *var, *v;
|
||||
char *newname;
|
||||
|
||||
|
||||
var = find_variable (name);
|
||||
if (var == 0)
|
||||
newname = nameref_transform_name (name, ASS_MKLOCAL);
|
||||
@@ -234,7 +236,7 @@ declare_invalid_opts (int flags_on, int flags_off)
|
||||
else if (flags_on & att_array)
|
||||
optchar = "-a";
|
||||
|
||||
sh_invalidopt (optchar);
|
||||
sh_invalidopt (optchar);
|
||||
return (EXECUTION_FAILURE);
|
||||
}
|
||||
else if ((flags_on & att_assoc) && (flags_off & att_assoc))
|
||||
@@ -255,7 +257,7 @@ declare_invalid_opts (int flags_on, int flags_off)
|
||||
/* Ineffective, since you can't have namerefs referencing positional parameters */
|
||||
else if ((flags_on & att_nameref) && (flags_on & att_integer))
|
||||
{
|
||||
builtin_error ("cannot use -n with -i");
|
||||
builtin_error (_("cannot use -n with -i"));
|
||||
return (EX_BADUSAGE);
|
||||
}
|
||||
|
||||
@@ -415,7 +417,7 @@ declare_internal (WORD_LIST *list, int local_var)
|
||||
opt = declare_invalid_opts (flags_on, flags_off);
|
||||
if (opt != 0)
|
||||
return (opt);
|
||||
|
||||
|
||||
#define NEXT_VARIABLE() free (name); list = list->next; continue
|
||||
|
||||
/* There are arguments left, so we are making variables. */
|
||||
@@ -520,7 +522,7 @@ declare_internal (WORD_LIST *list, int local_var)
|
||||
}
|
||||
else
|
||||
#endif /* DEBUGGER */
|
||||
{
|
||||
{
|
||||
t = nodefs ? name_cell (var) : named_function_string (name, function_cell (var), FUNC_MULTILINE|FUNC_EXTERNAL);
|
||||
printf ("%s\n", t);
|
||||
any_failed = sh_chkwrite (any_failed);
|
||||
@@ -876,7 +878,7 @@ restart_new_var_name:
|
||||
|
||||
/* Readonly variable error checking. */
|
||||
|
||||
/* Cannot use declare +r to turn off readonly attribute. */
|
||||
/* Cannot use declare +r to turn off readonly attribute. */
|
||||
if (readonly_p (var) && (flags_off & att_readonly))
|
||||
{
|
||||
sh_readonly (name_cell (var));
|
||||
@@ -1040,7 +1042,7 @@ restart_new_var_name:
|
||||
sh_invalidid (value);
|
||||
/* what else can cause this to fail? */
|
||||
else if (flags_on & att_integer)
|
||||
builtin_error ("%s: expands to invalid variable name for name reference", value);
|
||||
builtin_error (_("%s: expands to invalid variable name for name reference"), value);
|
||||
assign_error++;
|
||||
/* XXX - unset this variable? or leave it as normal var? */
|
||||
if (created_var)
|
||||
|
||||
+1
-1
@@ -183,7 +183,7 @@ file_error_and_exit:
|
||||
free (string);
|
||||
return ((flags & FEVAL_BUILTIN) ? EXECUTION_SUCCESS : 1);
|
||||
}
|
||||
|
||||
|
||||
if ((flags & FEVAL_CHECKBINARY) &&
|
||||
check_binary_file (string, (nr > 80) ? 80 : nr))
|
||||
{
|
||||
|
||||
@@ -341,10 +341,10 @@ parse_and_execute (char *string, const char *from_file, int flags)
|
||||
if (parser_expanding_alias ())
|
||||
/* push current shell_input_line */
|
||||
parser_save_alias ();
|
||||
|
||||
|
||||
if (lreset == 0)
|
||||
line_number--;
|
||||
|
||||
|
||||
indirection_level++;
|
||||
|
||||
code = should_jump_to_top_level = 0;
|
||||
@@ -425,7 +425,7 @@ parse_and_execute (char *string, const char *from_file, int flags)
|
||||
run_unwind_frame ("pe_dispose");
|
||||
last_result = last_command_exit_value = EXECUTION_FAILURE; /* XXX */
|
||||
set_pipestatus_from_exit (last_command_exit_value);
|
||||
|
||||
|
||||
if (subshell_environment)
|
||||
{
|
||||
should_jump_to_top_level = 1;
|
||||
@@ -698,7 +698,7 @@ parse_string (char *string, const char *from_file, int flags, COMMAND **cmdp, ch
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (parse_command () == 0)
|
||||
{
|
||||
if (cmdp)
|
||||
@@ -861,6 +861,6 @@ evalstring (char *string, const char *from_file, int flags)
|
||||
sh_longjmp (return_catch, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (r);
|
||||
}
|
||||
|
||||
+41
-51
@@ -183,7 +183,7 @@ char *arrayvar_builtins[] =
|
||||
"typeset", "unset", "wait", /*]*/
|
||||
(char *)NULL
|
||||
};
|
||||
|
||||
|
||||
/* Forward declarations. */
|
||||
static int is_special_builtin (char *);
|
||||
static int is_assignment_builtin (char *);
|
||||
@@ -288,6 +288,8 @@ main (int argc, char **argv)
|
||||
|
||||
if (include_filename == 0)
|
||||
include_filename = extern_filename;
|
||||
if (include_filename == 0)
|
||||
include_filename = "builtext.h";
|
||||
|
||||
/* If there are no files to process, just quit now. */
|
||||
if (arg_index == argc)
|
||||
@@ -328,7 +330,7 @@ main (int argc, char **argv)
|
||||
/* Process the .def files. */
|
||||
while (arg_index < argc)
|
||||
{
|
||||
register char *arg;
|
||||
char *arg;
|
||||
|
||||
arg = argv[arg_index++];
|
||||
|
||||
@@ -399,7 +401,7 @@ array_create (int width)
|
||||
ARRAY *
|
||||
copy_string_array (ARRAY *array)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
ARRAY *copy;
|
||||
|
||||
if (!array)
|
||||
@@ -412,7 +414,7 @@ copy_string_array (ARRAY *array)
|
||||
copy->width = array->width;
|
||||
|
||||
copy->array = (char **)xmalloc ((1 + array->sindex) * sizeof (char *));
|
||||
|
||||
|
||||
for (i = 0; i < array->sindex; i++)
|
||||
copy->array[i] = savestring (array->array[i]);
|
||||
|
||||
@@ -484,7 +486,7 @@ HANDLER_ENTRY handlers[] = {
|
||||
HANDLER_ENTRY *
|
||||
find_directive (char *directive)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; handlers[i].directive; i++)
|
||||
if (strcmp (handlers[i].directive, directive) == 0)
|
||||
@@ -513,7 +515,7 @@ int output_cpp_line_info = 0;
|
||||
void
|
||||
extract_info (char *filename, FILE *structfile, FILE *externfile)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
DEF_FILE *defs;
|
||||
struct stat finfo;
|
||||
size_t file_size;
|
||||
@@ -578,7 +580,7 @@ extract_info (char *filename, FILE *structfile, FILE *externfile)
|
||||
|
||||
if (*line == '$')
|
||||
{
|
||||
register int j;
|
||||
int j;
|
||||
char *directive;
|
||||
HANDLER_ENTRY *handler;
|
||||
|
||||
@@ -653,7 +655,7 @@ extract_info (char *filename, FILE *structfile, FILE *externfile)
|
||||
static void
|
||||
free_builtin (BUILTIN_DESC *builtin)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
free_safely (builtin->name);
|
||||
free_safely (builtin->function);
|
||||
@@ -675,8 +677,8 @@ free_builtin (BUILTIN_DESC *builtin)
|
||||
void
|
||||
free_defs (DEF_FILE *defs)
|
||||
{
|
||||
register int i;
|
||||
register BUILTIN_DESC *builtin;
|
||||
int i;
|
||||
BUILTIN_DESC *builtin;
|
||||
|
||||
if (defs->production)
|
||||
free (defs->production);
|
||||
@@ -718,7 +720,7 @@ strip_whitespace (char *string)
|
||||
void
|
||||
remove_trailing_whitespace (char *string)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
i = strlen (string) - 1;
|
||||
|
||||
@@ -769,7 +771,7 @@ current_builtin (char *directive, DEF_FILE *defs)
|
||||
void
|
||||
add_documentation (DEF_FILE *defs, char *line)
|
||||
{
|
||||
register BUILTIN_DESC *builtin;
|
||||
BUILTIN_DESC *builtin;
|
||||
|
||||
builtin = current_builtin ("(implied LONGDOC)", defs);
|
||||
|
||||
@@ -837,7 +839,7 @@ builtin_handler (char *self, DEF_FILE *defs, char *arg)
|
||||
int
|
||||
function_handler (char *self, DEF_FILE *defs, char *arg)
|
||||
{
|
||||
register BUILTIN_DESC *builtin;
|
||||
BUILTIN_DESC *builtin;
|
||||
|
||||
builtin = current_builtin (self, defs);
|
||||
|
||||
@@ -859,7 +861,7 @@ function_handler (char *self, DEF_FILE *defs, char *arg)
|
||||
int
|
||||
docname_handler (char *self, DEF_FILE *defs, char *arg)
|
||||
{
|
||||
register BUILTIN_DESC *builtin;
|
||||
BUILTIN_DESC *builtin;
|
||||
|
||||
builtin = current_builtin (self, defs);
|
||||
|
||||
@@ -876,7 +878,7 @@ docname_handler (char *self, DEF_FILE *defs, char *arg)
|
||||
int
|
||||
short_doc_handler (char *self, DEF_FILE *defs, char *arg)
|
||||
{
|
||||
register BUILTIN_DESC *builtin;
|
||||
BUILTIN_DESC *builtin;
|
||||
|
||||
builtin = current_builtin (self, defs);
|
||||
|
||||
@@ -900,7 +902,7 @@ comment_handler (char *self, DEF_FILE *defs, char *arg)
|
||||
int
|
||||
depends_on_handler (char *self, DEF_FILE *defs, char *arg)
|
||||
{
|
||||
register BUILTIN_DESC *builtin;
|
||||
BUILTIN_DESC *builtin;
|
||||
char *dependent;
|
||||
|
||||
builtin = current_builtin (self, defs);
|
||||
@@ -1077,7 +1079,7 @@ char *structfile_header[] = {
|
||||
"/* This file is manufactured by ./mkbuiltins, and should not be",
|
||||
" edited by hand. See the source to mkbuiltins for details. */",
|
||||
"",
|
||||
"/* Copyright (C) 1987-2022 Free Software Foundation, Inc.",
|
||||
"/* Copyright (C) 1987-2025 Free Software Foundation, Inc.",
|
||||
"",
|
||||
" This file is part of GNU Bash, the Bourne Again SHell.",
|
||||
"",
|
||||
@@ -1130,16 +1132,14 @@ char *structfile_footer[] = {
|
||||
void
|
||||
write_file_headers (FILE *structfile, FILE *externfile)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (structfile)
|
||||
{
|
||||
for (i = 0; structfile_header[i]; i++)
|
||||
fprintf (structfile, "%s\n", structfile_header[i]);
|
||||
|
||||
fprintf (structfile, "#include \"%s\"\n",
|
||||
include_filename ? include_filename : "builtext.h");
|
||||
|
||||
fprintf (structfile, "#include \"%s\"\n", include_filename);
|
||||
fprintf (structfile, "#include \"bashintl.h\"\n");
|
||||
|
||||
fprintf (structfile, "\nstruct builtin static_shell_builtins[] = {\n");
|
||||
@@ -1147,8 +1147,7 @@ write_file_headers (FILE *structfile, FILE *externfile)
|
||||
|
||||
if (externfile)
|
||||
fprintf (externfile,
|
||||
"/* %s - The list of builtins found in libbuiltins.a. */\n",
|
||||
include_filename ? include_filename : "builtext.h");
|
||||
"/* %s - The list of builtins found in libbuiltins.a. */\n", include_filename);
|
||||
}
|
||||
|
||||
/* Write out any necessary closing information for
|
||||
@@ -1156,7 +1155,7 @@ write_file_headers (FILE *structfile, FILE *externfile)
|
||||
void
|
||||
write_file_footers (FILE *structfile, FILE *externfile)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
/* Write out the footers. */
|
||||
if (structfile)
|
||||
@@ -1171,12 +1170,12 @@ write_file_footers (FILE *structfile, FILE *externfile)
|
||||
void
|
||||
write_builtins (DEF_FILE *defs, FILE *structfile, FILE *externfile)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
/* Write out the information. */
|
||||
if (defs->builtins)
|
||||
{
|
||||
register BUILTIN_DESC *builtin;
|
||||
BUILTIN_DESC *builtin;
|
||||
|
||||
for (i = 0; i < defs->builtins->sindex; i++)
|
||||
{
|
||||
@@ -1275,8 +1274,8 @@ write_builtins (DEF_FILE *defs, FILE *structfile, FILE *externfile)
|
||||
void
|
||||
write_longdocs (FILE *stream, ARRAY *builtins)
|
||||
{
|
||||
register int i;
|
||||
register BUILTIN_DESC *builtin;
|
||||
int i;
|
||||
BUILTIN_DESC *builtin;
|
||||
char *dname;
|
||||
char *sarray[2];
|
||||
|
||||
@@ -1312,7 +1311,7 @@ write_longdocs (FILE *stream, ARRAY *builtins)
|
||||
void
|
||||
write_dummy_declarations (FILE *stream, ARRAY *builtins)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
BUILTIN_DESC *builtin;
|
||||
|
||||
for (i = 0; structfile_header[i]; i++)
|
||||
@@ -1336,7 +1335,7 @@ write_dummy_declarations (FILE *stream, ARRAY *builtins)
|
||||
void
|
||||
write_ifdefs (FILE *stream, char **defines)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (!stream)
|
||||
return;
|
||||
@@ -1365,7 +1364,7 @@ write_ifdefs (FILE *stream, char **defines)
|
||||
void
|
||||
write_endifs (FILE *stream, char **defines)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
if (!stream)
|
||||
return;
|
||||
@@ -1390,8 +1389,8 @@ write_endifs (FILE *stream, char **defines)
|
||||
void
|
||||
write_documentation (FILE *stream, char **documentation, int indentation, int flags)
|
||||
{
|
||||
register int i, j;
|
||||
register char *line;
|
||||
int i, j;
|
||||
char *line;
|
||||
int string_array, texinfo, base_indent, filename_p;
|
||||
|
||||
if (stream == 0)
|
||||
@@ -1456,16 +1455,9 @@ write_documentation (FILE *stream, char **documentation, int indentation, int fl
|
||||
{
|
||||
for (j = 0; line[j]; j++)
|
||||
{
|
||||
switch (line[j])
|
||||
{
|
||||
case '\\':
|
||||
case '"':
|
||||
fprintf (stream, "\\%c", line[j]);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf (stream, "%c", line[j]);
|
||||
}
|
||||
if (line[j] == '\\' || line[j] == '"')
|
||||
fputc ('\\', stream);
|
||||
fputc (line[j], stream);
|
||||
}
|
||||
|
||||
/* closing right paren for gettext */
|
||||
@@ -1489,14 +1481,12 @@ write_documentation (FILE *stream, char **documentation, int indentation, int fl
|
||||
case '@':
|
||||
case '{':
|
||||
case '}':
|
||||
fprintf (stream, "@%c", line[j]);
|
||||
fputc ('@', stream);
|
||||
break;
|
||||
|
||||
default:
|
||||
fprintf (stream, "%c", line[j]);
|
||||
}
|
||||
fputc (line[j], stream);
|
||||
}
|
||||
fprintf (stream, "\n");
|
||||
fputc ('\n', stream);
|
||||
}
|
||||
else
|
||||
fprintf (stream, "%s\n", line);
|
||||
@@ -1554,12 +1544,12 @@ write_helpfiles (ARRAY *builtins)
|
||||
free (helpfile);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static int
|
||||
_find_in_table (char *name, char **name_table)
|
||||
{
|
||||
register int i;
|
||||
int i;
|
||||
|
||||
for (i = 0; name_table[i]; i++)
|
||||
if (strcmp (name, name_table[i]) == 0)
|
||||
|
||||
Reference in New Issue
Block a user