Static-ify a variable. make du work with all the human-readable variants
[oweals/busybox.git] / usage.h
diff --git a/usage.h b/usage.h
index 7cfa4601b0944821930ce947fd7a4660d3996682..db79630436cbd70e68a865c71e9fa1a4cc347eb0 100644 (file)
--- a/usage.h
+++ b/usage.h
@@ -64,7 +64,7 @@
        "Compare files."
 
 #define cp_trivial_usage \
-       "[OPTION]... SOURCE DEST\n"
+       "[OPTION]... SOURCE DEST"
 #define cp_full_usage \
        "Copies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" \
        "\n" \
@@ -87,7 +87,7 @@
        "\t-n\t\tIgnored"
 
 #define date_trivial_usage \
-       "[OPTION]... [+FORMAT]\n"
+       "[OPTION]... [+FORMAT]"
 #define date_full_usage \
        "Displays the current time in the given FORMAT, or sets the system date.\n" \
        "\nOptions:\n" \
 
 
 #ifdef BB_FEATURE_HUMAN_READABLE
-  #define USAGE_HUMAN_READABLE(a,b) a
+  #define USAGE_HUMAN_READABLE(a) a
+  #define USAGE_NOT_HUMAN_READABLE(a)
 #else
-  #define USAGE_HUMAN_READABLE(a,b) b
+  #define USAGE_HUMAN_READABLE(a) 
+  #define USAGE_NOT_HUMAN_READABLE(a) a
 #endif
 #define df_trivial_usage \
-       "[-" USAGE_HUMAN_READABLE("hm""") "k] [filesystem ...]"
+       "[-" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [filesystem ...]"
 #define df_full_usage \
        "Print the filesystem space used and space available.\n\n" \
        "Options:\n" \
        USAGE_HUMAN_READABLE( \
        "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
        "\t-m\tprint sizes in megabytes\n" \
-       "\t-k\tprint sizes in kilobytes(default)", \
+       "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
        "\n\t-k\tprint sizes in kilobytes(compatability)")
 
 #define dirname_trivial_usage \
        "\t-X\tVerbose extract"
 
 #define du_trivial_usage \
-       "[-ls" USAGE_HUMAN_READABLE("hm""") "k] [FILE]..."
+       "[-ls" USAGE_HUMAN_READABLE("hm") USAGE_NOT_HUMAN_READABLE("") "k] [FILE]..."
 #define du_full_usage \
        "Summarizes disk space used for each FILE and/or directory.\n" \
        "Disk space is printed in units of 1024 bytes.\n\n" \
        USAGE_HUMAN_READABLE( \
        "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
        "\t-m\tprint sizes in megabytes\n" \
-       "\t-k\tprint sizes in kilobytes(default)" \
-       , \
+       "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
        "\n\t-k\tprint sizes in kilobytes(compatability)")
 
 #define dumpkmap_trivial_usage \
        "\tARG1 *  ARG2 arithmetic product of ARG1 and ARG2\n" \
        "\tARG1 /  ARG2 arithmetic quotient of ARG1 divided by ARG2\n" \
        "\tARG1 %  ARG2 arithmetic remainder of ARG1 divided by ARG2\n" \
-       "\tSTRING : REGEXP                      anchored pattern match of REGEXP in STRING\n" \
-       "\tmatch STRING REGEXP          same as STRING : REGEXP\n" \
-       "\tsubstr STRING POS LENGTH     substring of STRING, POS counted from 1\n" \
-       "\tindex STRING CHARS           index in STRING where any CHARS is found, or 0\n" \
-       "\tlength STRING                        length of STRING\n" \
-       "\tquote TOKEN                  interpret TOKEN as a string, even if it is a \n" \
-       "\t                             keyword like `match' or an operator like `/'\n" \
-       "\t( EXPRESSION )                       value of EXPRESSION\n\n" \
+       "\tSTRING : REGEXP             anchored pattern match of REGEXP in STRING\n" \
+       "\tmatch STRING REGEXP         same as STRING : REGEXP\n" \
+       "\tsubstr STRING POS LENGTH    substring of STRING, POS counted from 1\n" \
+       "\tindex STRING CHARS          index in STRING where any CHARS is found,\n" \
+       "\t                            or 0\n" \
+       "\tlength STRING               length of STRING\n" \
+       "\tquote TOKEN                 interpret TOKEN as a string, even if\n" \
+       "\t                            it is a keyword like `match' or an\n" \
+       "\t                            operator like `/'\n" \
+       "\t( 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" \
 #define getopt_trivial_usage \
        "[OPTIONS]..."
 #define getopt_full_usage \
-       "\nParse command options\n" \
+       "Parse command options\n" \
        "\t-a, --alternative            Allow long options starting with single -\n" \
        "\t-l, --longoptions=longopts   Long options to be recognized\n" \
        "\t-n, --name=progname          The name under which errors are reported\n" \
   #define USAGE_AUTOWIDTH(a)
 #endif
 #define ls_trivial_usage \
