Now, what was that logic block doing up there?
[oweals/busybox.git] / usage.c
diff --git a/usage.c b/usage.c
index b86df330cd7141a1bcdb4dbad9a15168b67a0982..7e3ea81915563a96b76c97ac75470cf5214d6fff 100644 (file)
--- a/usage.c
+++ b/usage.c
@@ -1,16 +1,17 @@
-#include "internal.h"
+#include "busybox.h"
 
 #if defined BB_AR
 const char ar_usage[] =
-       "ar [optxvV] archive [filenames] \n"
+       "ar -[ovR]{ptx} archive filenames \n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
        "\nExtract or list files from an ar archive.\n\n"
        "Options:\n"
-       "\to\t\tpreserve original dates\n"
-       "\tp\t\textract to stdout\n"
-       "\tt\t\tlist\n"
-       "\tx\t\textract\n"
-       "\tv\t\tverbosely list files processed\n"
+       "\t-o\t\tpreserve original dates\n"
+       "\t-p\t\textract to stdout\n"
+       "\t-t\t\tlist\n"
+       "\t-x\t\textract\n"
+       "\t-v\t\tverbosely list files processed\n"
+       "\t-R\t\trecursive action\n"
 #endif
        ;
 #endif
@@ -92,6 +93,15 @@ const char clear_usage[] =
        ;
 #endif
 
+#if defined BB_CMP
+const char cmp_usage[] =
+       "cmp FILE1 [FILE2]\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nCompare files.\n"
+#endif
+       ;
+#endif
+
 #if defined BB_CP_MV
 const char cp_usage[] =
        "cp [OPTION]... SOURCE DEST\n"
@@ -117,7 +127,7 @@ const char cut_usage[] =
        "\t-b LIST\tOutput only bytes from LIST\n"
        "\t-c LIST\tOutput only characters from LIST\n"
        "\t-d CHAR\tUse CHAR instead of tab as the field delimiter\n"
-       "\t-s\tOnly output Lines if the include DELIM\n"
+       "\t-s\tOutput only the lines containing delimiter\n"
        "\t-f N\tPrint only these fields\n"
        "\t-n\tIgnored\n"
 #endif
@@ -159,6 +169,7 @@ const char dd_usage[] =
        "\tcount=N\tcopy only N input blocks\n"
        "\tskip=N\tskip N input blocks\n"
        "\tseek=N\tskip N output blocks\n"
+       "\tconv=notrunc\t dont truncate of at end of write\n"
        "\n"
        "Numbers may be suffixed by w (x2), k (x1024), b (x512), or M (x1024^2)\n"
 #endif
@@ -205,6 +216,15 @@ const char dmesg_usage[] =
        ;
 #endif
 
+#if defined BB_DOS2UNIX
+const char dos2unix_usage[] =
+       "dos2unix < dosfile > unixfile\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nConverts a text file from dos format to unix format.\n"
+#endif
+       ;
+#endif
+
 #if defined BB_DU
 const char du_usage[] =
        "du [OPTION]... [FILE]...\n"
@@ -220,7 +240,7 @@ const char du_usage[] =
 
 #if defined BB_DUMPKMAP
 const char dumpkmap_usage[] =
-       "dumpkmap\n"
+       "dumpkmap > keymap\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
        "\nPrints out a binary keyboard translation table to standard input.\n"
 #endif
@@ -250,6 +270,44 @@ const char echo_usage[] =
        ;
 #endif
 
