summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2002-02-02 09:37:12 +0000
committerJim Meyering <jim@meyering.net>2002-02-02 09:37:12 +0000
commit5e2bb11618f177b2b114b6ad46025f1b0efd87c7 (patch)
tree0d7c9e6595fba45cd5937b32e7049cac3ab3624d
parent44dc43bb3dd8765dbaefa7a6aaf671602c0083b3 (diff)
downloadcoreutils-5e2bb11618f177b2b114b6ad46025f1b0efd87c7.tar.xz
Add more support for POSIX 1003.1-2001, which requires removal for
support of obsolete "-N" option syntax in expand, head, fold, split, tail, unexpand, uniq, and which prohibits options with optional arguments in od and pr. (main): Check for obsolete options. (short_options): New constant.
-rw-r--r--src/sort.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/src/sort.c b/src/sort.c
index 736211613..f3a325536 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -362,6 +362,9 @@ native byte values.\n\
exit (status);
}
+static char const short_options[] =
+"-bcdfgik:mMno:rsS:t:T:uy" OPTARG_POSIX "z";
+
static struct option const long_options[] =
{
{"ignore-leading-blanks", no_argument, NULL, 'b'},
@@ -2262,8 +2265,7 @@ main (int argc, char **argv)
&& optind != argc
&& argv[optind][0] == '-' && argv[optind][1] == 'o'
&& (argv[optind][2] || optind + 1 != argc)))
- || ((c = getopt_long (argc, argv,
- "-bcdfgik:mMno:rsS:t:T:uy::z",
+ || ((c = getopt_long (argc, argv, short_options,
long_options, NULL))
== -1))
{
@@ -2292,7 +2294,7 @@ main (int argc, char **argv)
}
else
{
- if (! posix_pedantic)
+ if (OBSOLETE_OPTION_WARNINGS && ! posix_pedantic)
error (0, 0,
_("warning: `sort %s' is obsolete; use `sort -k'"),
optarg);
@@ -2428,8 +2430,10 @@ main (int argc, char **argv)
case 'y':
/* Accept and ignore e.g. -y0 for compatibility with Solaris
- 2.x through Solaris 7. -y is marked as obsolete starting
- with Solaris 8. */
+ 2.x through Solaris 7. -y SIZE is marked as obsolete
+ starting with Solaris 8. */
+ if (OBSOLETE_OPTION_WARNINGS && ! optarg && ! posix_pedantic)
+ error (0, 0, _("warning: `sort -y' is obsolete; omit `-y'"));
break;
case 'z':