summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-05-19 07:27:26 +0000
committertjr <tjr@FreeBSD.org>2002-05-19 07:27:26 +0000
commitb72e0fae17fc6090caae787b8da94c9d48147a91 (patch)
tree5e70023eefd89555e17ff5b38f3a72c44f816e10
parent4f59c7a631f1b8c2195cfcba3bde497298c6d578 (diff)
downloadFreeBSD-src-b72e0fae17fc6090caae787b8da94c9d48147a91.zip
FreeBSD-src-b72e0fae17fc6090caae787b8da94c9d48147a91.tar.gz
Make the fg and bg commands give the output required by SUSv3.
fg outputs the name of the command, bg outputs the name of the command and the job id.
-rw-r--r--bin/sh/jobs.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c
index b1cc2de..54d596b 100644
--- a/bin/sh/jobs.c
+++ b/bin/sh/jobs.c
@@ -203,6 +203,9 @@ fgcmd(int argc __unused, char **argv)
jp = getjob(argv[1]);
if (jp->jobctl == 0)
error("job not created under job control");
+ out1str(jp->ps[0].cmd);
+ out1c('\n');
+ flushout(&output);
pgrp = jp->ps[0].pid;
#ifdef OLD_TTY_DRIVER
ioctl(2, TIOCSPGRP, (char *)&pgrp);
@@ -220,13 +223,20 @@ fgcmd(int argc __unused, char **argv)
int
bgcmd(int argc, char **argv)
{
+ char s[64];
struct job *jp;
do {
jp = getjob(*++argv);
if (jp->jobctl == 0)
error("job not created under job control");
+ if (jp->state == JOBDONE)
+ continue;
restartjob(jp);
+ fmtstr(s, 64, "[%d] ", jp - jobtab + 1);
+ out1str(s);
+ out1str(jp->ps[0].cmd);
+ out1c('\n');
} while (--argc > 1);
return 0;
}
OpenPOWER on IntegriCloud