mirror of
https://https.git.savannah.gnu.org/git/bash.git
synced 2026-06-29 08:29:54 +02:00
rest of work to convert unwind-protects to ANSI/ISO C; size_t updates; function prototype changes for ANSI/ISO C
This commit is contained in:
@@ -5917,3 +5917,30 @@ unwind_prot.h
|
||||
- introduce new unwind-protect function pointer type to replace
|
||||
Function
|
||||
From Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
3/30
|
||||
----
|
||||
builtins/command.def,builtins/fc.def,builtins/read.def,builtins/source.def
|
||||
builtins/evalfile.c,builtins/evalstring.c
|
||||
dispose_cmd.c,execute_cmd.c,pcomplete.c,print_cmd.c,subst.c,jobs.c,variables.c
|
||||
dispose_cmd.h,general.h,trap.h
|
||||
unwind_prot.c,unwind_prot.h
|
||||
- rest of work to convert unwind-protect framework to ANSI/ISO C.
|
||||
Convert unwind-protects to use new shim functions that obey the new
|
||||
unwind-protect function type
|
||||
From Paul Eggert <eggert@cs.ucla.edu>
|
||||
|
||||
general.h
|
||||
- STREQ, STREQN: now static inline functions to take advantage of arg
|
||||
type conversion
|
||||
|
||||
pcomplete.c,subst.c
|
||||
lib/readline/histexpand.c,lib/readline/mbutil.c
|
||||
- fix size_t subtractions in comparisons to avoid unsigned underflow
|
||||
|
||||
externs.h
|
||||
execute_cmd.c
|
||||
builtins/times.h
|
||||
- add prototypes for functions taking clock_t and timeval, make their
|
||||
declaration in externs.h conditional on NEED_CLOCK_FUNCS_DECL and
|
||||
NEED_TIMEVAL_FUNCS_DECL, respectively
|
||||
|
||||
+1
-1
@@ -75,7 +75,7 @@ static int xattrfd = -1;
|
||||
|
||||
$BUILTIN cd
|
||||
$FUNCTION cd_builtin
|
||||
$SHORT_DOC cd [-L|[-P [-e]] [-@]] [dir]
|
||||
$SHORT_DOC cd [-L|[-P [-e]]] [-@] [dir]
|
||||
Change the shell working directory.
|
||||
|
||||
Change the current directory to DIR. The default DIR is the value of the
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
This file is command.def, from which is created command.c.
|
||||
It implements the builtin "command" in Bash.
|
||||
|
||||
Copyright (C) 1987-2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -131,7 +131,7 @@ command_builtin (WORD_LIST *list)
|
||||
command->flags |= COMMAND_BUILTIN_FLAGS;
|
||||
command->value.Simple->flags |= COMMAND_BUILTIN_FLAGS;
|
||||
|
||||
add_unwind_protect ((char *)dispose_command, command);
|
||||
add_unwind_protect (uw_dispose_command, command);
|
||||
result = execute_command (command);
|
||||
|
||||
run_unwind_frame ("command_builtin");
|
||||
|
||||
+2
-2
@@ -247,7 +247,7 @@ file_error_and_exit:
|
||||
fa->funcname_a = funcname_a;
|
||||
fa->funcname_v = funcname_v;
|
||||
if (flags & FEVAL_UNWINDPROT)
|
||||
add_unwind_protect (restore_funcarray_state, fa);
|
||||
add_unwind_protect (uw_restore_funcarray_state, fa);
|
||||
|
||||
# if defined (DEBUGGER)
|
||||
/* Have to figure out a better way to do this when `source' is supplied
|
||||
@@ -260,7 +260,7 @@ file_error_and_exit:
|
||||
tt[0] = '1'; tt[1] = '\0';
|
||||
array_push (bash_argc_a, tt);
|
||||
if (flags & FEVAL_UNWINDPROT)
|
||||
add_unwind_protect (pop_args, 0);
|
||||
add_unwind_protect (uw_pop_args, 0);
|
||||
}
|
||||
# endif
|
||||
#endif
|
||||
|
||||
+28
-9
@@ -70,19 +70,38 @@ static int cat_file (REDIRECT *);
|
||||
|
||||
#if defined (HISTORY)
|
||||
static void
|
||||
set_history_remembering (void)
|
||||
uw_set_history_remembering (void *ignore)
|
||||
{
|
||||
remember_on_history = enable_history_list;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static void
|
||||
restore_lastcom (char *x)
|
||||
uw_restore_lastcom (void *x)
|
||||
{
|
||||
FREE (the_printed_command_except_trap);
|
||||
the_printed_command_except_trap = x;
|
||||
}
|
||||
|
||||
static void
|
||||
uw_set_current_prompt_level (void *x)
|
||||
{
|
||||
set_current_prompt_level ((intptr_t) x);
|
||||
}
|
||||
|
||||
static void
|
||||
uw_pop_stream (void *x)
|
||||
{
|
||||
pop_stream ();
|
||||
}
|
||||
|
||||
static void
|
||||
uw_parser_restore_alias (void *x)
|
||||
{
|
||||
parser_restore_alias ();
|
||||
}
|
||||
|
||||
int
|
||||
should_optimize_fork (COMMAND *command, int subshell)
|
||||
{
|
||||
@@ -227,7 +246,7 @@ parse_prologue (char *string, int flags, char *tag)
|
||||
|
||||
#if defined (HISTORY)
|
||||
if (parse_and_execute_level == 0)
|
||||
add_unwind_protect (set_history_remembering, (char *)NULL);
|
||||
add_unwind_protect (uw_set_history_remembering, (char *)NULL);
|
||||
else
|
||||
unwind_protect_int (remember_on_history); /* can be used in scripts */
|
||||
# if defined (BANG_HISTORY)
|
||||
@@ -238,18 +257,18 @@ parse_prologue (char *string, int flags, char *tag)
|
||||
if (interactive_shell)
|
||||
{
|
||||
x = get_current_prompt_level ();
|
||||
add_unwind_protect (set_current_prompt_level, x);
|
||||
add_unwind_protect (uw_set_current_prompt_level, (void *) (intptr_t) x);
|
||||
}
|
||||
|
||||
if (the_printed_command_except_trap)
|
||||
{
|
||||
lastcom = savestring (the_printed_command_except_trap);
|
||||
add_unwind_protect (restore_lastcom, lastcom);
|
||||
add_unwind_protect (uw_restore_lastcom, lastcom);
|
||||
}
|
||||
|
||||
add_unwind_protect (pop_stream, (char *)NULL);
|
||||
add_unwind_protect (uw_pop_stream, (char *)NULL);
|
||||
if (parser_expanding_alias ())
|
||||
add_unwind_protect (parser_restore_alias, (char *)NULL);
|
||||
add_unwind_protect (uw_parser_restore_alias, (char *)NULL);
|
||||
|
||||
if (orig_string && ((flags & SEVAL_NOFREE) == 0))
|
||||
add_unwind_protect (xfree, orig_string);
|
||||
@@ -455,8 +474,8 @@ parse_and_execute (char *string, const char *from_file, int flags)
|
||||
|
||||
bitmap = new_fd_bitmap (FD_BITMAP_SIZE);
|
||||
begin_unwind_frame ("pe_dispose");
|
||||
add_unwind_protect (dispose_fd_bitmap, bitmap);
|
||||
add_unwind_protect (dispose_command, command); /* XXX */
|
||||
add_unwind_protect (uw_dispose_fd_bitmap, bitmap);
|
||||
add_unwind_protect (uw_dispose_command, command); /* XXX */
|
||||
|
||||
global_command = (COMMAND *)NULL;
|
||||
|
||||
|
||||
+9
-3
@@ -167,11 +167,17 @@ static void fc_addhist (char *);
|
||||
#endif
|
||||
|
||||
static void
|
||||
set_verbose_flag (void)
|
||||
uw_set_verbose_flag (void *ignore)
|
||||
{
|
||||
echo_input_at_read = verbose_flag;
|
||||
}
|
||||
|
||||
static void
|
||||
uw_unlink (void *fn)
|
||||
{
|
||||
unlink ((const char *)fn);
|
||||
}
|
||||
|
||||
/* String to execute on a file that we want to edit. */
|
||||
#define FC_EDIT_COMMAND "${FCEDIT:-${EDITOR:-vi}}"
|
||||
#if defined (STRICT_POSIX)
|
||||
@@ -525,8 +531,8 @@ fc_builtin (WORD_LIST *list)
|
||||
will be echoed as they are read by the parser. */
|
||||
begin_unwind_frame ("fc builtin");
|
||||
add_unwind_protect (xfree, fn);
|
||||
add_unwind_protect (unlink, fn);
|
||||
add_unwind_protect (set_verbose_flag, (char *)NULL);
|
||||
add_unwind_protect (uw_unlink, fn);
|
||||
add_unwind_protect (uw_set_verbose_flag, (char *)NULL);
|
||||
unwind_protect_int (suppress_debug_trap_verbose);
|
||||
echo_input_at_read = 1;
|
||||
suppress_debug_trap_verbose = 1;
|
||||
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
This file is jobs.def, from which is created jobs.c.
|
||||
It implements the builtins "jobs" and "disown" in Bash.
|
||||
|
||||
Copyright (C) 1987-2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -206,7 +206,7 @@ execute_list_with_replacements (WORD_LIST *list)
|
||||
command->flags |= CMD_INHIBIT_EXPANSION;
|
||||
command->value.Simple->flags |= CMD_INHIBIT_EXPANSION;
|
||||
|
||||
add_unwind_protect (dispose_command, command);
|
||||
add_unwind_protect (uw_dispose_command, command);
|
||||
result = execute_command (command);
|
||||
dispose_command (command);
|
||||
|
||||
|
||||
+33
-12
@@ -1,7 +1,7 @@
|
||||
This file is read.def, from which is created read.c.
|
||||
It implements the builtin "read" in Bash.
|
||||
|
||||
Copyright (C) 1987-2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -119,21 +119,24 @@ struct ttsave
|
||||
};
|
||||
|
||||
#if defined (READLINE)
|
||||
static void reset_attempted_completion_function (char *);
|
||||
static void uw_reset_attempted_completion_function (void *);
|
||||
static int set_itext (void);
|
||||
static char *edit_line (char *, char *);
|
||||
static void set_eol_delim (int);
|
||||
static void reset_eol_delim (char *);
|
||||
static void reset_eol_delim (void *);
|
||||
static void set_readline_timeout (sh_timer *t, time_t, long);
|
||||
static void uw_bashline_reset_event_hook (void *);
|
||||
#endif
|
||||
static SHELL_VAR *bind_read_variable (char *, char *, int);
|
||||
#if defined (HANDLE_MULTIBYTE)
|
||||
static int read_mbchar (int, char *, int, int, int);
|
||||
#endif
|
||||
static void ttyrestore (struct ttsave *);
|
||||
static void uw_ttyrestore (void *);
|
||||
|
||||
static sighandler sigalrm (int);
|
||||
static void reset_timeout (void);
|
||||
static void uw_reset_timeout (void *);
|
||||
|
||||
/* Try this to see what the rest of the shell can do with the information. */
|
||||
sh_timer *read_timeout;
|
||||
@@ -169,6 +172,12 @@ reset_timeout (void)
|
||||
read_timeout = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
uw_reset_timeout (void *ignore)
|
||||
{
|
||||
reset_timeout ();
|
||||
}
|
||||
|
||||
void
|
||||
check_read_timeout (void)
|
||||
{
|
||||
@@ -509,12 +518,12 @@ read_builtin (WORD_LIST *list)
|
||||
}
|
||||
if (interactive_shell == 0)
|
||||
initialize_terminating_signals ();
|
||||
add_unwind_protect (reset_timeout, (char *)NULL);
|
||||
add_unwind_protect (uw_reset_timeout, NULL);
|
||||
#if defined (READLINE)
|
||||
if (edit)
|
||||
{
|
||||
add_unwind_protect (reset_attempted_completion_function, (char *)NULL);
|
||||
add_unwind_protect (bashline_reset_event_hook, (char *)NULL);
|
||||
add_unwind_protect (uw_reset_attempted_completion_function, NULL);
|
||||
add_unwind_protect (uw_bashline_reset_event_hook, NULL);
|
||||
set_readline_timeout (read_timeout, tmsec, tmusec);
|
||||
}
|
||||
else
|
||||
@@ -538,7 +547,7 @@ read_builtin (WORD_LIST *list)
|
||||
if (delim != '\n')
|
||||
{
|
||||
set_eol_delim (delim);
|
||||
add_unwind_protect (reset_eol_delim, (char *)NULL);
|
||||
add_unwind_protect (reset_eol_delim, NULL);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -555,7 +564,7 @@ read_builtin (WORD_LIST *list)
|
||||
if (i < 0)
|
||||
sh_ttyerror (1);
|
||||
tty_modified = 1;
|
||||
add_unwind_protect ((Function *)ttyrestore, (char *)&termsave);
|
||||
add_unwind_protect (uw_ttyrestore, &termsave);
|
||||
if (interactive_shell == 0)
|
||||
initialize_terminating_signals ();
|
||||
}
|
||||
@@ -573,7 +582,7 @@ read_builtin (WORD_LIST *list)
|
||||
sh_ttyerror (1);
|
||||
|
||||
tty_modified = 1;
|
||||
add_unwind_protect ((Function *)ttyrestore, (char *)&termsave);
|
||||
add_unwind_protect (uw_ttyrestore, &termsave);
|
||||
if (interactive_shell == 0)
|
||||
initialize_terminating_signals ();
|
||||
}
|
||||
@@ -840,7 +849,7 @@ add_char:
|
||||
if (nchars > 0)
|
||||
rl_num_chars_to_read = 0;
|
||||
if (delim != '\n')
|
||||
reset_eol_delim ((char *)NULL);
|
||||
reset_eol_delim (NULL);
|
||||
}
|
||||
else
|
||||
#endif
|
||||
@@ -1114,6 +1123,12 @@ ttyrestore (struct ttsave *ttp)
|
||||
tty_modified = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
uw_ttyrestore (void *ttp)
|
||||
{
|
||||
ttyrestore (ttp);
|
||||
}
|
||||
|
||||
void
|
||||
read_tty_cleanup (void)
|
||||
{
|
||||
@@ -1133,12 +1148,18 @@ static rl_hook_func_t *old_startup_hook;
|
||||
static char *deftext;
|
||||
|
||||
static void
|
||||
reset_attempted_completion_function (char *cp)
|
||||
uw_reset_attempted_completion_function (void *cp)
|
||||
{
|
||||
if (rl_attempted_completion_function == 0 && old_attempted_completion_function)
|
||||
rl_attempted_completion_function = old_attempted_completion_function;
|
||||
}
|
||||
|
||||
static void
|
||||
uw_bashline_reset_event_hook (void *ignore)
|
||||
{
|
||||
bashline_reset_event_hook ();
|
||||
}
|
||||
|
||||
static int
|
||||
set_itext (void)
|
||||
{
|
||||
@@ -1241,7 +1262,7 @@ set_eol_delim (int c)
|
||||
}
|
||||
|
||||
static void
|
||||
reset_eol_delim (char *cp)
|
||||
reset_eol_delim (void *ignore)
|
||||
{
|
||||
Keymap cmap;
|
||||
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
This file is source.def, from which is created source.c.
|
||||
It implements the builtins "." and "source" in Bash.
|
||||
|
||||
Copyright (C) 1987-2022 Free Software Foundation, Inc.
|
||||
Copyright (C) 1987-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -80,7 +80,7 @@ $END
|
||||
extern int errno;
|
||||
#endif /* !errno */
|
||||
|
||||
static void maybe_pop_dollar_vars (void);
|
||||
static void uw_maybe_pop_dollar_vars (void *);
|
||||
|
||||
/* If non-zero, `.' uses $PATH to look up the script to be sourced. */
|
||||
int source_uses_path = 1;
|
||||
@@ -96,7 +96,7 @@ int source_searches_cwd = 1;
|
||||
not executing a shell function, we leave the new values alone and free
|
||||
the saved values. */
|
||||
static void
|
||||
maybe_pop_dollar_vars (void)
|
||||
uw_maybe_pop_dollar_vars (void *ignore)
|
||||
{
|
||||
if (variable_context == 0 && (dollar_vars_changed () & ARGS_SETBLTIN))
|
||||
dispose_saved_dollar_vars ();
|
||||
@@ -170,7 +170,7 @@ source_builtin (WORD_LIST *list)
|
||||
if (list->next)
|
||||
{
|
||||
push_dollar_vars ();
|
||||
add_unwind_protect ((Function *)maybe_pop_dollar_vars, (char *)NULL);
|
||||
add_unwind_protect (uw_maybe_pop_dollar_vars, NULL);
|
||||
if (debugging_mode || shell_compatibility_level <= 44)
|
||||
init_bash_argv (); /* Initialize BASH_ARGV and BASH_ARGC */
|
||||
remember_args (list->next, 1);
|
||||
@@ -187,7 +187,7 @@ source_builtin (WORD_LIST *list)
|
||||
{
|
||||
debug_trap = savestring (debug_trap);
|
||||
add_unwind_protect (xfree, debug_trap);
|
||||
add_unwind_protect (maybe_set_debug_trap, debug_trap);
|
||||
add_unwind_protect (uw_maybe_set_debug_trap, debug_trap);
|
||||
restore_default_signal (DEBUG_TRAP);
|
||||
}
|
||||
|
||||
|
||||
+4
-1
@@ -43,7 +43,6 @@ $END
|
||||
|
||||
#include <stdio.h>
|
||||
#include "../bashtypes.h"
|
||||
#include "../shell.h"
|
||||
|
||||
#include <posixtime.h>
|
||||
|
||||
@@ -55,6 +54,10 @@ $END
|
||||
# include <sys/resource.h>
|
||||
#endif
|
||||
|
||||
#define NEED_CLOCK_FUNCS_DECL
|
||||
#define NEED_TIMEVAL_FUNCS_DECL
|
||||
|
||||
#include "../shell.h"
|
||||
#include "common.h"
|
||||
|
||||
/* Print the totals for system and user time used. */
|
||||
|
||||
+13
-1
@@ -1,6 +1,6 @@
|
||||
/* dispose_command.c -- dispose of a COMMAND structure. */
|
||||
|
||||
/* Copyright (C) 1987-2009,2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1987-2009,2022,2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -204,6 +204,12 @@ dispose_command (COMMAND *command)
|
||||
free (command);
|
||||
}
|
||||
|
||||
void
|
||||
uw_dispose_command (void *command)
|
||||
{
|
||||
dispose_command (command);
|
||||
}
|
||||
|
||||
#if defined (COND_COMMAND)
|
||||
/* How to free a node in a conditional command. */
|
||||
void
|
||||
@@ -272,6 +278,12 @@ dispose_words (WORD_LIST *list)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
uw_dispose_words (void *list)
|
||||
{
|
||||
dispose_words (list);
|
||||
}
|
||||
|
||||
#ifdef INCLUDE_UNUSED
|
||||
/* How to dispose of an array of pointers to char. This is identical to
|
||||
free_array in stringlib.c. */
|
||||
|
||||
+4
-1
@@ -1,6 +1,6 @@
|
||||
/* dispose_cmd.h -- Functions appearing in dispose_cmd.c. */
|
||||
|
||||
/* Copyright (C) 1993-2022 Free Software Foundation, Inc.
|
||||
/* Copyright (C) 1993-2023 Free Software Foundation, Inc.
|
||||
|
||||
This file is part of GNU Bash, the Bourne Again SHell.
|
||||
|
||||
@@ -37,4 +37,7 @@ extern void dispose_cond_node (COND_COM *);
|
||||
extern void dispose_function_def_contents (FUNCTION_DEF *);
|
||||
extern void dispose_function_def (FUNCTION_DEF *);
|
||||
|
||||
extern void uw_dispose_command (void *);
|
||||
extern void uw_dispose_words (void *);
|
||||
|
||||
#endif /* !_DISPOSE_CMD_H_ */
|
||||
|
||||
+1
-1
@@ -7957,7 +7957,7 @@ The return value is 0 unless the shell is not executing a subroutine
|
||||
call or \fIexpr\fP does not correspond to a valid position in the
|
||||
call stack.
|
||||
.TP
|
||||
\fBcd\fP [\fB\-L\fP|[\fB\-P\fP [\fB\-e\fP]] [\-@]] [\fIdir\fP]
|
||||
\fBcd\fP [\fB\-L\fP|[\fB\-P\fP [\fB\-e\fP]]] [\-@] [\fIdir\fP]
|
||||
Change the current directory to \fIdir\fP.
|
||||
if \fIdir\fP is not supplied, the value of the
|
||||
.SM
|
||||
|
||||
+1
-1
@@ -3816,7 +3816,7 @@ The return status is zero unless @var{n} is not greater than or equal to 1.
|
||||
@item cd
|
||||
@btindex cd
|
||||
@example
|
||||
cd [-L|[-P [-e]] [-@@] [@var{directory}]
|
||||
cd [-L|[-P [-e]]] [-@@] [@var{directory}]
|
||||
@end example
|
||||
|
||||
Change the current working directory to @var{directory}.
|
||||
|
||||
+83
-33
@@ -59,6 +59,8 @@ extern int errno;
|
||||
|
||||
#define NEED_FPURGE_DECL
|
||||
#define NEED_SH_SETLINEBUF_DECL
|
||||
#define NEED_CLOCK_FUNCS_DECL
|
||||
#define NEED_TIMEVAL_FUNCS_DECL
|
||||
|
||||
#include "bashansi.h"
|
||||
#include "bashintl.h"
|
||||
@@ -123,7 +125,7 @@ static int shell_control_structure (enum command_type);
|
||||
static void cleanup_redirects (REDIRECT *);
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
static void restore_signal_mask (void *);
|
||||
static void uw_restore_signal_mask (void *);
|
||||
#endif
|
||||
|
||||
static int builtin_status (int);
|
||||
@@ -344,6 +346,12 @@ dispose_fd_bitmap (struct fd_bitmap *fdbp)
|
||||
free (fdbp);
|
||||
}
|
||||
|
||||
void
|
||||
uw_dispose_fd_bitmap (void *fdbp)
|
||||
{
|
||||
dispose_fd_bitmap (fdbp);
|
||||
}
|
||||
|
||||
void
|
||||
close_fd_bitmap (struct fd_bitmap *fdbp)
|
||||
{
|
||||
@@ -360,6 +368,18 @@ close_fd_bitmap (struct fd_bitmap *fdbp)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
uw_close_fd_bitmap (void *fdbp)
|
||||
{
|
||||
close_fd_bitmap (fdbp);
|
||||
}
|
||||
|
||||
void
|
||||
uw_close (void *fd)
|
||||
{
|
||||
close ((intptr_t) fd); /* XXX */
|
||||
}
|
||||
|
||||
/* Return the line number of the currently executing command. */
|
||||
int
|
||||
executing_line_number (void)
|
||||
@@ -403,7 +423,7 @@ execute_command (COMMAND *command)
|
||||
current_fds_to_close = (struct fd_bitmap *)NULL;
|
||||
bitmap = new_fd_bitmap (FD_BITMAP_DEFAULT_SIZE);
|
||||
begin_unwind_frame ("execute-command");
|
||||
add_unwind_protect (dispose_fd_bitmap, (char *)bitmap);
|
||||
add_unwind_protect (uw_dispose_fd_bitmap, (char *)bitmap);
|
||||
|
||||
/* Just do the command, but not asynchronously. */
|
||||
result = execute_command_internal (command, 0, NO_PIPE, NO_PIPE, bitmap);
|
||||
@@ -463,6 +483,18 @@ cleanup_redirects (REDIRECT *list)
|
||||
dispose_redirects (list);
|
||||
}
|
||||
|
||||
static void
|
||||
uw_cleanup_redirects (void *list)
|
||||
{
|
||||
cleanup_redirects (list);
|
||||
}
|
||||
|
||||
static void
|
||||
uw_dispose_redirects (void *list)
|
||||
{
|
||||
dispose_redirects (list);
|
||||
}
|
||||
|
||||
void
|
||||
undo_partial_redirects (void)
|
||||
{
|
||||
@@ -506,7 +538,7 @@ dispose_partial_redirects (void)
|
||||
/* A function to restore the signal mask to its proper value when the shell
|
||||
is interrupted or errors occur while creating a pipeline. */
|
||||
static void
|
||||
restore_signal_mask (void *set)
|
||||
uw_restore_signal_mask (void *set)
|
||||
{
|
||||
sigprocmask (SIG_SETMASK, set, NULL);
|
||||
}
|
||||
@@ -826,10 +858,10 @@ execute_command_internal (COMMAND *command, int asynchronous, int pipe_in, int p
|
||||
begin_unwind_frame ("loop_redirections");
|
||||
|
||||
if (my_undo_list)
|
||||
add_unwind_protect ((Function *)cleanup_redirects, my_undo_list);
|
||||
add_unwind_protect (uw_cleanup_redirects, my_undo_list);
|
||||
|
||||
if (exec_undo_list)
|
||||
add_unwind_protect ((Function *)dispose_redirects, exec_undo_list);
|
||||
add_unwind_protect (uw_dispose_redirects, exec_undo_list);
|
||||
|
||||
QUIT;
|
||||
|
||||
@@ -2438,11 +2470,23 @@ restore_stdin (int s)
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
uw_restore_stdin (void *s)
|
||||
{
|
||||
restore_stdin ((intptr_t)s);
|
||||
}
|
||||
|
||||
static void
|
||||
uw_merge_temporary_env (void *ignore)
|
||||
{
|
||||
merge_temporary_env ();
|
||||
}
|
||||
|
||||
/* Catch-all cleanup function for lastpipe code for unwind-protects */
|
||||
static void
|
||||
lastpipe_cleanup (int s)
|
||||
uw_lastpipe_cleanup (void *s)
|
||||
{
|
||||
set_jobs_list_frozen (s);
|
||||
set_jobs_list_frozen ((intptr_t) s);
|
||||
}
|
||||
|
||||
static int
|
||||
@@ -2516,15 +2560,15 @@ execute_pipeline (COMMAND *command, int asynchronous, int pipe_in, int pipe_out,
|
||||
unwind-protects are run, and the storage used for the
|
||||
bitmaps freed up. */
|
||||
begin_unwind_frame ("pipe-file-descriptors");
|
||||
add_unwind_protect (dispose_fd_bitmap, fd_bitmap);
|
||||
add_unwind_protect (close_fd_bitmap, fd_bitmap);
|
||||
add_unwind_protect (uw_dispose_fd_bitmap, fd_bitmap);
|
||||
add_unwind_protect (uw_close_fd_bitmap, fd_bitmap);
|
||||
if (prev >= 0)
|
||||
add_unwind_protect (close, prev);
|
||||
add_unwind_protect (uw_close, (void *) (intptr_t) prev);
|
||||
dummyfd = fildes[1];
|
||||
add_unwind_protect (close, dummyfd);
|
||||
add_unwind_protect (uw_close, (void *) (intptr_t) dummyfd);
|
||||
|
||||
#if defined (JOB_CONTROL)
|
||||
add_unwind_protect (restore_signal_mask, &oset);
|
||||
add_unwind_protect (uw_restore_signal_mask, &oset);
|
||||
#endif /* JOB_CONTROL */
|
||||
|
||||
if (ignore_return && cmd->value.Connection->first)
|
||||
@@ -2568,11 +2612,11 @@ execute_pipeline (COMMAND *command, int asynchronous, int pipe_in, int pipe_out,
|
||||
{
|
||||
do_piping (prev, pipe_out);
|
||||
prev = NO_PIPE;
|
||||
add_unwind_protect (restore_stdin, lstdin);
|
||||
add_unwind_protect (uw_restore_stdin, (void *) (intptr_t) lstdin);
|
||||
lastpipe_flag = 1;
|
||||
old_frozen = freeze_jobs_list ();
|
||||
lastpipe_jid = stop_pipeline (0, (COMMAND *)NULL); /* XXX */
|
||||
add_unwind_protect (lastpipe_cleanup, old_frozen);
|
||||
add_unwind_protect (uw_lastpipe_cleanup, (void *) (intptr_t) old_frozen);
|
||||
#if defined (JOB_CONTROL)
|
||||
UNBLOCK_CHILD (oset); /* XXX */
|
||||
#endif
|
||||
@@ -2581,7 +2625,7 @@ execute_pipeline (COMMAND *command, int asynchronous, int pipe_in, int pipe_out,
|
||||
cmd->flags |= CMD_LASTPIPE;
|
||||
}
|
||||
if (prev >= 0)
|
||||
add_unwind_protect (close, prev);
|
||||
add_unwind_protect (uw_close, (void *) (intptr_t) prev);
|
||||
|
||||
exec_result = execute_command_internal (cmd, asynchronous, prev, pipe_out, fds_to_close);
|
||||
|
||||
@@ -2841,14 +2885,14 @@ execute_for_command (FOR_COM *for_command)
|
||||
list = releaser = expand_words_no_vars (for_command->map_list);
|
||||
|
||||
begin_unwind_frame ("for");
|
||||
add_unwind_protect (dispose_words, releaser);
|
||||
add_unwind_protect (uw_dispose_words, releaser);
|
||||
|
||||
#if 0
|
||||
if (lexical_scoping)
|
||||
{
|
||||
old_value = copy_variable (find_variable (identifier));
|
||||
if (old_value)
|
||||
add_unwind_protect (dispose_variable, old_value);
|
||||
add_unwind_protect (uw_dispose_variable, old_value);
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -3375,7 +3419,7 @@ execute_select_command (SELECT_COM *select_command)
|
||||
}
|
||||
|
||||
begin_unwind_frame ("select");
|
||||
add_unwind_protect (dispose_words, releaser);
|
||||
add_unwind_protect (uw_dispose_words, releaser);
|
||||
|
||||
if (select_command->flags & CMD_IGNORE_RETURN)
|
||||
select_command->action->flags |= CMD_IGNORE_RETURN;
|
||||
@@ -4539,7 +4583,7 @@ itrace("execute_simple_command: posix mode tempenv assignment error");
|
||||
builtin = 0;
|
||||
}
|
||||
|
||||
add_unwind_protect (dispose_words, words);
|
||||
add_unwind_protect (uw_dispose_words, words);
|
||||
QUIT;
|
||||
|
||||
/* Bind the last word in this command to "$_" after execution. */
|
||||
@@ -4798,7 +4842,7 @@ execute_builtin (sh_builtin_func_t *builtin, WORD_LIST *words, int flags, int su
|
||||
{
|
||||
error_trap = savestring (error_trap);
|
||||
add_unwind_protect (xfree, error_trap);
|
||||
add_unwind_protect (set_error_trap, error_trap);
|
||||
add_unwind_protect (uw_set_error_trap, error_trap);
|
||||
restore_default_signal (ERROR_TRAP);
|
||||
}
|
||||
exit_immediately_on_error = 0;
|
||||
@@ -4838,7 +4882,7 @@ execute_builtin (sh_builtin_func_t *builtin, WORD_LIST *words, int flags, int su
|
||||
if (flags & CMD_COMMAND_BUILTIN)
|
||||
should_keep = 0;
|
||||
if (subshell == 0)
|
||||
add_unwind_protect (pop_scope, should_keep ? "1" : 0);
|
||||
add_unwind_protect (pop_scope, (void *) (intptr_t) should_keep);
|
||||
temporary_env = (HASH_TABLE *)NULL;
|
||||
}
|
||||
}
|
||||
@@ -4877,7 +4921,7 @@ execute_builtin (sh_builtin_func_t *builtin, WORD_LIST *words, int flags, int su
|
||||
if (posixly_correct && subshell == 0 && builtin == return_builtin && (flags & CMD_COMMAND_BUILTIN) == 0 && temporary_env)
|
||||
{
|
||||
begin_unwind_frame ("return_temp_env");
|
||||
add_unwind_protect (merge_temporary_env, (char *)NULL);
|
||||
add_unwind_protect (uw_merge_temporary_env, NULL);
|
||||
}
|
||||
|
||||
executing_builtin++;
|
||||
@@ -4908,7 +4952,7 @@ execute_builtin (sh_builtin_func_t *builtin, WORD_LIST *words, int flags, int su
|
||||
}
|
||||
|
||||
static void
|
||||
maybe_restore_getopt_state (void *arg)
|
||||
uw_maybe_restore_getopt_state (void *arg)
|
||||
{
|
||||
sh_getopt_state_t *gs;
|
||||
|
||||
@@ -4939,6 +4983,12 @@ restore_funcarray_state (struct func_array_state *fa)
|
||||
|
||||
free (fa);
|
||||
}
|
||||
|
||||
void
|
||||
uw_restore_funcarray_state (void *fa)
|
||||
{
|
||||
restore_funcarray_state (fa);
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
@@ -4998,14 +5048,14 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
|
||||
/* This has to be before the pop_context(), because the unwinding of
|
||||
local variables may cause the restore of a local declaration of
|
||||
OPTIND to force a getopts state reset. */
|
||||
add_unwind_protect (maybe_restore_getopt_state, gs);
|
||||
add_unwind_protect (pop_context, (char *)NULL);
|
||||
add_unwind_protect (uw_maybe_restore_getopt_state, gs);
|
||||
add_unwind_protect (pop_context, NULL);
|
||||
unwind_protect_int (line_number);
|
||||
unwind_protect_int (line_number_for_err_trap);
|
||||
unwind_protect_int (function_line_number);
|
||||
unwind_protect_int (return_catch_flag);
|
||||
unwind_protect_jmp_buf (return_catch);
|
||||
add_unwind_protect (dispose_command, (char *)tc);
|
||||
add_unwind_protect (uw_dispose_command, (char *)tc);
|
||||
unwind_protect_pointer (this_shell_function);
|
||||
unwind_protect_int (funcnest);
|
||||
unwind_protect_int (loop_level);
|
||||
@@ -5035,7 +5085,7 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
|
||||
{
|
||||
debug_trap = savestring (debug_trap);
|
||||
add_unwind_protect (xfree, debug_trap);
|
||||
add_unwind_protect (maybe_set_debug_trap, debug_trap);
|
||||
add_unwind_protect (uw_maybe_set_debug_trap, debug_trap);
|
||||
}
|
||||
restore_default_signal (DEBUG_TRAP);
|
||||
}
|
||||
@@ -5047,7 +5097,7 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
|
||||
{
|
||||
error_trap = savestring (error_trap);
|
||||
add_unwind_protect (xfree, error_trap);
|
||||
add_unwind_protect (maybe_set_error_trap, error_trap);
|
||||
add_unwind_protect (uw_maybe_set_error_trap, error_trap);
|
||||
}
|
||||
restore_default_signal (ERROR_TRAP);
|
||||
}
|
||||
@@ -5060,7 +5110,7 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
|
||||
{
|
||||
return_trap = savestring (return_trap);
|
||||
add_unwind_protect (xfree, return_trap);
|
||||
add_unwind_protect (maybe_set_return_trap, return_trap);
|
||||
add_unwind_protect (uw_maybe_set_return_trap, return_trap);
|
||||
}
|
||||
restore_default_signal (RETURN_TRAP);
|
||||
}
|
||||
@@ -5088,7 +5138,7 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
|
||||
fa->funcname_a = (ARRAY *)funcname_a;
|
||||
fa->funcname_v = funcname_v;
|
||||
if (subshell == 0)
|
||||
add_unwind_protect (restore_funcarray_state, fa);
|
||||
add_unwind_protect (uw_restore_funcarray_state, fa);
|
||||
#endif
|
||||
|
||||
/* The temporary environment for a function is supposed to apply to
|
||||
@@ -5106,7 +5156,7 @@ execute_function (SHELL_VAR *var, WORD_LIST *words, int flags, struct fd_bitmap
|
||||
{
|
||||
push_args (words->next);
|
||||
if (subshell == 0)
|
||||
add_unwind_protect (pop_args, 0);
|
||||
add_unwind_protect (uw_pop_args, 0);
|
||||
}
|
||||
|
||||
/* Number of the line on which the function body starts. */
|
||||
@@ -5205,7 +5255,7 @@ execute_shell_function (SHELL_VAR *var, WORD_LIST *words)
|
||||
|
||||
bitmap = new_fd_bitmap (FD_BITMAP_DEFAULT_SIZE);
|
||||
begin_unwind_frame ("execute-shell-function");
|
||||
add_unwind_protect (dispose_fd_bitmap, (char *)bitmap);
|
||||
add_unwind_protect (uw_dispose_fd_bitmap, (char *)bitmap);
|
||||
|
||||
ret = execute_function (var, words, 0, bitmap, 0, 0);
|
||||
|
||||
@@ -5386,7 +5436,7 @@ execute_builtin_or_function (WORD_LIST *words,
|
||||
if (saved_undo_list)
|
||||
{
|
||||
begin_unwind_frame ("saved-redirects");
|
||||
add_unwind_protect (cleanup_redirects, (char *)saved_undo_list);
|
||||
add_unwind_protect (uw_cleanup_redirects, (char *)saved_undo_list);
|
||||
}
|
||||
|
||||
redirection_undo_list = (REDIRECT *)NULL;
|
||||
|
||||
@@ -118,7 +118,12 @@ extern void close_all_files (void);
|
||||
|
||||
#if defined (ARRAY_VARS)
|
||||
extern void restore_funcarray_state (struct func_array_state *);
|
||||
extern void uw_restore_funcarray_state (void *);
|
||||
#endif
|
||||
|
||||
extern void bind_lastarg (char *);
|
||||
|
||||
extern void uw_dispose_fd_bitmap (void *);
|
||||
extern void uw_close (void *);
|
||||
|
||||
#endif /* _EXECUTE_CMD_H_ */
|
||||
|
||||
@@ -201,8 +201,10 @@ extern long get_clk_tck (void);
|
||||
/* declarations for functions defined in lib/sh/clock.c */
|
||||
/* No prototypes so we don't have to have clock_t defined when this file
|
||||
is included. */
|
||||
extern void clock_t_to_secs ();
|
||||
extern void print_clock_t ();
|
||||
#ifdef NEED_CLOCK_FUNCS_DECL
|
||||
extern void clock_t_to_secs (clock_t, time_t *, int *);
|
||||
extern void print_clock_t (FILE *, clock_t);
|
||||
#endif
|
||||
|
||||
/* Declarations for functions defined in lib/sh/dprintf.c */
|
||||
#if !defined (HAVE_DPRINTF)
|
||||
@@ -484,8 +486,10 @@ extern char *sh_strvis (const char *);
|
||||
/* declarations for functions defined in lib/sh/timeval.c. No prototypes
|
||||
so we don't have to count on having a definition of struct timeval in
|
||||
scope when this file is included. */
|
||||
extern void timeval_to_secs ();
|
||||
extern void print_timeval ();
|
||||
#ifdef NEED_TIMEVAL_FUNCS_DECL
|
||||
extern void timeval_to_secs (struct timeval *, time_t *, int *);
|
||||
extern void print_timeval (FILE *, struct timeval *);
|
||||
#endif
|
||||
|
||||
/* declarations for functions defined in lib/sh/tmpfile.c */
|
||||
#define MT_USETMPDIR 0x0001
|
||||
|
||||
@@ -0,0 +1,226 @@
|
||||
./configure~: Do not test the value of __STDC__, because some compilers set it to 0
|
||||
./configure~:#if !defined __STDC__
|
||||
./configure~:#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
|
||||
./configure~:ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
|
||||
./configure.ac~:ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
|
||||
./configure.ac:ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
|
||||
./config-bot.h~:/* Try this without testing __STDC__ for the time being. */
|
||||
./configure: Do not test the value of __STDC__, because some compilers set it to 0
|
||||
./configure:#if !defined __STDC__
|
||||
./configure:ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
|
||||
./autom4te.cache/traces.0: && !(defined __SUNPRO_C && __STDC__))) \\
|
||||
./autom4te.cache/traces.1: && !(defined __SUNPRO_C && __STDC__))) \\
|
||||
./autom4te.cache/output.0: Do not test the value of __STDC__, because some compilers set it to 0
|
||||
./autom4te.cache/output.0:#if !defined __STDC__
|
||||
./autom4te.cache/output.0:ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
|
||||
./autom4te.cache/output.1: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.1:#ifdef __STDC__
|
||||
./autom4te.cache/output.1: # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.1:@%:@ifdef __STDC__
|
||||
./autom4te.cache/output.1: # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.1:@%:@ifdef __STDC__
|
||||
./autom4te.cache/output.1:#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
|
||||
./autom4te.cache/output.1:#ifndef __STDC__
|
||||
./autom4te.cache/output.1:#ifndef __STDC__
|
||||
./autom4te.cache/output.1:#ifndef __STDC__
|
||||
./autom4te.cache/output.1:ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
|
||||
./autom4te.cache/output.3: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.3:#ifdef __STDC__
|
||||
./autom4te.cache/output.3: # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.3:@%:@ifdef __STDC__
|
||||
./autom4te.cache/output.3: # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.3:@%:@ifdef __STDC__
|
||||
./autom4te.cache/output.3:#if defined(__STDC__) || defined(__cplusplus)
|
||||
./autom4te.cache/output.3:#ifndef __STDC__
|
||||
./autom4te.cache/output.3:#ifndef __STDC__
|
||||
./autom4te.cache/output.3:#ifndef __STDC__
|
||||
./autom4te.cache/output.3:ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
|
||||
./autom4te.cache/output.2: # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:@%:@ifdef __STDC__
|
||||
./autom4te.cache/output.2: # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:@%:@ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2:#if defined(__STDC__) || defined(__cplusplus)
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2:#ifndef __STDC__
|
||||
./autom4te.cache/output.2:#ifndef __STDC__
|
||||
./autom4te.cache/output.2:#ifndef __STDC__
|
||||
./autom4te.cache/output.2: Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
|
||||
./autom4te.cache/output.2:#ifdef __STDC__
|
||||
./autom4te.cache/output.2:ibmrt-*bsd4*) LOCAL_CFLAGS="-ma -U__STDC__" ;;
|
||||
./include/memalloc.h~:# if defined (__STDC__)
|
||||
./include/memalloc.h~:# endif /* !__STDC__ */
|
||||
./include/stdc.h:# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) || defined (PROTOTYPES)
|
||||
./include/stdc.h:#if !defined (__STDC__)
|
||||
./include/stdc.h:#endif /* !__STDC__ */
|
||||
./include/stdc.h~:# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) || defined (PROTOTYPES)
|
||||
./include/stdc.h~:#if !defined (__STDC__)
|
||||
./include/stdc.h~:#endif /* !__STDC__ */
|
||||
./CWRU/old-conf/machines.h: /* SGI cc uses ansi c features *without* defining __STDC__ */
|
||||
./CWRU/old-conf/machines.h:# if defined (__EXTENSIONS__) && !defined (__STDC__)
|
||||
./CWRU/old-conf/machines.h:# define ANSIC -D__STDC__
|
||||
./CWRU/old-conf/machines.h:# endif /* !__EXTENSIONS__ || __STDC__ */
|
||||
./CWRU/old-conf/machines.h:# define SYSDEP_CFLAGS -ma -U__STDC__
|
||||
./CWRU/old-conf/machines.h:# if defined (__STDC__)
|
||||
./CWRU/old-conf/machines.h:# endif /* __STDC__ */
|
||||
./CWRU/old-changelogs/CWRU.chlog.v11: - hpux_9 needs alloca declared as `extern void *' if __STDC__
|
||||
./CWRU/old-changelogs/CWRU.chlog.v11: if __STDC__ is defined and we're using stdarg
|
||||
./CWRU/old-changelogs/CWRU.chlog.v10: - add a __STDC__ definition for getpwnam() for isc386 machines
|
||||
./CWRU/old-changelogs/CWRU.chlog.v10: - correctly declare the second argument as a size_t if __STDC__
|
||||
./CWRU/old-changelogs/CWRU.chlog.v10: on whether __STDC__ is defined and > 0. The `stdc' version uses
|
||||
./CWRU/old-changelogs/CWRU.chlog.v10: - sgi needs __STDC__ defined if __EXTENSIONS__ is defined
|
||||
./CWRU/old-changelogs/CWRU.chlog.v10: - moved the #if defined (__P) inside the check for __STDC__, so
|
||||
./CWRU/old-changelogs/CWRU.chlog.v10: - if __STDC__ is defined but we're not using gcc (__GNUC__ not
|
||||
./CWRU/old-changelogs/CWRU.chlog.v10: - only test for and possibly define __STDC__ if __GNUC__ is not
|
||||
./CWRU/old-changelogs/CWRU.chlog.v10: - removed support for outputting -D__STDC__; it's rarely right
|
||||
./CWRU/old-changelogs/CHANGES.090393:__STDC__ is defined
|
||||
./CWRU/old-changelogs/CWRU.chlog.v12: - add prototypes for extern function declarations if __STDC__
|
||||
./CWRU/old-changelogs/CWRU.chlog.v12: - break the definition of __P out from a strict __STDC__ block,
|
||||
./CWRU/old-changelogs/CWRU.chlog.v12: as either `__const' (gcc -traditional) or nothing if __STDC__ and
|
||||
./CWRU/old-changelogs/CWRU.chlog.v13: use `void *' and prototype if __STDC__ is defined
|
||||
./CWRU/old-changelogs/CWRU.chlog.v13: - don't test __STDC__ when deciding whether or not to use stdarg.h;
|
||||
./CWRU/old-changelogs/CWRU.chlog.v13: - don't try to use \a and \v unless __STDC__ is defined; use the
|
||||
./CWRU/old-changelogs/CWRU.chlog.v9: __STDC__ is defined
|
||||
./CWRU/old-changelogs/CWRU.chlog.v9: - add extern declaration of strcpy if __STDC__ and strcpy not defined
|
||||
./CWRU/old-changelogs/CWRU.chlog.v9: ANSI C environment (__STDC__)
|
||||
./CWRU/old-changelogs/CWRU.chlog.v9: - recognize __GNUC__ and __STDC__ and pass them along as output
|
||||
./CWRU/old-changelogs/CWRU.chlog.v9: where __STDC__ is not defined and _POSIX_SOURCE is
|
||||
./CWRU/old/RELEASE.113:__STDC__ is defined
|
||||
./CWRU/CWRU.chlog~: - restrict: make sure we have a definition if __STDC__ is not defined
|
||||
./CWRU/CWRU.chlog~: - don't bother with __STDC__ if we are just using C89 features like
|
||||
./CWRU/CWRU.chlog: - restrict: make sure we have a definition if __STDC__ is not defined
|
||||
./CWRU/CWRU.chlog: - don't bother with __STDC__ if we are just using C89 features like
|
||||
./lib/intl/explodename.c:# if defined __STDC__ && __STDC__
|
||||
./lib/intl/gmo.h:#if __STDC__
|
||||
./lib/intl/gettextP.h:# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
|
||||
./lib/intl/loadinfo.h:# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
|
||||
./lib/intl/plural.c:# if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:#if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:# if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:#if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:#if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:# if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:# if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:#if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:#if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:# if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:#if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:# if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/plural.c:#if defined (__STDC__) || defined (__cplusplus)
|
||||
./lib/intl/localcharset.c:#if __STDC__ != 1
|
||||
./lib/intl/l10nflist.c:# if defined __STDC__ && __STDC__
|
||||
./lib/intl/libgnuintl.h.in:# if __STDC__ || defined __GNUC__ || defined __SUNPRO_C || defined __cplusplus || __PROTOTYPES
|
||||
./lib/intl/libgnuintl.h.in:# if __GNUC__ >= 2 && !defined __APPLE_CC__ && (defined __STDC__ || defined __cplusplus)
|
||||
./lib/readline/histlib.h~:# if !defined (strchr) && !defined (__STDC__)
|
||||
./lib/readline/histlib.h~:# endif /* !strchr && !__STDC__ */
|
||||
./lib/readline/rldefs.h~:#if !defined (strchr) && !defined (__STDC__)
|
||||
./lib/readline/rldefs.h~:#endif /* !strchr && !__STDC__ */
|
||||
./lib/readline/bind.c~:#if !defined (strchr) && !defined (__STDC__)
|
||||
./lib/readline/bind.c~:#endif /* !strchr && !__STDC__ */
|
||||
./lib/readline/parens.c:#if !defined (strchr) && !defined (__STDC__)
|
||||
./lib/readline/parens.c:#endif /* !strchr && !__STDC__ */
|
||||
./lib/readline/complete.c~:#ifdef __STDC__
|
||||
./lib/readline/rlstdc.h:# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
|
||||
./lib/readline/display.c~:#if !defined (strchr) && !defined (__STDC__)
|
||||
./lib/readline/display.c~:#endif /* !strchr && !__STDC__ */
|
||||
./lib/readline/rlstdc.h~:# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus)
|
||||
./lib/readline/rlstdc.h~:#if defined (__STDC__) && defined (HAVE_STDARG_H)
|
||||
./lib/readline/funmap.c~:#ifdef __STDC__
|
||||
./lib/sh/vprint.c:# if defined (__STDC__)
|
||||
./lib/sh/vprint.c:# endif /* __STDC__ */
|
||||
./lib/termcap/grot/ChangeLog: * termcap.h [__STDC__]: Add consts. From Franc,ois Pinard.
|
||||
./lib/malloc/OLD/ogmalloc.c:#if defined (__GNU_LIBRARY__) || (defined (__STDC__) && __STDC__)
|
||||
./lib/malloc/OLD/ogmalloc.c:#if defined (__cplusplus) || (defined (__STDC__) && __STDC__)
|
||||
./lib/malloc/OLD/ogmalloc.c:#if defined (__STDC__) && __STDC__
|
||||
./lib/malloc/OLD/omalloc.c:# if defined (__STDC__)
|
||||
./lib/malloc/OLD/omalloc.c:#if defined (__STDC__)
|
||||
./lib/malloc/OLD/gmalloc.c:#if __STDC__
|
||||
./lib/malloc/OLD/gmalloc.c:#endif /* !__STDC__ */
|
||||
./lib/malloc/OLD/old-nmalloc.c:# if defined (__STDC__)
|
||||
./lib/malloc/OLD/old-nmalloc.c:#if defined (__STDC__)
|
||||
./lib/malloc/shmalloc.h~:#if defined (__STDC__)
|
||||
./lib/malloc/alloca.c~:#if __STDC__
|
||||
./lib/malloc/imalloc.h~:# if defined (__STDC__)
|
||||
./lib/malloc/imalloc.h~:# if defined (__STDC__) || defined (__GNUC__) || defined (__cplusplus) || defined (PROTOTYPES)
|
||||
./lib/malloc/xmalloc.c~:#if defined (__STDC__)
|
||||
./m4/iconv.m4~:#if defined(__STDC__) || defined(_MSC_VER) || defined(__cplusplus)
|
||||
./m4/extern-inline.m4: && !(defined __SUNPRO_C && __STDC__))) \
|
||||
./aclocal.m4~:#ifdef __STDC__
|
||||
./general.h~:#ifdef __STDC__
|
||||
./aclocal.m4:#ifdef __STDC__
|
||||
@@ -150,9 +150,17 @@ typedef struct {
|
||||
#endif /* !__GNUC__ */
|
||||
|
||||
/* String comparisons that possibly save a function call each. */
|
||||
#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
|
||||
#define STREQN(a, b, n) ((n == 0) ? (1) \
|
||||
: ((a)[0] == (b)[0] && strncmp(a, b, n) == 0))
|
||||
static inline int
|
||||
STREQ(const char *a, const char *b)
|
||||
{
|
||||
return ((a)[0] == (b)[0] && strcmp(a, b) == 0);
|
||||
}
|
||||
|
||||
static inline int
|
||||
STREQN(const char *a, const char *b, size_t n)
|
||||
{
|
||||
return ((n == 0) || ((a)[0] == (b)[0] && strncmp(a, b, n) == 0));
|
||||
}
|
||||
|
||||
/* More convenience definitions that possibly save system or libc calls. */
|
||||
#define STRLEN(s) (((s) && (s)[0]) ? ((s)[1] ? ((s)[2] ? strlen(s) : 2) : 1) : 0)
|
||||
@@ -177,15 +185,6 @@ typedef struct {
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
/* Function pointers can be declared as (Function *)foo. */
|
||||
#if !defined (_FUNCTION_DEF)
|
||||
# define _FUNCTION_DEF
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CPFunction (); /* no longer used */
|
||||
typedef char **CPPFunction (); /* no longer used */
|
||||
#endif /* _FUNCTION_DEF */
|
||||
|
||||
#ifndef SH_FUNCTION_TYPEDEF
|
||||
# define SH_FUNCTION_TYPEDEF
|
||||
|
||||
|
||||
@@ -4148,7 +4148,7 @@ run_sigchld_trap (int nchild)
|
||||
in reverse order of adding. We don't want maybe_set_sigchld_trap ()
|
||||
to reference freed memory. */
|
||||
add_unwind_protect (xfree, trap_command);
|
||||
add_unwind_protect (maybe_set_sigchld_trap, trap_command);
|
||||
add_unwind_protect (uw_maybe_set_sigchld_trap, trap_command);
|
||||
|
||||
subst_assign_varlist = (WORD_LIST *)NULL;
|
||||
the_pipeline = (PROCESS *)NULL;
|
||||
|
||||
@@ -896,7 +896,7 @@ history_expand_internal (const char *string, int start, int qc, int *end_index_p
|
||||
#define ADD_CHAR(c) \
|
||||
do \
|
||||
{ \
|
||||
if (j >= result_len - 1) \
|
||||
if ((j + 1) >= result_len) \
|
||||
result = (char *)xrealloc (result, result_len += 64); \
|
||||
result[j++] = c; \
|
||||
result[j] = '\0'; \
|
||||
|
||||
@@ -482,7 +482,7 @@ _rl_char_value (const char *buf, int ind)
|
||||
if (_rl_utf8locale && UTF8_SINGLEBYTE(buf[ind]))
|
||||
return ((WCHAR_T) buf[ind]);
|
||||
l = strlen (buf);
|
||||
if (ind >= l - 1)
|
||||
if (ind + 1 >= l)
|
||||
return ((WCHAR_T) buf[ind]);
|
||||
if (l < ind) /* Sanity check */
|
||||
l = strlen (buf+ind);
|
||||
|
||||
@@ -31,17 +31,10 @@ extern "C" {
|
||||
#if !defined (_FUNCTION_DEF)
|
||||
# define _FUNCTION_DEF
|
||||
|
||||
#if defined(__GNUC__) || defined(__clang__)
|
||||
typedef int Function () __attribute__((deprecated));
|
||||
typedef void VFunction () __attribute__((deprecated));
|
||||
typedef char *CPFunction () __attribute__((deprecated));
|
||||
typedef char **CPPFunction () __attribute__((deprecated));
|
||||
#else
|
||||
typedef int Function ();
|
||||
typedef void VFunction ();
|
||||
typedef char *CPFunction ();
|
||||
typedef char **CPPFunction ();
|
||||
#endif
|
||||
|
||||
#endif /* _FUNCTION_DEF */
|
||||
|
||||
|
||||
+20
-8
@@ -135,7 +135,7 @@ static char *pcomp_filename_completion_function (const char *, int);
|
||||
static SHELL_VAR *bind_comp_words (WORD_LIST *);
|
||||
#endif
|
||||
static void bind_compfunc_variables (char *, int, WORD_LIST *, int, int);
|
||||
static void unbind_compfunc_variables (int);
|
||||
static void unbind_compfunc_variables (void *); /* XXX uw_ */
|
||||
static WORD_LIST *build_arg_list (const char *, const char *, const char *, WORD_LIST *, int);
|
||||
static WORD_LIST *command_line_to_word_list (char *, int, int, int *, int *);
|
||||
|
||||
@@ -982,7 +982,7 @@ bind_compfunc_variables (char *line, int ind, WORD_LIST *lwords, int cw, int exp
|
||||
}
|
||||
|
||||
static void
|
||||
unbind_compfunc_variables (int exported)
|
||||
unbind_compfunc_variables (void *exported)
|
||||
{
|
||||
unbind_variable_noref ("COMP_LINE");
|
||||
unbind_variable_noref ("COMP_POINT");
|
||||
@@ -1035,6 +1035,18 @@ build_arg_list (const char *cmd, const char *cname, const char *text, WORD_LIST
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void
|
||||
uw_restore_parser_state (void *ps)
|
||||
{
|
||||
restore_parser_state (ps);
|
||||
}
|
||||
|
||||
static void
|
||||
uw_rl_set_signals (void *ignore)
|
||||
{
|
||||
rl_set_signals ();
|
||||
}
|
||||
|
||||
/* Build a command string with
|
||||
$0 == cs->funcname (function to execute for completion list)
|
||||
$1 == command name (command being completed)
|
||||
@@ -1091,12 +1103,12 @@ gen_shell_function_matches (COMPSPEC *cs, const char *cmd, const char *text,
|
||||
pps = &ps;
|
||||
save_parser_state (pps);
|
||||
begin_unwind_frame ("gen-shell-function-matches");
|
||||
add_unwind_protect (restore_parser_state, (char *)pps);
|
||||
add_unwind_protect (dispose_words, (char *)cmdlist);
|
||||
add_unwind_protect (unbind_compfunc_variables, (char *)0);
|
||||
add_unwind_protect (uw_restore_parser_state, pps);
|
||||
add_unwind_protect (uw_dispose_words, cmdlist);
|
||||
add_unwind_protect (unbind_compfunc_variables, NULL);
|
||||
if (local_compgen == 0)
|
||||
{
|
||||
add_unwind_protect (rl_set_signals, (char *)NULL);
|
||||
add_unwind_protect (uw_rl_set_signals, (char *)NULL);
|
||||
rl_clear_signals ();
|
||||
}
|
||||
|
||||
@@ -1206,7 +1218,7 @@ gen_command_matches (COMPSPEC *cs, const char *cmd, const char *text,
|
||||
/* Now clean up and destroy everything. */
|
||||
dispose_words (cmdlist);
|
||||
free (cscmd);
|
||||
unbind_compfunc_variables (1);
|
||||
unbind_compfunc_variables ("");
|
||||
|
||||
if (csbuf == 0 || *csbuf == '\0')
|
||||
{
|
||||
@@ -1227,7 +1239,7 @@ gen_command_matches (COMPSPEC *cs, const char *cmd, const char *text,
|
||||
we++;
|
||||
}
|
||||
t = substring (csbuf, ws, we);
|
||||
if (sl->list_len >= sl->list_size - 1)
|
||||
if (sl->list_len + 1 >= sl->list_size)
|
||||
strlist_resize (sl, sl->list_size + 16);
|
||||
sl->list[sl->list_len++] = t;
|
||||
while (csbuf[we] == '\n') we++;
|
||||
|
||||
+9
-3
@@ -57,7 +57,8 @@ typedef void PFUNC (const char *, ...);
|
||||
static void cprintf (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
|
||||
static void xprintf (const char *, ...) __attribute__((__format__ (printf, 1, 2)));
|
||||
|
||||
static void reset_locals (void);
|
||||
static void uw_reset_locals (void *);
|
||||
|
||||
static void newline (char *);
|
||||
static void indent (int);
|
||||
static void semicolon (void);
|
||||
@@ -93,6 +94,11 @@ static void print_cond_node (COND_COM *);
|
||||
#endif
|
||||
static void print_function_def (FUNCTION_DEF *);
|
||||
|
||||
#ifdef DEBUG
|
||||
void debug_print_word_list (char *, WORD_LIST *, char *);
|
||||
void debug_print_cond_command (COND_COM *);
|
||||
#endif
|
||||
|
||||
#define PRINTED_COMMAND_INITIAL_SIZE 64
|
||||
#define PRINTED_COMMAND_GROW_SIZE 128
|
||||
|
||||
@@ -1241,7 +1247,7 @@ print_redirection (REDIRECT *redirect)
|
||||
}
|
||||
|
||||
static void
|
||||
reset_locals (void)
|
||||
uw_reset_locals (void *ignore)
|
||||
{
|
||||
inside_function_def = 0;
|
||||
indentation = 0;
|
||||
@@ -1267,7 +1273,7 @@ print_function_def (FUNCTION_DEF *func)
|
||||
cprintf ("%s () \n", func->name->word);
|
||||
|
||||
begin_unwind_frame ("function-def");
|
||||
add_unwind_protect (reset_locals, 0);
|
||||
add_unwind_protect (uw_reset_locals, 0);
|
||||
|
||||
indent (indentation);
|
||||
cprintf ("{ \n"); /* } */
|
||||
|
||||
@@ -732,7 +732,7 @@ sub_append_string (char *source, char *target, size_t *indx, size_t *size)
|
||||
size_t n, srclen;
|
||||
|
||||
srclen = STRLEN (source);
|
||||
if (srclen >= (*size - *indx))
|
||||
if ((srclen + *indx) >= *size)
|
||||
{
|
||||
n = srclen + *indx;
|
||||
n = (n + DEFAULT_ARRAY_SIZE) - (n % DEFAULT_ARRAY_SIZE);
|
||||
@@ -6028,7 +6028,7 @@ static pid_t *dev_fd_list = (pid_t *)NULL;
|
||||
static int nfds;
|
||||
static int totfds; /* The highest possible number of open files. */
|
||||
|
||||
void
|
||||
static void
|
||||
clear_fifo (int i)
|
||||
{
|
||||
if (dev_fd_list[i])
|
||||
@@ -6960,7 +6960,7 @@ command_substitute (char *string, int quoted, int flags)
|
||||
|
||||
begin_unwind_frame ("read-comsub");
|
||||
dummyfd = fildes[0];
|
||||
add_unwind_protect (close, dummyfd);
|
||||
add_unwind_protect (uw_close, (void *) (intptr_t) dummyfd);
|
||||
|
||||
/* Block SIGINT while we're reading from the pipe. If the child
|
||||
process gets a SIGINT, it will either handle it or die, and the
|
||||
|
||||
+1
-1
@@ -283,7 +283,7 @@ declare -A assoc=(["*"]="star" ["!"]="bang" ["@"]="at" )
|
||||
at
|
||||
star
|
||||
declare -A a=(["@"]="at" )
|
||||
./assoc13.sub: line 22: ia[@]: bad array subscript
|
||||
./assoc13.sub: line 35: ia[@]: bad array subscript
|
||||
declare -a ia
|
||||
declare -A a=(["@"]="at2" )
|
||||
declare -A a=(["@"]=" string" )
|
||||
|
||||
+13
-1
@@ -1,3 +1,16 @@
|
||||
# This program is free software: you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
# the Free Software Foundation, either version 3 of the License, or
|
||||
# (at your option) any later version.
|
||||
#
|
||||
# This program is distributed in the hope that it will be useful,
|
||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
# GNU General Public License for more details.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# assignment to @ and *
|
||||
|
||||
declare -A assoc
|
||||
@@ -41,4 +54,3 @@ declare a[*]=star2
|
||||
|
||||
declare -p a
|
||||
unset a
|
||||
|
||||
|
||||
@@ -652,10 +652,10 @@ set_sigchld_trap (const char *command_string)
|
||||
reset the disposition to the default and not have the original signal
|
||||
accidentally restored, undoing the user's command. */
|
||||
void
|
||||
maybe_set_sigchld_trap (const char *command_string)
|
||||
uw_maybe_set_sigchld_trap (void *command_string)
|
||||
{
|
||||
if ((sigmodes[SIGCHLD] & SIG_TRAPPED) == 0 && trap_list[SIGCHLD] == (char *)IMPOSSIBLE_TRAP_HANDLER)
|
||||
set_signal (SIGCHLD, command_string);
|
||||
set_signal (SIGCHLD, (const char *)command_string);
|
||||
}
|
||||
|
||||
/* Temporarily set the SIGCHLD trap string to IMPOSSIBLE_TRAP_HANDLER. Used
|
||||
@@ -666,7 +666,7 @@ set_impossible_sigchld_trap (void)
|
||||
{
|
||||
restore_default_signal (SIGCHLD);
|
||||
change_signal (SIGCHLD, (char *)IMPOSSIBLE_TRAP_HANDLER);
|
||||
sigmodes[SIGCHLD] &= ~SIG_TRAPPED; /* maybe_set_sigchld_trap checks this */
|
||||
sigmodes[SIGCHLD] &= ~SIG_TRAPPED; /* uw_maybe_set_sigchld_trap checks this */
|
||||
}
|
||||
|
||||
/* Act as if we received SIGCHLD NCHILD times and increment
|
||||
@@ -705,7 +705,7 @@ set_debug_trap (const char *command)
|
||||
SIG_TRAPPED will be set and we don't bother restoring the original trap string.
|
||||
This is used by both functions and the source builtin. */
|
||||
void
|
||||
maybe_set_debug_trap (const char *command)
|
||||
uw_maybe_set_debug_trap (void *command)
|
||||
{
|
||||
trap_if_untrapped (DEBUG_TRAP, command);
|
||||
}
|
||||
@@ -717,7 +717,13 @@ set_error_trap (const char *command)
|
||||
}
|
||||
|
||||
void
|
||||
maybe_set_error_trap (const char *command)
|
||||
uw_set_error_trap (void *command)
|
||||
{
|
||||
set_error_trap (command);
|
||||
}
|
||||
|
||||
void
|
||||
uw_maybe_set_error_trap (void *command)
|
||||
{
|
||||
trap_if_untrapped (ERROR_TRAP, command);
|
||||
}
|
||||
@@ -729,7 +735,7 @@ set_return_trap (const char *command)
|
||||
}
|
||||
|
||||
void
|
||||
maybe_set_return_trap (const char *command)
|
||||
uw_maybe_set_return_trap (void *command)
|
||||
{
|
||||
trap_if_untrapped (RETURN_TRAP, command);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,6 @@ extern void initialize_traps (void);
|
||||
extern void run_pending_traps (void);
|
||||
|
||||
extern void queue_sigchld_trap (int);
|
||||
extern void maybe_set_sigchld_trap (const char *);
|
||||
extern void set_impossible_sigchld_trap (void);
|
||||
extern void set_sigchld_trap (const char *);
|
||||
|
||||
@@ -81,9 +80,11 @@ extern void set_debug_trap (const char *);
|
||||
extern void set_error_trap (const char *);
|
||||
extern void set_return_trap (const char *);
|
||||
|
||||
extern void maybe_set_debug_trap (const char *);
|
||||
extern void maybe_set_error_trap (const char *);
|
||||
extern void maybe_set_return_trap (const char *);
|
||||
extern void uw_set_error_trap (void *);
|
||||
extern void uw_maybe_set_sigchld_trap (void *);
|
||||
extern void uw_maybe_set_debug_trap (void *);
|
||||
extern void uw_maybe_set_error_trap (void *);
|
||||
extern void uw_maybe_set_return_trap (void *);
|
||||
|
||||
extern void set_sigint_trap (const char *);
|
||||
extern void set_signal (int, const char *);
|
||||
|
||||
+15
-15
@@ -65,11 +65,11 @@ typedef struct {
|
||||
typedef union uwp {
|
||||
struct uwp_head {
|
||||
union uwp *next;
|
||||
Function *cleanup;
|
||||
sh_uwfunc_t *cleanup;
|
||||
} head;
|
||||
struct {
|
||||
struct uwp_head uwp_head;
|
||||
char *v;
|
||||
void *v;
|
||||
} arg;
|
||||
struct {
|
||||
struct uwp_head uwp_head;
|
||||
@@ -79,12 +79,12 @@ typedef union uwp {
|
||||
|
||||
static void unwind_frame_discard_internal (char *);
|
||||
static void unwind_frame_run_internal (char *);
|
||||
static void add_unwind_protect_internal (Function *, char *);
|
||||
static void add_unwind_protect_internal (sh_uwfunc_t *, void *);
|
||||
static void remove_unwind_protect_internal (void);
|
||||
static void run_unwind_protects_internal (void);
|
||||
static void clear_unwind_protects_internal (int);
|
||||
static inline void restore_variable (SAVED_VAR *);
|
||||
static void unwind_protect_mem_internal (char *, char *);
|
||||
static inline void restore_variable (void *);
|
||||
static void unwind_protect_mem_internal (void *, int);
|
||||
|
||||
static UNWIND_ELT *unwind_protect_list = (UNWIND_ELT *)NULL;
|
||||
|
||||
@@ -132,7 +132,7 @@ run_unwind_frame (char *tag)
|
||||
|
||||
/* Add the function CLEANUP with ARG to the list of unwindable things. */
|
||||
void
|
||||
add_unwind_protect (Function *cleanup, char *arg)
|
||||
add_unwind_protect (sh_uwfunc_t *cleanup, void *arg)
|
||||
{
|
||||
add_unwind_protect_internal (cleanup, arg);
|
||||
}
|
||||
@@ -189,7 +189,7 @@ unwind_protect_tag_on_stack (const char *tag)
|
||||
/* **************************************************************** */
|
||||
|
||||
static void
|
||||
add_unwind_protect_internal (Function *cleanup, char *arg)
|
||||
add_unwind_protect_internal (sh_uwfunc_t *cleanup, void *arg)
|
||||
{
|
||||
UNWIND_ELT *elt;
|
||||
|
||||
@@ -258,8 +258,10 @@ unwind_frame_discard_internal (char *tag)
|
||||
sv->desired_setting is a block of memory SIZE bytes long holding the
|
||||
value itself. This block of memory is copied back into the variable. */
|
||||
static inline void
|
||||
restore_variable (SAVED_VAR *sv)
|
||||
restore_variable (void *arg)
|
||||
{
|
||||
SAVED_VAR *sv;
|
||||
sv = arg;
|
||||
FASTCOPY (sv->desired_setting, sv->variable, sv->size);
|
||||
}
|
||||
|
||||
@@ -286,7 +288,7 @@ unwind_frame_run_internal (char *tag)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (elt->head.cleanup == (Function *) restore_variable)
|
||||
if (elt->head.cleanup == restore_variable)
|
||||
restore_variable (&elt->sv.v);
|
||||
else
|
||||
(*(elt->head.cleanup)) (elt->arg.v);
|
||||
@@ -299,19 +301,17 @@ unwind_frame_run_internal (char *tag)
|
||||
}
|
||||
|
||||
static void
|
||||
unwind_protect_mem_internal (char *var, char *psize)
|
||||
unwind_protect_mem_internal (void *var, int size)
|
||||
{
|
||||
int size;
|
||||
size_t allocated;
|
||||
UNWIND_ELT *elt;
|
||||
|
||||
size = *(int *) psize;
|
||||
allocated = size + offsetof (UNWIND_ELT, sv.v.desired_setting[0]);
|
||||
if (allocated < sizeof (UNWIND_ELT))
|
||||
allocated = sizeof (UNWIND_ELT);
|
||||
elt = (UNWIND_ELT *)xmalloc (allocated);
|
||||
elt->head.next = unwind_protect_list;
|
||||
elt->head.cleanup = (Function *) restore_variable;
|
||||
elt->head.cleanup = restore_variable;
|
||||
elt->sv.v.variable = var;
|
||||
elt->sv.v.size = size;
|
||||
FASTCOPY (var, elt->sv.v.desired_setting, size);
|
||||
@@ -324,7 +324,7 @@ unwind_protect_mem_internal (char *var, char *psize)
|
||||
void
|
||||
unwind_protect_mem (char *var, int size)
|
||||
{
|
||||
unwind_protect_mem_internal (var, (char *) &size);
|
||||
unwind_protect_mem_internal (var, size);
|
||||
}
|
||||
|
||||
#if defined (DEBUG)
|
||||
@@ -339,7 +339,7 @@ print_unwind_protect_tags (void)
|
||||
while (elt)
|
||||
{
|
||||
if (elt->head.cleanup == 0)
|
||||
fprintf(stderr, "tag: %s\n", elt->arg.v);
|
||||
fprintf(stderr, "tag: %s\n", (char *)elt->arg.v);
|
||||
elt = elt->head.next;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ extern void uwp_init (void);
|
||||
extern void begin_unwind_frame (char *);
|
||||
extern void discard_unwind_frame (char *);
|
||||
extern void run_unwind_frame (char *);
|
||||
extern void add_unwind_protect (); /* Not portable to arbitrary C99 hosts. */
|
||||
extern void add_unwind_protect (sh_uwfunc_t *, void *);
|
||||
extern void remove_unwind_protect (void);
|
||||
extern void run_unwind_protects (void);
|
||||
extern void clear_unwind_protect_list (int);
|
||||
|
||||
+9
-3
@@ -5330,7 +5330,7 @@ push_exported_var (PTR_T data)
|
||||
variables in its temporary environment. In the first case, we call
|
||||
push_builtin_var, which does the right thing. */
|
||||
void
|
||||
pop_scope (int is_special)
|
||||
pop_scope (void *is_special)
|
||||
{
|
||||
VAR_CONTEXT *vcxt, *ret;
|
||||
int is_bltinenv;
|
||||
@@ -5354,7 +5354,7 @@ pop_scope (int is_special)
|
||||
FREE (vcxt->name);
|
||||
if (vcxt->table)
|
||||
{
|
||||
if (is_special)
|
||||
if ((intptr_t) is_special)
|
||||
hash_flush (vcxt->table, push_builtin_var);
|
||||
else
|
||||
hash_flush (vcxt->table, push_exported_var);
|
||||
@@ -5453,7 +5453,7 @@ push_context (char *name, int is_subshell, HASH_TABLE *tempvars)
|
||||
/* Only called when subshell == 0, so we don't need to check, and can
|
||||
unconditionally pop the dollar vars off the stack. */
|
||||
void
|
||||
pop_context (void)
|
||||
pop_context (void *ignore)
|
||||
{
|
||||
pop_dollar_vars ();
|
||||
variable_context--;
|
||||
@@ -5592,6 +5592,12 @@ pop_args (void)
|
||||
#endif /* ARRAY_VARS && DEBUGGER */
|
||||
}
|
||||
|
||||
void
|
||||
uw_pop_args (void *ignore)
|
||||
{
|
||||
pop_args ();
|
||||
}
|
||||
|
||||
/*************************************************
|
||||
* *
|
||||
* Functions to manage special variables *
|
||||
|
||||
+4
-2
@@ -345,12 +345,12 @@ extern void dispose_var_context (VAR_CONTEXT *);
|
||||
extern VAR_CONTEXT *push_var_context (char *, int, HASH_TABLE *);
|
||||
extern void pop_var_context (void);
|
||||
extern VAR_CONTEXT *push_scope (int, HASH_TABLE *);
|
||||
extern void pop_scope (int);
|
||||
extern void pop_scope (void *); /* XXX uw_ */
|
||||
|
||||
extern void clear_dollar_vars (void);
|
||||
|
||||
extern void push_context (char *, int, HASH_TABLE *);
|
||||
extern void pop_context (void);
|
||||
extern void pop_context (void *); /* XXX uw_ */
|
||||
extern void push_dollar_vars (void);
|
||||
extern void pop_dollar_vars (void);
|
||||
extern void dispose_saved_dollar_vars (void);
|
||||
@@ -359,6 +359,7 @@ extern void init_bash_argv (void);
|
||||
extern void save_bash_argv (void);
|
||||
extern void push_args (WORD_LIST *);
|
||||
extern void pop_args (void);
|
||||
extern void uw_pop_args (void *);
|
||||
|
||||
extern void adjust_shell_level (int);
|
||||
extern void non_unsettable (char *);
|
||||
@@ -367,6 +368,7 @@ extern void dispose_used_env_vars (void);
|
||||
extern void dispose_function_env (void);
|
||||
extern void dispose_builtin_env (void);
|
||||
extern void merge_temporary_env (void);
|
||||
extern void merge_function_temporary_env (void);
|
||||
extern void flush_temporary_env (void);
|
||||
extern void merge_builtin_env (void);
|
||||
extern void kill_all_local_variables (void);
|
||||
|
||||
Reference in New Issue
Block a user