version 1.14, 2008/09/08 17:04:20 |
version 1.15, 2009/07/17 17:39:30 |
|
|
gargv = ++argv; |
gargv = ++argv; |
|
|
#define SKIP1 "#-+ 0" |
#define SKIP1 "#-+ 0" |
#define SKIP2 "*0123456789" |
#define SKIP2 "0123456789" |
do { |
do { |
/* |
/* |
* Basic algorithm is to scan the format string for conversion |
* Basic algorithm is to scan the format string for conversion |
|
|
} |
} |
|
|
/* skip to field width */ |
/* skip to field width */ |
for (; strchr(SKIP1, *fmt); ++fmt) ; |
for (; strchr(SKIP1, *fmt); ++fmt) |
fieldwidth = *fmt == '*' ? getint() : 0; |
; |
|
if (*fmt == '*') { |
|
++fmt; |
|
fieldwidth = getint(); |
|
} else |
|
fieldwidth = 0; |
|
|
/* skip to possible '.', get following precision */ |
/* skip to field precision */ |
for (; strchr(SKIP2, *fmt); ++fmt) ; |
for (; strchr(SKIP2, *fmt); ++fmt) |
if (*fmt == '.') |
; |
|
precision = 0; |
|
if (*fmt == '.') { |
++fmt; |
++fmt; |
precision = *fmt == '*' ? getint() : 0; |
if (*fmt == '*') { |
|
++fmt; |
|
precision = getint(); |
|
} |
|
for (; strchr(SKIP2, *fmt); ++fmt) |
|
; |
|
} |
|
|
for (; strchr(SKIP2, *fmt); ++fmt) ; |
|
if (!*fmt) { |
if (!*fmt) { |
warnx ("missing format character"); |
warnx ("missing format character"); |
return(1); |
return(1); |