Imported from ../bash-2.05b.tar.gz.
[platform/upstream/bash.git] / builtins / fg_bg.def
index 2f1b826..c16d894 100644 (file)
@@ -1,13 +1,13 @@
 This file is fg_bg.def, from which is created fg_bg.c.
 It implements the builtins "bg" and "fg" 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.
 
 Bash 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 1, or (at your option) any later
+Software Foundation; either version 2, or (at your option) any later
 version.
 
 Bash is distributed in the hope that it will be useful, but WITHOUT ANY
@@ -17,7 +17,7 @@ for more details.
 
 You should have received a copy of the GNU General Public License along
 with Bash; see the file COPYING.  If not, write to the Free Software
-Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+Foundation, 59 Temple Place, Suite 330, Boston, MA 02111 USA.
 
 $PRODUCES fg_bg.c
 
@@ -42,11 +42,12 @@ $END
 #include "../shell.h"
 #include "../jobs.h"
 #include "common.h"
+#include "bashgetopt.h"
 
 #if defined (JOB_CONTROL)
 extern char *this_command_name;
 
-static int fg_bg ();
+static int fg_bg __P((WORD_LIST *, int));
 
 /* How to bring a job into the foreground. */
 int
@@ -58,12 +59,13 @@ fg_builtin (list)
 
   if (job_control == 0)
     {
-      builtin_error ("no job control");
+      sh_nojobs ((char *)NULL);
       return (EXECUTION_FAILURE);
     }
 
   if (no_options (list))
     return (EX_USAGE);
+  list = loptend;
 
   /* If the last arg on the line is '&', then start this job in the
      background.  Else, fg the job. */
@@ -92,12 +94,13 @@ bg_builtin (list)
 {
   if (job_control == 0)
     {
-      builtin_error ("no job control");
+      sh_nojobs ((char *)NULL);
       return (EXECUTION_FAILURE);
     }
 
   if (no_options (list))
     return (EX_USAGE);
+  list = loptend;
 
   return (fg_bg (list, 0));
 }
@@ -117,7 +120,7 @@ fg_bg (list, foreground)
   if (job < 0 || job >= job_slots || jobs[job] == 0)
     {
       if (job != DUP_JOB)
-       builtin_error ("%s: no such job", list ? list->word->word : "current");
+       sh_badjob (list ? list->word->word : "current");
 
       goto failure;
     }