summaryrefslogtreecommitdiff
path: root/src/sort.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1993-10-23 15:37:19 +0000
committerJim Meyering <jim@meyering.net>1993-10-23 15:37:19 +0000
commitb869639f4661488eba0bb2d08020c6e71bb72627 (patch)
treee325845ec7ca06b4d59fcc07e87020897c7c4d9b /src/sort.c
parentd1df8c198d8878b77d1d1583bc7b3c491534616a (diff)
downloadcoreutils-b869639f4661488eba0bb2d08020c6e71bb72627.tar.xz
merge with 1.8d+
Diffstat (limited to 'src/sort.c')
-rw-r--r--src/sort.c51
1 files changed, 43 insertions, 8 deletions
diff --git a/src/sort.c b/src/sort.c
index 5253f5f89..ce3d271c1 100644
--- a/src/sort.c
+++ b/src/sort.c
@@ -1539,7 +1539,7 @@ main (argc, argv)
if (digits[UCHAR (*s)])
{
if (!key)
- usage ();
+ usage (2);
for (t = 0; digits[UCHAR (*s)]; ++s)
t = t * 10 + *s - '0';
t2 = 0;
@@ -1676,7 +1676,7 @@ main (argc, argv)
default:
fprintf (stderr, "%s: unrecognized option `-%c'\n",
argv[0], *s);
- usage ();
+ usage (2);
}
if (*s)
++s;
@@ -1775,11 +1775,46 @@ main (argc, argv)
}
static void
-usage ()
+usage (status)
+ int status;
{
- fprintf (stderr, "\
-Usage: %s [-cmus] [-t separator] [-o output-file] [-T tempdir] [-bdfiMnr]\n\
- [+POS1 [-POS2]] [-k POS1[,POS2]] [file...]\n",
- program_name);
- exit (2);
+ if (status != 0)
+ fprintf (stderr, "Try `%s --help' for more information.\n",
+ program_name);
+ else
+ {
+ printf ("\
+Usage: %s [OPTION]... [FILE]...\n\
+",
+ program_name);
+ printf ("\
+\n\
+ +POS1 [-POS2] start a key at POS1, end it before POS2\n\
+ -M compare (unknown) < `JAN' < ... < `DEC', imply -b\n\
+ -T DIRECT use DIRECTfor temporary files, not $TEMPDIR nor /tmp\n\
+ -b ignore leading blanks in sort fields or keys\n\
+ -c check if given files already sorted, do not sort\n\
+ -d consider only [a-zA-Z0-9 ] characters in keys\n\
+ -f fold lower case to upper case characters in keys\n\
+ -i consider only [\\040-\\0176] characters in keys\n\
+ -k POS1[,POS2] same as +POS1 [-POS2], but all positions counted from 1\n\
+ -m merge already sorted files, do not sort\n\
+ -n compare according to string numerical value, imply -b\n\
+ -o FILE write result on FILE instead of standard output\n\
+ -r reverse the result of comparisons\n\
+ -s stabilize sort by disabling last resort comparison\n\
+ -t SEP use SEParator instead of non- to whitespace transition\n\
+ -u with -c, check for strict ordering\n\
+ -u with -m, only output the first of an equal sequence\n\
+ --help display this help and exit\n\
+ --version output version information and exit\n\
+\n\
+POS is F[.C][OPTS], where F is the field number and C the character\n\
+position in the field, both counted from zero. OPTS is made up of one\n\
+or more of Mbdfinr, this effectively disable global -Mbdfinr settings\n\
+for that key. If no key given, use the entire line as key. With no\n\
+FILE, or when FILE is -, read standard input.\n\
+");
+ }
+ exit (status);
}