diff options
author | Jim Meyering <jim@meyering.net> | 2002-02-16 09:03:12 +0000 |
---|---|---|
committer | Jim Meyering <jim@meyering.net> | 2002-02-16 09:03:12 +0000 |
commit | 7513e6d4f40cce1bffd0c03552ba11241383ae39 (patch) | |
tree | 3d67b0d460b1dfac51347332524e79cb89f46baa /src | |
parent | 361dda3c2098dec704eaa8b5a492b05cdb75b668 (diff) | |
download | coreutils-7513e6d4f40cce1bffd0c03552ba11241383ae39.tar.xz |
Add support for _POSIX2_VERSION, which lets you pick which POSIX
version you want the utilities to conform to. Remove warnings about
failure to conform to a future POSIX version.
(usage): Document only the intersection of the
old and new behaviors, to encourage portability.
(main): Parse options using POSIX 1003.1-2001 rules if
conforming to that standard. Do not warn of obsolete options.
Diffstat (limited to 'src')
-rw-r--r-- | src/nice.c | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/src/nice.c b/src/nice.c index 4bb6d10fd..72ce9e3c5 100644 --- a/src/nice.c +++ b/src/nice.c @@ -70,7 +70,6 @@ With no COMMAND, print the current scheduling priority. ADJUST is 10\n\ by default. Range goes from -20 (highest priority) to 19 (lowest).\n\ \n\ -n, --adjustment=ADJUST increment priority by ADJUST first\n\ - -ADJUST (obsolete) same as -n ADJUST\n\ "), stdout); fputs (HELP_OPTION_DESCRIPTION, stdout); fputs (VERSION_OPTION_DESCRIPTION, stdout); @@ -102,30 +101,24 @@ main (int argc, char **argv) { char *s = argv[i]; - if (POSIX2_VERSION < 200112 - && s[0] == '-' && s[1] == '-' && ISDIGIT (s[2])) + if (s[0] == '-' && s[1] == '-' && ISDIGIT (s[2]) + && posix2_version () < 200112) { if (xstrtol (&s[2], NULL, 10, &adjustment, "") != LONGINT_OK) error (1, 0, _("invalid option `%s'"), s); - if (OBSOLETE_OPTION_WARNINGS && ! getenv ("POSIXLY_CORRECT")) - error (0, 0, _("warning: `%s' option is obsolete; use `-n %s'"), - s, s + 1); minusflag = 1; adjustment_given = 1; ++i; } - else if (POSIX2_VERSION < 200112 - && s[0] == '-' && (ISDIGIT (s[1]) - || (s[1] == '+' && ISDIGIT (s[2])))) + else if (s[0] == '-' + && (ISDIGIT (s[1]) || (s[1] == '+' && ISDIGIT (s[2]))) + && posix2_version () < 200112) { if (s[1] == '+') ++s; if (xstrtol (&s[1], NULL, 10, &adjustment, "") != LONGINT_OK) error (1, 0, _("invalid option `%s'"), s); - if (OBSOLETE_OPTION_WARNINGS && ! getenv ("POSIXLY_CORRECT")) - error (0, 0, _("warning: `%s' option is obsolete; use `-n %s'"), - argv[i], s + 1); minusflag = 0; adjustment_given = 1; |