summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2005-04-26 16:42:51 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2005-04-26 16:42:51 +0000
commitaa9faf52c49936747ec4017bcf35261774ba9655 (patch)
tree55c520658bb22c12956cb9d88815eaf045b811fc /src
parent8f7612bc5ef991b303d8ae21a30732e31fb7099f (diff)
downloadcoreutils-aa9faf52c49936747ec4017bcf35261774ba9655.tar.xz
Remove posixver.h and its uses.
(short_options): New constant, which always supports -y arg. (COMMON_SHORT_OPTIONS): Remove.
Diffstat (limited to 'src')
-rw-r--r--src/sort.c11
1 files changed, 4 insertions, 7 deletions
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;