diff options
author | tjr <tjr@FreeBSD.org> | 2002-05-19 07:27:26 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-05-19 07:27:26 +0000 |
commit | b72e0fae17fc6090caae787b8da94c9d48147a91 (patch) | |
tree | 5e70023eefd89555e17ff5b38f3a72c44f816e10 /bin | |
parent | 4f59c7a631f1b8c2195cfcba3bde497298c6d578 (diff) | |
download | FreeBSD-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.
Diffstat (limited to 'bin')
-rw-r--r-- | bin/sh/jobs.c | 10 |
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; } |