diff options
| author | H. Peter Anvin <hpa@zytor.com> | 2006-05-03 17:32:15 -0700 |
|---|---|---|
| committer | H. Peter Anvin <hpa@zytor.com> | 2006-05-03 17:32:15 -0700 |
| commit | 28eecd8965aedbd75727fb0797a2e7033d5c54ee (patch) | |
| tree | 1cac9ffc5f7fe7fd82d59b4accd7b8cf85762f74 /dos/printf.c | |
| parent | f8c463722022008c8412a69f90576d2bf38818ed (diff) | |
| download | syslinux-28eecd8965aedbd75727fb0797a2e7033d5c54ee.tar.gz | |
Across-the-board stealth whitespace cleanup
Diffstat (limited to 'dos/printf.c')
| -rw-r--r-- | dos/printf.c | 45 |
1 files changed, 22 insertions, 23 deletions
diff --git a/dos/printf.c b/dos/printf.c index bea400de..99b389f6 100644 --- a/dos/printf.c +++ b/dos/printf.c @@ -45,7 +45,7 @@ static char * number(char * str, long num, int base, int size, int precision char c,sign,tmp[66]; const char *digits="0123456789abcdefghijklmnopqrstuvwxyz"; int i; - + if (type & LARGE) digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"; if (type & LEFT) @@ -116,20 +116,20 @@ int vsprintf(char *buf, const char *fmt, va_list args) int i, base; char * str; const char *s; - + int flags; /* flags to number() */ - + int field_width; /* width of output field */ int precision; /* min. # of digits for integers; max number of chars for from string */ int qualifier; /* 'h', 'l', or 'L' for integer fields */ - + for (str=buf ; *fmt ; ++fmt) { if (*fmt != '%') { *str++ = *fmt; continue; } - + /* process flags */ flags = 0; repeat: @@ -141,7 +141,7 @@ int vsprintf(char *buf, const char *fmt, va_list args) case '#': flags |= SPECIAL; goto repeat; case '0': flags |= ZEROPAD; goto repeat; } - + /* get field width */ field_width = -1; if (isdigit(*fmt)) @@ -155,11 +155,11 @@ int vsprintf(char *buf, const char *fmt, va_list args) flags |= LEFT; } } - + /* get the precision */ precision = -1; if (*fmt == '.') { - ++fmt; + ++fmt; if (isdigit(*fmt)) precision = skip_atou(&fmt); else if (*fmt == '*') { @@ -170,17 +170,17 @@ int vsprintf(char *buf, const char *fmt, va_list args) if (precision < 0) precision = 0; } - + /* get the conversion qualifier */ qualifier = -1; if (*fmt == 'h' || *fmt == 'l' || *fmt == 'L') { qualifier = *fmt; ++fmt; } - + /* default base */ base = 10; - + switch (*fmt) { case 'c': if (!(flags & LEFT)) @@ -190,11 +190,11 @@ int vsprintf(char *buf, const char *fmt, va_list args) while (--field_width > 0) *str++ = ' '; continue; - + case 's': s = va_arg(args, char *); len = strnlen(s, precision); - + if (!(flags & LEFT)) while (len < field_width--) *str++ = ' '; @@ -203,7 +203,7 @@ int vsprintf(char *buf, const char *fmt, va_list args) while (len < field_width--) *str++ = ' '; continue; - + case 'p': if (field_width == -1) { field_width = 2*sizeof(void *); @@ -213,8 +213,8 @@ int vsprintf(char *buf, const char *fmt, va_list args) (unsigned long) va_arg(args, void *), 16, field_width, precision, flags); continue; - - + + case 'n': if (qualifier == 'l') { long * ip = va_arg(args, long *); @@ -224,28 +224,28 @@ int vsprintf(char *buf, const char *fmt, va_list args) *ip = (str - buf); } continue; - + case '%': *str++ = '%'; continue; - + /* integer number formats - set up the flags and "break" */ case 'o': base = 8; break; - + case 'X': flags |= LARGE; case 'x': base = 16; break; - + case 'd': case 'i': flags |= SIGN; case 'u': break; - + default: *str++ = '%'; if (*fmt) @@ -274,7 +274,7 @@ int sprintf(char * buf, const char *fmt, ...) { va_list args; int i; - + va_start(args, fmt); i=vsprintf(buf,fmt,args); va_end(args); @@ -295,4 +295,3 @@ int printf(const char *fmt, ...) return printed; } - |
