--- bash/bash/builtins/fg_bg.def:1.1.1.4 Sat Apr 5 00:00:28 2003
+++ bash/bash/builtins/fg_bg.def Mon Jul 19 13:50:41 2004
@@ -80,8 +80,8 @@
$BUILTIN bg
$FUNCTION bg_builtin
$DEPENDS_ON JOB_CONTROL
-$SHORT_DOC bg [job_spec]
-Place JOB_SPEC in the background, as if it had been started with
+$SHORT_DOC bg [job_spec ...]
+Place JOB_SPEC(s) in the background, as if it had been started with
`&'. If JOB_SPEC is not present, the shell's notion of the current
job is used.
$END
@@ -105,55 +105,62 @@
return (fg_bg (list, 0));
}
-/* How to put a job into the foreground/background. */
+/* How to put jobs into the foreground/background. */
static int
fg_bg (list, foreground)
WORD_LIST *list;
int foreground;
{
sigset_t set, oset;
- int job, status, old_async_pid;
+ int job, status, old_async_pid, return_status=-1;
BLOCK_CHILD (set, oset);
- job = get_job_spec (list);
+ do {
+ job = get_job_spec (list);
- if (job < 0 || job >= job_slots || jobs[job] == 0)
- {
- if (job != DUP_JOB)
- sh_badjob (list ? list->word->word : "current");
-
- goto failure;
- }
-
- /* Or if jobs[job]->pgrp == shell_pgrp. */
- if (IS_JOBCONTROL (job) == 0)
- {
- builtin_error ("job %%%d started without job control", job + 1);
- goto failure;
- }
-
- if (foreground == 0)
- {
- old_async_pid = last_asynchronous_pid;
- last_asynchronous_pid = jobs[job]->pgrp; /* As per Posix.2 5.4.2
*/