-       "[-1Aa" USAGE_LS_TIMESTAMPS("c") "Cd" USAGE_LS_TIMESTAMPS("e") USAGE_LS_FILETYPES("F") "iln" USAGE_LS_FILETYPES("p") USAGE_LS_FOLLOWLINKS("L") USAGE_LS_RECURSIVE("R") USAGE_LS_SORTFILES("rS") "s" USAGE_AUTOWIDTH("T") USAGE_LS_TIMESTAMPS("tu") USAGE_LS_SORTFILES("v") USAGE_AUTOWIDTH("w") "x" USAGE_LS_SORTFILES("X") USAGE_HUMAN_READABLE("h""") "k] [filenames...]"
+       "[-1Aa" USAGE_LS_TIMESTAMPS("c") "Cd" USAGE_LS_TIMESTAMPS("e") USAGE_LS_FILETYPES("F") "iln" USAGE_LS_FILETYPES("p") USAGE_LS_FOLLOWLINKS("L") USAGE_LS_RECURSIVE("R") USAGE_LS_SORTFILES("rS") "s" USAGE_AUTOWIDTH("T") USAGE_LS_TIMESTAMPS("tu") USAGE_LS_SORTFILES("v") USAGE_AUTOWIDTH("w") "x" USAGE_LS_SORTFILES("X") USAGE_HUMAN_READABLE("h") USAGE_NOT_HUMAN_READABLE("") "k] [filenames...]"
 #define ls_full_usage \
        "List directory contents\n\n" \
        "Options:\n" \
        USAGE_LS_SORTFILES("\t-X\tsort the listing by extension\n") \
        USAGE_HUMAN_READABLE( \
        "\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
-       "\t-k\tprint sizes in kilobytes(default)" , \
+       "\t-k\tprint sizes in kilobytes(default)") USAGE_NOT_HUMAN_READABLE( \
        "\t-k\tprint sizes in kilobytes(compatability)") 
 
 #define lsmod_trivial_usage \
        "\t-t\tread files in text mode (default)\n" \
        "\t-g\tread a string\n" \
        "\nThe following two options are useful only when verifying checksums:\n" \
-       "\t-s,\tdon't output anything, status code shows success\n" \
-       "\t-w,\twarn about improperly formated MD5 checksum lines"
+       "\t-s\tdon't output anything, status code shows success\n" \
+       "\t-w\twarn about improperly formated MD5 checksum lines"
 
 #define mkdir_trivial_usage \
        "[OPTION] DIRECTORY..."
 #define rdate_trivial_usage \
        "[OPTION] HOST"
 #define rdate_full_usage \
-       "Get and possibly set the system date and time from a remote HOST.\n" \
+       "Get and possibly set the system date and time from a remote HOST.\n\n" \
        "Options:\n" \
        "\t-s\tSet the system date and time (default).\n" \
        "\t-p\tPrint the date and time."
 #define sed_trivial_usage \
        "[-Vhnef] pattern [files...]"
 #define sed_full_usage \
-       "-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\t\tdisplay this help message\n" \
+       "Options:\n" \
+       "\t-n\t\tsuppress automatic printing of pattern space\n" \
+       "\t-e script\tadd the script to the commands to be executed\n" \
+       "\t-f scriptfile\tadd the contents of script-file to the commands to be executed\n" \
+       "\t-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" \
 #define stty_full_usage \
        "Without arguments, prints baud rate, line discipline," \
        "\nand deviations from stty sane." \
-       "\n -F device  open and use the specified device instead of stdin" \
-       "\n -a    print all current settings in human-readable form. Or" \
-       "\n -g    print in a stty-readable form" \
-       "\n [SETTING]  see in documentation"
+       "\n\nOptions:" \
+       "\n\t-F device\topen device instead of stdin" \
+       "\n\t-a\t\tprint all current settings in human-readable form" \
+       "\n\t-g\t\tprint in stty-readable form" \
+       "\n\t[SETTING]\tsee documentation"
 
 #define swapoff_trivial_usage \
        "[OPTION] [device]"
        USAGE_KLOGD("\t-K\t\tDo not start up the klogd process\n") \
        "\t-O FILE\t\tUse an alternate log file (default=/var/log/messages)" \
        USAGE_REMOTE_LOG( \
-       "\n\t-R HOST[:PORT]\t\tLog remotely to IP or hostname on PORT (default PORT=514/UDP)\n" \
-       "\t-L\t\tLog locally as well as network logging (default is network only)")
+       "\n\t-R HOST[:PORT]\tLog to IP or hostname on PORT (default PORT=514/UDP)\n" \
+       "\t-L\t\tLog locally and via network logging (default is network only)")
 
 
 #ifdef BB_FEATURE_SIMPLE_TAIL
        "Checks file types and compares values returning an exit\n" \
        "code determined by the value of EXPRESSION."
 
+#ifdef BB_FEATURE_TFTP_GET
+  #define USAGE_TFTP_GET(a) a
+#else
+  #define USAGE_TFTP_GET(a)
+#endif
+#ifdef BB_FEATURE_TFTP_PUT
+  #define USAGE_TFTP_PUT(a) a
+#else
+  #define USAGE_TFTP_PUT(a)
+#endif
+
+#define tftp_trivial_usage \
+       "command SOURCE DEST"
+#define tftp_full_usage \
+       "Transfers a file from/to a tftp server using \"octet\" mode.\n\n" \
+       "Commands:\n" \
+        USAGE_TFTP_GET(        \
+        "\tget\tGet file from server SOURCE and store to local DEST.\n" \
+        ) \
+        USAGE_TFTP_PUT(        \
+       "\tput\tPut local file SOURCE to server DEST.\n" \
+       ) \
+       "\nWhen nameing a server, use the syntax \"server:file\"."
+
 #define touch_trivial_usage \
        "[-c] file [file ...]"
 #define touch_full_usage \
        "\t-m\tuse base64 encoding as of RFC1521"
 
 #define watchdog_trivial_usage \
-       "dev"
+       "DEV"
 #define watchdog_full_usage \
-       "Periodically write to watchdog device \"dev\""
+       "Periodically write to watchdog device DEV"
 
 #define wc_trivial_usage \
        "[OPTION]... [FILE]..."