aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenys Vlasenko <vda.linux@googlemail.com>2010-06-15 15:40:16 +0200
committerDenys Vlasenko <vda.linux@googlemail.com>2010-06-15 15:40:16 +0200
commit4f731ce30ec2a9f5e9b231b47aa68f32b75feb35 (patch)
treef63b07e88c4f31b4b3d1b5a1deeac971785158e6
parentc37fecb86c52da9e2781ee9eeb90d5d8894f59e0 (diff)
downloadbusybox-w32-4f731ce30ec2a9f5e9b231b47aa68f32b75feb35.tar.gz
busybox-w32-4f731ce30ec2a9f5e9b231b47aa68f32b75feb35.tar.bz2
busybox-w32-4f731ce30ec2a9f5e9b231b47aa68f32b75feb35.zip
findutils/*: move usage and applet bits to *.c files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--findutils/find.c90
-rw-r--r--findutils/grep.c63
-rw-r--r--findutils/xargs.c27
-rw-r--r--include/applets.src.h5
-rw-r--r--include/usage.src.h139
5 files changed, 172 insertions, 152 deletions
diff --git a/findutils/find.c b/findutils/find.c
index ca630b6c5..297081489 100644
--- a/findutils/find.c
+++ b/findutils/find.c
@@ -53,8 +53,10 @@
53 * diff -u /tmp/std_find /tmp/bb_find && echo Identical 53 * diff -u /tmp/std_find /tmp/bb_find && echo Identical
54 */ 54 */
55 55
56//applet:IF_FIND(APPLET_NOEXEC(find, find, _BB_DIR_USR_BIN, _BB_SUID_DROP, find))
57
56//kbuild:lib-$(CONFIG_FIND) += find.o 58//kbuild:lib-$(CONFIG_FIND) += find.o
57//config: 59
58//config:config FIND 60//config:config FIND
59//config: bool "find" 61//config: bool "find"
60//config: default y 62//config: default y
@@ -1044,6 +1046,92 @@ static action*** parse_params(char **argv)
1044#undef ALLOC_ACTION 1046#undef ALLOC_ACTION
1045} 1047}
1046 1048
1049//usage:#define find_trivial_usage
1050//usage: "[PATH]... [EXPRESSION]"
1051//usage:#define find_full_usage "\n\n"
1052//usage: "Search for files. The default PATH is the current directory,\n"
1053//usage: "default EXPRESSION is '-print'\n"
1054//usage: "\nEXPRESSION may consist of:"
1055//usage: "\n -follow Follow symlinks"
1056//usage: IF_FEATURE_FIND_XDEV(
1057//usage: "\n -xdev Don't descend directories on other filesystems"
1058//usage: )
1059//usage: IF_FEATURE_FIND_MAXDEPTH(
1060//usage: "\n -maxdepth N Descend at most N levels. -maxdepth 0 applies"
1061//usage: "\n tests/actions to command line arguments only"
1062//usage: )
1063//usage: "\n -mindepth N Don't act on first N levels"
1064//usage: "\n -name PATTERN File name (w/o directory name) matches PATTERN"
1065//usage: "\n -iname PATTERN Case insensitive -name"
1066//usage: IF_FEATURE_FIND_PATH(
1067//usage: "\n -path PATTERN Path matches PATTERN"
1068//usage: )
1069//usage: IF_FEATURE_FIND_REGEX(
1070//usage: "\n -regex PATTERN Path matches regex PATTERN"
1071//usage: )
1072//usage: IF_FEATURE_FIND_TYPE(
1073//usage: "\n -type X File type is X (X is one of: f,d,l,b,c,...)"
1074//usage: )
1075//usage: IF_FEATURE_FIND_PERM(
1076//usage: "\n -perm NNN Permissions match any of (+NNN), all of (-NNN),"
1077//usage: "\n or exactly NNN"
1078//usage: )
1079//usage: IF_FEATURE_FIND_MTIME(
1080//usage: "\n -mtime DAYS Modified time is greater than (+N), less than (-N),"
1081//usage: "\n or exactly N days"
1082//usage: )
1083//usage: IF_FEATURE_FIND_MMIN(
1084//usage: "\n -mmin MINS Modified time is greater than (+N), less than (-N),"
1085//usage: "\n or exactly N minutes"
1086//usage: )
1087//usage: IF_FEATURE_FIND_NEWER(
1088//usage: "\n -newer FILE Modified time is more recent than FILE's"
1089//usage: )
1090//usage: IF_FEATURE_FIND_INUM(
1091//usage: "\n -inum N File has inode number N"
1092//usage: )
1093//usage: IF_FEATURE_FIND_USER(
1094//usage: "\n -user NAME File is owned by user NAME (numeric user ID allowed)"
1095//usage: )
1096//usage: IF_FEATURE_FIND_GROUP(
1097//usage: "\n -group NAME File belongs to group NAME (numeric group ID allowed)"
1098//usage: )
1099//usage: IF_FEATURE_FIND_DEPTH(
1100//usage: "\n -depth Process directory name after traversing it"
1101//usage: )
1102//usage: IF_FEATURE_FIND_SIZE(
1103//usage: "\n -size N[bck] File size is N (c:bytes,k:kbytes,b:512 bytes(def.))"
1104//usage: "\n +/-N: file size is bigger/smaller than N"
1105//usage: )
1106//usage: IF_FEATURE_FIND_LINKS(
1107//usage: "\n -links N Number of links is greater than (+N), less than (-N),"
1108//usage: "\n or exactly N"
1109//usage: )
1110//usage: "\n -print Print (default and assumed)"
1111//usage: IF_FEATURE_FIND_PRINT0(
1112//usage: "\n -print0 Delimit output with null characters rather than"
1113//usage: "\n newlines"
1114//usage: )
1115//usage: IF_FEATURE_FIND_CONTEXT(
1116//usage: "\n -context File has specified security context"
1117//usage: )
1118//usage: IF_FEATURE_FIND_EXEC(
1119//usage: "\n -exec CMD ARG ; Run CMD with all instances of {} replaced by the"
1120//usage: "\n matching files"
1121//usage: )
1122//usage: IF_FEATURE_FIND_PRUNE(
1123//usage: "\n -prune Stop traversing current subtree"
1124//usage: )
1125//usage: IF_FEATURE_FIND_DELETE(
1126//usage: "\n -delete Delete files, turns on -depth option"
1127//usage: )
1128//usage: IF_FEATURE_FIND_PAREN(
1129//usage: "\n (EXPR) Group an expression"
1130//usage: )
1131//usage:
1132//usage:#define find_example_usage
1133//usage: "$ find / -name passwd\n"
1134//usage: "/etc/passwd\n"
1047 1135
1048int find_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 1136int find_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1049int find_main(int argc UNUSED_PARAM, char **argv) 1137int find_main(int argc UNUSED_PARAM, char **argv)
diff --git a/findutils/grep.c b/findutils/grep.c
index dd1a4efc4..ac290a911 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -14,13 +14,16 @@
14 * 2004,2006 (C) Vladimir Oleynik <dzo@simtreas.ru> - 14 * 2004,2006 (C) Vladimir Oleynik <dzo@simtreas.ru> -
15 * correction "-e pattern1 -e pattern2" logic and more optimizations. 15 * correction "-e pattern1 -e pattern2" logic and more optimizations.
16 * precompiled regex 16 * precompiled regex
17 */ 17 *
18/*
19 * (C) 2006 Jac Goudsmit added -o option 18 * (C) 2006 Jac Goudsmit added -o option
20 */ 19 */
21 20
21//applet:IF_GREP(APPLET(grep, _BB_DIR_BIN, _BB_SUID_DROP))
22//applet:IF_FEATURE_GREP_EGREP_ALIAS(APPLET_ODDNAME(egrep, grep, _BB_DIR_BIN, _BB_SUID_DROP, egrep))
23//applet:IF_FEATURE_GREP_FGREP_ALIAS(APPLET_ODDNAME(fgrep, grep, _BB_DIR_BIN, _BB_SUID_DROP, fgrep))
24
22//kbuild:lib-$(CONFIG_GREP) += grep.o 25//kbuild:lib-$(CONFIG_GREP) += grep.o
23//config: 26
24//config:config GREP 27//config:config GREP
25//config: bool "grep" 28//config: bool "grep"
26//config: default y 29//config: default y
@@ -57,17 +60,67 @@
57#include "libbb.h" 60#include "libbb.h"
58#include "xregex.h" 61#include "xregex.h"
59 62
63
60/* options */ 64/* options */
65//usage:#define grep_trivial_usage
66//usage: "[-HhnlLoqvsriw"
67//usage: "F"
68//usage: IF_FEATURE_GREP_EGREP_ALIAS("E")
69//usage: IF_EXTRA_COMPAT("z")
70//usage: "] [-m N] "
71//usage: IF_FEATURE_GREP_CONTEXT("[-A/B/C N] ")
72//usage: "PATTERN/-e PATTERN.../-f FILE [FILE]..."
73//usage:#define grep_full_usage "\n\n"
74//usage: "Search for PATTERN in FILEs (or stdin)\n"
75//usage: "\nOptions:"
76//usage: "\n -H Add 'filename:' prefix"
77//usage: "\n -h Do not add 'filename:' prefix"
78//usage: "\n -n Add 'line_no:' prefix"
79//usage: "\n -l Show only names of files that match"
80//usage: "\n -L Show only names of files that don't match"
81//usage: "\n -c Show only count of matching lines"
82//usage: "\n -o Show only the matching part of line"
83//usage: "\n -q Quiet. Return 0 if PATTERN is found, 1 otherwise"
84//usage: "\n -v Select non-matching lines"
85//usage: "\n -s Suppress open and read errors"
86//usage: "\n -r Recurse"
87//usage: "\n -i Ignore case"
88//usage: "\n -w Match whole words only"
89//usage: "\n -F PATTERN is a literal (not regexp)"
90//usage: IF_FEATURE_GREP_EGREP_ALIAS(
91//usage: "\n -E PATTERN is an extended regexp"
92//usage: )
93//usage: IF_EXTRA_COMPAT(
94//usage: "\n -z Input is NUL terminated"
95//usage: )
96//usage: "\n -m N Match up to N times per file"
97//usage: IF_FEATURE_GREP_CONTEXT(
98//usage: "\n -A N Print N lines of trailing context"
99//usage: "\n -B N Print N lines of leading context"
100//usage: "\n -C N Same as '-A N -B N'"
101//usage: )
102//usage: "\n -e PTRN Pattern to match"
103//usage: "\n -f FILE Read pattern from file"
104//usage:
105//usage:#define grep_example_usage
106//usage: "$ grep root /etc/passwd\n"
107//usage: "root:x:0:0:root:/root:/bin/bash\n"
108//usage: "$ grep ^[rR]oo. /etc/passwd\n"
109//usage: "root:x:0:0:root:/root:/bin/bash\n"
110//usage:
111//usage:#define egrep_trivial_usage NOUSAGE_STR
112//usage:#define egrep_full_usage ""
113//usage:#define fgrep_trivial_usage NOUSAGE_STR
114//usage:#define fgrep_full_usage ""
115
61#define OPTSTR_GREP \ 116#define OPTSTR_GREP \
62 "lnqvscFiHhe:f:Lorm:w" \ 117 "lnqvscFiHhe:f:Lorm:w" \
63 IF_FEATURE_GREP_CONTEXT("A:B:C:") \ 118 IF_FEATURE_GREP_CONTEXT("A:B:C:") \
64 IF_FEATURE_GREP_EGREP_ALIAS("E") \ 119 IF_FEATURE_GREP_EGREP_ALIAS("E") \
65 IF_EXTRA_COMPAT("z") \ 120 IF_EXTRA_COMPAT("z") \
66 "aI" 121 "aI"
67
68/* ignored: -a "assume all files to be text" */ 122/* ignored: -a "assume all files to be text" */
69/* ignored: -I "assume binary files have no matches" */ 123/* ignored: -I "assume binary files have no matches" */
70
71enum { 124enum {
72 OPTBIT_l, /* list matched file names only */ 125 OPTBIT_l, /* list matched file names only */
73 OPTBIT_n, /* print line# */ 126 OPTBIT_n, /* print line# */
diff --git a/findutils/xargs.c b/findutils/xargs.c
index 8caaff91c..46a62cbf1 100644
--- a/findutils/xargs.c
+++ b/findutils/xargs.c
@@ -1,7 +1,6 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * Mini xargs implementation for busybox 3 * Mini xargs implementation for busybox
4 * Options are supported: "-prtx -n max_arg -s max_chars -e[ouf_str]"
5 * 4 *
6 * (C) 2002,2003 by Vladimir Oleynik <dzo@simtreas.ru> 5 * (C) 2002,2003 by Vladimir Oleynik <dzo@simtreas.ru>
7 * 6 *
@@ -14,9 +13,10 @@
14 * 13 *
15 * xargs is described in the Single Unix Specification v3 at 14 * xargs is described in the Single Unix Specification v3 at
16 * http://www.opengroup.org/onlinepubs/007904975/utilities/xargs.html 15 * http://www.opengroup.org/onlinepubs/007904975/utilities/xargs.html
17 *
18 */ 16 */
19 17
18//applet:IF_XARGS(APPLET_NOEXEC(xargs, xargs, _BB_DIR_USR_BIN, _BB_SUID_DROP, xargs))
19
20//kbuild:lib-$(CONFIG_XARGS) += xargs.o 20//kbuild:lib-$(CONFIG_XARGS) += xargs.o
21 21
22//config:config XARGS 22//config:config XARGS
@@ -351,6 +351,29 @@ static int xargs_ask_confirmation(void)
351# define xargs_ask_confirmation() 1 351# define xargs_ask_confirmation() 1
352#endif 352#endif
353 353
354//usage:#define xargs_trivial_usage
355//usage: "[OPTIONS] [PROG ARGS]"
356//usage:#define xargs_full_usage "\n\n"
357//usage: "Run PROG on every item given by stdin\n"
358//usage: "\nOptions:"
359//usage: IF_FEATURE_XARGS_SUPPORT_CONFIRMATION(
360//usage: "\n -p Ask user whether to run each command"
361//usage: )
362//usage: "\n -r Don't run command if input is empty"
363//usage: IF_FEATURE_XARGS_SUPPORT_ZERO_TERM(
364//usage: "\n -0 Input is separated by NUL characters"
365//usage: )
366//usage: "\n -t Print the command on stderr before execution"
367//usage: "\n -e[STR] STR stops input processing"
368//usage: "\n -n N Pass no more than N args to PROG"
369//usage: "\n -s N Pass command line of no more than N bytes"
370//usage: IF_FEATURE_XARGS_SUPPORT_TERMOPT(
371//usage: "\n -x Exit if size is exceeded"
372//usage: )
373//usage:#define xargs_example_usage
374//usage: "$ ls | xargs gzip\n"
375//usage: "$ find . -name '*.c' -print | xargs rm\n"
376
354/* Correct regardless of combination of CONFIG_xxx */ 377/* Correct regardless of combination of CONFIG_xxx */
355enum { 378enum {
356 OPTBIT_VERBOSE = 0, 379 OPTBIT_VERBOSE = 0,
diff --git a/include/applets.src.h b/include/applets.src.h
index 2998a0ea9..9162b66c7 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -136,7 +136,6 @@ IF_DUMPLEASES(APPLET(dumpleases, _BB_DIR_USR_BIN, _BB_SUID_DROP))
136//IF_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, _BB_DIR_SBIN, _BB_SUID_DROP, e2label)) 136//IF_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, _BB_DIR_SBIN, _BB_SUID_DROP, e2label))
137IF_ECHO(APPLET_NOFORK(echo, echo, _BB_DIR_BIN, _BB_SUID_DROP, echo)) 137IF_ECHO(APPLET_NOFORK(echo, echo, _BB_DIR_BIN, _BB_SUID_DROP, echo))
138IF_ED(APPLET(ed, _BB_DIR_BIN, _BB_SUID_DROP)) 138IF_ED(APPLET(ed, _BB_DIR_BIN, _BB_SUID_DROP))
139IF_FEATURE_GREP_EGREP_ALIAS(APPLET_ODDNAME(egrep, grep, _BB_DIR_BIN, _BB_SUID_DROP, egrep))
140IF_EJECT(APPLET(eject, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 139IF_EJECT(APPLET(eject, _BB_DIR_USR_BIN, _BB_SUID_DROP))
141IF_ENV(APPLET_NOEXEC(env, env, _BB_DIR_USR_BIN, _BB_SUID_DROP, env)) 140IF_ENV(APPLET_NOEXEC(env, env, _BB_DIR_USR_BIN, _BB_SUID_DROP, env))
142IF_ENVDIR(APPLET_ODDNAME(envdir, chpst, _BB_DIR_USR_BIN, _BB_SUID_DROP, envdir)) 141IF_ENVDIR(APPLET_ODDNAME(envdir, chpst, _BB_DIR_USR_BIN, _BB_SUID_DROP, envdir))
@@ -152,8 +151,6 @@ IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, _BB_DIR_BIN, _BB_SUID_DROP, fdfl
152IF_FDFORMAT(APPLET(fdformat, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 151IF_FDFORMAT(APPLET(fdformat, _BB_DIR_USR_BIN, _BB_SUID_DROP))
153IF_FDISK(APPLET(fdisk, _BB_DIR_SBIN, _BB_SUID_DROP)) 152IF_FDISK(APPLET(fdisk, _BB_DIR_SBIN, _BB_SUID_DROP))
154IF_FGCONSOLE(APPLET(fgconsole, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 153IF_FGCONSOLE(APPLET(fgconsole, _BB_DIR_USR_BIN, _BB_SUID_DROP))
155IF_FEATURE_GREP_FGREP_ALIAS(APPLET_ODDNAME(fgrep, grep, _BB_DIR_BIN, _BB_SUID_DROP, fgrep))
156IF_FIND(APPLET_NOEXEC(find, find, _BB_DIR_USR_BIN, _BB_SUID_DROP, find))
157IF_FINDFS(APPLET(findfs, _BB_DIR_SBIN, _BB_SUID_MAYBE)) 154IF_FINDFS(APPLET(findfs, _BB_DIR_SBIN, _BB_SUID_MAYBE))
158IF_FLASH_ERASEALL(APPLET(flash_eraseall, _BB_DIR_USR_SBIN, _BB_SUID_DROP)) 155IF_FLASH_ERASEALL(APPLET(flash_eraseall, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
159IF_FLASH_LOCK(APPLET_ODDNAME(flash_lock, flash_lock_unlock, _BB_DIR_USR_SBIN, _BB_SUID_DROP, flash_lock)) 156IF_FLASH_LOCK(APPLET_ODDNAME(flash_lock, flash_lock_unlock, _BB_DIR_USR_SBIN, _BB_SUID_DROP, flash_lock))
@@ -176,7 +173,6 @@ IF_GETENFORCE(APPLET(getenforce, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
176IF_GETOPT(APPLET(getopt, _BB_DIR_BIN, _BB_SUID_DROP)) 173IF_GETOPT(APPLET(getopt, _BB_DIR_BIN, _BB_SUID_DROP))
177IF_GETSEBOOL(APPLET(getsebool, _BB_DIR_USR_SBIN, _BB_SUID_DROP)) 174IF_GETSEBOOL(APPLET(getsebool, _BB_DIR_USR_SBIN, _BB_SUID_DROP))
178IF_GETTY(APPLET(getty, _BB_DIR_SBIN, _BB_SUID_DROP)) 175IF_GETTY(APPLET(getty, _BB_DIR_SBIN, _BB_SUID_DROP))
179IF_GREP(APPLET(grep, _BB_DIR_BIN, _BB_SUID_DROP))
180IF_GUNZIP(APPLET(gunzip, _BB_DIR_BIN, _BB_SUID_DROP)) 176IF_GUNZIP(APPLET(gunzip, _BB_DIR_BIN, _BB_SUID_DROP))
181IF_GZIP(APPLET(gzip, _BB_DIR_BIN, _BB_SUID_DROP)) 177IF_GZIP(APPLET(gzip, _BB_DIR_BIN, _BB_SUID_DROP))
182IF_HALT(APPLET(halt, _BB_DIR_SBIN, _BB_SUID_DROP)) 178IF_HALT(APPLET(halt, _BB_DIR_SBIN, _BB_SUID_DROP))
@@ -433,7 +429,6 @@ IF_WGET(APPLET(wget, _BB_DIR_USR_BIN, _BB_SUID_DROP))
433IF_WHICH(APPLET(which, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 429IF_WHICH(APPLET(which, _BB_DIR_USR_BIN, _BB_SUID_DROP))
434IF_WHO(APPLET(who, _BB_DIR_USR_BIN, _BB_SUID_DROP)) 430IF_WHO(APPLET(who, _BB_DIR_USR_BIN, _BB_SUID_DROP))
435IF_WHOAMI(APPLET_NOFORK(whoami, whoami, _BB_DIR_USR_BIN, _BB_SUID_DROP, whoami)) 431IF_WHOAMI(APPLET_NOFORK(whoami, whoami, _BB_DIR_USR_BIN, _BB_SUID_DROP, whoami))
436IF_XARGS(APPLET_NOEXEC(xargs, xargs, _BB_DIR_USR_BIN, _BB_SUID_DROP, xargs))
437IF_UNXZ(APPLET_ODDNAME(xzcat, unxz, _BB_DIR_USR_BIN, _BB_SUID_DROP, xzcat)) 432IF_UNXZ(APPLET_ODDNAME(xzcat, unxz, _BB_DIR_USR_BIN, _BB_SUID_DROP, xzcat))
438IF_XZ(APPLET_ODDNAME(xz, unxz, _BB_DIR_USR_BIN, _BB_SUID_DROP, xz)) 433IF_XZ(APPLET_ODDNAME(xz, unxz, _BB_DIR_USR_BIN, _BB_SUID_DROP, xz))
439IF_YES(APPLET_NOFORK(yes, yes, _BB_DIR_USR_BIN, _BB_SUID_DROP, yes)) 434IF_YES(APPLET_NOFORK(yes, yes, _BB_DIR_USR_BIN, _BB_SUID_DROP, yes))
diff --git a/include/usage.src.h b/include/usage.src.h
index bd2e56385..f30edbc54 100644
--- a/include/usage.src.h
+++ b/include/usage.src.h
@@ -1280,72 +1280,6 @@ INSERT
1280#define findfs_example_usage \ 1280#define findfs_example_usage \
1281 "$ findfs LABEL=MyDevice" 1281 "$ findfs LABEL=MyDevice"
1282 1282
1283#define find_trivial_usage \
1284 "[PATH]... [EXPRESSION]"
1285#define find_full_usage "\n\n" \
1286 "Search for files. The default PATH is the current directory,\n" \
1287 "default EXPRESSION is '-print'\n" \
1288 "\nEXPRESSION may consist of:" \
1289 "\n -follow Follow symlinks" \
1290 IF_FEATURE_FIND_XDEV( \
1291 "\n -xdev Don't descend directories on other filesystems") \
1292 IF_FEATURE_FIND_MAXDEPTH( \
1293 "\n -maxdepth N Descend at most N levels. -maxdepth 0 applies" \
1294 "\n tests/actions to command line arguments only") \
1295 "\n -mindepth N Don't act on first N levels" \
1296 "\n -name PATTERN File name (w/o directory name) matches PATTERN" \
1297 "\n -iname PATTERN Case insensitive -name" \
1298 IF_FEATURE_FIND_PATH( \
1299 "\n -path PATTERN Path matches PATTERN") \
1300 IF_FEATURE_FIND_REGEX( \
1301 "\n -regex PATTERN Path matches regex PATTERN") \
1302 IF_FEATURE_FIND_TYPE( \
1303 "\n -type X File type is X (X is one of: f,d,l,b,c,...)") \
1304 IF_FEATURE_FIND_PERM( \
1305 "\n -perm NNN Permissions match any of (+NNN), all of (-NNN)," \
1306 "\n or exactly NNN") \
1307 IF_FEATURE_FIND_MTIME( \
1308 "\n -mtime DAYS Modified time is greater than (+N), less than (-N)," \
1309 "\n or exactly N days") \
1310 IF_FEATURE_FIND_MMIN( \
1311 "\n -mmin MINS Modified time is greater than (+N), less than (-N)," \
1312 "\n or exactly N minutes") \
1313 IF_FEATURE_FIND_NEWER( \
1314 "\n -newer FILE Modified time is more recent than FILE's") \
1315 IF_FEATURE_FIND_INUM( \
1316 "\n -inum N File has inode number N") \
1317 IF_FEATURE_FIND_USER( \
1318 "\n -user NAME File is owned by user NAME (numeric user ID allowed)") \
1319 IF_FEATURE_FIND_GROUP( \
1320 "\n -group NAME File belongs to group NAME (numeric group ID allowed)") \
1321 IF_FEATURE_FIND_DEPTH( \
1322 "\n -depth Process directory name after traversing it") \
1323 IF_FEATURE_FIND_SIZE( \
1324 "\n -size N[bck] File size is N (c:bytes,k:kbytes,b:512 bytes(def.))" \
1325 "\n +/-N: file size is bigger/smaller than N") \
1326 IF_FEATURE_FIND_LINKS( \
1327 "\n -links N Number of links is greater than (+N), less than (-N)," \
1328 "\n or exactly N") \
1329 "\n -print Print (default and assumed)" \
1330 IF_FEATURE_FIND_PRINT0( \
1331 "\n -print0 Delimit output with null characters rather than" \
1332 "\n newlines") \
1333 IF_FEATURE_FIND_CONTEXT ( \
1334 "\n -context File has specified security context") \
1335 IF_FEATURE_FIND_EXEC( \
1336 "\n -exec CMD ARG ; Run CMD with all instances of {} replaced by the" \
1337 "\n matching files") \
1338 IF_FEATURE_FIND_PRUNE( \
1339 "\n -prune Stop traversing current subtree") \
1340 IF_FEATURE_FIND_DELETE( \
1341 "\n -delete Delete files, turns on -depth option") \
1342 IF_FEATURE_FIND_PAREN( \
1343 "\n (EXPR) Group an expression") \
1344
1345#define find_example_usage \
1346 "$ find / -name passwd\n" \
1347 "/etc/passwd\n"
1348
1349#define flash_lock_trivial_usage \ 1283#define flash_lock_trivial_usage \
1350 "MTD_DEVICE OFFSET SECTORS" 1284 "MTD_DEVICE OFFSET SECTORS"
1351#define flash_lock_full_usage "\n\n" \ 1285#define flash_lock_full_usage "\n\n" \
@@ -1575,58 +1509,6 @@ INSERT
1575 "\n -I INITSTR Send INITSTR before anything else" \ 1509 "\n -I INITSTR Send INITSTR before anything else" \
1576 "\n -H HOST Log HOST into the utmp file as the hostname" \ 1510 "\n -H HOST Log HOST into the utmp file as the hostname" \
1577 1511
1578#define grep_trivial_usage \
1579 "[-HhnlLoqvsriw" \
1580 "F" \
1581 IF_FEATURE_GREP_EGREP_ALIAS("E") \
1582 IF_EXTRA_COMPAT("z") \
1583 "] [-m N] " \
1584 IF_FEATURE_GREP_CONTEXT("[-A/B/C N] ") \
1585 "PATTERN/-e PATTERN.../-f FILE [FILE]..."
1586#define grep_full_usage "\n\n" \
1587 "Search for PATTERN in FILEs (or stdin)\n" \
1588 "\nOptions:" \
1589 "\n -H Add 'filename:' prefix" \
1590 "\n -h Do not add 'filename:' prefix" \
1591 "\n -n Add 'line_no:' prefix" \
1592 "\n -l Show only names of files that match" \
1593 "\n -L Show only names of files that don't match" \
1594 "\n -c Show only count of matching lines" \
1595 "\n -o Show only the matching part of line" \
1596 "\n -q Quiet. Return 0 if PATTERN is found, 1 otherwise" \
1597 "\n -v Select non-matching lines" \
1598 "\n -s Suppress open and read errors" \
1599 "\n -r Recurse" \
1600 "\n -i Ignore case" \
1601 "\n -w Match whole words only" \
1602 "\n -F PATTERN is a literal (not regexp)" \
1603 IF_FEATURE_GREP_EGREP_ALIAS( \
1604 "\n -E PATTERN is an extended regexp" \
1605 ) \
1606 IF_EXTRA_COMPAT( \
1607 "\n -z Input is NUL terminated" \
1608 ) \
1609 "\n -m N Match up to N times per file" \
1610 IF_FEATURE_GREP_CONTEXT( \
1611 "\n -A N Print N lines of trailing context" \
1612 "\n -B N Print N lines of leading context" \
1613 "\n -C N Same as '-A N -B N'" \
1614 ) \
1615 "\n -e PTRN Pattern to match" \
1616 "\n -f FILE Read pattern from file" \
1617
1618#define grep_example_usage \
1619 "$ grep root /etc/passwd\n" \
1620 "root:x:0:0:root:/root:/bin/bash\n" \
1621 "$ grep ^[rR]oo. /etc/passwd\n" \
1622 "root:x:0:0:root:/root:/bin/bash\n"
1623
1624#define egrep_trivial_usage NOUSAGE_STR
1625#define egrep_full_usage ""
1626
1627#define fgrep_trivial_usage NOUSAGE_STR
1628#define fgrep_full_usage ""
1629
1630#define gunzip_trivial_usage \ 1512#define gunzip_trivial_usage \
1631 "[OPTIONS] [FILE]..." 1513 "[OPTIONS] [FILE]..."
1632#define gunzip_full_usage "\n\n" \ 1514#define gunzip_full_usage "\n\n" \
@@ -5104,27 +4986,6 @@ INSERT
5104#define whoami_full_usage "\n\n" \ 4986#define whoami_full_usage "\n\n" \
5105 "Print the user name associated with the current effective user id" 4987 "Print the user name associated with the current effective user id"
5106 4988
5107#define xargs_trivial_usage \
5108 "[OPTIONS] [PROG ARGS]"
5109#define xargs_full_usage "\n\n" \
5110 "Run PROG on every item given by stdin\n" \
5111 "\nOptions:" \
5112 IF_FEATURE_XARGS_SUPPORT_CONFIRMATION( \
5113 "\n -p Ask user whether to run each command") \
5114 "\n -r Don't run command if input is empty" \
5115 IF_FEATURE_XARGS_SUPPORT_ZERO_TERM( \
5116 "\n -0 Input is separated by NUL characters") \
5117 "\n -t Print the command on stderr before execution" \
5118 "\n -e[STR] STR stops input processing" \
5119 "\n -n N Pass no more than N args to PROG" \
5120 "\n -s N Pass command line of no more than N bytes" \
5121 IF_FEATURE_XARGS_SUPPORT_TERMOPT( \
5122 "\n -x Exit if size is exceeded") \
5123
5124#define xargs_example_usage \
5125 "$ ls | xargs gzip\n" \
5126 "$ find . -name '*.c' -print | xargs rm\n"
5127
5128#define zcat_trivial_usage \ 4989#define zcat_trivial_usage \
5129 "FILE" 4990 "FILE"
5130#define zcat_full_usage "\n\n" \ 4991#define zcat_full_usage "\n\n" \