summaryrefslogtreecommitdiffstats
path: root/bin/sh/show.c
diff options
context:
space:
mode:
authortjr <tjr@FreeBSD.org>2002-07-09 03:26:47 +0000
committertjr <tjr@FreeBSD.org>2002-07-09 03:26:47 +0000
commit284f7b18517c1ae9289b5c527797519a64b1ab39 (patch)
treeea3a229fface84e43ad810146281b13aef78af32 /bin/sh/show.c
parent6eb4916dee42174b74d9d3077dd3a4b594452e66 (diff)
downloadFreeBSD-src-284f7b18517c1ae9289b5c527797519a64b1ab39.zip
FreeBSD-src-284f7b18517c1ae9289b5c527797519a64b1ab39.tar.gz
Print out commands with NTOFD/NFROMFD redirections that close the
descriptors (">&-" or similar) correctly in the jobs(1) command.
Diffstat (limited to 'bin/sh/show.c')
-rw-r--r--bin/sh/show.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bin/sh/show.c b/bin/sh/show.c
index e6bf574..9baac48 100644
--- a/bin/sh/show.c
+++ b/bin/sh/show.c
@@ -152,7 +152,10 @@ shcmd(union node *cmd, FILE *fp)
fprintf(fp, "%d", np->nfile.fd);
fputs(s, fp);
if (np->nfile.type == NTOFD || np->nfile.type == NFROMFD) {
- fprintf(fp, "%d", np->ndup.dupfd);
+ if (np->ndup.dupfd >= 0)
+ fprintf(fp, "%d", np->ndup.dupfd);
+ else
+ fprintf(fp, "-");
} else {
sharg(np->nfile.fname, fp);
}
OpenPOWER on IntegriCloud