diff options
author | Eric Andersen <andersen@codepoet.org> | 2002-03-22 08:17:28 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2002-03-22 08:17:28 +0000 |
commit | 2dcfcf02449441b0745b4ebaec76c0e40d976eed (patch) | |
tree | 011adf98060ef41f767aeb5bc90e1806dbd63e2c /libc/stdio/printf.c | |
parent | c85ba8c4b7e5dc2946438c1a91f44da187a20dc0 (diff) |
Add in a knob to disable %m support
-Erik
Diffstat (limited to 'libc/stdio/printf.c')
-rw-r--r-- | libc/stdio/printf.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libc/stdio/printf.c b/libc/stdio/printf.c index 8efa7dd5b..9654cda90 100644 --- a/libc/stdio/printf.c +++ b/libc/stdio/printf.c @@ -31,6 +31,7 @@ * * ATTENTION! ATTENTION! ATTENTION! ATTENTION! ATTENTION! */ + #define _ISOC99_SOURCE /* for ULLONG primarily... */ #define _GNU_SOURCE #define _STDIO_UTILITY /* We're using _uintmaxtostr. */ @@ -54,7 +55,12 @@ /**********************************************************************/ +/* These provide some control over printf's feature set */ #define __STDIO_PRINTF_FLOAT +#define __STDIO_PRINTF_M_SUPPORT + + +/**********************************************************************/ #if defined(__UCLIBC__) && !defined(__UCLIBC_HAS_FLOATS__) #undef __STDIO_PRINTF_FLOAT @@ -118,7 +124,9 @@ enum { CONV_x, CONV_X, CONV_o, CONV_u, CONV_d, CONV_i, CONV_f, CONV_F, CONV_e, CONV_E, CONV_g, CONV_G, CONV_a, CONV_A, CONV_C, CONV_S, CONV_c, CONV_s, +#ifdef __STDIO_PRINTF_M_SUPPORT CONV_m, +#endif CONV_custom0 /* must be last */ }; @@ -878,11 +886,13 @@ extern int _ppfs_parsespec(ppfs_t *ppfs) if (!*p) { #ifdef __STDIO_GLIBC_CUSTOM_PRINTF /* TODO -- gnu %m support build option. */ +#ifdef __STDIO_PRINTF_M_SUPPORT if (*fmt == 'm') { conv_num = CONV_m; ppfs->num_data_args = 0; goto DONE; } +#endif /* Handle custom arg -- WARNING -- overwrites p!!! */ conv_num = CONV_custom0; @@ -1166,9 +1176,11 @@ int _do_one_spec(FILE * __restrict stream, register ppfs_t *ppfs, int *count) s[1] = 0; slen = 1; } +#ifdef __STDIO_PRINTF_M_SUPPORT } else if (ppfs->conv_num == CONV_m) { s = strerror(errno); goto SET_STRING_LEN; +#endif } else { assert(ppfs->conv_num == CONV_custom0); |