ash: fix display of ">&-" redirect in job strings
authorDenys Vlasenko <vda.linux@googlemail.com>
Mon, 31 Jul 2017 12:32:18 +0000 (14:32 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Mon, 31 Jul 2017 12:32:18 +0000 (14:32 +0200)
function                                             old     new   delta
cmdtxt                                               558     569     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c

index 5c2e0659902aeb8384c3606a3ea9e950f72739dd..9c61ce618e73e8abe97f82d1c7552eba899c9d8c 100644 (file)
@@ -4642,6 +4642,10 @@ cmdputs(const char *s)
                        /* These can only happen inside quotes */
                        cc[0] = c;
                        str = cc;
+//FIXME:
+// $ true $$ &
+// $ <cr>
+// [1]+  Done    true ${\$}   <<=== BUG: ${\$} is not a valid way to write $$ (${$} would be ok)
                        c = '\\';
                        break;
                default:
@@ -4823,7 +4827,10 @@ cmdtxt(union node *n)
                cmdputs(utoa(n->nfile.fd));
                cmdputs(p);
                if (n->type == NTOFD || n->type == NFROMFD) {
-                       cmdputs(utoa(n->ndup.dupfd));
+                       if (n->ndup.dupfd >= 0)
+                               cmdputs(utoa(n->ndup.dupfd));
+                       else
+                               cmdputs("-");
                        break;
                }
                n = n->nfile.fname;