Imported from ../bash-3.1.tar.gz.
[platform/upstream/bash.git] / builtins / exec.def
index c7137e3..0818a25 100644 (file)
@@ -1,7 +1,7 @@
 This file is exec.def, from which is created exec.c.
 It implements the builtin "exec" in Bash.
 
-Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
+Copyright (C) 1987-2003 Free Software Foundation, Inc.
 
 This file is part of GNU Bash, the Bourne Again SHell.
 
@@ -46,6 +46,7 @@ $END
 #endif
 
 #include "../bashansi.h"
+#include "../bashintl.h"
 
 #include "../shell.h"
 #include "../execute_cmd.h"
@@ -127,19 +128,19 @@ exec_builtin (list)
 #if defined (RESTRICTED_SHELL)
   if (restricted)
     {
-      builtin_error ("restricted");
+      sh_restricted ((char *)NULL);
       return (EXECUTION_FAILURE);
     }
 #endif /* RESTRICTED_SHELL */
 
-  args = word_list_to_argv (list, 1, 0, (int *)NULL);
+  args = strvec_from_word_list (list, 1, 0, (int *)NULL);
 
   /* A command with a slash anywhere in its name is not looked up in $PATH. */
   command = absolute_program (args[0]) ? args[0] : search_for_command (args[0]);
 
   if (command == 0)
     {
-      builtin_error ("%s: not found", args[0]);
+      sh_notfound (args[0]);
       exit_value = EX_NOTFOUND;        /* As per Posix.2, 3.14.6 */
       goto failed_exec;
     }
@@ -201,27 +202,27 @@ exec_builtin (list)
 
   if (executable_file (command) == 0)
     {
-      builtin_error ("%s: cannot execute: %s", command, strerror (errno));
+      builtin_error (_("%s: cannot execute: %s"), command, strerror (errno));
       exit_value = EX_NOEXEC;  /* As per Posix.2, 3.14.6 */
     }
   else
     file_error (command);
 
 failed_exec:
-  if (command)
-    free (command);
+  FREE (command);
 
   if (subshell_environment || (interactive == 0 && no_exit_on_failed_exec == 0))
     exit_shell (exit_value);
 
   if (args)
-    free_array (args);
+    strvec_dispose (args);
 
   initialize_traps ();
-  reinitialize_signals ();
+  initialize_signals (1);
 
 #if defined (JOB_CONTROL)
-  restart_job_control ();
+  if (interactive_shell || job_control)
+    restart_job_control ();
 #endif /* JOB_CONTROL */
 
   return (exit_value);