diff options
author | Jim Meyering <jim@meyering.net> | 1997-04-27 23:45:57 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 1997-04-27 23:45:57 +0000 |
commit | 795d25471586b2d1c773afded1aabd331f1ee868 (patch) | |
tree | 54f19d9cd42c8d4f0cc37dc70383f427b1735d48 /src | |
parent | e5ce0d8b3e7b01defd6e9a243ceaa0dbfe24bc83 (diff) | |
download | coreutils-795d25471586b2d1c773afded1aabd331f1ee868.tar.xz |
(STRTOX): Don't fail because of extra character(s) following a
character constant. Give the *warning* only if !POSIXLY_CORRECT.
Diffstat (limited to 'src')
-rw-r--r-- | src/printf.c | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/src/printf.c b/src/printf.c index fb395b369..dd18f609b 100644 --- a/src/printf.c +++ b/src/printf.c @@ -68,8 +68,12 @@ char *xmalloc (); /* The value to return to the calling program. */ static int exit_status; +/* FIXME */ +static int posixly_correct; + +/* FIXME */ static char *const cfcc_msg = - N_("%s: character(s) following character constant"); + N_("warning: %s: character(s) following character constant have been ignored"); /* The name this program was run with. */ char *program_name; @@ -147,11 +151,12 @@ FUNC_NAME (const char *s) \ if (*s == '\"' || *s == '\'') \ { \ val = *(unsigned char *) ++s; \ - if (*++s != 0) \ - { \ - error (0, 0, _(cfcc_msg), s); \ - exit_status = 1; \ - } \ + /* If POSIXLY_CORRECT is not set, then give a warning that there \ + are characters following the character constant and that GNU \ + printf is ignoring those characters. If POSIXLY_CORRECT *is* \ + set, then don't give the warning. */ \ + if (*++s != 0 && !posixly_correct) \ + error (0, 0, _(cfcc_msg), s); \ } \ else \ { \ @@ -483,7 +488,8 @@ main (int argc, char **argv) exit_status = 0; /* Don't recognize --help or --version if POSIXLY_CORRECT is set. */ - if (getenv ("POSIXLY_CORRECT") == NULL) + posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL); + if (!posixly_correct) parse_long_options (argc, argv, "printf", GNU_PACKAGE, VERSION, usage); if (argc == 1) |