summaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
authorJilles Tjoelker <jilles@FreeBSD.org>2013-08-16 13:56:43 +0000
committerJilles Tjoelker <jilles@FreeBSD.org>2013-08-16 13:56:43 +0000
commitf0ef49bbf45c0819aa3d92c314f8aa0efb1f5033 (patch)
treef78109c5fa749dbfadfe19c63d325acb7746a0ef /bin
parent4fe1afd789f3df866c9099cd5c279ea49f7de9e8 (diff)
downloadsrc-test2-f0ef49bbf45c0819aa3d92c314f8aa0efb1f5033.tar.gz
src-test2-f0ef49bbf45c0819aa3d92c314f8aa0efb1f5033.zip
Notes
Diffstat (limited to 'bin')
-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 89e481297fea..4ff5093b102d 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');