diff options
author | pfg <pfg@FreeBSD.org> | 2012-01-12 20:30:20 +0000 |
---|---|---|
committer | pfg <pfg@FreeBSD.org> | 2012-01-12 20:30:20 +0000 |
commit | 0238379b18c22577e791b322bb2f68d9447a5b12 (patch) | |
tree | 9bbe84e3b502e9c244597a932616e010cd015370 /usr.bin | |
parent | ea95a90ac2f573bd82e13af603ed7972bab42635 (diff) | |
download | FreeBSD-src-0238379b18c22577e791b322bb2f68d9447a5b12.zip FreeBSD-src-0238379b18c22577e791b322bb2f68d9447a5b12.tar.gz |
Style cleanups for printf.
PR: bin/152934
Approved by: jhb (mentor)
Obtained from: Illumos
MFC after: 2 weeks
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/printf/printf.c | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/usr.bin/printf/printf.c b/usr.bin/printf/printf.c index eace370..89149dcda 100644 --- a/usr.bin/printf/printf.c +++ b/usr.bin/printf/printf.c @@ -66,21 +66,21 @@ static const char rcsid[] = #include "error.h" #endif -#define PF(f, func) do { \ - char *b = NULL; \ - if (havewidth) \ - if (haveprec) \ +#define PF(f, func) do { \ + char *b = NULL; \ + if (havewidth) \ + if (haveprec) \ (void)asprintf(&b, f, fieldwidth, precision, func); \ - else \ - (void)asprintf(&b, f, fieldwidth, func); \ - else if (haveprec) \ - (void)asprintf(&b, f, precision, func); \ - else \ - (void)asprintf(&b, f, func); \ - if (b) { \ - (void)fputs(b, stdout); \ - free(b); \ - } \ + else \ + (void)asprintf(&b, f, fieldwidth, func); \ + else if (haveprec) \ + (void)asprintf(&b, f, precision, func); \ + else \ + (void)asprintf(&b, f, func); \ + if (b) { \ + (void)fputs(b, stdout); \ + free(b); \ + } \ } while (0) static int asciicode(void); @@ -357,10 +357,10 @@ mknum(char *str, char ch) static int escape(char *fmt, int percent, size_t *len) { - char *save, *store; - int value, c; + char *save, *store, c; + int value; - for (save = store = fmt; (c = *fmt); ++fmt, ++store) { + for (save = store = fmt; ((c = *fmt) != 0); ++fmt, ++store) { if (c != '\\') { *store = c; continue; @@ -414,7 +414,7 @@ escape(char *fmt, int percent, size_t *len) *store++ = '%'; *store = '%'; } else - *store = value; + *store = (char)value; break; default: *store = *fmt; |