+/* 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"
"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)"
"\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"
"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 \
"\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)" \
#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-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" \
#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") \
"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"
"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" \
"\t-c\tcheck MD5 sums against given list\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-w\twarn about improperly formatted MD5 checksum lines")
#define md5sum_example_usage \
"$ md5sum < busybox\n" \
"6fd11e98b98a58f64ff3398d7b324003\n" \
"\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]"
"\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" \
" 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 \
#define more_example_usage \
"$ dmesg | more\n"
-#ifdef CONFIG_FEATURE_MOUNT_LOOP
-# define USAGE_MOUNT_LOOP(a) a
-#else
-# define USAGE_MOUNT_LOOP(a)
-#endif
-#ifdef CONFIG_FEATURE_MTAB_SUPPORT
-# define USAGE_MTAB(a) a
-#else
-# define USAGE_MTAB(a)
-#endif
#define mount_trivial_usage \
"[flags] DEVICE NODE [-o options,more-options]"
#define mount_full_usage \
"Mount a filesystem. Filesystem autodetection requires /proc be mounted.\n\n" \
"Flags:\n" \
"\t-a:\t\tMount all filesystems in fstab\n" \
- USAGE_MTAB( \
- "\t-f:\t\t\"Fake\" Add entry to mount table but don't mount it\n" \
- "\t-n:\t\tDon't write a mount table entry\n" \
+ USE_FEATURE_MTAB_SUPPORT( \
+ "\t-f:\t\t\"Fake\" Add entry to mount table but don't mount it\n" \
+ "\t-n:\t\tDon't write a mount table entry\n" \
) \
"\t-o option:\tOne of many filesystem options, listed below\n" \
"\t-r:\t\tMount the filesystem read-only\n" \
"\t-w:\t\tMount for reading and writing (default)\n" \
"\n" \
"Options for use with the \"-o\" flag:\n" \
- "\tasync/sync:\tWrites are asynchronous / synchronous\n" \
- "\tatime/noatime:\tEnable / disable updates to inode access times\n" \
- "\tdev/nodev:\tAllow use of special device files / disallow them\n" \
- "\texec/noexec:\tAllow use of executable files / disallow them\n" \
- USAGE_MOUNT_LOOP( \
- "\tloop:\t\t Ignored (loop devices are autodetected)\n" \
+ USE_FEATURE_MOUNT_LOOP( \
+ "\tloop:\t\tIgnored (loop devices are autodetected)\n" \
+ ) \
+ USE_FEATURE_MOUNT_FLAGS( \
+ "\t[a]sync:\tWrites are asynchronous / synchronous\n" \
+ "\t[no]atime:\tDisable / enable updates to inode access times\n" \
+ "\t[no]diratime:\tDisable / enable atime updates to directories\n" \
+ "\t[no]dev:\tAllow use of special device files / disallow them\n" \
+ "\t[no]exec:\tAllow use of executable files / disallow them\n" \
+ "\t[no]suid:\tAllow set-user-id-root programs / disallow them\n" \
+ "\t[r]shared:\tConvert [recursively] to a shared subtree.\n" \
+ "\t[r]slave:\tConvert [recursively] to a slave subtree.\n" \
+ "\t[r]private:\tConvert [recursively] to a private subtree\n" \
+ "\t[un]bindable:\tMake mount point [un]able to be bind mounted.\n" \
+ "\tbind:\t\tBind a directory to an additional location\n" \
+ "\tmove:\t\tRelocate an existing mount point.\n" \
) \
- "\tsuid/nosuid:\tAllow set-user-id-root programs / disallow them\n" \
"\tremount:\tRe-mount a mounted filesystem, changing its flags\n" \
"\tro/rw:\t\tMount for read-only / read-write\n" \
- "\tbind:\t\tBind a directory to an additional location\n" \
- "\tmove:\t\tRelocate an existing mount point.\n" \
"\nThere are EVEN MORE flags that are specific to each filesystem\n" \
"You'll have to see the written documentation for those filesystems"
#define mount_example_usage \
"$ 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>"
" or\n" \
"$ nameif -c /etc/my_mactab_file\n" \
-#ifdef CONFIG_NC_GAPING_SECURITY_HOLE
-# define USAGE_NC_EXEC(a) a
+#if ENABLE_NC_SERVER || ENABLE_NC_EXTRA
+#define NC_BR1 "["
+#define NC_BR2 "]"
#else
-# define USAGE_NC_EXEC(a)
+#define NC_BR1
+#define NC_BR2
#endif
+
#define nc_trivial_usage \
- "[OPTIONS] [IP] [port]"
+ "[" \
+ NC_BR1 USE_NC_SERVER("-lp")USE_NC_EXTRA("iwf") NC_BR2 \
+ " ["USE_NC_EXTRA("FILENAME|")"{IPADDR PORTNUM}]"USE_NC_EXTRA(" [-e COMMAND]")
#define nc_full_usage \
- "Netcat opens a pipe to IP:port\n\n" \
- "Options:\n" \
- "\t-l\t\tlisten mode, for inbound connects\n" \
- "\t-p PORT\t\tlocal port number\n" \
- "\t-i SECS\t\tdelay interval for lines sent\n" \
- USAGE_NC_EXEC( \
- "\t-e PROG\t\tprogram to exec after connect (dangerous!)\n" \
+ "Netcat opens a pipe, either to IP:port\n\n" \
+ "Options:" \
+ USE_NC_EXTRA( \
+ "\n\t-e\t\texec rest of command line after connect\n" \
+ "\t-i SECS\t\tdelay interval for lines sent\n" \
+ "\t-w SECS\t\ttimeout for connect\n" \
+ "\t-f filename\tuse file (ala /dev/ttyS0) instead of network" \
) \
- "\t-w SECS\t\ttimeout for connects and final net reads"
+ USE_NC_SERVER( \
+ "\n\t-l\t\tlisten mode, for inbound connects\n" \
+ USE_NC_EXTRA("\t\t\t(use -l twice with -e for persistent server)\n") \
+ "\t-p PORT\t\tlocal port number" \
+ )
+
+
+#define nc_notes_usage "" \
+ USE_NC_EXTRA( \
+ "To use netcat as a terminal emulator on a serial port:\n\n" \
+ "$ stty 115200 -F /dev/ttyS0\n" \
+ "$ stty raw -echo -ctlecho && nc -f /dev/ttyS0\n" \
+ ) ""
+
#define nc_example_usage \
"$ nc foobar.somedomain.com 25\n" \
"220 foobar ESMTP Exim 3.12 #1 Sat, 15 Apr 2000 00:03:02 -0600\n" \
"\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
"\t-c\tcheck SHA1 sums against given list\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 SHA1 checksum lines")
+ "\t-w\twarn about improperly formatted SHA1 checksum lines")
#ifdef CONFIG_FEATURE_FANCY_SLEEP
# define USAGE_FANCY_SLEEP(a) a
"\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" \
- "\n\t-s|--signal <signal>\t\tsignal to send (default TERM)"
+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)" \
+ "\n\t-U|--chuid <username>|<uid>\tstart process with this name"
#ifdef CONFIG_FEATURE_STAT_FORMAT
# define USAGE_STAT_FORMAT(a) a
#define udhcpd_full_usage \
""
-#ifdef CONFIG_FEATURE_MOUNT_FORCE
-# define USAGE_MOUNT_FORCE(a) a
-#else
-# define USAGE_MOUNT_FORCE(a)
-#endif
#define umount_trivial_usage \
"[flags] FILESYSTEM|DIRECTORY"
#define umount_full_usage \
"Unmount file systems\n" \
"\nFlags:\n" "\t-a\tUnmount all file systems" \
- USAGE_MTAB(" in /etc/mtab\n\t-n\tDon't erase /etc/mtab entries") \
+ USE_FEATURE_MTAB_SUPPORT(" in /etc/mtab\n\t-n\tDon't erase /etc/mtab entries") \
"\n\t-r\tTry to remount devices as read-only if mount is busy" \
"\n\t-l\tLazy umount (detach filesystem)" \
"\n\t-f\tForce umount (i.e., unreachable NFS server)" \
- USAGE_MOUNT_LOOP("\n\t-D\tDo not free loop device (if a loop device has been used)")
+ USE_FEATURE_MOUNT_LOOP("\n\t-D\tDo not free loop device (if a loop device has been used)")
#define umount_example_usage \
"$ umount /dev/hdc1 \n"
"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]..."
"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"
"\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__ */