diff options
Diffstat (limited to 'bin/ksh/tree.c')
-rw-r--r-- | bin/ksh/tree.c | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/bin/ksh/tree.c b/bin/ksh/tree.c index 6daed170ba0..1760f19f5fd 100644 --- a/bin/ksh/tree.c +++ b/bin/ksh/tree.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tree.c,v 1.28 2018/01/01 19:45:56 millert Exp $ */ +/* $OpenBSD: tree.c,v 1.29 2018/01/04 19:06:16 millert Exp $ */ /* * command tree climbing @@ -390,15 +390,6 @@ vfptreef(struct shf *shf, int indent, const char *fmt, va_list va) case 'c': tputc(va_arg(va, int), shf); break; - case 'd': /* decimal */ - n = va_arg(va, int); - neg = n < 0; - p = ulton(neg ? -n : n, 10); - if (neg) - *--p = '-'; - while (*p) - tputc(*p++, shf); - break; case 's': p = va_arg(va, char *); while (*p) @@ -408,8 +399,13 @@ vfptreef(struct shf *shf, int indent, const char *fmt, va_list va) p = va_arg(va, char *); tputS(p, shf); break; - case 'u': /* unsigned decimal */ - p = ulton(va_arg(va, unsigned int), 10); + case 'd': case 'u': /* decimal */ + n = (c == 'd') ? va_arg(va, int) : + va_arg(va, unsigned int); + neg = c=='d' && n<0; + p = ulton((neg) ? -n : n, 10); + if (neg) + *--p = '-'; while (*p) tputc(*p++, shf); break; |