version 1.19, 2013/11/20 20:46:47 |
version 1.20, 2014/04/18 11:35:51 |
|
|
#define hextobin(c) ((c) >= 'A' && (c) <= 'F' ? c - 'A' + 10 : (c) >= 'a' && (c) <= 'f' ? c - 'a' + 10 : c - '0') |
#define hextobin(c) ((c) >= 'A' && (c) <= 'F' ? c - 'A' + 10 : (c) >= 'a' && (c) <= 'f' ? c - 'a' + 10 : c - '0') |
|
|
#define PF(f, func) { \ |
#define PF(f, func) { \ |
if (fieldwidth) \ |
if (havefieldwidth) \ |
if (precision) \ |
if (haveprecision) \ |
(void)printf(f, fieldwidth, precision, func); \ |
(void)printf(f, fieldwidth, precision, func); \ |
else \ |
else \ |
(void)printf(f, fieldwidth, func); \ |
(void)printf(f, fieldwidth, func); \ |
else if (precision) \ |
else if (haveprecision) \ |
(void)printf(f, precision, func); \ |
(void)printf(f, precision, func); \ |
else \ |
else \ |
(void)printf(f, func); \ |
(void)printf(f, func); \ |
|
|
main(int argc, char *argv[]) |
main(int argc, char *argv[]) |
{ |
{ |
char *fmt, *start; |
char *fmt, *start; |
|
int havefieldwidth, haveprecision; |
int fieldwidth, precision; |
int fieldwidth, precision; |
char convch, nextch; |
char convch, nextch; |
char *format; |
char *format; |
|
|
; |
; |
if (*fmt == '*') { |
if (*fmt == '*') { |
++fmt; |
++fmt; |
|
havefieldwidth = 1; |
fieldwidth = getint(); |
fieldwidth = getint(); |
} else |
} else |
fieldwidth = 0; |
havefieldwidth = 0; |
|
|
/* skip to field precision */ |
/* skip to field precision */ |
for (; strchr(SKIP2, *fmt); ++fmt) |
for (; strchr(SKIP2, *fmt); ++fmt) |
; |
; |
precision = 0; |
haveprecision = 0; |
if (*fmt == '.') { |
if (*fmt == '.') { |
++fmt; |
++fmt; |
if (*fmt == '*') { |
if (*fmt == '*') { |
++fmt; |
++fmt; |
|
haveprecision = 1; |
precision = getint(); |
precision = getint(); |
} |
} |
for (; strchr(SKIP2, *fmt); ++fmt) |
for (; strchr(SKIP2, *fmt); ++fmt) |