summaryrefslogtreecommitdiffstats
path: root/bin/sh/jobs.c
diff options
context:
space:
mode:
authorjilles <jilles@FreeBSD.org>2013-08-16 13:56:43 +0000
committerjilles <jilles@FreeBSD.org>2013-08-16 13:56:43 +0000
commitc433419763665f84075930e6318012aec9a984e8 (patch)
treef78109c5fa749dbfadfe19c63d325acb7746a0ef /bin/sh/jobs.c
parentb6d179c1400c0d392869d1b07a39e00f552072cc (diff)
downloadFreeBSD-src-c433419763665f84075930e6318012aec9a984e8.zip
FreeBSD-src-c433419763665f84075930e6318012aec9a984e8.tar.gz
sh: Recognize "--" as end of options in bg/fg/jobid builtins.
Diffstat (limited to 'bin/sh/jobs.c')
-rw-r--r--bin/sh/jobs.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index 89e4812..4ff5093 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -183,13 +183,14 @@ out: out2fmt_flush("sh: can't access tty; job control turned off\n");
#if JOBS
int
-fgcmd(int argc __unused, char **argv)
+fgcmd(int argc __unused, char **argv __unused)
{
struct job *jp;
pid_t pgrp;
int status;
- jp = getjob(argv[1]);
+ nextopt("");
+ jp = getjob(*argptr);
if (jp->jobctl == 0)
error("job not created under job control");
printjobcmd(jp);
@@ -210,8 +211,9 @@ bgcmd(int argc, char **argv)
{
struct job *jp;
+ nextopt("");
do {
- jp = getjob(*++argv);
+ jp = getjob(*argptr);
if (jp->jobctl == 0)
error("job not created under job control");
if (jp->state == JOBDONE)
@@ -220,7 +222,7 @@ bgcmd(int argc, char **argv)
jp->foreground = 0;
out1fmt("[%td] ", jp - jobtab + 1);
printjobcmd(jp);
- } while (--argc > 1);
+ } while (*argptr != NULL && *++argptr != NULL);
return 0;
}
@@ -542,12 +544,13 @@ waitcmdloop(struct job *job)
int
-jobidcmd(int argc __unused, char **argv)
+jobidcmd(int argc __unused, char **argv __unused)
{
struct job *jp;
int i;
- jp = getjob(argv[1]);
+ nextopt("");
+ jp = getjob(*argptr);
for (i = 0 ; i < jp->nprocs ; ) {
out1fmt("%d", (int)jp->ps[i].pid);
out1c(++i < jp->nprocs? ' ' : '\n');
OpenPOWER on IntegriCloud