From 5afcf8697f2bbdaa4eb8abbebb1c0807427411d9 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Tue, 15 Jun 2004 18:00:35 +0000 Subject: (print_esc): Support \x, \u, \U even if POSIXLY_CORRECT, since POSIX says the behavior is unspecified here. (main): Recognize --help, --version even if POSIXLY_CORRECT. POSIX does not specify any options, but it does not prohibit options either, so "printf" is like "expr" here. --- src/printf.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/printf.c') diff --git a/src/printf.c b/src/printf.c index 0c709864b..af2f31afa 100644 --- a/src/printf.c +++ b/src/printf.c @@ -241,7 +241,7 @@ print_esc (const char *escstart, bool octal_0) int esc_value = 0; /* Value of \nnn escape. */ int esc_length; /* Length of \nnn escape. */ - if (!posixly_correct && *p == 'x') + if (*p == 'x') { /* A hexadecimal \xhh escape sequence must have 1 or 2 hex. digits. */ for (esc_length = 0, ++p; @@ -265,7 +265,7 @@ print_esc (const char *escstart, bool octal_0) } else if (*p && strchr ("\"\\abcfnrtv", *p)) print_esc_char (*p++); - else if (!posixly_correct && (*p == 'u' || *p == 'U')) + else if (*p == 'u' || *p == 'U') { char esc_char = *p; unsigned int uni_value; @@ -557,11 +557,10 @@ main (int argc, char **argv) exit_status = 0; - /* Don't recognize --help or --version if POSIXLY_CORRECT is set. */ posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL); - if (!posixly_correct) - parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION, - usage, AUTHORS, (char const *) NULL); + + parse_long_options (argc, argv, PROGRAM_NAME, GNU_PACKAGE, VERSION, + usage, AUTHORS, (char const *) NULL); /* The above handles --help and --version. Since there is no other invocation of getopt, handle `--' here. */ -- cgit v1.2.3-70-g09d2