X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=coreutils%2Fsort.c;h=a1625fc9cdb30a6d332ba023ef901ff6abac172d;hb=1b49c25e0a719ec3051eafa2329e68012c815abb;hp=3562464d1639fcda1c930f13ce01867da8f21c01;hpb=fb132e47370378474c68ad22c1c0cb2ccee178de;p=oweals%2Fbusybox.git diff --git a/coreutils/sort.c b/coreutils/sort.c index 3562464d1..a1625fc9c 100644 --- a/coreutils/sort.c +++ b/coreutils/sort.c @@ -12,6 +12,53 @@ * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html */ +//usage:#define sort_trivial_usage +//usage: "[-nru" +//usage: IF_FEATURE_SORT_BIG("gMcszbdfimSTokt] [-o FILE] [-k start[.offset][opts][,end[.offset][opts]] [-t CHAR") +//usage: "] [FILE]..." +//usage:#define sort_full_usage "\n\n" +//usage: "Sort lines of text\n" +//usage: IF_FEATURE_SORT_BIG( +//usage: "\n -b Ignore leading blanks" +//usage: "\n -c Check whether input is sorted" +//usage: "\n -d Dictionary order (blank or alphanumeric only)" +//usage: "\n -f Ignore case" +//usage: "\n -g General numerical sort" +//usage: "\n -i Ignore unprintable characters" +//usage: "\n -k Sort key" +//usage: "\n -M Sort month" +//usage: ) +//usage: "\n -n Sort numbers" +//usage: IF_FEATURE_SORT_BIG( +//usage: "\n -o Output to file" +//usage: "\n -k Sort by key" +//usage: "\n -t CHAR Key separator" +//usage: ) +//usage: "\n -r Reverse sort order" +//usage: IF_FEATURE_SORT_BIG( +//usage: "\n -s Stable (don't sort ties alphabetically)" +//usage: ) +//usage: "\n -u Suppress duplicate lines" +//usage: IF_FEATURE_SORT_BIG( +//usage: "\n -z Lines are terminated by NUL, not newline" +//usage: "\n -mST Ignored for GNU compatibility") +//usage: +//usage:#define sort_example_usage +//usage: "$ echo -e \"e\\nf\\nb\\nd\\nc\\na\" | sort\n" +//usage: "a\n" +//usage: "b\n" +//usage: "c\n" +//usage: "d\n" +//usage: "e\n" +//usage: "f\n" +//usage: IF_FEATURE_SORT_BIG( +//usage: "$ echo -e \"c 3\\nb 2\\nd 2\" | $SORT -k 2,2n -k 1,1r\n" +//usage: "d 2\n" +//usage: "b 2\n" +//usage: "c 3\n" +//usage: ) +//usage: "" + #include "libbb.h" /* This is a NOEXEC applet. Be very careful! */ @@ -172,7 +219,7 @@ static int compare_keys(const void *xarg, const void *yarg) y = get_key(*(char **)yarg, key, flags); #else /* This curly bracket serves no purpose but to match the nesting - level of the for () loop we're not using */ + * level of the for () loop we're not using */ { x = *(char **)xarg; y = *(char **)yarg;