Print out commands with NTOFD/NFROMFD redirections that close the

descriptors (">&-" or similar) correctly in the jobs(1) command.
This commit is contained in:
Tim J. Robbins 2002-07-09 03:26:47 +00:00
parent 518b7839f2
commit 907354479f
2 changed files with 8 additions and 2 deletions

View File

@ -1229,7 +1229,10 @@ cmdtxt(union node *n)
}
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 {

View File

@ -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);
}