+#if defined BB_EXPR
+const char expr_usage[] =
+       "expr EXPRESSION\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nPrints the value of EXPRESSION to standard output.\n\n"
+       "EXPRESSION may be:\n"
+       "ARG1 |  ARG2   ARG1 if it is neither null nor 0, otherwise ARG2\n"
+       "ARG1 &  ARG2   ARG1 if neither argument is null or 0, otherwise 0\n"
+       "ARG1 <  ARG2   ARG1 is less than ARG2\n"
+       "ARG1 <= ARG2   ARG1 is less than or equal to ARG2\n"
+       "ARG1 =  ARG2   ARG1 is equal to ARG2\n"
+       "ARG1 != ARG2   ARG1 is unequal to ARG2\n"
+       "ARG1 >= ARG2   ARG1 is greater than or equal to ARG2\n"
+       "ARG1 >  ARG2   ARG1 is greater than ARG2\n"
+       "ARG1 +  ARG2   arithmetic sum of ARG1 and ARG2\n"
+       "ARG1 -  ARG2   arithmetic difference of ARG1 and ARG2\n"
+       "ARG1 *  ARG2   arithmetic product of ARG1 and ARG2\n"
+       "ARG1 /  ARG2   arithmetic quotient of ARG1 divided by ARG2\n"
+       "ARG1 %  ARG2   arithmetic remainder of ARG1 divided by ARG2\n"
+       "STRING : REGEXP                    anchored pattern match of REGEXP in STRING\n"
+       "match STRING REGEXP        same as STRING : REGEXP\n"
+       "substr STRING POS LENGTH    substring of STRING, POS counted from 1\n"
+       "index STRING CHARS         index in STRING where any CHARS is found, or 0\n"
+       "length STRING              length of STRING\n"
+       "quote TOKEN                interpret TOKEN as a string, even if it is a \n"
+       "                               keyword like `match' or an operator like `/'\n"
+       "( EXPRESSION )             value of EXPRESSION\n\n"
+       "Beware that many operators need to be escaped or quoted for shells.\n"
+       "Comparisons are arithmetic if both ARGs are numbers, else\n"
+       "lexicographical.  Pattern matches return the string matched between \n"
+       "\\( and \\) or null; if \\( and \\) are not used, they return the number \n"
+       "of characters matched or 0.\n"
+
+#endif
+       ;
+#endif
+
+
 #if defined BB_TRUE_FALSE
 const char false_usage[] =
        "false\n"
@@ -317,6 +375,24 @@ const char fsck_minix_usage[] =
        ;
 #endif
 
+#if defined BB_GETOPT
+const char getopt_usage[] =
+"getopt [OPTIONS]...\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+"Parse command options\n"
+"  -a, --alternative            Allow long options starting with single -\n"
+"  -l, --longoptions=longopts   Long options to be recognized\n"
+"  -n, --name=progname          The name under which errors are reported\n"
+"  -o, --options=optstring      Short options to be recognized\n"
+"  -q, --quiet                  Disable error reporting by getopt(3)\n"
+"  -Q, --quiet-output           No normal output\n"
+"  -s, --shell=shell            Set shell quoting conventions\n"
+"  -T, --test                   Test for getopt(1) version\n"
+"  -u, --unqote                 Do not quote the output\n"
+#endif
+;
+#endif
+
 #if defined BB_GREP
 const char grep_usage[] =
        "grep [-ihHnqvs] pattern [files...]\n"
@@ -400,7 +476,7 @@ const char hostname_usage[] =
 
        "\t-i\t\tAddresses for the hostname\n"
        "\t-d\t\tDNS domain name\n"
-       "\t-F FILE\t\tUse the contents of FILE to specify the hostname\n"
+       "\t-F, --file FILE\tUse the contents of FILE to specify the hostname\n"
 #endif
        ;
 #endif
@@ -477,7 +553,7 @@ const char ln_usage[] =
 
 #if defined BB_LOADACM
 const char loadacm_usage[] =
-       "loadacm\n"
+       "loadacm < mapfile\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
        "\nLoads an acm from standard input.\n"
 #endif
@@ -486,7 +562,7 @@ const char loadacm_usage[] =
 
 #if defined BB_LOADFONT
 const char loadfont_usage[] =
-       "loadfont\n"
+       "loadfont < font\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
        "Loads a console font from standard input.\n"
 #endif
@@ -495,7 +571,7 @@ const char loadfont_usage[] =
 
 #if defined BB_LOADKMAP
 const char loadkmap_usage[] =
-       "loadkmap\n"
+       "loadkmap < keymap\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
        "\nLoads a binary keyboard translation table from standard input.\n"
 #endif
@@ -528,33 +604,55 @@ const char logname_usage[] =
 
 #if defined BB_LS
 const char ls_usage[] =
-       "ls [-1a"
+       "ls [-1Aa"
 #ifdef BB_FEATURE_LS_TIMESTAMPS
        "c"
 #endif
