]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - make_cmd.c
Bash-5.1 patch 4: fix key-value pair associative array assignment word expansions
[thirdparty/bash.git] / make_cmd.c
index b42e9ff148b22b43c7e087cd79ce2972488d44d6..2d7ac9609a058bb3b83533ca134a8021d0212148 100644 (file)
@@ -1,7 +1,7 @@
 /* make_cmd.c -- Functions for making instances of the various
    parser constructs. */
 
-/* Copyright (C) 1989-2009 Free Software Foundation, Inc.
+/* Copyright (C) 1989-2020 Free Software Foundation, Inc.
 
    This file is part of GNU Bash, the Bourne Again SHell.
 
 
 #include "bashintl.h"
 
+#include "shell.h"
+#include "execute_cmd.h"
 #include "parser.h"
-#include "syntax.h"
-#include "command.h"
-#include "general.h"
-#include "error.h"
 #include "flags.h"
-#include "make_cmd.h"
-#include "dispose_cmd.h"
-#include "variables.h"
-#include "subst.h"
 #include "input.h"
-#include "ocache.h"
-#include "externs.h"
 
 #if defined (JOB_CONTROL)
 #include "jobs.h"
 
 #include "shmbutil.h"
 
-extern int line_number, current_command_line_count, parser_state;
-extern int last_command_exit_value;
-extern int shell_initialized;
-
 int here_doc_first_line = 0;
 
 /* Object caching */
@@ -67,11 +55,11 @@ sh_obj_cache_t wlcache = {0, 0, 0};
 #define WDCACHESIZE    128
 #define WLCACHESIZE    128
 
-static COMMAND *make_for_or_select __P((enum command_type, WORD_DESC *, WORD_LIST *, COMMAND *, int));
+static COMMAND *make_for_or_select PARAMS((enum command_type, WORD_DESC *, WORD_LIST *, COMMAND *, int));
 #if defined (ARITH_FOR_COMMAND)
-static WORD_LIST *make_arith_for_expr __P((char *));
+static WORD_LIST *make_arith_for_expr PARAMS((char *));
 #endif
-static COMMAND *make_until_or_while __P((enum command_type, COMMAND *, COMMAND *));
+static COMMAND *make_until_or_while PARAMS((enum command_type, COMMAND *, COMMAND *));
 
 void
 cmd_init ()
@@ -247,7 +235,7 @@ make_select_command (name, map_list, action, lineno)
 #if defined (SELECT_COMMAND)
   return (make_for_or_select (cm_select, name, map_list, action, lineno));
 #else
-  last_command_exit_value = 2;
+  set_exit_status (2);
   return ((COMMAND *)NULL);
 #endif
 }
@@ -333,7 +321,7 @@ make_arith_for_command (exprs, action, lineno)
       free (init);
       free (test);
       free (step);
-      last_command_exit_value = 2;
+      set_exit_status (2);
       return ((COMMAND *)NULL);
     }
 
@@ -349,7 +337,7 @@ make_arith_for_command (exprs, action, lineno)
   return (make_command (cm_arith_for, (SIMPLE_COM *)temp));
 #else
   dispose_words (exprs);
-  last_command_exit_value = 2;
+  set_exit_status (2);
   return ((COMMAND *)NULL);
 #endif /* ARITH_FOR_COMMAND */
 }
@@ -459,7 +447,7 @@ make_arith_command (exp)
 
   return (command);
 #else
-  last_command_exit_value = 2;
+  set_exit_status (2);
   return ((COMMAND *)NULL);
 #endif
 }
@@ -502,7 +490,7 @@ make_cond_command (cond_node)
 
   return (command);
 #else
-  last_command_exit_value = 2;
+  set_exit_status (2);
   return ((COMMAND *)NULL);
 #endif
 }
@@ -805,7 +793,7 @@ make_function_def (name, command, lineno, lstart)
     temp->source_file = shell_initialized ? "main" : "environment";
 
 #if defined (DEBUGGER)
-  bind_function_def (name->word, temp);
+  bind_function_def (name->word, temp, 0);
 #endif
 
   temp->source_file = temp->source_file ? savestring (temp->source_file) : 0;
@@ -822,6 +810,7 @@ make_subshell_command (command)
   temp = (SUBSHELL_COM *)xmalloc (sizeof (SUBSHELL_COM));
   temp->command = command;
   temp->flags = CMD_WANT_SUBSHELL;
+  temp->line = line_number;
   return (make_command (cm_subshell, (SIMPLE_COM *)temp));
 }