Standardize on the vi editing directives being on the first line.
[oweals/busybox.git] / include / usage.h
index 052f6fcc2647754893c31850ac883f755c690e6e..3c1fb18e95c487dbedf3724381e18ff30b0a2fc5 100644 (file)
@@ -1,3 +1,4 @@
+/* vi: set sw=4 ts=4: */
 #ifndef __BB_USAGE_H__
 #define __BB_USAGE_H__
 
        "$ cat /proc/uptime\n" \
        "110716.72 17.67"
 
+#define catv_trivial_usage \
+       "[-etv] [FILE]..."
+#define catv_full_usage \
+       "Display nonprinting characters as ^x or M-x.\n\n"\
+       "\t-e\tEnd each line with $\n" \
+       "\t-t\tShow tabs as ^I\n" \
+       "\t-v\tDon't use ^x or M-x escapes."
 #define chattr_trivial_usage \
        "[-R] [-+=AacDdijsStTu] [-v version] files..."
 #define chattr_full_usage \
        "\t-l num\tlog level (8 - default)\n" \
        "\t-S\tlog to syslogd (default)\n" \
        "\t-L file\tlog to file\n" \
-       "\t-f\trun in fordeground\n" \
+       "\t-f\trun in foreground\n" \
        "\t-b\trun in background (default)\n" \
        "\t-c dir\tworking dir"
 
@@ -370,19 +378,23 @@ USE_FEATURE_DATE_ISOFMT( \
        "64\n"
 
 #define dd_trivial_usage \
-       "[if=FILE] [of=FILE] [bs=N] [count=N] [skip=N]\n" \
-       "\t  [seek=N] [conv=notrunc|noerror|sync]"
+       "[if=FILE] [of=FILE] " USE_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n" \
+       "\t  [seek=N]" USE_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync]")
 #define dd_full_usage \
        "Copy a file, converting and formatting according to options\n\n" \
        "\tif=FILE\t\tread from FILE instead of stdin\n" \
        "\tof=FILE\t\twrite to FILE instead of stdout\n" \
        "\tbs=N\t\tread and write N bytes at a time\n" \
+       USE_FEATURE_DD_IBS_OBS("\tibs=N\t\tread N bytes at a time\n") \
+       USE_FEATURE_DD_IBS_OBS("\tobs=N\t\twrite N bytes at a time\n") \
        "\tcount=N\t\tcopy only N input blocks\n" \
        "\tskip=N\t\tskip N input blocks\n" \
        "\tseek=N\t\tskip N output blocks\n" \
-       "\tconv=notrunc\tdon't truncate output file\n" \
-       "\tconv=noerror\tcontinue after read errors\n" \
-       "\tconv=sync\tpad blocks with zeros\n" \
+       USE_FEATURE_DD_IBS_OBS( \
+               "\tconv=notrunc\tdon't truncate output file\n" \
+               "\tconv=noerror\tcontinue after read errors\n" \
+               "\tconv=sync\tpad blocks with zeros\n" \
+       ) \
        "\n" \
        "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \
        "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)"