-       "d"
+       "Cd"
 #ifdef BB_FEATURE_LS_TIMESTAMPS
        "e"
 #endif
-       "ln"
 #ifdef BB_FEATURE_LS_FILETYPES
-       "p"
-#endif
-#ifdef BB_FEATURE_LS_TIMESTAMPS
-       "u"
+       "F"
 #endif
-       "xAC"
+       "iln"
 #ifdef BB_FEATURE_LS_FILETYPES
-       "F"
+       "p"
+#endif
+#ifdef BB_FEATURE_LS_FOLLOWLINKS
+    "L"
 #endif
 #ifdef BB_FEATURE_LS_RECURSIVE
        "R"
+#endif
+#ifdef BB_FEATURE_LS_SORTFILES
+       "rS"
+#endif
+       "s"
+#ifdef BB_FEATURE_AUTOWIDTH
+       "T"
+#endif
+#ifdef BB_FEATURE_LS_TIMESTAMPS
+       "tu"
+#endif
+#ifdef BB_FEATURE_LS_SORTFILES
+       "v"
+#endif
+#ifdef BB_FEATURE_AUTOWIDTH
+       "w"
+#endif
+       "x"
+#ifdef BB_FEATURE_LS_SORTFILES
+       "X"
 #endif
        "] [filenames...]\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
        "\nList directory contents\n\n"
        "Options:\n"
+       "\t-1\tlist files in a single column\n"
+       "\t-A\tdo not list implied . and ..\n"
        "\t-a\tdo not hide entries starting with .\n"
+       "\t-C\tlist entries by columns\n"
 #ifdef BB_FEATURE_LS_TIMESTAMPS
        "\t-c\twith -l: show ctime (the time of last\n"
        "\t\tmodification of file status information)\n"
@@ -563,27 +661,48 @@ const char ls_usage[] =
 #ifdef BB_FEATURE_LS_TIMESTAMPS
        "\t-e\tlist both full date and full time\n"
 #endif
+#ifdef BB_FEATURE_LS_FILETYPES
+       "\t-F\tappend indicator (one of */=@|) to entries\n"
+#endif
+       "\t-i\tlist the i-node for each file\n"
        "\t-l\tuse a long listing format\n"
        "\t-n\tlist numeric UIDs and GIDs instead of names\n"
 #ifdef BB_FEATURE_LS_FILETYPES
        "\t-p\tappend indicator (one of /=@|) to entries\n"
 #endif
+#ifdef BB_FEATURE_LS_FOLLOWLINKS
+    "\t-L\tlist entries pointed to by symbolic links\n"
+#endif
+#ifdef BB_FEATURE_LS_RECURSIVE
+       "\t-R\tlist subdirectories recursively\n"
+#endif
+#ifdef BB_FEATURE_LS_SORTFILES
+       "\t-r\tsort the listing in reverse order\n"
+       "\t-S\tsort the listing by file size\n"
+#endif
+       "\t-s\tlist the size of each file, in blocks\n"
+#ifdef BB_FEATURE_AUTOWIDTH
+       "\t-T NUM\tassume Tabstop every NUM columns\n"
+#endif
 #ifdef BB_FEATURE_LS_TIMESTAMPS
+       "\t-t\twith -l: show modification time (the time of last\n"
+       "\t\tchange of the file)\n"
        "\t-u\twith -l: show access time (the time of last\n"
        "\t\taccess of the file)\n"
 #endif
-       "\t-x\tlist entries by lines instead of by columns\n"
-       "\t-A\tdo not list implied . and ..\n"
-       "\t-C\tlist entries by columns\n"
-#ifdef BB_FEATURE_LS_FILETYPES
-       "\t-F\tappend indicator (one of */=@|) to entries\n"
+#ifdef BB_FEATURE_LS_SORTFILES
+       "\t-v\tsort the listing by version\n"
 #endif
-#ifdef BB_FEATURE_LS_RECURSIVE
-       "\t-R\tlist subdirectories recursively\n"
+#ifdef BB_FEATURE_AUTOWIDTH
+       "\t-w NUM\tassume the terminal is NUM columns wide\n"
 #endif
+       "\t-x\tlist entries by lines instead of by columns\n"
+#ifdef BB_FEATURE_LS_SORTFILES
+       "\t-X\tsort the listing by extension\n"
 #endif
