aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2005-01-24 07:00:02 +0000
committerRob Landley <rob@landley.net>2005-01-24 07:00:02 +0000
commitc0dedd05e81ac03a1793abd8cbfacf8c546e976f (patch)
treecd761995a05504c6d068ba33ddc62e86f9342e4c /include
parentf4bb212d6ccc1a14724ba56fa57c3bc3ca66cf22 (diff)
downloadbusybox-c0dedd05e81ac03a1793abd8cbfacf8c546e976f.tar.gz
Sort rewrite to be SUSv3 compliant. New config option, updated help, and
a couple of infrastructure bits.
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h1
-rw-r--r--include/usage.h50
2 files changed, 38 insertions, 13 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 93ab5375c..0119aabe4 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -137,6 +137,7 @@ extern long *find_pid_by_name( const char* pidName);
extern char *find_real_root_device_name(void);
extern char *bb_get_line_from_file(FILE *file);
extern char *bb_get_chomped_line_from_file(FILE *file);
+extern char *bb_get_chunk_from_file(FILE *file);
extern int bb_copyfd_size(int fd1, int fd2, const off_t size);
extern int bb_copyfd_eof(int fd1, int fd2);
extern void bb_xprint_and_close_file(FILE *file);
diff --git a/include/usage.h b/include/usage.h
index 7cf44d74a..c53ead0c7 100644
--- a/include/usage.h
+++ b/include/usage.h
@@ -2193,24 +2193,40 @@
USAGE_FANCY_SLEEP("$ sleep 1d 3h 22m 8s\n" \
"[98528 second delay results]\n")
-#ifdef CONFIG_FEATURE_SORT_UNIQUE
- #define USAGE_SORT_UNIQUE(a) a
+#ifdef CONFIG_SORT_BIG
+ #define USAGE_SORT_BIG(a) a
#else
- #define USAGE_SORT_UNIQUE(a)
-#endif
-#ifdef CONFIG_FEATURE_SORT_REVERSE
- #define USAGE_SORT_REVERSE(a) a
-#else
- #define USAGE_SORT_REVERSE(a)
+ #define USAGE_SORT_BIG(a)
#endif
+
+
#define sort_trivial_usage \
- "[-n" USAGE_SORT_REVERSE("r") USAGE_SORT_UNIQUE("u") "] [FILE]..."
+ "[-nru" USAGE_SORT_BIG("gMcszbdfimSTokt] [-o outfile] [-k start[.offset][opts][,end[.offset][opts]] [-t char") "] [FILE]..."
#define sort_full_usage \
"Sorts lines of text in the specified files\n\n"\
"Options:\n" \
- USAGE_SORT_UNIQUE("\t-u\tsuppress duplicate lines\n") \
- USAGE_SORT_REVERSE("\t-r\tsort in reverse order\n") \
- "\t-n\tsort numerics"
+ USAGE_SORT_BIG( \
+ "\t-b\tignore leading blanks\n" \
+ "\t-c\tcheck whether input is sorted\n" \
+ "\t-d\tdictionary order (blank or alphanumeric only)\n" \
+ "\t-f\tignore case\n" \
+ "\t-g\tgeneral numerical sort\n" \
+ "\t-i\tignore unprintable characters\n" \
+ "\t-k\tspecify sort key\n" \
+ "\t-M\tsort month\n" \
+ ) \
+ "\t-n\tsort numbers\n" \
+ USAGE_SORT_BIG( \
+ "\t-o\toutput to file\n" \
+ "\t-k\tsort by key\n" \
+ "\t-t\tuse key separator other than whitespace\n" \
+ ) \
+ "\t-r\treverse sort order\n" \
+ USAGE_SORT_BIG("\t-s\tstable (don't sort ties alphabetically)\n") \
+ "\t-u\tsuppress duplicate lines" \
+ USAGE_SORT_BIG("\n\t-z\tinput terminated by nulls, not newlines\n") \
+ USAGE_SORT_BIG("\t-mST\tignored for GNU compatability") \
+ ""
#define sort_example_usage \
"$ echo -e \"e\\nf\\nb\\nd\\nc\\na\" | sort\n" \
"a\n" \
@@ -2218,7 +2234,15 @@
"c\n" \
"d\n" \
"e\n" \
- "f\n"
+ "f\n" \
+ USAGE_SORT_BIG( \
+ "$ echo -e \"c 3\\nb 2\\nd 2\" | $SORT -k 2,2n -k 1,1r\n" \
+ "d 2\n" \
+ "b 2\n" \
+ "c 3\n" \
+ ) \
+ ""
+
#define start_stop_daemon_trivial_usage \
"[OPTIONS] [--start|--stop] ... [-- arguments...]\n"