Imported from ../bash-2.05b.tar.gz.
[platform/upstream/bash.git] / builtins / wait.def
index f34da8d..23c8b19 100644 (file)
@@ -1,7 +1,7 @@
 This file is wait.def, from which is created wait.c.
 It implements the builtin "wait" in Bash.
 
-Copyright (C) 1987, 1989, 1991 Free Software Foundation, Inc.
+Copyright (C) 1987-2002 Free Software Foundation, Inc.
 
 This file is part of GNU Bash, the Bourne Again SHell.
 
@@ -60,6 +60,7 @@ $END
 #include "bashgetopt.h"
 
 extern int interrupt_immediately;
+extern int wait_signal_received;
 
 procenv_t wait_intr_buf;
 
@@ -87,8 +88,7 @@ wait_builtin (list)
 
   if (no_options (list))
     return (EX_USAGE);
-  if (list != loptend)
-    list = loptend;
+  list = loptend;
 
   old_interrupt_immediately = interrupt_immediately;
   interrupt_immediately++;
@@ -104,7 +104,7 @@ wait_builtin (list)
   code = setjmp (wait_intr_buf);
   if (code)
     {
-      status = 128 + SIGINT;
+      status = 128 + wait_signal_received;
       WAIT_RETURN (status);
     }
 
@@ -124,7 +124,7 @@ wait_builtin (list)
     {
       pid_t pid;
       char *w;
-      long pid_value;
+      intmax_t pid_value;
 
       w = list->word->word;
       if (DIGIT (*w))
@@ -136,7 +136,7 @@ wait_builtin (list)
            }
          else
            {
-             builtin_error ("`%s' is not a pid or valid job spec", w);
+             sh_badpid (w);
              WAIT_RETURN (EXECUTION_FAILURE);
            }
        }
@@ -153,7 +153,7 @@ wait_builtin (list)
          if (job < 0 || job >= job_slots || !jobs[job])
            {
              if (job != DUP_JOB)
-               builtin_error ("%s: no such job", list->word->word);
+               sh_badjob (list->word->word);
              UNBLOCK_CHILD (oset);
              status = 127;     /* As per Posix.2, section 4.70.2 */
              list = list->next;
@@ -167,13 +167,13 @@ wait_builtin (list)
       else if (job_control == 0 && *w == '%')
        {
          /* can't use jobspecs as arguments if job control is not active. */
-         builtin_error ("job control not enabled");
+         sh_nojobs ((char *)NULL);
          status = EXECUTION_FAILURE;
        }
 #endif /* JOB_CONTROL */
       else
        {
-         builtin_error ("`%s' is not a pid or valid job spec", w);
+         sh_badpid (w);
          status = EXECUTION_FAILURE;
        }
       list = list->next;