+#endif /*  BB_FEATURE_TRIVIAL_HELP */
        ;
-#endif
+#endif /* BB_LS */
 
 #if defined BB_LSMOD
 const char lsmod_usage[] =
@@ -757,6 +876,11 @@ const char mt_usage[] =
        "mt [-f device] opcode value\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
        "\nControl magnetic tape drive operation\n"
+       "\nAvailable Opcodes:\n\n"
+       "bsf bsfm bsr bss datacompression drvbuffer eof eom erase\n"
+       "fsf fsfm fsr fss load lock mkpart nop offline ras1 ras2\n"
+       "ras3 reset retension rew rewoffline seek setblk setdensity\n"
+       "setpart tell unload unlock weof wset\n"
 #endif
        ;
 #endif
@@ -850,6 +974,27 @@ const char pwd_usage[] =
        ;
 #endif
 
+#if defined BB_RDATE
+const char rdate_usage[] =
+       "rdate [OPTION] HOST\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nGet and possibly set the system date and time from a remote HOST.\n"
+       "Options:\n"
+       "\t-s\tSet the system date and time (default).\n"
+       "\t-p\tPrint the date and time.\n"
+#endif
+       ;
+#endif
+
+#if defined BB_READLINK
+const char readlink_usage[] =
+       "readlink\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nRead a symbolic link.\n"
+#endif
+       ;
+#endif
+
 #if defined BB_REBOOT
 const char reboot_usage[] =
        "reboot\n"
@@ -858,6 +1003,27 @@ const char reboot_usage[] =
 #endif
        ;
 #endif
+       
+#if defined BB_RENICE
+const char renice_usage[] =
+       "renice priority pid [pid ...]\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nChanges priority of running processes. Allowed priorities range\n"
+       "from 20 (the process runs only when nothing else is running) to 0\n"
+       "(default priority) to -20 (almost nothing else ever gets to run).\n"
+#endif
+       ;
+#endif
+
+
+#if defined BB_RESET
+const char reset_usage[] =
+       "reset\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nResets the screen.\n"
+#endif
+       ;
+#endif
 
 #if defined BB_RM
 const char rm_usage[] =
@@ -897,11 +1063,10 @@ const char sed_usage[] =
        "sed [-Vhnef] pattern [files...]\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
        "\n"
-       "-n\tsuppress automatic printing of pattern space\n"
+       "-n\t\tsuppress automatic printing of pattern space\n"
        "-e script\tadd the script to the commands to be executed\n"
        "-f scriptfile\tadd the contents of script-file to the commands to be executed\n"
-       "-h\tdisplay this help message\n"
-       "-V\toutput version information and exit\n"
+       "-h\t\tdisplay this help message\n"
        "\n"
        "If no -e or -f is given, the first non-option argument is taken as the\n"
        "sed script to interpret. All remaining arguments are names of input\n"
@@ -1006,7 +1171,6 @@ const char syslogd_usage[] =
 #endif
 
 #if defined BB_TAIL
-#if defined BB_FEATURE_SIMPLE_TAIL
 const char tail_usage[] =
        "tail [OPTION] [FILE]...\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
@@ -1014,32 +1178,24 @@ const char tail_usage[] =
        "With more than one FILE, precede each with a header giving the\n"
        "file name. With no FILE, or when FILE is -, read standard input.\n\n"
        "Options:\n"
-       "\t-n NUM\t\tPrint last NUM lines instead of first 10\n"
-
-       "\t-f\t\tOutput data as the file grows.  This version\n"
-       "\t\t\tof 'tail -f' supports only one file at a time.\n"
+#ifndef BB_FEATURE_SIMPLE_TAIL
+       "\t-c=N[kbm]\toutput the last N bytes\n"
 #endif
