diff options
author | das <das@FreeBSD.org> | 2003-06-29 01:11:31 +0000 |
---|---|---|
committer | das <das@FreeBSD.org> | 2003-06-29 01:11:31 +0000 |
commit | 71d3f43884b92a4ce96d6c702b48c728b8b156ba (patch) | |
tree | 50524f22004f0625e40f0b6f6dfb6932c4973032 /lib/libc/gen/fmtcheck.c | |
parent | f5521f77ff660b570e1ca17b5fd3b39d5c683aaf (diff) | |
download | FreeBSD-src-71d3f43884b92a4ce96d6c702b48c728b8b156ba.zip FreeBSD-src-71d3f43884b92a4ce96d6c702b48c728b8b156ba.tar.gz |
Teach fmtcheck(3) about the flags a, A, F, G, t, and z.
Diffstat (limited to 'lib/libc/gen/fmtcheck.c')
-rw-r--r-- | lib/libc/gen/fmtcheck.c | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/lib/libc/gen/fmtcheck.c b/lib/libc/gen/fmtcheck.c index 1ea495d..eb5326d 100644 --- a/lib/libc/gen/fmtcheck.c +++ b/lib/libc/gen/fmtcheck.c @@ -49,10 +49,14 @@ enum __e_fmtcheck_types { FMTCHECK_INT, FMTCHECK_LONG, FMTCHECK_QUAD, + FMTCHECK_PTRDIFFT, + FMTCHECK_SIZET, FMTCHECK_SHORTPOINTER, FMTCHECK_INTPOINTER, FMTCHECK_LONGPOINTER, FMTCHECK_QUADPOINTER, + FMTCHECK_PTRDIFFTPOINTER, + FMTCHECK_SIZETPOINTER, FMTCHECK_DOUBLE, FMTCHECK_LONGDOUBLE, FMTCHECK_STRING, @@ -71,10 +75,10 @@ typedef enum __e_fmtcheck_types EFT; static EFT get_next_format_from_precision(const char **pf) { - int sh, lg, quad, longdouble; + int sh, lg, quad, longdouble, ptrdifft, sizet; const char *f; - sh = lg = quad = longdouble = 0; + sh = lg = quad = longdouble = ptrdifft = sizet = 0; f = *pf; switch (*f) { @@ -96,6 +100,14 @@ get_next_format_from_precision(const char **pf) f++; quad = 1; break; + case 't': + f++; + ptrdifft = 1; + break; + case 'z': + f++; + sizet = 1; + break; case 'L': f++; longdouble = 1; @@ -111,6 +123,10 @@ get_next_format_from_precision(const char **pf) RETURN(pf,f,FMTCHECK_LONG); if (quad) RETURN(pf,f,FMTCHECK_QUAD); + if (ptrdifft) + RETURN(pf,f,FMTCHECK_PTRDIFFT); + if (sizet) + RETURN(pf,f,FMTCHECK_SIZET); RETURN(pf,f,FMTCHECK_INT); } if (*f == 'n') { @@ -122,32 +138,36 @@ get_next_format_from_precision(const char **pf) RETURN(pf,f,FMTCHECK_LONGPOINTER); if (quad) RETURN(pf,f,FMTCHECK_QUADPOINTER); + if (ptrdifft) + RETURN(pf,f,FMTCHECK_PTRDIFFTPOINTER); + if (sizet) + RETURN(pf,f,FMTCHECK_SIZETPOINTER); RETURN(pf,f,FMTCHECK_INTPOINTER); } if (strchr("DOU", *f)) { - if (sh + lg + quad + longdouble) + if (sh + lg + quad + longdouble + ptrdifft + sizet) RETURN(pf,f,FMTCHECK_UNKNOWN); RETURN(pf,f,FMTCHECK_LONG); } - if (strchr("eEfg", *f)) { + if (strchr("aAeEfFgG", *f)) { if (longdouble) RETURN(pf,f,FMTCHECK_LONGDOUBLE); - if (sh + lg + quad) + if (sh + lg + quad + ptrdifft + sizet) RETURN(pf,f,FMTCHECK_UNKNOWN); RETURN(pf,f,FMTCHECK_DOUBLE); } if (*f == 'c') { - if (sh + lg + quad + longdouble) + if (sh + lg + quad + longdouble + ptrdifft + sizet) RETURN(pf,f,FMTCHECK_UNKNOWN); RETURN(pf,f,FMTCHECK_INT); } if (*f == 's') { - if (sh + lg + quad + longdouble) + if (sh + lg + quad + longdouble + ptrdifft + sizet) RETURN(pf,f,FMTCHECK_UNKNOWN); RETURN(pf,f,FMTCHECK_STRING); } if (*f == 'p') { - if (sh + lg + quad + longdouble) + if (sh + lg + quad + longdouble + ptrdifft + sizet) RETURN(pf,f,FMTCHECK_UNKNOWN); RETURN(pf,f,FMTCHECK_LONG); } |