@@ -509,7 +521,7 @@ USE_FEATURE_DATE_ISOFMT( \
        "\t-i\t\tInstall the package\n" \
        "\t-l\t\tList of installed packages\n" \
        "\t-C\t\tConfigure an unpackaged package\n" \
-       "\t-F depends\tIgnore depency problems\n" \
+       "\t-F depends\tIgnore dependency problems\n" \
        "\t-P\t\tPurge all files of a package\n" \
        "\t-r\t\tRemove all but the configuration files for a package\n" \
        "\t-u\t\tUnpack a package, but don't configure it"
@@ -576,7 +588,7 @@ USE_FEATURE_DATE_ISOFMT( \
        "Displays the DHCP leases granted by udhcpd.\n\n" \
        "Options:\n" \
        "\t-f,\t--file=FILENAME\tLeases file to load\n" \
-       "\t-r,\t--remaining\tInterpret lease times as time remaing\n" \
+       "\t-r,\t--remaining\tInterpret lease times as time remaining\n" \
        "\t-a,\t--absolute\tInterpret lease times as expire time"
 
 #define e2fsck_trivial_usage \
@@ -626,6 +638,9 @@ USE_FEATURE_DATE_ISOFMT( \
        "Options:\n" \
        "\t-t\tclose tray"
 
+#define ed_trivial_usage ""
+#define ed_full_usage ""
+
 #define env_trivial_usage \
        "[-iu] [-] [name=value]... [command]"
 #define env_full_usage \
@@ -745,7 +760,9 @@ USE_FEATURE_DATE_ISOFMT( \
        "\t-follow\t\tDereference symbolic links\n" \
        "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN\n" \
        "\t-print\t\tPrint (default and assumed)\n" \
-       USE_FEATURE_FIND_TYPE( \
+       USE_FEATURE_FIND_PRINT0( \
+       "\t-print0\t\tDelimit output with null characters rather than\n\t\t\tnewlines" \
+) USE_FEATURE_FIND_TYPE( \
        "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" \
 ) USE_FEATURE_FIND_PERM( \
        "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \
@@ -975,54 +992,24 @@ USE_FEATURE_DATE_ISOFMT( \
        "\t-n\t\tno call to sync()\n" \
        "\t-f\t\tforce halt (don't go through init)"
 
-#ifdef CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
-#define USAGE_SCAN_HWIF(a) a
-#else
-#define USAGE_SCAN_HWIF(a)
-#endif
-
-#ifdef CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
-#define USAGE_UNREGISTER_HWIF(a) a
-#else
-#define USAGE_UNREGISTER_HWIF(a)
-#endif
-
-#ifdef CONFIG_FEATURE_HDPARM_HDIO_DRIVE_RESET
-#define USAGE_DRIVE_RESET(a) a
-#else
-#define USAGE_DRIVE_RESET(a)
-#endif
-
-#ifdef CONFIG_FEATURE_HDPARM_HDIO_TRISTATE_HWIF
-#define USAGE_TRISTATE_HWIF(a) a
-#else
-#define USAGE_TRISTATE_HWIF(a)
-#endif
-
-#ifdef CONFIG_FEATURE_HDPARM_HDIO_GETSET_DMA
-#define USAGE_GETSET_DMA(a) a
-#else
-#define USAGE_GETSET_DMA(a)
-#endif
-
 #define hdparm_trivial_usage \
        "[options] [device] .."
 #define hdparm_full_usage \
-       "Options:" \
+       USE_FEATURE_HDPARM_GET_IDENTITY("\tIf no device name is specified try to read from stdin.\n") \
+       "\nOptions:\n" \
        "\t-a   get/set fs readahead\n" \
        "\t-A   set drive read-lookahead flag (0/1)\n" \
        "\t-b   get/set bus state (0 == off, 1 == on, 2 == tristate)\n" \
        "\t-B   set Advanced Power Management setting (1-255)\n" \
        "\t-c   get/set IDE 32-bit IO setting\n" \
        "\t-C   check IDE power mode status\n" \
-       USAGE_GETSET_DMA("\t-d   get/set using_dma flag\n") \
+       USE_FEATURE_HDPARM_HDIO_GETSET_DMA("\t-d   get/set using_dma flag\n") \
        "\t-D   enable/disable drive defect-mgmt\n" \
        "\t-f   flush buffer cache for device on exit\n" \
        "\t-g   display drive geometry\n" \
        "\t-h   display terse usage information\n" \
-       "\t-i   display drive identification\n" \
+       USE_FEATURE_HDPARM_GET_IDENTITY("\t-i   display drive identification\n") \
        USE_FEATURE_HDPARM_GET_IDENTITY("\t-I   detailed/current information directly from drive\n") \
-       USE_FEATURE_HDPARM_GET_IDENTITY("\t-Istdin  similar to -I, but wants /proc/ide/" "*" "/hd?/identify as input\n") \
        "\t-k   get/set keep_settings_over_reset flag (0/1)\n" \
        "\t-K   set drive keep_features_over_reset flag (0/1)\n" \
        "\t-L   set drive doorlock (0/1) (removable harddisks only)\n" \
@@ -1033,29 +1020,23 @@ USE_FEATURE_DATE_ISOFMT( \
        "\t-q   change next setting quietly\n" \
        "\t-Q   get/set DMA tagged-queuing depth (if supported)\n" \
        "\t-r   get/set readonly flag (DANGEROUS to set)\n" \
-       USAGE_SCAN_HWIF("\t-R   register an IDE interface (DANGEROUS)\n") \
+       USE_FEATURE_HDPARM_HDIO_SCAN_HWIF("\t-R   register an IDE interface (DANGEROUS)\n") \
        "\t-S   set standby (spindown) timeout\n" \
        "\t-t   perform device read timings\n" \
        "\t-T   perform cache read timings\n" \
        "\t-u   get/set unmaskirq flag (0/1)\n" \
-       USAGE_UNREGISTER_HWIF("\t-U   un-register an IDE interface (DANGEROUS)\n") \
+       USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF("\t-U   un-register an IDE interface (DANGEROUS)\n") \
        "\t-v   defaults; same as -mcudkrag for IDE drives\n" \
        "\t-V   display program version and exit immediately\n" \
-       USAGE_DRIVE_RESET("\t-w   perform device reset (DANGEROUS)\n") \
+       USE_FEATURE_HDPARM_HDIO_DRIVE_RESET("\t-w   perform device reset (DANGEROUS)\n") \
        "\t-W   set drive write-caching flag (0/1) (DANGEROUS)\n" \
-       USAGE_TRISTATE_HWIF("\t-x   tristate device for hotswap (0/1) (DANGEROUS)\n") \
+       USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF("\t-x   tristate device for hotswap (0/1) (DANGEROUS)\n") \
        "\t-X   set IDE xfer mode (DANGEROUS)\n" \
        "\t-y   put IDE drive in standby mode\n" \
        "\t-Y   put IDE drive to sleep\n" \
        "\t-Z   disable Seagate auto-powersaving mode\n" \
        "\t-z   re-read partition table"
 
-#ifdef CONFIG_FEATURE_FANCY_HEAD
-#define USAGE_FANCY_HEAD(a) a
-#else
-#define USAGE_FANCY_HEAD(a)
-#endif
-
 #define head_trivial_usage \
        "[OPTION]... [FILE]..."
 #define head_full_usage \
@@ -1064,7 +1045,7 @@ USE_FEATURE_DATE_ISOFMT( \
        "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
        "Options:\n" \
        "\t-n NUM\t\tPrint first NUM lines instead of first 10" \
-       USAGE_FANCY_HEAD( \
+       USE_FEATURE_FANCY_HEAD( \
        "\n\t-c NUM\t\toutput the first NUM bytes\n" \
        "\t-q\t\tnever output headers giving file names\n" \
        "\t-v\t\talways output headers giving file names" )
@@ -1111,44 +1092,22 @@ USE_FEATURE_DATE_ISOFMT( \
        "$ hostname\n" \
        "sage\n"
 
-#ifdef CONFIG_FEATURE_HTTPD_BASIC_AUTH
-#  define USAGE_HTTPD_BASIC_AUTH(a) a
-#  ifdef CONFIG_FEATURE_HTTPD_AUTH_MD5
-#    define USAGE_HTTPD_AUTH_MD5(a) a
-#  else
-#    define USAGE_HTTPD_AUTH_MD5(a)
-#  endif
-#else
-#  define USAGE_HTTPD_BASIC_AUTH(a)
-#  define USAGE_HTTPD_AUTH_MD5(a)
-#endif
-#ifdef CONFIG_FEATURE_HTTPD_USAGE_FROM_INETD_ONLY
-#  define USAGE_HTTPD_STANDALONE(a)
-#  define USAGE_HTTPD_SETUID(a)
-#else
-#  define USAGE_HTTPD_STANDALONE(a) a
-#  ifdef CONFIG_FEATURE_HTTPD_SETUID
-#    define USAGE_HTTPD_SETUID(a) a
-#  else
-#    define USAGE_HTTPD_SETUID(a)
-#  endif
-#endif
 #define httpd_trivial_usage \
        "[-c <conf file>]" \
-       USAGE_HTTPD_STANDALONE(" [-p <port>]") \
-       USAGE_HTTPD_SETUID(" [-u user]") \
-       USAGE_HTTPD_BASIC_AUTH(" [-r <realm>]") \
-       USAGE_HTTPD_AUTH_MD5(" [-m pass]") \
+       USE_FEATURE_HTTPD_WITHOUT_INETD(" [-p <port>]") \
+       USE_FEATURE_HTTPD_SETUID(" [-u user]") \
+       USE_FEATURE_HTTPD_BASIC_AUTH(" [-r <realm>]") \
+       USE_FEATURE_HTTPD_AUTH_MD5(" [-m pass]") \
        " [-h home]" \
        " [-d/-e <string>]"
 #define httpd_full_usage \
        "Listens for incoming http server requests.\n\n" \
        "Options:\n" \
        "\t-c FILE\t\tSpecifies configuration file. (default httpd.conf)\n" \
-       USAGE_HTTPD_STANDALONE("\t-p PORT\tServer port (default 80)\n") \
-       USAGE_HTTPD_SETUID("\t-u USER\tSet uid to USER after listening privileges port\n") \
-       USAGE_HTTPD_BASIC_AUTH("\t-r REALM\tAuthentication Realm for Basic Authentication\n") \
-       USAGE_HTTPD_AUTH_MD5("\t-m PASS\t\tCrypt PASS with md5 algorithm\n") \
+       USE_FEATURE_HTTPD_WITHOUT_INETD("\t-p PORT\tServer port (default 80)\n") \
+       USE_FEATURE_HTTPD_SETUID("\t-u USER\tSet uid to USER after listening privileges port\n") \
+       USE_FEATURE_HTTPD_BASIC_AUTH("\t-r REALM\tAuthentication Realm for Basic Authentication\n") \
+       USE_FEATURE_HTTPD_AUTH_MD5("\t-m PASS\t\tCrypt PASS with md5 algorithm\n") \
        "\t-h HOME  \tSpecifies http HOME directory (default ./)\n" \
        "\t-e STRING\tHtml encode STRING\n" \
        "\t-d STRING\tURL decode STRING"
@@ -1215,8 +1174,8 @@ USE_FEATURE_DATE_ISOFMT( \
 #define ifconfig_full_usage \
        "configure a network interface\n\n" \
        "Options:\n" \
-       USAGE_IPV6("[add <address>[/<prefixlen>]]\n") \
-       USAGE_IPV6("[del <address>[/<prefixlen>]]\n") \
+       USAGE_IPV6("\t[add <address>[/<prefixlen>]]\n") \
+       USAGE_IPV6("\t[del <address>[/<prefixlen>]]\n") \
        "\t[[-]broadcast [<address>]]  [[-]pointopoint [<address>]]\n" \
        "\t[netmask <address>]  [dstaddr <address>]\n" \
        USAGE_SIOCSKEEPALIVE("\t[outfill <NN>] [keepalive <NN>]\n") \
@@ -1470,7 +1429,7 @@ USE_FEATURE_DATE_ISOFMT( \
        "The upper-case options MQS are used to remove a shared memory\n" \
        "segment by an shmkey value. The lower-case options mqs are used\n" \
        "to remove a segment by shmid value.\n" \
-       "\t-m | -M\tRemove the memory segment after the last detatch\n" \
+       "\t-m | -M\tRemove the memory segment after the last detach\n" \
        "\t-q | -Q\tRemove the message queue\n" \
        "\t-s | -S\tRemove the semaphore"
 
@@ -1481,7 +1440,7 @@ USE_FEATURE_DATE_ISOFMT( \
        "Resource specification:\n" \
        "\t-m\tshared memory segments\n" \
        "\t-q\tmessage queues\n" \
-       "\t-s\tsempahore arrays\n" \
+       "\t-s\tsemaphore arrays\n" \
        "\t-a\tall (default)\n" \
        "Output format:\n" \
        "\t-t\ttime\n" \
@@ -1841,19 +1800,25 @@ USE_FEATURE_DATE_ISOFMT( \
        "\t-s\tScan /sys and populate /dev during system boot\n\n" \
        "Called with no options (via hotplug) it uses environment variables\n" \
        "to determine which device to add/remove."
-#ifdef CONFIG_FEATURE_MDEV_CONFIG
-#define mdev_notes_usage \
+#define mdev_notes_usage "" \
+USE_FEATURE_MDEV_CONFIG( \
        "The mdev config file contains lines that look like:\n" \
        "  hd[a-z][0-9]* 0:3 660\n\n" \
        "That's device name (with regex match), uid:gid, and permissions.\n\n" \
-       "Optionally, that can be followed (on the same line) by an asterisk\n" \
-       "and a command line to run after creating the corresponding device(s),\n"\
-       "ala:\n\n" \
-       "  hdc root:cdrom 660  *ln -s hdc cdrom\n\n" \
+       USE_FEATURE_MDEV_EXEC( \
+               "Optionally, that can be followed (on the same line) by a special character\n" \
+               "and a command line to run after creating/before deleting the corresponding\n" \
+               "device(s).  The environment variable $MDEV indicates the active device node\n" \
+               "(which is useful if it's a regex match).  For example:\n\n" \
+               "  hdc root:cdrom 660  *ln -s $MDEV cdrom\n\n" \
+               "The special characters are @ (run after creating), $ (run before deleting),\n" \
+               "and * (run both after creating and before deleting).  The commands run in\n" \
+               "the /dev directory, and use system() which calls /bin/sh.\n\n" \
+       ) \
        "Config file parsing stops on the first matching line.  If no config\n"\
        "entry is matched, devices are created with default 0:0 660.  (Make\n"\
-       "the last line match .* to override this.)\n\n"
-#endif
+       "the last line match .* to override this.)\n\n" \
+)
 
 #define mesg_trivial_usage \
        "[y|n]"
@@ -1993,7 +1958,7 @@ USE_FEATURE_DATE_ISOFMT( \
 "\n" \
 "  alias <alias_name> <mod_name>\n" \
 "    Makes it possible to modprobe alias_name, when there is no such module.\n" \
-"    It makes sense if your mod_name is long, or you want a more reprenstative\n" \
+"    It makes sense if your mod_name is long, or you want a more representative\n" \
 "    name for that module (eg. 'scsi' in place of 'aha7xxx').\n" \
 "    This makes it also possible to use a different set of options (below) for\n" \
 "    the module and the alias.\n" \
@@ -2027,11 +1992,11 @@ USE_FEATURE_DATE_ISOFMT( \
        "   which are the default for alias 'tulip2'\n\n" \
        "$ modprobe tulip2 irq=8\n" \
        "   will load the module 'tulip' with default options 'irq=4 io=0x308 irq=8',\n" \
-       "   which are the default for alias 'tulip2' overriden by the option 'irq=8'\n\n" \
+       "   which are the default for alias 'tulip2' overridden by the option 'irq=8'\n\n" \
        "   from the command line\n\n" \
        "$ modprobe tulip2 irq=2 io=0x210\n" \
        "   will load the module 'tulip' with default options 'irq=4 io=0x308 irq=4 io=0x210',\n" \
-       "   which are the default for alias 'tulip2' overriden by the options 'irq=2 io=0x210'\n\n" \
+       "   which are the default for alias 'tulip2' overridden by the options 'irq=2 io=0x210'\n\n" \
        "   from the command line\n"
 
 #define more_trivial_usage \
@@ -2089,6 +2054,8 @@ USE_FEATURE_DATE_ISOFMT( \
        "$ mount /dev/fd0 /mnt -t msdos -o ro\n" \
        "$ mount /tmp/diskimage /opt -t ext2 -o loop\n" \
        "$ mount cd_image.iso mydir\n"
+#define mount_notes_usage \
+       "Returns 0 for success, number of failed mounts for -a, or errno for one mount." 
 
 #define mountpoint_trivial_usage \
        "[-q] <[-d] DIR | -x DEVICE>"
@@ -2239,12 +2206,12 @@ USE_FEATURE_DATE_ISOFMT( \
        "\t-u\tUnlocks (re-enables) the specified user account"
 
 #define patch_trivial_usage \
-       "[-p<num>] [-i<patch.diff>]"
+       "[-p<num>] [-i <diff>]"
 #define patch_full_usage \
-       "[-p<num>]\n" \
-       "[-i<diff>]"
+       "\t-p <num>\tStrip <num> leading components from file names\n" \
+       "\t-i <diff>\tRead <diff> instead of stdin"
 #define patch_example_usage \
-       "$ patch -p1 <example.diff\n" \
+       "$ patch -p1 < example.diff\n" \
        "$ patch -p0 -i example.diff"
 
 #if ENABLE_FEATURE_PIDOF_SINGLE
@@ -2723,6 +2690,10 @@ USE_FEATURE_DATE_ISOFMT( \
        "\n\t-n|--name <process-name>\tstop processes with this name" \
        "\n\t-p|--pidfile <pid-file>\t\tsave or load pid using a pid-file" \
        "\n\t-q|--quiet\t\t\tbe quiet" \
+USE_FEATURE_START_STOP_DAEMON_FANCY( \
+       "\n\t-o|--oknodo\t\t\texit status 0 if nothing done" \
+       "\n\t-v|--verbose\t\t\tbe verbose" \
+) \
        "\n\t-s|--signal <signal>\t\tsignal to send (default TERM)"
 
 #ifdef CONFIG_FEATURE_STAT_FORMAT
@@ -3385,11 +3356,12 @@ USE_FEATURE_DATE_ISOFMT( \
        "Mon Dec 17 10:31:44 GMT 2000"
 
 #define watchdog_trivial_usage \
-       "[-t <seconds>] DEV"
+       "[-t <seconds>] [-F] DEV"
 #define watchdog_full_usage \
        "Periodically write to watchdog device DEV.\n" \
        "Options:\n" \
-       "\t-t\tTimer period in seconds - default is 30"
+       "\t-t\tTimer period in seconds - default is 30\n" \
+       "\t-F\tStay in the foreground and don't fork"
 
 #define wc_trivial_usage \
        "[OPTION]... [FILE]..."
@@ -3458,7 +3430,7 @@ USE_FEATURE_DATE_ISOFMT( \
        "Executes COMMAND on every item given by standard input.\n\n" \
        "Options:\n" \
        USAGE_XARGS_CONFIRMATION("\t-p\tPrompt the user about whether to run each command\n") \
-       "\t-r\tDo not run command for empty readed lines\n" \
+       "\t-r\tDo not run command for empty read lines\n" \
        USAGE_XARGS_TERMOPT("\t-x\tExit if the size is exceeded\n") \
        USAGE_XARGS_ZERO_TERM("\t-0\tInput filenames are terminated by a null character\n") \
        "\t-t\tPrint the command line on stderr before executing it"
@@ -3484,6 +3456,6 @@ USE_FEATURE_DATE_ISOFMT( \
        "\t-f              foreground mode\n" \
        "\t-q              quit after address (no daemon)\n" \
        "\t-r 169.254.x.x  request this address first\n" \
-       "\t-v              verbose; show version"
+       "\t-v              verbose"
 
 #endif /* __BB_USAGE_H__ */