summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2004-06-15 18:00:35 +0000
committerJim Meyering <jim@meyering.net>2004-06-15 18:00:35 +0000
commit5afcf8697f2bbdaa4eb8abbebb1c0807427411d9 (patch)
tree3b1654c0a0781e9c036fb30ab7d4398887af9a1b /src
parentdb2fa4fdcdc0a6ccb1087b62a48c2e0a6e91fdec (diff)
downloadcoreutils-5afcf8697f2bbdaa4eb8abbebb1c0807427411d9.tar.xz
(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.
Diffstat (limited to 'src')
-rw-r--r--src/printf.c11
1 files changed, 5 insertions, 6 deletions
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. */