From aa9faf52c49936747ec4017bcf35261774ba9655 Mon Sep 17 00:00:00 2001 From: Paul Eggert Date: Tue, 26 Apr 2005 16:42:51 +0000 Subject: Remove posixver.h and its uses. (short_options): New constant, which always supports -y arg. (COMMON_SHORT_OPTIONS): Remove. --- src/sort.c | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) (limited to 'src') diff --git a/src/sort.c b/src/sort.c index 95c8e2e10..c5562c4d7 100644 --- a/src/sort.c +++ b/src/sort.c @@ -354,7 +354,7 @@ native byte values.\n\ exit (status); } -#define COMMON_SHORT_OPTIONS "-bcdfgik:mMno:rsS:t:T:uz" +static char const short_options[] = "-bcdfgik:mMno:rsS:t:T:uy:z"; static struct option const long_options[] = { @@ -2300,9 +2300,6 @@ main (int argc, char **argv) size_t nfiles = 0; bool posixly_correct = (getenv ("POSIXLY_CORRECT") != NULL); bool obsolete_usage = (posix2_version () < 200112); - char const *short_options = (obsolete_usage - ? COMMON_SHORT_OPTIONS "y::" - : COMMON_SHORT_OPTIONS "y:"); char *minus = "-", **files; char const *outfile = NULL; @@ -2582,12 +2579,12 @@ main (int argc, char **argv) emulate Solaris 8 and 9 "sort -y 100" which ignores the "100", and which in general ignores the argument after "-y" if it consists entirely of digits (it can even be empty). */ - if (!optarg && optind != argc) + if (optarg == argv[optind - 1]) { char const *p; - for (p = argv[optind]; ISDIGIT (*p); p++) + for (p = optarg; ISDIGIT (*p); p++) continue; - optind += !*p; + optind -= (*p != '\0'); } break; -- cgit v1.2.3-70-g09d2