diff options
author | Eric Andersen <andersen@codepoet.org> | 2000-09-05 17:37:48 +0000 |
---|---|---|
committer | Eric Andersen <andersen@codepoet.org> | 2000-09-05 17:37:48 +0000 |
commit | 1b355ebba68bdd567dd3961a18291dfd9532c2e8 (patch) | |
tree | c4c1cb4ed9cc025e05640e19c0b0a3f86080563a /applets/usage.c | |
parent | 43c8c38bbfe3d25e21f37d899184de52c6dc9c17 (diff) | |
download | busybox-w32-1b355ebba68bdd567dd3961a18291dfd9532c2e8.tar.gz busybox-w32-1b355ebba68bdd567dd3961a18291dfd9532c2e8.tar.bz2 busybox-w32-1b355ebba68bdd567dd3961a18291dfd9532c2e8.zip |
Added expr, from Edward Betts <edward@debian.org>, with some fixups
and docs added by me.
-Erik
Diffstat (limited to 'applets/usage.c')
-rw-r--r-- | applets/usage.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/applets/usage.c b/applets/usage.c index 91064f52c..05913f3e3 100644 --- a/applets/usage.c +++ b/applets/usage.c | |||
@@ -250,6 +250,44 @@ const char echo_usage[] = | |||
250 | ; | 250 | ; |
251 | #endif | 251 | #endif |
252 | 252 | ||
253 | #if defined BB_EXPR | ||
254 | const char expr_usage[] = | ||
255 | "expr EXPRESSION\n" | ||
256 | #ifndef BB_FEATURE_TRIVIAL_HELP | ||
257 | "\nPrints the value of EXPRESSION to standard output.\n\n" | ||
258 | "EXPRESSION may be:\n" | ||
259 | "ARG1 | ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n" | ||
260 | "ARG1 & ARG2 ARG1 if neither argument is null or 0, otherwise 0\n" | ||
261 | "ARG1 < ARG2 ARG1 is less than ARG2\n" | ||
262 | "ARG1 <= ARG2 ARG1 is less than or equal to ARG2\n" | ||
263 | "ARG1 = ARG2 ARG1 is equal to ARG2\n" | ||
264 | "ARG1 != ARG2 ARG1 is unequal to ARG2\n" | ||
265 | "ARG1 >= ARG2 ARG1 is greater than or equal to ARG2\n" | ||
266 | "ARG1 > ARG2 ARG1 is greater than ARG2\n" | ||
267 | "ARG1 + ARG2 arithmetic sum of ARG1 and ARG2\n" | ||
268 | "ARG1 - ARG2 arithmetic difference of ARG1 and ARG2\n" | ||
269 | "ARG1 * ARG2 arithmetic product of ARG1 and ARG2\n" | ||
270 | "ARG1 / ARG2 arithmetic quotient of ARG1 divided by ARG2\n" | ||
271 | "ARG1 % ARG2 arithmetic remainder of ARG1 divided by ARG2\n" | ||
272 | "STRING : REGEXP anchored pattern match of REGEXP in STRING\n" | ||
273 | "match STRING REGEXP same as STRING : REGEXP\n" | ||
274 | "substr STRING POS LENGTH substring of STRING, POS counted from 1\n" | ||
275 | "index STRING CHARS index in STRING where any CHARS is found, or 0\n" | ||
276 | "length STRING length of STRING\n" | ||
277 | "quote TOKEN interpret TOKEN as a string, even if it is a \n" | ||
278 | " keyword like `match' or an operator like `/'\n" | ||
279 | "( EXPRESSION ) value of EXPRESSION\n\n" | ||
280 | "Beware that many operators need to be escaped or quoted for shells.\n" | ||
281 | "Comparisons are arithmetic if both ARGs are numbers, else\n" | ||
282 | "lexicographical. Pattern matches return the string matched between \n" | ||
283 | "\\( and \\) or null; if \\( and \\) are not used, they return the number \n" | ||
284 | "of characters matched or 0.\n" | ||
285 | |||
286 | #endif | ||
287 | ; | ||
288 | #endif | ||
289 | |||
290 | |||
253 | #if defined BB_TRUE_FALSE | 291 | #if defined BB_TRUE_FALSE |
254 | const char false_usage[] = | 292 | const char false_usage[] = |
255 | "false\n" | 293 | "false\n" |