/* execute_cmd.c -- Execute a COMMAND structure. */
-/* Copyright (C) 1987-2018 Free Software Foundation, Inc.
+/* Copyright (C) 1987-2019 Free Software Foundation, Inc.
This file is part of GNU Bash, the Bourne Again SHell.
extern char *glob_argv_flags;
#endif
-extern int close __P((int));
+extern int close PARAMS((int));
/* Static functions defined and used in this file. */
-static void close_pipes __P((int, int));
-static void do_piping __P((int, int));
-static void bind_lastarg __P((char *));
-static int shell_control_structure __P((enum command_type));
-static void cleanup_redirects __P((REDIRECT *));
+static void close_pipes PARAMS((int, int));
+static void do_piping PARAMS((int, int));
+static void bind_lastarg PARAMS((char *));
+static int shell_control_structure PARAMS((enum command_type));
+static void cleanup_redirects PARAMS((REDIRECT *));
#if defined (JOB_CONTROL)
-static int restore_signal_mask __P((sigset_t *));
+static int restore_signal_mask PARAMS((sigset_t *));
#endif
-static void async_redirect_stdin __P((void));
+static void async_redirect_stdin PARAMS((void));
-static int builtin_status __P((int));
+static int builtin_status PARAMS((int));
-static int execute_for_command __P((FOR_COM *));
+static int execute_for_command PARAMS((FOR_COM *));
#if defined (SELECT_COMMAND)
-static int displen __P((const char *));
-static int print_index_and_element __P((int, int, WORD_LIST *));
-static void indent __P((int, int));
-static void print_select_list __P((WORD_LIST *, int, int, int));
-static char *select_query __P((WORD_LIST *, int, char *, int));
-static int execute_select_command __P((SELECT_COM *));
+static int displen PARAMS((const char *));
+static int print_index_and_element PARAMS((int, int, WORD_LIST *));
+static void indent PARAMS((int, int));
+static void print_select_list PARAMS((WORD_LIST *, int, int, int));
+static char *select_query PARAMS((WORD_LIST *, int, char *, int));
+static int execute_select_command PARAMS((SELECT_COM *));
#endif
#if defined (DPAREN_ARITHMETIC)
-static int execute_arith_command __P((ARITH_COM *));
+static int execute_arith_command PARAMS((ARITH_COM *));
#endif
#if defined (COND_COMMAND)
-static int execute_cond_node __P((COND_COM *));
-static int execute_cond_command __P((COND_COM *));
+static int execute_cond_node PARAMS((COND_COM *));
+static int execute_cond_command PARAMS((COND_COM *));
#endif
#if defined (COMMAND_TIMING)
-static int mkfmt __P((char *, int, int, time_t, int));
-static void print_formatted_time __P((FILE *, char *,
+static int mkfmt PARAMS((char *, int, int, time_t, int));
+static void print_formatted_time PARAMS((FILE *, char *,
time_t, int, time_t, int,
time_t, int, int));
-static int time_command __P((COMMAND *, int, int, int, struct fd_bitmap *));
+static int time_command PARAMS((COMMAND *, int, int, int, struct fd_bitmap *));
#endif
#if defined (ARITH_FOR_COMMAND)
-static intmax_t eval_arith_for_expr __P((WORD_LIST *, int *));
-static int execute_arith_for_command __P((ARITH_FOR_COM *));
-#endif
-static int execute_case_command __P((CASE_COM *));
-static int execute_while_command __P((WHILE_COM *));
-static int execute_until_command __P((WHILE_COM *));
-static int execute_while_or_until __P((WHILE_COM *, int));
-static int execute_if_command __P((IF_COM *));
-static int execute_null_command __P((REDIRECT *, int, int, int));
-static void fix_assignment_words __P((WORD_LIST *));
-static int execute_simple_command __P((SIMPLE_COM *, int, int, int, struct fd_bitmap *));
-static int execute_builtin __P((sh_builtin_func_t *, WORD_LIST *, int, int));
-static int execute_function __P((SHELL_VAR *, WORD_LIST *, int, struct fd_bitmap *, int, int));
-static int execute_builtin_or_function __P((WORD_LIST *, sh_builtin_func_t *,
+static intmax_t eval_arith_for_expr PARAMS((WORD_LIST *, int *));
+static int execute_arith_for_command PARAMS((ARITH_FOR_COM *));
+#endif
+static int execute_case_command PARAMS((CASE_COM *));
+static int execute_while_command PARAMS((WHILE_COM *));
+static int execute_until_command PARAMS((WHILE_COM *));
+static int execute_while_or_until PARAMS((WHILE_COM *, int));
+static int execute_if_command PARAMS((IF_COM *));
+static int execute_null_command PARAMS((REDIRECT *, int, int, int));
+static void fix_assignment_words PARAMS((WORD_LIST *));
+static int execute_simple_command PARAMS((SIMPLE_COM *, int, int, int, struct fd_bitmap *));
+static int execute_builtin PARAMS((sh_builtin_func_t *, WORD_LIST *, int, int));
+static int execute_function PARAMS((SHELL_VAR *, WORD_LIST *, int, struct fd_bitmap *, int, int));
+static int execute_builtin_or_function PARAMS((WORD_LIST *, sh_builtin_func_t *,
SHELL_VAR *,
REDIRECT *, struct fd_bitmap *, int));
-static void execute_subshell_builtin_or_function __P((WORD_LIST *, REDIRECT *,
+static void execute_subshell_builtin_or_function PARAMS((WORD_LIST *, REDIRECT *,
sh_builtin_func_t *,
SHELL_VAR *,
int, int, int,
struct fd_bitmap *,
int));
-static int execute_disk_command __P((WORD_LIST *, REDIRECT *, char *,
+static int execute_disk_command PARAMS((WORD_LIST *, REDIRECT *, char *,
int, int, int, struct fd_bitmap *, int));
-static char *getinterp __P((char *, int, int *));
-static void initialize_subshell __P((void));
-static int execute_in_subshell __P((COMMAND *, int, int, int, struct fd_bitmap *));
+static char *getinterp PARAMS((char *, int, int *));
+static void initialize_subshell PARAMS((void));
+static int execute_in_subshell PARAMS((COMMAND *, int, int, int, struct fd_bitmap *));
#if defined (COPROCESS_SUPPORT)
-static void coproc_setstatus __P((struct coproc *, int));
-static int execute_coproc __P((COMMAND *, int, int, struct fd_bitmap *));
+static void coproc_setstatus PARAMS((struct coproc *, int));
+static int execute_coproc PARAMS((COMMAND *, int, int, struct fd_bitmap *));
#endif
-static int execute_pipeline __P((COMMAND *, int, int, int, struct fd_bitmap *));
+static int execute_pipeline PARAMS((COMMAND *, int, int, int, struct fd_bitmap *));
-static int execute_connection __P((COMMAND *, int, int, int, struct fd_bitmap *));
+static int execute_connection PARAMS((COMMAND *, int, int, int, struct fd_bitmap *));
-static int execute_intern_function __P((WORD_DESC *, FUNCTION_DEF *));
+static int execute_intern_function PARAMS((WORD_DESC *, FUNCTION_DEF *));
/* Set to 1 if fd 0 was the subject of redirection to a subshell. Global
so that reader_loop can set it to zero before executing a command. */
#if defined (COMMAND_TIMING)
#if defined (HAVE_GETRUSAGE) && defined (HAVE_GETTIMEOFDAY)
-extern struct timeval *difftimeval __P((struct timeval *, struct timeval *, struct timeval *));
-extern struct timeval *addtimeval __P((struct timeval *, struct timeval *, struct timeval *));
-extern int timeval_to_cpu __P((struct timeval *, struct timeval *, struct timeval *));
+extern struct timeval *difftimeval PARAMS((struct timeval *, struct timeval *, struct timeval *));
+extern struct timeval *addtimeval PARAMS((struct timeval *, struct timeval *, struct timeval *));
+extern int timeval_to_cpu PARAMS((struct timeval *, struct timeval *, struct timeval *));
#endif
#define POSIX_TIMEFORMAT "real %2R\nuser %2U\nsys %2S"
}
cplist_t;
-static struct cpelement *cpe_alloc __P((struct coproc *));
-static void cpe_dispose __P((struct cpelement *));
-static struct cpelement *cpl_add __P((struct coproc *));
-static struct cpelement *cpl_delete __P((pid_t));
-static void cpl_reap __P((void));
-static void cpl_flush __P((void));
-static void cpl_closeall __P((void));
-static struct cpelement *cpl_search __P((pid_t));
-static struct cpelement *cpl_searchbyname __P((const char *));
-static void cpl_prune __P((void));
+static struct cpelement *cpe_alloc PARAMS((struct coproc *));
+static void cpe_dispose PARAMS((struct cpelement *));
+static struct cpelement *cpl_add PARAMS((struct coproc *));
+static struct cpelement *cpl_delete PARAMS((pid_t));
+static void cpl_reap PARAMS((void));
+static void cpl_flush PARAMS((void));
+static void cpl_closeall PARAMS((void));
+static struct cpelement *cpl_search PARAMS((pid_t));
+static struct cpelement *cpl_searchbyname PARAMS((const char *));
+static void cpl_prune PARAMS((void));
-static void coproc_free __P((struct coproc *));
+static void coproc_free PARAMS((struct coproc *));
/* Will go away when there is fully-implemented support for multiple coprocs. */
Coproc sh_coproc = { 0, NO_PID, -1, -1, 0, 0, 0, 0, 0 };
funcvalue = setjmp_nosigs (return_catch);
if (result == EXITPROG)
- exit (last_command_exit_value);
+ subshell_exit (last_command_exit_value);
else if (result)
- exit (EXECUTION_FAILURE);
+ subshell_exit (EXECUTION_FAILURE);
else if (funcvalue)
- exit (return_catch_value);
+ subshell_exit (return_catch_value);
else
{
r = execute_builtin (builtin, words, flags, 1);
r = execute_disk_command (words, (REDIRECT *)0, command_line,
-1, -1, async, (struct fd_bitmap *)0, flags|CMD_NO_FORK);
}
- sh_exit (r);
+ subshell_exit (r);
}
}
else
{
r = execute_function (var, words, flags, fds_to_close, async, 1);
fflush (stdout);
- sh_exit (r);
+ subshell_exit (r);
}
}