-       ;
-#else /* ! defined BB_FEATURE_SIMPLE_TAIL */
-const char tail_usage[] =
-       "tail [OPTION]... [FILE]...\n"
-#ifndef BB_FEATURE_TRIVIAL_HELP
-       "\nPrint last 10 lines of each FILE to standard output.\n"
-       "With more than one FILE, precede each with a header giving the file name.\n"
-       "With no FILE, or when FILE is -, read standard input.\n"
-       "\n"
-       "  -c=N[kbm]       output the last N bytes\n"
-       "  -f              output appended data as the file grows\n"
-       "  -n=N            output the last N lines, instead of last 10\n"
-       "  -q              never output headers giving file names\n"
-       "  -v              always output headers giving file names\n"
-       "\n"
+       "\t-n NUM\t\tPrint last NUM lines instead of first 10\n"
+       "\t-f\t\tOutput data as the file grows.\n"
+#ifndef BB_FEATURE_SIMPLE_TAIL
+       "\t-q\t\tnever output headers giving file names\n"
+       "\t-s SEC\t\tWait SEC seconds between reads with -f\n"
+       "\t-v\t\talways output headers giving file names\n\n"
        "If the first character of N (bytes or lines) is a `+', output begins with \n"
        "the Nth item from the start of each file, otherwise, print the last N items\n"
-       "in the file.  N bytes may be suffixed by k (x1024), b (x512), or m (1024^2).\n"
+       "in the file. N bytes may be suffixed by k (x1024), b (x512), or m (1024^2).\n"
+//#else
+//     "\nIf the first character of N (bytes or lines) is a `+', output begins with \n"
+//     "the Nth item from the start of each file.\n"
 #endif
-       ;
 #endif
+       ;
 #endif
 
 #if defined BB_TAR
@@ -1052,7 +1208,7 @@ const char tar_usage[] =
 #if defined BB_FEATURE_TAR_EXCLUDE
        "[--exclude File] "
 #endif
-       "[-f tarFile] [FILE] ...\n"
+       "[-f tarFile] [FILE(s)] ...\n"
 #ifndef BB_FEATURE_TRIVIAL_HELP
        "\nCreate, extract, or list files from a tar file.  Note that\n"
        "this version of tar treats hard links as separate files.\n\n"
@@ -1066,7 +1222,7 @@ const char tar_usage[] =
        "\tf\t\tname of tarfile or \"-\" for stdin\n"
        "\tO\t\textract to stdout\n"
 #if defined BB_FEATURE_TAR_EXCLUDE
-       "\t--exclude\tfile to exclude\n"
+       "\texclude\t\tfile to exclude\n"
 #endif
        "\nInformative output:\n"
        "\tv\t\tverbosely list files processed\n"
@@ -1200,6 +1356,24 @@ const char uniq_usage[] =
        ;
 #endif
 
+#if defined BB_UNIX2DOS
+const char unix2dos_usage[] =
+       "unix2dos < unixfile > dosfile\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nConverts a text file from unix format to dos format.\n"
+#endif
+       ;
+#endif
+
+#if defined BB_UNRPM
+const char unrpm_usage[] =
+       "unrpm < package.rpm | gzip -d | cpio -idmuv\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nExtracts an rpm archive.\n"
+#endif
+       ;
+#endif
+
 #if defined BB_UPDATE
 const char update_usage[] =
        "update [options]\n"
@@ -1269,6 +1443,17 @@ const char wc_usage[] =
        ;
 #endif
 
+#if defined BB_WGET
+const char wget_usage[] = "wget [-c] [-O file] url\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nwget retrieves files via HTTP\n\n"
+       "Options:\n"
+       "\t-c\tcontinue retrieval of aborted transfers\n"
+       "\t-O\tsave to filename ('-' for stdout)\n"
+#endif
+       ;
+#endif
+
 #if defined BB_WHICH
 const char which_usage[] =
        "which [COMMAND ...]\n"
@@ -1287,6 +1472,16 @@ const char whoami_usage[] =
        ;
 #endif
 
+#if defined BB_XARGS
+const char xargs_usage[] = "xargs [OPTIONS] [COMMAND] [ARGS...]\n"
+#ifndef BB_FEATURE_TRIVIAL_HELP
+       "\nExecutes COMMAND on every item given by standard input.\n\n" 
+       "Options:\n"
+       "\t-t\tPrint the command just before it is run\n"
+#endif
+       ;
+#endif
+
 #if defined BB_YES
 const char yes_usage[] =
        "yes [OPTION]... [STRING]...\n"
@@ -1295,3 +1490,4 @@ const char yes_usage[] =
 #endif
        ;
 #endif
+