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
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
#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
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. */
{
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));
}
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;
}