diff options
author | tjr <tjr@FreeBSD.org> | 2002-07-09 03:26:47 +0000 |
---|---|---|
committer | tjr <tjr@FreeBSD.org> | 2002-07-09 03:26:47 +0000 |
commit | 284f7b18517c1ae9289b5c527797519a64b1ab39 (patch) | |
tree | ea3a229fface84e43ad810146281b13aef78af32 /bin | |
parent | 6eb4916dee42174b74d9d3077dd3a4b594452e66 (diff) | |
download | FreeBSD-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')
-rw-r--r-- | bin/sh/jobs.c | 5 | ||||
-rw-r--r-- | bin/sh/show.c | 5 |
2 files changed, 8 insertions, 2 deletions
diff --git a/bin/sh/jobs.c b/bin/sh/jobs.c index efdb69e..c0d3e4f 100644 --- a/bin/sh/jobs.c +++ b/bin/sh/jobs.c @@ -1229,7 +1229,10 @@ redir: } cmdputs(p); if (n->type == NTOFD || n->type == NFROMFD) { - s[0] = n->ndup.dupfd + '0'; + if (n->ndup.dupfd >= 0) + s[0] = n->ndup.dupfd + '0'; + else + s[0] = '-'; s[1] = '\0'; cmdputs(s); } else { 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); } |