summaryrefslogtreecommitdiffstats
path: root/bin/sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/sh')
-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