Ignore:
Timestamp:
Nov 6, 2007, 11:01:53 AM (13 years ago)
Author:
Bruno Cornec
Message:
  • Better output for mindi-busybox revision
  • Remove dummy file created on NFS - report from Arnaud Tiger <arnaud.tiger_at_hp.com>
  • strace useful for debug
  • fix new versions for pb (2.0.0 for mindi and 1.7.2 for mindi-busybox)
  • fix build process for mindi-busybox + options used in that version (dd for label-partitions-as-necessary)
  • fix typo in label-partitions-as-necessary which doesn't seem to work
  • Update to busybox 1.7.2
  • perl is now required at restore time to support uuid swap partitions (and will be used for many other thigs

in the future for sure)

  • next mindi version will be 2.0.0 due to all the changes made in it (udev may break working distros)
  • small optimization in mindi on keyboard handling (one single find instead of multiple)
  • better interaction for USB device when launching mindi manually
  • attempt to automatically guess block disk size for ramdisk
  • fix typos in bkphw
  • Fix the remaining problem with UUID support for swap partitions
  • Updates mondoarchive man page for USB support
  • Adds preliminary Hardware support to mindi (Proliant SSSTK)
  • Tries to add udev support also for rhel4
  • Fix UUID support which was still broken.
  • Be conservative in test for the start-nfs script
  • Update config file for mindi-busybox for 1.7.2 migration
  • Try to run around a busybox bug (1.2.2 pb on inexistant links)
  • Add build content for mindi-busybox in pb
  • Remove distributions content for mindi-busybox
  • Fix a warning on inexistant raidtab
  • Solve problem on tmpfs in restore init (Problem of inexistant symlink and busybox)
  • Create MONDO_CACHE and use it everywhere + creation at start
  • Really never try to eject a USB device
  • Fix a issue with &> usage (replaced with 1> and 2>)
  • Adds magic file to depllist in order to have file working + ldd which helps for debugging issues
  • tty modes correct to avoid sh error messages
  • Use ext3 normally and not ext2 instead
  • USB device should be corrected after reading (take 1st part)
  • Adds a mount_USB_here function derived from mount_CDROM_here
  • usb detection place before /dev detection in device name at restore time
  • Fix when restoring from USB: media is asked in interactive mode
  • Adds USB support for mondorestore
  • mount_cdrom => mount_media
  • elilo.efi is now searched throughout /boot/efi and not in a fixed place as there is no standard
  • untar-and-softlink => untar (+ interface change)
  • suppress useless softlinks creation/removal in boot process
  • avoids udevd messages on groups
  • Increase # of disks to 99 as in mindi at restore time (should be a conf file parameter)
  • skip existing big file creation
  • seems to work correctly for USB mindi boot
  • Adds group and tty link to udev conf
  • Always load usb-torage (even 2.6) to initiate USB bus discovery
  • Better printing of messages
  • Attempt to fix a bug in supporting OpenSusE 10.3 kernel for initramfs (mindi may now use multiple regex for kernel initrd detection)
  • Links were not correctly done as non relative for modules in mindi
  • exclusion of modules denied now works
  • Also create modules in their ordinary place, so that classical modprobe works + copy modules.dep
  • Fix bugs for DENY_MODS handling
  • Add device /dev/console for udev
  • ide-generic should now really be excluded
  • Fix a bug in major number for tty
  • If udev then adds modprobe/insmod to rootfs
  • tty0 is also cretaed with udev
  • ide-generic put rather in DENY_MODS
  • udevd remove from deplist s handled in mindi directly
  • better default for mindi when using --usb
  • Handles dynamically linked busybox (in case we want to use it soon ;-)
  • Adds fixed devices to create for udev
  • ide-generic should not be part of the initrd when using libata v2
  • support a dynamically linked udev (case on Ubuntu 7.10 and Mandriva 2008.0 so should be quite generic) This will give incitation to move to dyn. linked binaries in the initrd which will help for other tasks (ia6 4)
  • Improvement in udev support (do not use cl options not available in busybox)
  • Udev in mindi
    • auto creation of the right links at boot time with udev-links.conf(from Mandriva 2008.0)
    • rework startup of udev as current makes kernel crash (from Mandriva 2008.0)
    • add support for 64 bits udev
  • Try to render MyInsmod? silent at boot time
  • Adds udev support (mandatory for newest distributions to avoid remapping of devices in a different way as on the original system)
  • We also need vaft format support for USB boot
  • Adds libusual support (Ubuntu 7.10 needs it for USB)
  • Improve Ubuntu/Debian? keyboard detection and support
  • pbinit adapted to new pb (0.8.10). Filtering of docs done in it
  • Suppress some mondo warnings and errors on USB again
  • Tries to fix lack of files in deb mindi package
  • Verify should now work for USB devices
  • More log/mesages improvement for USB support
  • - Supress g_erase_tmpdir_and_scratchdir
  • Improve some log messages for USB support
  • Try to improve install in mindi to avoid issues with isolinux.cfg not installed vene if in the pkg :-(
  • Improve mindi-busybox build
  • In conformity with pb 0.8.9
  • Add support for Ubuntu 7.10 in build process
  • Add USB Key button to Menu UI (CD streamer removed)
  • Attempt to fix error messages on tmp/scratch files at the end by removing those dir at the latest possible.
  • Fix a bug linked to the size of the -E param which could be used (Arnaud Tiger/René? Ribaud).
  • Integrate ~/.pbrc content into mondorescue.pb (required project-builder >= 0.8.7)
  • Put mondorescue in conformity with new pb filtering rules
  • Add USB support at restore time (no test done yet). New start-usb script PB varibale added where useful
  • Unmounting USB device before removal of temporary scratchdir
  • Stil refining USB copy back to mondo (one command was not executed)
  • No need to have the image subdor in the csratchdir when USB.
  • umount the USB partition before attempting to use it
  • Remove useless copy from mindi to mondo at end of USB handling

(risky merge, we are raising the limits of 2 diverging branches. The status of stable is not completely sure as such. Will need lots of tests, but it's not yet done :-()
(merge -r1692:1769 $SVN_M/branches/2.2.5)

Location:
branches/stable/mindi-busybox/include
Files:
12 edited
1 copied

Legend:

Unmodified
Added
Removed
  • branches/stable/mindi-busybox/include/applets.h

    r821 r1770  
     1/* vi: set sw=4 ts=4: */
    12/*
    23 * applets.h - a listing of all busybox applets.
     
    1112 */
    1213
    13 #undef APPLET
    14 #undef APPLET_ODDNAME
    15 #undef APPLET_NOUSAGE
    16 
     14/*
     15name  - applet name as it is typed on command line
     16name2 - applet name, converted to C (ether-wake: name2 = ether_wake)
     17main  - corresponding <applet>_main to call (bzcat: main = bunzip2)
     18l     - location to install link to: [/usr]/[s]bin
     19s     - suid type:
     20        _BB_SUID_ALWAYS: will complain if busybox isn't suid
     21        and is run by non-root (applet_main() will not be called at all)
     22        _BB_SUID_NEVER: will drop suid prior to applet_main()
     23        _BB_SUID_MAYBE: neither of the above
     24*/
    1725
    1826#if defined(PROTOTYPES)
    19 # define APPLET(a,b,c) extern int a##_main(int argc, char **argv);
    20 # define APPLET_NOUSAGE(a,b,c,d) extern int b##_main(int argc, char **argv);
    21 # define APPLET_ODDNAME(a,b,c,d,e) extern int b##_main(int argc, char **argv);
    22 #elif defined(MAKE_USAGE)
    23 # ifdef CONFIG_FEATURE_VERBOSE_USAGE
    24 #  define APPLET(a,b,c) a##_trivial_usage "\n\n" a##_full_usage "\0"
    25 #  define APPLET_NOUSAGE(a,b,c,d) "\b\0"
    26 #  define APPLET_ODDNAME(a,b,c,d,e) e##_trivial_usage "\n\n" e##_full_usage "\0"
    27 # else
    28 #  define APPLET(a,b,c) a##_trivial_usage "\0"
    29 #  define APPLET_NOUSAGE(a,b,c,d) "\b\0"
    30 #  define APPLET_ODDNAME(a,b,c,d,e) e##_trivial_usage "\0"
    31 # endif
     27# define APPLET(name,l,s)                    int name##_main(int argc, char **argv);
     28# define APPLET_NOUSAGE(name,main,l,s)       int main##_main(int argc, char **argv);
     29# define APPLET_ODDNAME(name,main,l,s,name2) int main##_main(int argc, char **argv);
     30# define APPLET_NOEXEC(name,main,l,s,name2)  int main##_main(int argc, char **argv);
     31# define APPLET_NOFORK(name,main,l,s,name2)  int main##_main(int argc, char **argv);
     32
     33#elif defined(MAKE_USAGE) && ENABLE_FEATURE_VERBOSE_USAGE
     34# define APPLET(name,l,s)                    name##_trivial_usage "\n\n" name##_full_usage "\0"
     35# define APPLET_NOUSAGE(name,main,l,s)       "\b\0"
     36# define APPLET_ODDNAME(name,main,l,s,name2) name2##_trivial_usage "\n\n" name2##_full_usage "\0"
     37# define APPLET_NOEXEC(name,main,l,s,name2)  name2##_trivial_usage "\n\n" name2##_full_usage "\0"
     38# define APPLET_NOFORK(name,main,l,s,name2)  name2##_trivial_usage "\n\n" name2##_full_usage "\0"
     39
     40#elif defined(MAKE_USAGE) && !ENABLE_FEATURE_VERBOSE_USAGE
     41# define APPLET(name,l,s)                    name##_trivial_usage "\0"
     42# define APPLET_NOUSAGE(name,main,l,s)       "\b\0"
     43# define APPLET_ODDNAME(name,main,l,s,name2) name2##_trivial_usage "\0"
     44# define APPLET_NOEXEC(name,main,l,s,name2)  name2##_trivial_usage "\0"
     45# define APPLET_NOFORK(name,main,l,s,name2)  name2##_trivial_usage "\0"
     46
    3247#elif defined(MAKE_LINKS)
    33 # define APPLET(a,b,c) LINK b a
    34 # define APPLET_NOUSAGE(a,b,c,d) LINK c a
    35 # define APPLET_ODDNAME(a,b,c,d,e) LINK c a
     48# define APPLET(name,l,c)                    LINK l name
     49# define APPLET_NOUSAGE(name,main,l,s)       LINK l name
     50# define APPLET_ODDNAME(name,main,l,s,name2) LINK l name
     51# define APPLET_NOEXEC(name,main,l,s,name2)  LINK l name
     52# define APPLET_NOFORK(name,main,l,s,name2)  LINK l name
     53
    3654#else
    37   const struct BB_applet applets[] = {
    38 # define APPLET(a,b,c) {#a,a##_main,b,c},
    39 # define APPLET_NOUSAGE(a,b,c,d) {#a,b##_main,c,d},
    40 # define APPLET_ODDNAME(a,b,c,d,e) {#a,b##_main,c,d},
    41 #endif
    42 
    43 #ifdef CONFIG_INSTALL_NO_USR
     55  const struct bb_applet applets[] = { /*    name, main, location, need_suid */
     56# define APPLET(name,l,s)                    { #name, name##_main USE_FEATURE_INSTALLER(,l) USE_FEATURE_SUID(,s) },
     57# define APPLET_NOUSAGE(name,main,l,s)       { #name, main##_main USE_FEATURE_INSTALLER(,l) USE_FEATURE_SUID(,s) },
     58# define APPLET_ODDNAME(name,main,l,s,name2) { #name, main##_main USE_FEATURE_INSTALLER(,l) USE_FEATURE_SUID(,s) },
     59# define APPLET_NOEXEC(name,main,l,s,name2)  { #name, main##_main USE_FEATURE_INSTALLER(,l) USE_FEATURE_SUID(,s) USE_FEATURE_PREFER_APPLETS(,1) },
     60# define APPLET_NOFORK(name,main,l,s,name2)  { #name, main##_main USE_FEATURE_INSTALLER(,l) USE_FEATURE_SUID(,s) USE_FEATURE_PREFER_APPLETS(,1 ,1) },
     61#endif
     62
     63#if ENABLE_INSTALL_NO_USR
    4464# define _BB_DIR_USR_BIN _BB_DIR_BIN
    4565# define _BB_DIR_USR_SBIN _BB_DIR_SBIN
     
    4767
    4868
    49 USE_TEST(APPLET_NOUSAGE([, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     69USE_TEST(APPLET_NOEXEC([, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
    5070USE_TEST(APPLET_NOUSAGE([[, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    5171USE_ADDGROUP(APPLET(addgroup, _BB_DIR_BIN, _BB_SUID_NEVER))
     
    5373USE_ADJTIMEX(APPLET(adjtimex, _BB_DIR_SBIN, _BB_SUID_NEVER))
    5474USE_AR(APPLET(ar, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     75USE_ARP(APPLET(arp, _BB_DIR_SBIN, _BB_SUID_NEVER))
    5576USE_ARPING(APPLET(arping, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    5677USE_ASH(APPLET_NOUSAGE(ash, ash, _BB_DIR_BIN, _BB_SUID_NEVER))
    57 USE_AWK(APPLET(awk, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    58 USE_BASENAME(APPLET(basename, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     78USE_AWK(APPLET_NOEXEC(awk, awk, _BB_DIR_USR_BIN, _BB_SUID_NEVER, awk))
     79USE_BASENAME(APPLET_NOFORK(basename, basename, _BB_DIR_USR_BIN, _BB_SUID_NEVER, basename))
    5980USE_BBCONFIG(APPLET(bbconfig, _BB_DIR_BIN, _BB_SUID_NEVER))
     81//USE_BBSH(APPLET(bbsh, _BB_DIR_BIN, _BB_SUID_NEVER))
    6082USE_BUNZIP2(APPLET(bunzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    61 /* Always enabled. */
    62 APPLET_NOUSAGE(busybox, busybox, _BB_DIR_BIN, _BB_SUID_MAYBE)
    6383USE_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, _BB_DIR_USR_BIN, _BB_SUID_NEVER, bzcat))
    6484USE_CAL(APPLET(cal, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    65 USE_CAT(APPLET(cat, _BB_DIR_BIN, _BB_SUID_NEVER))
     85USE_CAT(APPLET_NOFORK(cat, cat, _BB_DIR_BIN, _BB_SUID_NEVER, cat))
    6686USE_CATV(APPLET(catv, _BB_DIR_BIN, _BB_SUID_NEVER))
    6787USE_CHATTR(APPLET(chattr, _BB_DIR_BIN, _BB_SUID_NEVER))
    68 USE_CHGRP(APPLET(chgrp, _BB_DIR_BIN, _BB_SUID_NEVER))
    69 USE_CHMOD(APPLET(chmod, _BB_DIR_BIN, _BB_SUID_NEVER))
    70 USE_CHOWN(APPLET(chown, _BB_DIR_BIN, _BB_SUID_NEVER))
     88USE_CHCON(APPLET(chcon, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     89USE_CHGRP(APPLET_NOEXEC(chgrp, chgrp, _BB_DIR_BIN, _BB_SUID_NEVER, chgrp))
     90USE_CHMOD(APPLET_NOEXEC(chmod, chmod, _BB_DIR_BIN, _BB_SUID_NEVER, chmod))
     91USE_CHOWN(APPLET_NOEXEC(chown, chown, _BB_DIR_BIN, _BB_SUID_NEVER, chown))
     92USE_CHPASSWD(APPLET(chpasswd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
     93USE_CHPST(APPLET(chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    7194USE_CHROOT(APPLET(chroot, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
     95USE_CHRT(APPLET(chrt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    7296USE_CHVT(APPLET(chvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    7397USE_CKSUM(APPLET(cksum, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     
    7599USE_CMP(APPLET(cmp, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    76100USE_COMM(APPLET(comm, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    77 USE_CP(APPLET(cp, _BB_DIR_BIN, _BB_SUID_NEVER))
     101USE_CP(APPLET_NOEXEC(cp, cp, _BB_DIR_BIN, _BB_SUID_NEVER, cp))
    78102USE_CPIO(APPLET(cpio, _BB_DIR_BIN, _BB_SUID_NEVER))
    79103USE_CROND(APPLET(crond, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
    80104USE_CRONTAB(APPLET(crontab, _BB_DIR_USR_BIN, _BB_SUID_ALWAYS))
    81 USE_CUT(APPLET(cut, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     105USE_CRYPTPW(APPLET(cryptpw, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     106USE_CTTYHACK(APPLET_NOUSAGE(cttyhack, cttyhack, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     107USE_CUT(APPLET_NOEXEC(cut, cut, _BB_DIR_USR_BIN, _BB_SUID_NEVER, cut))
    82108USE_DATE(APPLET(date, _BB_DIR_BIN, _BB_SUID_NEVER))
    83109USE_DC(APPLET(dc, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    84 USE_DD(APPLET(dd, _BB_DIR_BIN, _BB_SUID_NEVER))
     110USE_DD(APPLET_NOEXEC(dd, dd, _BB_DIR_BIN, _BB_SUID_NEVER, dd))
    85111USE_DEALLOCVT(APPLET(deallocvt, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    86112USE_DELGROUP(APPLET_ODDNAME(delgroup, deluser, _BB_DIR_BIN, _BB_SUID_NEVER, delgroup))
     
    88114USE_DEVFSD(APPLET(devfsd, _BB_DIR_SBIN, _BB_SUID_NEVER))
    89115USE_DF(APPLET(df, _BB_DIR_BIN, _BB_SUID_NEVER))
     116USE_APP_DHCPRELAY(APPLET(dhcprelay, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
    90117USE_DIFF(APPLET(diff, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    91 USE_DIRNAME(APPLET(dirname, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     118USE_DIRNAME(APPLET_NOFORK(dirname, dirname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, dirname))
    92119USE_DMESG(APPLET(dmesg, _BB_DIR_BIN, _BB_SUID_NEVER))
    93120USE_DNSD(APPLET(dnsd, _BB_DIR_USR_SBIN, _BB_SUID_ALWAYS))
     
    98125USE_DUMPKMAP(APPLET(dumpkmap, _BB_DIR_BIN, _BB_SUID_NEVER))
    99126USE_APP_DUMPLEASES(APPLET(dumpleases, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    100 USE_E2FSCK(APPLET(e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
    101 USE_E2LABEL(APPLET_NOUSAGE(e2label, tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
    102 USE_ECHO(APPLET(echo, _BB_DIR_BIN, _BB_SUID_NEVER))
     127//USE_E2FSCK(APPLET(e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
     128//USE_E2LABEL(APPLET_NOUSAGE(e2label, tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
     129USE_ECHO(APPLET_NOFORK(echo, echo, _BB_DIR_BIN, _BB_SUID_NEVER, echo))
    103130USE_ED(APPLET(ed, _BB_DIR_BIN, _BB_SUID_NEVER))
    104131USE_FEATURE_GREP_EGREP_ALIAS(APPLET_NOUSAGE(egrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER))
    105132USE_EJECT(APPLET(eject, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    106133USE_ENV(APPLET(env, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    107 USE_ETHER_WAKE(APPLET_ODDNAME(ether-wake, etherwake, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ether_wake))
     134USE_ENVDIR(APPLET_ODDNAME(envdir, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, envdir))
     135USE_ENVUIDGID(APPLET_ODDNAME(envuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, envuidgid))
     136USE_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ether_wake))
     137USE_EXPAND(APPLET(expand, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    108138USE_EXPR(APPLET(expr, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    109139USE_FAKEIDENTD(APPLET(fakeidentd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
    110 USE_FALSE(APPLET(false, _BB_DIR_BIN, _BB_SUID_NEVER))
     140USE_FALSE(APPLET_NOFORK(false, false, _BB_DIR_BIN, _BB_SUID_NEVER, false))
    111141USE_FBSET(APPLET(fbset, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
    112142USE_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, _BB_DIR_BIN, _BB_SUID_NEVER, fdflush))
     
    114144USE_FDISK(APPLET(fdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))
    115145USE_FEATURE_GREP_FGREP_ALIAS(APPLET_NOUSAGE(fgrep, grep, _BB_DIR_BIN, _BB_SUID_NEVER))
    116 USE_FIND(APPLET(find, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    117 USE_FINDFS(APPLET_NOUSAGE(findfs, tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
     146USE_FIND(APPLET_NOEXEC(find, find, _BB_DIR_USR_BIN, _BB_SUID_NEVER, find))
     147//USE_FINDFS(APPLET_NOUSAGE(findfs, tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
    118148USE_FOLD(APPLET(fold, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    119149USE_FREE(APPLET(free, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    120150USE_FREERAMDISK(APPLET(freeramdisk, _BB_DIR_SBIN, _BB_SUID_NEVER))
    121151USE_FSCK(APPLET(fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
    122 USE_E2FSCK(APPLET_NOUSAGE(fsck.ext2, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
    123 USE_E2FSCK(APPLET_NOUSAGE(fsck.ext3, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
     152//USE_E2FSCK(APPLET_NOUSAGE(fsck.ext2, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
     153//USE_E2FSCK(APPLET_NOUSAGE(fsck.ext3, e2fsck, _BB_DIR_SBIN, _BB_SUID_NEVER))
    124154USE_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, fsck_minix))
    125 USE_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER,ftpget))
    126 USE_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER,ftpput))
     155USE_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ftpget))
     156USE_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, _BB_DIR_USR_BIN, _BB_SUID_NEVER, ftpput))
    127157USE_FUSER(APPLET(fuser, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     158USE_GETENFORCE(APPLET(getenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
    128159USE_GETOPT(APPLET(getopt, _BB_DIR_BIN, _BB_SUID_NEVER))
     160USE_GETSEBOOL(APPLET(getsebool, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
    129161USE_GETTY(APPLET(getty, _BB_DIR_SBIN, _BB_SUID_NEVER))
    130162USE_GREP(APPLET(grep, _BB_DIR_BIN, _BB_SUID_NEVER))
     
    134166USE_HDPARM(APPLET(hdparm, _BB_DIR_SBIN, _BB_SUID_NEVER))
    135167USE_HEAD(APPLET(head, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    136 USE_HEXDUMP(APPLET(hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    137 USE_HOSTID(APPLET(hostid, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     168USE_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hexdump))
     169USE_HOSTID(APPLET_NOFORK(hostid, hostid, _BB_DIR_USR_BIN, _BB_SUID_NEVER, hostid))
    138170USE_HOSTNAME(APPLET(hostname, _BB_DIR_BIN, _BB_SUID_NEVER))
    139171USE_HTTPD(APPLET(httpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
     
    148180USE_INSMOD(APPLET(insmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
    149181USE_INSTALL(APPLET(install, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     182#if ENABLE_FEATURE_IP_ADDRESS \
     183 || ENABLE_FEATURE_IP_ROUTE \
     184 || ENABLE_FEATURE_IP_LINK \
     185 || ENABLE_FEATURE_IP_TUNNEL \
     186 || ENABLE_FEATURE_IP_RULE
    150187USE_IP(APPLET(ip, _BB_DIR_BIN, _BB_SUID_NEVER))
     188#endif
    151189USE_IPADDR(APPLET(ipaddr, _BB_DIR_BIN, _BB_SUID_NEVER))
    152190USE_IPCALC(APPLET(ipcalc, _BB_DIR_BIN, _BB_SUID_NEVER))
     
    155193USE_IPLINK(APPLET(iplink, _BB_DIR_BIN, _BB_SUID_NEVER))
    156194USE_IPROUTE(APPLET(iproute, _BB_DIR_BIN, _BB_SUID_NEVER))
     195USE_IPRULE(APPLET(iprule, _BB_DIR_BIN, _BB_SUID_NEVER))
    157196USE_IPTUNNEL(APPLET(iptunnel, _BB_DIR_BIN, _BB_SUID_NEVER))
    158197USE_KILL(APPLET(kill, _BB_DIR_BIN, _BB_SUID_NEVER))
    159198USE_KILLALL(APPLET_ODDNAME(killall, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall))
     199USE_KILLALL5(APPLET_ODDNAME(killall5, kill, _BB_DIR_USR_BIN, _BB_SUID_NEVER, killall5))
    160200USE_KLOGD(APPLET(klogd, _BB_DIR_SBIN, _BB_SUID_NEVER))
    161201USE_LASH(APPLET(lash, _BB_DIR_BIN, _BB_SUID_NEVER))
    162202USE_LAST(APPLET(last, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    163 USE_LENGTH(APPLET(length, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     203USE_LENGTH(APPLET_NOFORK(length, length, _BB_DIR_USR_BIN, _BB_SUID_NEVER, length))
    164204USE_LESS(APPLET(less, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    165205USE_SETARCH(APPLET_NOUSAGE(linux32, setarch, _BB_DIR_BIN, _BB_SUID_NEVER))
    166206USE_SETARCH(APPLET_NOUSAGE(linux64, setarch, _BB_DIR_BIN, _BB_SUID_NEVER))
    167207USE_FEATURE_INITRD(APPLET_NOUSAGE(linuxrc, init, _BB_DIR_ROOT, _BB_SUID_NEVER))
    168 USE_LN(APPLET(ln, _BB_DIR_BIN, _BB_SUID_NEVER))
     208USE_LN(APPLET_NOEXEC(ln, ln, _BB_DIR_BIN, _BB_SUID_NEVER, ln))
     209USE_LOAD_POLICY(APPLET(load_policy, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
    169210USE_LOADFONT(APPLET(loadfont, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    170211USE_LOADKMAP(APPLET(loadkmap, _BB_DIR_SBIN, _BB_SUID_NEVER))
    171212USE_LOGGER(APPLET(logger, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    172213USE_LOGIN(APPLET(login, _BB_DIR_BIN, _BB_SUID_ALWAYS))
    173 USE_LOGNAME(APPLET(logname, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     214USE_LOGNAME(APPLET_NOFORK(logname, logname, _BB_DIR_USR_BIN, _BB_SUID_NEVER, logname))
    174215USE_LOGREAD(APPLET(logread, _BB_DIR_SBIN, _BB_SUID_NEVER))
    175216USE_LOSETUP(APPLET(losetup, _BB_DIR_SBIN, _BB_SUID_NEVER))
    176 USE_LS(APPLET(ls, _BB_DIR_BIN, _BB_SUID_NEVER))
     217USE_LS(APPLET_NOEXEC(ls, ls, _BB_DIR_BIN, _BB_SUID_NEVER, ls))
    177218USE_LSATTR(APPLET(lsattr, _BB_DIR_BIN, _BB_SUID_NEVER))
    178219USE_LSMOD(APPLET(lsmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
    179220USE_UNLZMA(APPLET_ODDNAME(lzmacat, unlzma, _BB_DIR_USR_BIN, _BB_SUID_NEVER, lzmacat))
    180221USE_MAKEDEVS(APPLET(makedevs, _BB_DIR_SBIN, _BB_SUID_NEVER))
    181 USE_MD5SUM(APPLET(md5sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     222USE_MATCHPATHCON(APPLET(matchpathcon, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
     223USE_MD5SUM(APPLET_ODDNAME(md5sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, md5sum))
    182224USE_MDEV(APPLET(mdev, _BB_DIR_SBIN, _BB_SUID_NEVER))
    183225USE_MESG(APPLET(mesg, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    184 USE_MKDIR(APPLET(mkdir, _BB_DIR_BIN, _BB_SUID_NEVER))
    185 USE_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
     226USE_MKDIR(APPLET_NOFORK(mkdir, mkdir, _BB_DIR_BIN, _BB_SUID_NEVER, mkdir))
     227//USE_MKE2FS(APPLET(mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
    186228USE_MKFIFO(APPLET(mkfifo, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    187 USE_MKE2FS(APPLET_NOUSAGE(mkfs.ext2, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
    188 USE_MKE2FS(APPLET_NOUSAGE(mkfs.ext3, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
     229//USE_MKE2FS(APPLET_NOUSAGE(mkfs.ext2, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
     230//USE_MKE2FS(APPLET_NOUSAGE(mkfs.ext3, mke2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
    189231USE_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, _BB_DIR_SBIN, _BB_SUID_NEVER, mkfs_minix))
    190232USE_MKNOD(APPLET(mknod, _BB_DIR_BIN, _BB_SUID_NEVER))
     
    193235USE_MODPROBE(APPLET(modprobe, _BB_DIR_SBIN, _BB_SUID_NEVER))
    194236USE_MORE(APPLET(more, _BB_DIR_BIN, _BB_SUID_NEVER))
    195 USE_MOUNT(APPLET(mount, _BB_DIR_BIN, _BB_SUID_NEVER))
     237USE_MOUNT(APPLET(mount, _BB_DIR_BIN, USE_DESKTOP(_BB_SUID_MAYBE) SKIP_DESKTOP(_BB_SUID_NEVER)))
    196238USE_MOUNTPOINT(APPLET(mountpoint, _BB_DIR_BIN, _BB_SUID_NEVER))
    197239USE_MSH(APPLET_NOUSAGE(msh, msh, _BB_DIR_BIN, _BB_SUID_NEVER))
     
    202244USE_NETSTAT(APPLET(netstat, _BB_DIR_BIN, _BB_SUID_NEVER))
    203245USE_NICE(APPLET(nice, _BB_DIR_BIN, _BB_SUID_NEVER))
     246USE_NMETER(APPLET(nmeter, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    204247USE_NOHUP(APPLET(nohup, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    205248USE_NSLOOKUP(APPLET(nslookup, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     
    217260USE_PRINTF(APPLET(printf, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    218261USE_PS(APPLET(ps, _BB_DIR_BIN, _BB_SUID_NEVER))
    219 USE_PWD(APPLET(pwd, _BB_DIR_BIN, _BB_SUID_NEVER))
     262USE_PSCAN(APPLET(pscan, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     263USE_PWD(APPLET_NOFORK(pwd, pwd, _BB_DIR_BIN, _BB_SUID_NEVER, pwd))
     264USE_RAIDAUTORUN(APPLET(raidautorun, _BB_DIR_SBIN, _BB_SUID_NEVER))
    220265USE_RDATE(APPLET(rdate, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
     266USE_READAHEAD(APPLET(readahead, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    221267USE_READLINK(APPLET(readlink, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    222268USE_READPROFILE(APPLET(readprofile, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
     
    225271USE_RENICE(APPLET(renice, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    226272USE_RESET(APPLET(reset, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    227 USE_RM(APPLET(rm, _BB_DIR_BIN, _BB_SUID_NEVER))
    228 USE_RMDIR(APPLET(rmdir, _BB_DIR_BIN, _BB_SUID_NEVER))
     273USE_RESIZE(APPLET(resize, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     274USE_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, _BB_DIR_SBIN, _BB_SUID_NEVER, restorecon))
     275USE_RM(APPLET_NOFORK(rm, rm, _BB_DIR_BIN, _BB_SUID_NEVER, rm))
     276USE_RMDIR(APPLET_NOFORK(rmdir, rmdir, _BB_DIR_BIN, _BB_SUID_NEVER, rmdir))
    229277USE_RMMOD(APPLET(rmmod, _BB_DIR_SBIN, _BB_SUID_NEVER))
    230278USE_ROUTE(APPLET(route, _BB_DIR_SBIN, _BB_SUID_NEVER))
     
    232280USE_RPM2CPIO(APPLET(rpm2cpio, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    233281USE_RUN_PARTS(APPLET_ODDNAME(run-parts, run_parts, _BB_DIR_BIN, _BB_SUID_NEVER, run_parts))
     282USE_RUNCON(APPLET(runcon, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    234283USE_RUNLEVEL(APPLET(runlevel, _BB_DIR_SBIN, _BB_SUID_NEVER))
     284USE_RUNSV(APPLET(runsv, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     285USE_RUNSVDIR(APPLET(runsvdir, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    235286USE_RX(APPLET(rx, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    236287USE_SED(APPLET(sed, _BB_DIR_BIN, _BB_SUID_NEVER))
    237 USE_SEQ(APPLET(seq, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     288USE_SELINUXENABLED(APPLET(selinuxenabled, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
     289USE_SEQ(APPLET_NOFORK(seq, seq, _BB_DIR_USR_BIN, _BB_SUID_NEVER, seq))
    238290USE_SETARCH(APPLET(setarch, _BB_DIR_BIN, _BB_SUID_NEVER))
    239291USE_SETCONSOLE(APPLET(setconsole, _BB_DIR_SBIN, _BB_SUID_NEVER))
     292USE_SETENFORCE(APPLET(setenforce, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
     293USE_SETFILES(APPLET(setfiles, _BB_DIR_SBIN, _BB_SUID_NEVER))
    240294USE_SETKEYCODES(APPLET(setkeycodes, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    241295USE_SETLOGCONS(APPLET(setlogcons, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
    242296USE_SETSID(APPLET(setsid, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     297USE_SETUIDGID(APPLET_ODDNAME(setuidgid, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, setuidgid))
    243298USE_FEATURE_SH_IS_ASH(APPLET_NOUSAGE(sh, ash, _BB_DIR_BIN, _BB_SUID_NEVER))
    244299USE_FEATURE_SH_IS_HUSH(APPLET_NOUSAGE(sh, hush, _BB_DIR_BIN, _BB_SUID_NEVER))
    245300USE_FEATURE_SH_IS_LASH(APPLET_NOUSAGE(sh, lash, _BB_DIR_BIN, _BB_SUID_NEVER))
    246301USE_FEATURE_SH_IS_MSH(APPLET_NOUSAGE(sh, msh, _BB_DIR_BIN, _BB_SUID_NEVER))
    247 USE_SHA1SUM(APPLET(sha1sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    248 USE_SLEEP(APPLET(sleep, _BB_DIR_BIN, _BB_SUID_NEVER))
    249 USE_SORT(APPLET(sort, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     302USE_SHA1SUM(APPLET_ODDNAME(sha1sum, md5_sha1_sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sha1sum))
     303USE_SLATTACH(APPLET(slattach, _BB_DIR_SBIN, _BB_SUID_NEVER))
     304USE_SLEEP(APPLET_NOFORK(sleep, sleep, _BB_DIR_BIN, _BB_SUID_NEVER, sleep))
     305USE_SOFTLIMIT(APPLET_ODDNAME(softlimit, chpst, _BB_DIR_USR_BIN, _BB_SUID_NEVER, softlimit))
     306USE_SORT(APPLET_NOEXEC(sort, sort, _BB_DIR_USR_BIN, _BB_SUID_NEVER, sort))
     307USE_SPLIT(APPLET(split, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    250308USE_START_STOP_DAEMON(APPLET_ODDNAME(start-stop-daemon, start_stop_daemon, _BB_DIR_SBIN, _BB_SUID_NEVER, start_stop_daemon))
    251309USE_STAT(APPLET(stat, _BB_DIR_BIN, _BB_SUID_NEVER))
     
    255313USE_SULOGIN(APPLET(sulogin, _BB_DIR_SBIN, _BB_SUID_NEVER))
    256314USE_SUM(APPLET(sum, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     315USE_SV(APPLET(sv, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     316USE_SVLOGD(APPLET(svlogd, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    257317USE_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER,swapoff))
    258318USE_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, _BB_DIR_SBIN, _BB_SUID_NEVER, swapon))
    259319USE_SWITCH_ROOT(APPLET(switch_root, _BB_DIR_SBIN, _BB_SUID_NEVER))
    260 USE_SYNC(APPLET(sync, _BB_DIR_BIN, _BB_SUID_NEVER))
     320USE_SYNC(APPLET_NOFORK(sync, sync, _BB_DIR_BIN, _BB_SUID_NEVER, sync))
    261321USE_BB_SYSCTL(APPLET(sysctl, _BB_DIR_SBIN, _BB_SUID_NEVER))
    262322USE_SYSLOGD(APPLET(syslogd, _BB_DIR_SBIN, _BB_SUID_NEVER))
    263323USE_TAIL(APPLET(tail, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    264324USE_TAR(APPLET(tar, _BB_DIR_BIN, _BB_SUID_NEVER))
     325USE_TASKSET(APPLET(taskset, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     326USE_TCPSVD(APPLET_ODDNAME(tcpsvd, tcpudpsvd, _BB_DIR_USR_BIN, _BB_SUID_NEVER, tcpsvd))
    265327USE_TEE(APPLET(tee, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    266328USE_TELNET(APPLET(telnet, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    267329USE_TELNETD(APPLET(telnetd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
    268 USE_TEST(APPLET(test, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     330USE_TEST(APPLET_NOEXEC(test, test, _BB_DIR_USR_BIN, _BB_SUID_NEVER, test))
     331#if ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT
    269332USE_TFTP(APPLET(tftp, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     333#endif
    270334USE_TIME(APPLET(time, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    271335USE_TOP(APPLET(top, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    272 USE_TOUCH(APPLET(touch, _BB_DIR_BIN, _BB_SUID_NEVER))
     336USE_TOUCH(APPLET_NOFORK(touch, touch, _BB_DIR_BIN, _BB_SUID_NEVER, touch))
    273337USE_TR(APPLET(tr, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    274338USE_TRACEROUTE(APPLET(traceroute, _BB_DIR_USR_BIN, _BB_SUID_MAYBE))
    275 USE_TRUE(APPLET(true, _BB_DIR_BIN, _BB_SUID_NEVER))
     339USE_TRUE(APPLET_NOFORK(true, true, _BB_DIR_BIN, _BB_SUID_NEVER, true))
    276340USE_TTY(APPLET(tty, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    277 USE_TUNE2FS(APPLET(tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
     341USE_TTYSIZE(APPLET(ttysize, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     342//USE_TUNE2FS(APPLET(tune2fs, _BB_DIR_SBIN, _BB_SUID_NEVER))
    278343USE_APP_UDHCPC(APPLET(udhcpc, _BB_DIR_SBIN, _BB_SUID_NEVER))
    279344USE_APP_UDHCPD(APPLET(udhcpd, _BB_DIR_USR_SBIN, _BB_SUID_NEVER))
     345USE_UDPSVD(APPLET_ODDNAME(udpsvd, tcpudpsvd, _BB_DIR_USR_BIN, _BB_SUID_NEVER, udpsvd))
    280346USE_UMOUNT(APPLET(umount, _BB_DIR_BIN, _BB_SUID_NEVER))
    281347USE_UNAME(APPLET(uname, _BB_DIR_BIN, _BB_SUID_NEVER))
    282348USE_UNCOMPRESS(APPLET(uncompress, _BB_DIR_BIN, _BB_SUID_NEVER))
     349USE_UNEXPAND(APPLET_ODDNAME(unexpand, expand, _BB_DIR_USR_BIN, _BB_SUID_NEVER, unexpand))
    283350USE_UNIQ(APPLET(uniq, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    284351USE_UNIX2DOS(APPLET_ODDNAME(unix2dos, dos2unix, _BB_DIR_USR_BIN, _BB_SUID_NEVER, unix2dos))
     
    286353USE_UNZIP(APPLET(unzip, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    287354USE_UPTIME(APPLET(uptime, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    288 USE_USLEEP(APPLET(usleep, _BB_DIR_BIN, _BB_SUID_NEVER))
     355USE_USLEEP(APPLET_NOFORK(usleep, usleep, _BB_DIR_BIN, _BB_SUID_NEVER, usleep))
    289356USE_UUDECODE(APPLET(uudecode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    290357USE_UUENCODE(APPLET(uuencode, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     
    298365USE_WHICH(APPLET(which, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    299366USE_WHO(APPLET(who, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    300 USE_WHOAMI(APPLET(whoami, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    301 USE_XARGS(APPLET(xargs, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
    302 USE_YES(APPLET(yes, _BB_DIR_USR_BIN, _BB_SUID_NEVER))
     367USE_WHOAMI(APPLET_NOFORK(whoami, whoami, _BB_DIR_USR_BIN, _BB_SUID_NEVER, whoami))
     368USE_XARGS(APPLET_NOEXEC(xargs, xargs, _BB_DIR_USR_BIN, _BB_SUID_NEVER, xargs))
     369USE_YES(APPLET_NOFORK(yes, yes, _BB_DIR_USR_BIN, _BB_SUID_NEVER, yes))
    303370USE_GUNZIP(APPLET_ODDNAME(zcat, gunzip, _BB_DIR_BIN, _BB_SUID_NEVER, zcat))
    304371USE_ZCIP(APPLET(zcip, _BB_DIR_SBIN, _BB_SUID_NEVER))
    305372
    306373#if !defined(PROTOTYPES) && !defined(MAKE_USAGE)
    307     { 0,NULL,0,0 }
     374    { NULL }
    308375};
    309 
    310 #endif
     376#endif
     377
     378#undef APPLET
     379#undef APPLET_NOUSAGE
     380#undef APPLET_ODDNAME
     381#undef APPLET_NOEXEC
     382#undef APPLET_NOFORK
  • branches/stable/mindi-busybox/include/busybox.h

    r821 r1770  
    88#define _BB_INTERNAL_H_    1
    99
    10 #include "bb_config.h"
    11 
    1210#include "libbb.h"
    1311
    14 /* order matters:  used as index into "install_dir[]" in busybox.c */
    15 enum Location {
     12#if ENABLE_FEATURE_INSTALLER
     13/* order matters: used as index into "install_dir[]" in busybox.c */
     14typedef enum bb_install_loc_t {
    1615    _BB_DIR_ROOT = 0,
    1716    _BB_DIR_BIN,
     
    1918    _BB_DIR_USR_BIN,
    2019    _BB_DIR_USR_SBIN
    21 };
     20} bb_install_loc_t;
     21#endif
    2222
    23 enum SUIDRoot {
     23#if ENABLE_FEATURE_SUID
     24typedef enum bb_suid_t {
    2425    _BB_SUID_NEVER = 0,
    2526    _BB_SUID_MAYBE,
    2627    _BB_SUID_ALWAYS
     28} bb_suid_t;
     29#endif
     30
     31struct bb_applet {
     32    const char *name;
     33    int (*main) (int argc, char **argv);
     34#if ENABLE_FEATURE_INSTALLER
     35    __extension__ enum bb_install_loc_t install_loc:8;
     36#endif
     37#if ENABLE_FEATURE_SUID
     38    __extension__ enum bb_suid_t need_suid:8;
     39#endif
     40#if ENABLE_FEATURE_PREFER_APPLETS
     41    /* true if instead of fork(); exec("applet"); waitpid();
     42     * one can do fork(); exit(applet_main(argc,argv)); waitpid(); */
     43    unsigned char noexec;
     44    /* Even nicer */
     45    /* true if instead of fork(); exec("applet"); waitpid();
     46     * one can simply call applet_main(argc,argv); */
     47    unsigned char nofork;
     48#endif
    2749};
    2850
    29 struct BB_applet {
    30     const char *name;
    31     int (*main) (int argc, char **argv);
    32     __extension__ enum Location location:4;
    33     __extension__ enum SUIDRoot need_suid:4;
    34 };
     51/* Defined in applet.c */
     52extern const struct bb_applet applets[];
     53extern const unsigned short NUM_APPLETS;
    3554
    36 /* From busybox.c */
    37 extern const struct BB_applet applets[];
    38 
    39 /* Automagically pull in all the applet function prototypes and
    40  * applet usage strings.  These are all of the form:
    41  *      extern int foo_main(int argc, char **argv);
    42  *      extern const char foo_usage[];
    43  * These are all autogenerated from the set of currently defined applets.
    44  */
    45 #define PROTOTYPES
    46 #include "applets.h"
    47 #undef PROTOTYPES
    48 
    49 #endif                          /* _BB_INTERNAL_H_ */
     55#endif  /* _BB_INTERNAL_H_ */
  • branches/stable/mindi-busybox/include/dump.h

    r821 r1770  
     1/* vi: set sw=4 ts=4: */
    12#define F_IGNORE    0x01        /* %_A */
    23#define F_SETREP    0x02        /* rep count set, not default */
     
    4041
    4142extern void bb_dump_add(const char *fmt);
    42 extern int bb_dump_dump (char **argv);
     43extern int bb_dump_dump(char **argv);
    4344extern int bb_dump_size(FS * fs);
    4445
  • branches/stable/mindi-busybox/include/grp_.h

    r821 r1770  
     1/* vi: set sw=4 ts=4: */
    12/* Copyright (C) 1991,92,95,96,97,98,99,2000,01 Free Software Foundation, Inc.
    23   This file is part of the GNU C Library.
     
    2122 */
    2223
     24#if !ENABLE_USE_BB_PWD_GRP
    2325
    24 #if !defined CONFIG_USE_BB_PWD_GRP
    2526#include <grp.h>
    2627
     
    2829
    2930#ifndef _GRP_H
    30 #define _GRP_H  1
     31#define _GRP_H 1
     32
     33/* The group structure.  */
     34struct group {
     35    char *gr_name;          /* Group name.  */
     36    char *gr_passwd;        /* Password.    */
     37    gid_t gr_gid;           /* Group ID.    */
     38    char **gr_mem;          /* Member list. */
     39};
     40
     41/* We don't reimplement this, just supplying prototype */
     42/* The function itself is in libc */
     43/* Set the group set for the current user to GROUPS (N of them).  */
     44extern int setgroups(size_t __n, __const gid_t *__groups);
    3145
    3246
    33 #include <sys/types.h>
    34 #include <features.h>
    35 #include <stdio.h>
     47#define setgrent     bb_internal_setgrent
     48#define endgrent     bb_internal_endgrent
     49#define getgrent     bb_internal_getgrent
     50#define fgetgrent    bb_internal_fgetgrent
     51#define putgrent     bb_internal_putgrent
     52#define getgrgid     bb_internal_getgrgid
     53#define getgrnam     bb_internal_getgrnam
     54#define getgrent_r   bb_internal_getgrent_r
     55#define getgrgid_r   bb_internal_getgrgid_r
     56#define getgrnam_r   bb_internal_getgrnam_r
     57#define fgetgrent_r  bb_internal_fgetgrent_r
     58#define getgrouplist bb_internal_getgrouplist
     59#define initgroups   bb_internal_initgroups
    3660
    3761
    38 /* The group structure.  */
    39 struct group
    40 {
    41     char *gr_name;      /* Group name.  */
    42     char *gr_passwd;        /* Password.    */
    43     gid_t gr_gid;       /* Group ID.    */
    44     char **gr_mem;      /* Member list. */
    45 };
     62/* All function names below should be remapped by #defines above
     63 * in order to not collide with libc names.
     64 * In theory it isn't necessary, but I saw weird interactions at link time.
     65 * Let's play safe */
    4666
    4767
    4868/* Rewind the group-file stream.  */
    49 extern void setgrent (void);
     69extern void setgrent(void);
    5070
    5171/* Close the group-file stream.  */
    52 extern void endgrent (void);
     72extern void endgrent(void);
    5373
    5474/* Read an entry from the group-file stream, opening it if necessary.  */
    55 extern struct group *getgrent (void);
     75extern struct group *getgrent(void);
    5676
    5777/* Read a group entry from STREAM.  */
    58 extern struct group *fgetgrent (FILE *__stream);
     78extern struct group *fgetgrent(FILE *__stream);
    5979
    6080/* Write the given entry onto the given stream.  */
    61 extern int putgrent (__const struct group *__restrict __p,
     81extern int putgrent(__const struct group *__restrict __p,
    6282             FILE *__restrict __f);
    6383
    6484/* Search for an entry with a matching group ID.  */
    65 extern struct group *getgrgid (gid_t __gid);
     85extern struct group *getgrgid(gid_t __gid);
    6686
    6787/* Search for an entry with a matching group name.  */
    68 extern struct group *getgrnam (__const char *__name);
     88extern struct group *getgrnam(__const char *__name);
    6989
    7090/* Reentrant versions of some of the functions above.
     
    7696   POSIX people would choose.  */
    7797
    78 extern int getgrent_r (struct group *__restrict __resultbuf,
     98extern int getgrent_r(struct group *__restrict __resultbuf,
    7999               char *__restrict __buffer, size_t __buflen,
    80100               struct group **__restrict __result);
    81101
    82102/* Search for an entry with a matching group ID.  */
    83 extern int getgrgid_r (gid_t __gid, struct group *__restrict __resultbuf,
     103extern int getgrgid_r(gid_t __gid, struct group *__restrict __resultbuf,
    84104               char *__restrict __buffer, size_t __buflen,
    85105               struct group **__restrict __result);
    86106
    87107/* Search for an entry with a matching group name.  */
    88 extern int getgrnam_r (__const char *__restrict __name,
     108extern int getgrnam_r(__const char *__restrict __name,
    89109               struct group *__restrict __resultbuf,
    90110               char *__restrict __buffer, size_t __buflen,
     
    93113/* Read a group entry from STREAM.  This function is not standardized
    94114   an probably never will.  */
    95 extern int fgetgrent_r (FILE *__restrict __stream,
     115extern int fgetgrent_r(FILE *__restrict __stream,
    96116            struct group *__restrict __resultbuf,
    97117            char *__restrict __buffer, size_t __buflen,
    98118            struct group **__restrict __result);
    99119
    100 /* Set the group set for the current user to GROUPS (N of them).  */
    101 extern int setgroups (size_t __n, __const gid_t *__groups);
    102 
    103120/* Store at most *NGROUPS members of the group set for USER into
    104121   *GROUPS.  Also include GROUP.  The actual number of groups found is
    105122   returned in *NGROUPS.  Return -1 if the if *NGROUPS is too small.  */
    106 extern int getgrouplist (__const char *__user, gid_t __group,
     123extern int getgrouplist(__const char *__user, gid_t __group,
    107124             gid_t *__groups, int *__ngroups);
    108125
     
    110127   by reading the group database and using all groups
    111128   of which USER is a member.  Also include GROUP.  */
    112 extern int initgroups (__const char *__user, gid_t __group);
     129extern int initgroups(__const char *__user, gid_t __group);
    113130
    114131
  • branches/stable/mindi-busybox/include/inet_common.h

    r821 r1770  
     1/* vi: set sw=4 ts=4: */
    12/*
    23 * stolen from net-tools-1.59 and stripped down for busybox by
     
    56 * Heavily modified by Manuel Novoa III       Mar 12, 2001
    67 *
    7  * Version:     $Id: inet_common.h,v 1.4 2004/03/10 07:42:37 mjn3 Exp $
    8  *
    98 */
    109
    11 #include <features.h>
    12 #include <sys/types.h>
    13 #include <sys/socket.h>
    1410#include "platform.h"
    15 
    16 
    17 extern const char bb_INET_default[];    /* = "default" */
    1811
    1912/* hostfirst!=0 If we expect this to be a hostname,
    2013   try hostname database first
    2114 */
    22 extern int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst);
     15int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst);
    2316
    24 
    25 /* numeric: & 0x8000: default instead of *,
     17/* numeric: & 0x8000: "default" instead of "*",
    2618 *          & 0x4000: host instead of net,
    2719 *          & 0x0fff: don't resolve
    2820 */
    29 extern int INET_rresolve(char *name, size_t len, struct sockaddr_in *s_in,
    30              int numeric, unsigned int netmask);
    3121
    32 extern int INET6_resolve(const char *name, struct sockaddr_in6 *sin6);
    33 extern int INET6_rresolve(char *name, size_t len, struct sockaddr_in6 *sin6, int numeric);
     22int INET6_resolve(const char *name, struct sockaddr_in6 *sin6);
     23
     24/* These return malloced string */
     25char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask);
     26char *INET6_rresolve(struct sockaddr_in6 *sin6, int numeric);
  • branches/stable/mindi-busybox/include/libbb.h

    r821 r1770  
    33 * Busybox main internal header file
    44 *
    5  * Licensed under the GPL v2 or later, see the file LICENSE in this tarball.
    6  *
    75 * Based in part on code from sash, Copyright (c) 1999 by David I. Bell
    86 * Permission has been granted to redistribute this code under the GPL.
    97 *
     8 * Licensed under the GPL version 2, see the file LICENSE in this tarball.
    109 */
    1110#ifndef __LIBBUSYBOX_H__
    1211#define __LIBBUSYBOX_H__    1
    1312
    14 #include "bb_config.h"
    1513#include "platform.h"
    1614
    1715#include <ctype.h>
    1816#include <dirent.h>
     17#include <errno.h>
    1918#include <fcntl.h>
    2019#include <inttypes.h>
     20#include <mntent.h>
    2121#include <netdb.h>
     22#include <setjmp.h>
     23#include <signal.h>
    2224#include <stdio.h>
    2325#include <stdlib.h>
    2426#include <stdarg.h>
     27#include <stddef.h>
    2528#include <string.h>
    26 #include <strings.h>
     29/* #include <strings.h> - said to be obsolete */
     30#include <sys/ioctl.h>
     31#include <sys/mman.h>
    2732#include <sys/socket.h>
    2833#include <sys/stat.h>
     34#include <sys/statfs.h>
    2935#include <sys/time.h>
    3036#include <sys/types.h>
     37#include <sys/wait.h>
    3138#include <termios.h>
     39#include <time.h>
    3240#include <unistd.h>
    33 
    34 #ifdef CONFIG_SELINUX
     41#include <utime.h>
     42
     43#if ENABLE_SELINUX
    3544#include <selinux/selinux.h>
     45#include <selinux/context.h>
     46#endif
     47
     48#if ENABLE_LOCALE_SUPPORT
     49#include <locale.h>
     50#else
     51#define setlocale(x,y) ((void)0)
    3652#endif
    3753
    3854#include "pwd_.h"
    3955#include "grp_.h"
    40 #ifdef CONFIG_FEATURE_SHADOWPASSWDS
     56/* ifdef it out, because it may include <shadow.h> */
     57/* and we may not even _have_ <shadow.h>! */
     58#if ENABLE_FEATURE_SHADOWPASSWDS
    4159#include "shadow_.h"
    42 #endif
    43 #ifdef CONFIG_FEATURE_SHA1_PASSWORDS
    44 # include "sha1.h"
    4560#endif
    4661
     
    4964#include <sys/param.h>
    5065#ifndef PATH_MAX
    51 #define  PATH_MAX         256
    52 #endif
    53 
    54 #ifdef DMALLOC
    55 #include <dmalloc.h>
    56 #endif
     66#define PATH_MAX 256
     67#endif
     68
     69/* Tested to work correctly (IIRC :]) */
     70#define MAXINT(T) (T)( \
     71    ((T)-1) > 0 \
     72    ? (T)-1 \
     73    : (T)~((T)1 << (sizeof(T)*8-1)) \
     74    )
     75
     76#define MININT(T) (T)( \
     77    ((T)-1) > 0 \
     78    ? (T)0 \
     79    : ((T)1 << (sizeof(T)*8-1)) \
     80    )
     81
     82/* Large file support */
     83/* Note that CONFIG_LFS forces bbox to be built with all common ops
     84 * (stat, lseek etc) mapped to "largefile" variants by libc.
     85 * Practically it means that open() automatically has O_LARGEFILE added
     86 * and all filesize/file_offset parameters and struct members are "large"
     87 * (in today's world - signed 64bit). For full support of large files,
     88 * we need a few helper #defines (below) and careful use of off_t
     89 * instead of int/ssize_t. No lseek64(), O_LARGEFILE etc necessary */
     90#if ENABLE_LFS
     91/* CONFIG_LFS is on */
     92# if ULONG_MAX > 0xffffffff
     93/* "long" is long enough on this system */
     94#  define XATOOFF(a) xatoul_range(a, 0, LONG_MAX)
     95/* usage: sz = BB_STRTOOFF(s, NULL, 10); if (errno || sz < 0) die(); */
     96#  define BB_STRTOOFF bb_strtoul
     97#  define STRTOOFF strtoul
     98/* usage: printf("size: %"OFF_FMT"d (%"OFF_FMT"x)\n", sz, sz); */
     99#  define OFF_FMT "l"
     100# else
     101/* "long" is too short, need "long long" */
     102#  define XATOOFF(a) xatoull_range(a, 0, LLONG_MAX)
     103#  define BB_STRTOOFF bb_strtoull
     104#  define STRTOOFF strtoull
     105#  define OFF_FMT "ll"
     106# endif
     107#else
     108/* CONFIG_LFS is off */
     109# if UINT_MAX == 0xffffffff
     110/* While sizeof(off_t) == sizeof(int), off_t is typedef'ed to long anyway.
     111 * gcc will throw warnings on printf("%d", off_t). Crap... */
     112#  define XATOOFF(a) xatoi_u(a)
     113#  define BB_STRTOOFF bb_strtou
     114#  define STRTOOFF strtol
     115#  define OFF_FMT "l"
     116# else
     117#  define XATOOFF(a) xatoul_range(a, 0, LONG_MAX)
     118#  define BB_STRTOOFF bb_strtoul
     119#  define STRTOOFF strtol
     120#  define OFF_FMT "l"
     121# endif
     122#endif
     123/* scary. better ideas? (but do *test* them first!) */
     124#define OFF_T_MAX  ((off_t)~((off_t)1 << (sizeof(off_t)*8-1)))
    57125
    58126/* Some useful definitions */
     
    81149
    82150/* buffer allocation schemes */
    83 #ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK
    84 #define RESERVE_CONFIG_BUFFER(buffer,len)           char buffer[len]
     151#if ENABLE_FEATURE_BUFFERS_GO_ON_STACK
     152#define RESERVE_CONFIG_BUFFER(buffer,len)  char buffer[len]
    85153#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len]
    86154#define RELEASE_CONFIG_BUFFER(buffer)      ((void)0)
    87155#else
    88 #ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS
     156#if ENABLE_FEATURE_BUFFERS_GO_IN_BSS
    89157#define RESERVE_CONFIG_BUFFER(buffer,len)  static          char buffer[len]
    90158#define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len]
    91159#define RELEASE_CONFIG_BUFFER(buffer)      ((void)0)
    92160#else
    93 #define RESERVE_CONFIG_BUFFER(buffer,len)           char *buffer=xmalloc(len)
    94 #define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
    95 #define RELEASE_CONFIG_BUFFER(buffer)      free (buffer)
    96 #endif
    97 #endif
    98 
    99 
    100 typedef struct llist_s {
    101     char *data;
    102     struct llist_s *link;
    103 } llist_t;
    104 extern void llist_add_to(llist_t **old_head, void *data);
    105 extern void llist_add_to_end(llist_t **list_head, void *data);
    106 extern void *llist_pop(llist_t **elm);
    107 extern void llist_free(llist_t *elm, void (*freeit)(void *data));
    108 
    109 
    110 extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
    111 extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
    112 extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
    113 extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
    114 extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
    115 extern void bb_vherror_msg(const char *s, va_list p);
    116 extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
    117 extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
    118 
    119 extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN;
    120 extern void bb_perror_nomsg(void);
    121 
    122 /* These two are used internally -- you shouldn't need to use them */
    123 extern void bb_verror_msg(const char *s, va_list p) __attribute__ ((format (printf, 1, 0)));
    124 extern void bb_vperror_msg(const char *s, va_list p)  __attribute__ ((format (printf, 1, 0)));
    125 
    126 extern int bb_echo(int argc, char** argv);
    127 extern int bb_test(int argc, char** argv);
    128 
    129 extern const char *bb_mode_string(int mode);
    130 extern int is_directory(const char *name, int followLinks, struct stat *statBuf);
    131 extern DIR *bb_opendir(const char *path);
    132 extern DIR *bb_xopendir(const char *path);
    133 
    134 extern int remove_file(const char *path, int flags);
    135 extern int copy_file(const char *source, const char *dest, int flags);
    136 extern ssize_t safe_read(int fd, void *buf, size_t count);
    137 extern ssize_t bb_full_read(int fd, void *buf, size_t len);
    138 extern ssize_t safe_write(int fd, const void *buf, size_t count);
    139 extern ssize_t bb_full_write(int fd, const void *buf, size_t len);
    140 extern int recursive_action(const char *fileName, int recurse,
    141       int followLinks, int depthFirst,
    142       int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData),
    143       int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData),
    144       void* userData);
    145 
    146 extern int bb_parse_mode( const char* s, mode_t* theMode);
    147 extern long bb_xgetlarg(const char *arg, int base, long lower, long upper);
    148 
    149 extern unsigned int tty_baud_to_value(speed_t speed);
    150 extern speed_t tty_value_to_baud(unsigned int value);
    151 
    152 extern int get_linux_version_code(void);
    153 
    154 extern int get_console_fd(void);
    155 extern struct mntent *find_mount_point(const char *name, const char *table);
    156 extern void erase_mtab(const char * name);
    157 extern long *find_pid_by_name( const char* pidName);
    158 extern long *pidlist_reverse(long *pidList);
    159 extern char *find_block_device(char *path);
    160 extern char *bb_get_line_from_file(FILE *file);
    161 extern char *bb_get_chomped_line_from_file(FILE *file);
    162 extern char *bb_get_chunk_from_file(FILE *file, int *end);
    163 extern int bb_copyfd_size(int fd1, int fd2, const off_t size);
    164 extern int bb_copyfd_eof(int fd1, int fd2);
    165 extern void  bb_xprint_and_close_file(FILE *file);
    166 extern int   bb_xprint_file_by_name(const char *filename);
    167 extern char  bb_process_escape_sequence(const char **ptr);
    168 extern char *bb_get_last_path_component(char *path);
    169 extern FILE *bb_wfopen(const char *path, const char *mode);
    170 extern FILE *bb_wfopen_input(const char *filename);
    171 extern FILE *bb_xfopen(const char *path, const char *mode);
    172 
    173 extern int   bb_fclose_nonstdin(FILE *f);
    174 extern void  bb_fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN;
    175 
    176 extern void xstat(const char *filename, struct stat *buf);
    177 extern int  bb_xsocket(int domain, int type, int protocol);
    178 extern pid_t bb_spawn(char **argv);
    179 extern pid_t bb_xspawn(char **argv);
    180 extern int wait4pid(int pid);
    181 extern void bb_xdaemon(int nochdir, int noclose);
    182 extern void bb_xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen);
    183 extern void bb_xlisten(int s, int backlog);
    184 extern void bb_xchdir(const char *path);
    185 extern void xsetgid(gid_t gid);
    186 extern void xsetuid(uid_t uid);
    187 
    188 #define BB_GETOPT_ERROR 0x80000000UL
    189 extern const char *bb_opt_complementally;
    190 extern const struct option *bb_applet_long_options;
    191 extern unsigned long bb_getopt_ulflags(int argc, char **argv, const char *applet_opts, ...);
    192 
    193 extern int bb_vfprintf(FILE * __restrict stream, const char * __restrict format,
    194                        va_list arg) __attribute__ ((format (printf, 2, 0)));
    195 extern int bb_vprintf(const char * __restrict format, va_list arg)
    196     __attribute__ ((format (printf, 1, 0)));
    197 extern int bb_fprintf(FILE * __restrict stream, const char * __restrict format, ...)
    198     __attribute__ ((format (printf, 2, 3)));
    199 extern int bb_printf(const char * __restrict format, ...)
    200     __attribute__ ((format (printf, 1, 2)));
    201 
    202 //#warning rename to xferror_filename?
    203 extern void bb_xferror(FILE *fp, const char *fn);
    204 extern void bb_xferror_stdout(void);
    205 extern void bb_xfflush_stdout(void);
    206 
    207 extern void bb_warn_ignoring_args(int n);
    208 
    209 extern void chomp(char *s);
    210 extern void trim(char *s);
    211 extern char *skip_whitespace(const char *);
    212 
    213 extern struct BB_applet *find_applet_by_name(const char *name);
    214 void run_applet_by_name(const char *name, int argc, char **argv);
    215 
    216 /* dmalloc will redefine these to it's own implementation. It is safe
    217  * to have the prototypes here unconditionally.  */
    218 extern void *xmalloc(size_t size);
    219 extern void *xrealloc(void *old, size_t size);
    220 extern void *xzalloc(size_t size);
    221 extern void *xcalloc(size_t nmemb, size_t size);
    222 
    223 extern char *bb_xstrdup (const char *s);
    224 extern char *bb_xstrndup (const char *s, int n);
    225 extern char *safe_strncpy(char *dst, const char *src, size_t size);
    226 extern int safe_strtoi(char *arg, int* value);
    227 extern int safe_strtod(char *arg, double* value);
    228 extern int safe_strtol(char *arg, long* value);
    229 extern int safe_strtoul(char *arg, unsigned long* value);
    230 
    231 struct suffix_mult {
    232     const char *suffix;
    233     unsigned int mult;
    234 };
    235 
    236 extern unsigned long bb_xgetularg_bnd_sfx(const char *arg, int base,
    237                                           unsigned long lower,
    238                                           unsigned long upper,
    239                                           const struct suffix_mult *suffixes);
    240 extern unsigned long bb_xgetularg_bnd(const char *arg, int base,
    241                                       unsigned long lower,
    242                                       unsigned long upper);
    243 extern unsigned long bb_xgetularg10_bnd(const char *arg,
    244                                         unsigned long lower,
    245                                         unsigned long upper);
    246 extern unsigned long bb_xgetularg10(const char *arg);
    247 
    248 extern long bb_xgetlarg_bnd_sfx(const char *arg, int base,
    249                                 long lower,
    250                                 long upper,
    251                                 const struct suffix_mult *suffixes);
    252 extern long bb_xgetlarg10_sfx(const char *arg, const struct suffix_mult *suffixes);
    253 
    254 
    255 //#warning pitchable now?
    256 extern unsigned long bb_xparse_number(const char *numstr,
    257         const struct suffix_mult *suffixes);
    258 
    259 
    260 /* These parse entries in /etc/passwd and /etc/group.  This is desirable
    261  * for BusyBox since we want to avoid using the glibc NSS stuff, which
    262  * increases target size and is often not needed on embedded systems.  */
    263 extern long bb_xgetpwnam(const char *name);
    264 extern long bb_xgetgrnam(const char *name);
    265 extern char * bb_getug(char *buffer, char *idname, long id, int bufsize, char prefix);
    266 extern char * bb_getpwuid(char *name, long uid, int bufsize);
    267 extern char * bb_getgrgid(char *group, long gid, int bufsize);
    268 extern char *bb_askpass(int timeout, const char * prompt);
    269 
    270 extern int device_open(const char *device, int mode);
    271 
    272 extern char *query_loop(const char *device);
    273 extern int del_loop(const char *device);
    274 extern int set_loop(char **device, const char *file, int offset);
    275 
    276 #if (__GLIBC__ < 2)
    277 extern int vdprintf(int d, const char *format, va_list ap);
    278 #endif
    279 
    280 int nfsmount(const char *spec, const char *node, int *flags,
    281          char **mount_opts, int running_bg);
    282 
     161#define RESERVE_CONFIG_BUFFER(buffer,len)  char *buffer = xmalloc(len)
     162#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer = xmalloc(len)
     163#define RELEASE_CONFIG_BUFFER(buffer)      free(buffer)
     164#endif
     165#endif
     166
     167
     168#if defined(__GLIBC__)
     169/* glibc uses __errno_location() to get a ptr to errno */
     170/* We can just memorize it once - no multithreading in busybox :) */
     171extern int *const bb_errno;
     172#undef errno
     173#define errno (*bb_errno)
     174#endif
     175
     176#if defined(__GLIBC__) && __GLIBC__ < 2
     177int vdprintf(int d, const char *format, va_list ap);
     178#endif
     179// This is declared here rather than #including <libgen.h> in order to avoid
     180// confusing the two versions of basename.  See the dirname/basename man page
     181// for details.
     182char *dirname(char *path);
    283183/* Include our own copy of struct sysinfo to avoid binary compatibility
    284184 * problems with Linux 2.4, which changed things.  Grumble, grumble. */
     
    299199    char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
    300200};
    301 extern int sysinfo (struct sysinfo* info);
    302 
     201int sysinfo(struct sysinfo* info);
     202
     203unsigned long long monotonic_us(void);
     204unsigned monotonic_sec(void);
     205
     206extern void chomp(char *s);
     207extern void trim(char *s);
     208extern char *skip_whitespace(const char *);
     209extern char *skip_non_whitespace(const char *);
     210
     211//TODO: supply a pointer to char[11] buffer (avoid statics)?
     212extern const char *bb_mode_string(mode_t mode);
     213extern int is_directory(const char *name, int followLinks, struct stat *statBuf);
     214extern int remove_file(const char *path, int flags);
     215extern int copy_file(const char *source, const char *dest, int flags);
    303216enum {
    304     KILOBYTE = 1024,
    305     MEGABYTE = (KILOBYTE*1024),
    306     GIGABYTE = (MEGABYTE*1024)
    307 };
     217    ACTION_RECURSE        = (1 << 0),
     218    ACTION_FOLLOWLINKS    = (1 << 1),
     219    ACTION_FOLLOWLINKS_L0 = (1 << 2),
     220    ACTION_DEPTHFIRST     = (1 << 3),
     221    /*ACTION_REVERSE      = (1 << 4), - unused */
     222};
     223extern int recursive_action(const char *fileName, unsigned flags,
     224    int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData, int depth),
     225    int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData, int depth),
     226    void* userData, unsigned depth);
     227extern int device_open(const char *device, int mode);
     228extern int get_console_fd(void);
     229extern char *find_block_device(const char *path);
     230/* bb_copyfd_XX print read/write errors and return -1 if they occur */
     231extern off_t bb_copyfd_eof(int fd1, int fd2);
     232extern off_t bb_copyfd_size(int fd1, int fd2, off_t size);
     233extern void bb_copyfd_exact_size(int fd1, int fd2, off_t size);
     234/* "short" copy can be detected by return value < size */
     235/* this helper yells "short read!" if param is not -1 */
     236extern void complain_copyfd_and_die(off_t sz) ATTRIBUTE_NORETURN;
     237extern char bb_process_escape_sequence(const char **ptr);
     238/* TODO: sometimes modifies its parameter, which
     239 * makes it rather inconvenient at times: */
     240extern char *bb_get_last_path_component(char *path);
     241
     242int ndelay_on(int fd);
     243int ndelay_off(int fd);
     244void xdup2(int, int);
     245void xmove_fd(int, int);
     246
     247
     248DIR *xopendir(const char *path);
     249DIR *warn_opendir(const char *path);
     250
     251/* UNUSED: char *xmalloc_realpath(const char *path); */
     252char *xmalloc_readlink(const char *path);
     253char *xmalloc_readlink_or_warn(const char *path);
     254char *xrealloc_getcwd_or_warn(char *cwd);
     255
     256
     257//TODO: signal(sid, f) is the same? then why?
     258extern void sig_catch(int,void (*)(int));
     259//#define sig_ignore(s) (sig_catch((s), SIG_IGN))
     260//#define sig_uncatch(s) (sig_catch((s), SIG_DFL))
     261extern void sig_block(int);
     262extern void sig_unblock(int);
     263/* UNUSED: extern void sig_blocknone(void); */
     264extern void sig_pause(void);
     265
     266
     267void xsetgid(gid_t gid);
     268void xsetuid(uid_t uid);
     269void xchdir(const char *path);
     270void xsetenv(const char *key, const char *value);
     271void xunlink(const char *pathname);
     272void xstat(const char *pathname, struct stat *buf);
     273int xopen(const char *pathname, int flags);
     274int xopen3(const char *pathname, int flags, int mode);
     275int open_or_warn(const char *pathname, int flags);
     276int open3_or_warn(const char *pathname, int flags, int mode);
     277void xpipe(int filedes[2]);
     278off_t xlseek(int fd, off_t offset, int whence);
     279off_t fdlength(int fd);
     280
     281int xsocket(int domain, int type, int protocol);
     282void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen);
     283void xlisten(int s, int backlog);
     284void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen);
     285ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to,
     286                socklen_t tolen);
     287/* SO_REUSEADDR allows a server to rebind to an address that is already
     288 * "in use" by old connections to e.g. previous server instance which is
     289 * killed or crashed. Without it bind will fail until all such connections
     290 * time out. Linux does not allow multiple live binds on same ip:port
     291 * regardless of SO_REUSEADDR (unlike some other flavors of Unix).
     292 * Turn it on before you call bind(). */
     293void setsockopt_reuseaddr(int fd); /* On Linux this never fails. */
     294int setsockopt_broadcast(int fd);
     295/* NB: returns port in host byte order */
     296unsigned bb_lookup_port(const char *port, const char *protocol, unsigned default_port);
     297typedef struct len_and_sockaddr {
     298    socklen_t len;
     299    union {
     300        struct sockaddr sa;
     301        struct sockaddr_in sin;
     302#if ENABLE_FEATURE_IPV6
     303        struct sockaddr_in6 sin6;
     304#endif
     305    };
     306} len_and_sockaddr;
     307enum {
     308    LSA_SIZEOF_SA = sizeof(
     309        union {
     310            struct sockaddr sa;
     311            struct sockaddr_in sin;
     312#if ENABLE_FEATURE_IPV6
     313            struct sockaddr_in6 sin6;
     314#endif
     315        }
     316    )
     317};
     318/* Create stream socket, and allocate suitable lsa.
     319 * (lsa of correct size and lsa->sa.sa_family (AF_INET/AF_INET6))
     320 * af == AF_UNSPEC will result in trying to create IPv6 socket,
     321 * and if kernel doesn't support it, IPv4.
     322 */
     323int xsocket_type(len_and_sockaddr **lsap, USE_FEATURE_IPV6(int af,) int sock_type);
     324int xsocket_stream(len_and_sockaddr **lsap);
     325/* Create server socket bound to bindaddr:port. bindaddr can be NULL,
     326 * numeric IP ("N.N.N.N") or numeric IPv6 address,
     327 * and can have ":PORT" suffix (for IPv6 use "[X:X:...:X]:PORT").
     328 * Only if there is no suffix, port argument is used */
     329/* NB: these set SO_REUSEADDR before bind */
     330int create_and_bind_stream_or_die(const char *bindaddr, int port);
     331int create_and_bind_dgram_or_die(const char *bindaddr, int port);
     332/* Create client TCP socket connected to peer:port. Peer cannot be NULL.
     333 * Peer can be numeric IP ("N.N.N.N"), numeric IPv6 address or hostname,
     334 * and can have ":PORT" suffix (for IPv6 use "[X:X:...:X]:PORT").
     335 * If there is no suffix, port argument is used */
     336int create_and_connect_stream_or_die(const char *peer, int port);
     337/* Connect to peer identified by lsa */
     338int xconnect_stream(const len_and_sockaddr *lsa);
     339/* Return malloc'ed len_and_sockaddr with socket address of host:port
     340 * Currently will return IPv4 or IPv6 sockaddrs only
     341 * (depending on host), but in theory nothing prevents e.g.
     342 * UNIX socket address being returned, IPX sockaddr etc...
     343 * On error does bb_error_msg and returns NULL */
     344len_and_sockaddr* host2sockaddr(const char *host, int port);
     345/* Version which dies on error */
     346len_and_sockaddr* xhost2sockaddr(const char *host, int port);
     347len_and_sockaddr* xdotted2sockaddr(const char *host, int port);
     348#if ENABLE_FEATURE_IPV6
     349/* Same, useful if you want to force family (e.g. IPv6) */
     350len_and_sockaddr* host_and_af2sockaddr(const char *host, int port, sa_family_t af);
     351len_and_sockaddr* xhost_and_af2sockaddr(const char *host, int port, sa_family_t af);
     352#else
     353/* [we evaluate af: think about "host_and_af2sockaddr(..., af++)"] */
     354#define host_and_af2sockaddr(host, port, af) ((void)(af), host2sockaddr((host), (port)))
     355#define xhost_and_af2sockaddr(host, port, af) ((void)(af), xhost2sockaddr((host), (port)))
     356#endif
     357/* Assign sin[6]_port member if the socket is an AF_INET[6] one,
     358 * otherwise no-op. Useful for ftp.
     359 * NB: does NOT do htons() internally, just direct assignment. */
     360void set_nport(len_and_sockaddr *lsa, unsigned port);
     361/* Retrieve sin[6]_port or return -1 for non-INET[6] lsa's */
     362int get_nport(const struct sockaddr *sa);
     363/* Reverse DNS. Returns NULL on failure. */
     364char* xmalloc_sockaddr2host(const struct sockaddr *sa);
     365/* This one doesn't append :PORTNUM */
     366char* xmalloc_sockaddr2host_noport(const struct sockaddr *sa);
     367/* This one also doesn't fall back to dotted IP (returns NULL) */
     368char* xmalloc_sockaddr2hostonly_noport(const struct sockaddr *sa);
     369/* inet_[ap]ton on steroids */
     370char* xmalloc_sockaddr2dotted(const struct sockaddr *sa);
     371char* xmalloc_sockaddr2dotted_noport(const struct sockaddr *sa);
     372// "old" (ipv4 only) API
     373// users: traceroute.c hostname.c - use _list_ of all IPs
     374struct hostent *xgethostbyname(const char *name);
     375// Also mount.c and inetd.c are using gethostbyname(),
     376// + inet_common.c has additional IPv4-only stuff
     377
     378
     379void socket_want_pktinfo(int fd);
     380ssize_t send_to_from(int fd, void *buf, size_t len, int flags,
     381        const struct sockaddr *from, const struct sockaddr *to,
     382        socklen_t tolen);
     383ssize_t recv_from_to(int fd, void *buf, size_t len, int flags,
     384        struct sockaddr *from, struct sockaddr *to,
     385        socklen_t sa_size);
     386
     387
     388extern char *xstrdup(const char *s);
     389extern char *xstrndup(const char *s, int n);
     390extern char *safe_strncpy(char *dst, const char *src, size_t size);
     391extern char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
     392// gcc-4.1.1 still isn't good enough at optimizing it
     393// (+200 bytes compared to macro)
     394//static ALWAYS_INLINE
     395//int LONE_DASH(const char *s) { return s[0] == '-' && !s[1]; }
     396//static ALWAYS_INLINE
     397//int NOT_LONE_DASH(const char *s) { return s[0] != '-' || s[1]; }
     398#define LONE_DASH(s)     ((s)[0] == '-' && !(s)[1])
     399#define NOT_LONE_DASH(s) ((s)[0] != '-' || (s)[1])
     400#define LONE_CHAR(s,c)     ((s)[0] == (c) && !(s)[1])
     401#define NOT_LONE_CHAR(s,c) ((s)[0] != (c) || (s)[1])
     402#define DOT_OR_DOTDOT(s) ((s)[0] == '.' && (!(s)[1] || ((s)[1] == '.' && !(s)[2])))
     403
     404/* dmalloc will redefine these to it's own implementation. It is safe
     405 * to have the prototypes here unconditionally.  */
     406extern void *malloc_or_warn(size_t size);
     407extern void *xmalloc(size_t size);
     408extern void *xzalloc(size_t size);
     409extern void *xrealloc(void *old, size_t size);
     410
     411extern ssize_t safe_read(int fd, void *buf, size_t count);
     412extern ssize_t full_read(int fd, void *buf, size_t count);
     413extern void xread(int fd, void *buf, size_t count);
     414extern unsigned char xread_char(int fd);
     415// Read one line a-la fgets. Uses one read(), works only on seekable streams
     416extern char *reads(int fd, char *buf, size_t count);
     417// Read one line a-la fgets. Reads byte-by-byte.
     418// Useful when it is important to not read ahead.
     419extern char *xmalloc_reads(int fd, char *pfx);
     420extern ssize_t read_close(int fd, void *buf, size_t count);
     421extern ssize_t open_read_close(const char *filename, void *buf, size_t count);
     422extern void *xmalloc_open_read_close(const char *filename, size_t *sizep);
     423
     424extern ssize_t safe_write(int fd, const void *buf, size_t count);
     425extern ssize_t full_write(int fd, const void *buf, size_t count);
     426extern void xwrite(int fd, const void *buf, size_t count);
     427
     428/* Reads and prints to stdout till eof, then closes FILE. Exits on error: */
     429extern void xprint_and_close_file(FILE *file);
     430extern char *xmalloc_fgets(FILE *file);
     431/* Read up to (and including) TERMINATING_STRING: */
     432extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string);
     433/* Chops off '\n' from the end, unlike fgets: */
     434extern char *xmalloc_getline(FILE *file);
     435extern char *bb_get_chunk_from_file(FILE *file, int *end);
     436extern void die_if_ferror(FILE *file, const char *msg);
     437extern void die_if_ferror_stdout(void);
     438extern void xfflush_stdout(void);
     439extern void fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN;
     440extern int fclose_if_not_stdin(FILE *file);
     441extern FILE *xfopen(const char *filename, const char *mode);
     442/* Prints warning to stderr and returns NULL on failure: */
     443extern FILE *fopen_or_warn(const char *filename, const char *mode);
     444/* "Opens" stdin if filename is special, else just opens file: */
     445extern FILE *fopen_or_warn_stdin(const char *filename);
     446
     447/* Convert each alpha char in str to lower-case */
     448extern char* str_tolower(char *str);
     449
     450char *utoa(unsigned n);
     451char *itoa(int n);
     452/* Returns a pointer past the formatted number, does NOT null-terminate */
     453char *utoa_to_buf(unsigned n, char *buf, unsigned buflen);
     454char *itoa_to_buf(int n, char *buf, unsigned buflen);
     455void smart_ulltoa5(unsigned long long ul, char buf[5]);
     456//TODO: provide pointer to buf (avoid statics)?
    308457const char *make_human_readable_str(unsigned long long size,
    309458        unsigned long block_size, unsigned long display_unit);
    310 
     459/* Put a string of hex bytes ("1b2e66fe"...), return advanced pointer */
     460char *bin2hex(char *buf, const char *cp, int count);
     461
     462/* Last element is marked by mult == 0 */
     463struct suffix_mult {
     464    char suffix[4];
     465    unsigned mult;
     466};
     467#include "xatonum.h"
     468/* Specialized: */
     469/* Using xatoi() instead of naive atoi() is not always convenient -
     470 * in many places people want *non-negative* values, but store them
     471 * in signed int. Therefore we need this one:
     472 * dies if input is not in [0, INT_MAX] range. Also will reject '-0' etc */
     473int xatoi_u(const char *numstr);
     474/* Useful for reading port numbers */
     475uint16_t xatou16(const char *numstr);
     476
     477
     478/* These parse entries in /etc/passwd and /etc/group.  This is desirable
     479 * for BusyBox since we want to avoid using the glibc NSS stuff, which
     480 * increases target size and is often not needed on embedded systems.  */
     481long xuname2uid(const char *name);
     482long xgroup2gid(const char *name);
     483/* wrapper: allows string to contain numeric uid or gid */
     484unsigned long get_ug_id(const char *s, long (*xname2id)(const char *));
     485/* from chpst. Does not die, returns 0 on failure */
     486struct bb_uidgid_t {
     487    uid_t uid;
     488    gid_t gid;
     489};
     490/* always sets uid and gid */
     491int get_uidgid(struct bb_uidgid_t*, const char*, int numeric_ok);
     492/* chown-like handling of "user[:[group]" */
     493void parse_chown_usergroup_or_die(struct bb_uidgid_t *u, char *user_group);
     494/* bb_getpwuid, bb_getgrgid:
     495 * bb_getXXXid(buf, bufsz, id) - copy user/group name or id
     496 *              as a string to buf, return user/group name or NULL
     497 * bb_getXXXid(NULL, 0, id) - return user/group name or NULL
     498 * bb_getXXXid(NULL, -1, id) - return user/group name or exit
     499*/
     500char *bb_getpwuid(char *name, int bufsize, long uid);
     501char *bb_getgrgid(char *group, int bufsize, long gid);
     502/* versions which cache results (useful for ps, ls etc) */
     503const char* get_cached_username(uid_t uid);
     504const char* get_cached_groupname(gid_t gid);
     505void clear_username_cache(void);
     506/* internally usernames are saved in fixed-sized char[] buffers */
     507enum { USERNAME_MAX_SIZE = 16 - sizeof(int) };
     508
     509
     510struct bb_applet;
     511int execable_file(const char *name);
     512char *find_execable(const char *filename);
     513int exists_execable(const char *filename);
     514
     515#if ENABLE_FEATURE_PREFER_APPLETS
     516int bb_execvp(const char *file, char *const argv[]);
     517#define BB_EXECVP(prog,cmd) bb_execvp(prog,cmd)
     518#define BB_EXECLP(prog,cmd,...) \
     519    execlp((find_applet_by_name(prog)) ? CONFIG_BUSYBOX_EXEC_PATH : prog, \
     520        cmd, __VA_ARGS__)
     521#else
     522#define BB_EXECVP(prog,cmd)     execvp(prog,cmd)
     523#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__)
     524#endif
     525
     526/* NOMMU friendy fork+exec */
     527pid_t spawn(char **argv);
     528pid_t xspawn(char **argv);
     529
     530/* Unlike waitpid, waits ONLY for one process,
     531 * It's safe to pass negative 'pids' from failed [v]fork -
     532 * wait4pid will return -1 (and will not clobber [v]fork's errno).
     533 * IOW: rc = wait4pid(spawn(argv));
     534 *      if (rc < 0) bb_perror_msg("%s", argv[0]);
     535 *      if (rc > 0) bb_error_msg("exit code: %d", rc);
     536 */
     537int wait4pid(int pid);
     538int wait_pid(int *wstat, int pid);
     539int wait_nohang(int *wstat);
     540#define wait_crashed(w) ((w) & 127)
     541#define wait_exitcode(w) ((w) >> 8)
     542#define wait_stopsig(w) ((w) >> 8)
     543#define wait_stopped(w) (((w) & 127) == 127)
     544/* wait4pid(spawn(argv)) + NOFORK/NOEXEC (if configured) */
     545int spawn_and_wait(char **argv);
     546struct nofork_save_area {
     547    jmp_buf die_jmp;
     548    const struct bb_applet *current_applet;
     549    int xfunc_error_retval;
     550    uint32_t option_mask32;
     551    int die_sleep;
     552    smallint saved;
     553};
     554void save_nofork_data(struct nofork_save_area *save);
     555void restore_nofork_data(struct nofork_save_area *save);
     556/* Does NOT check that applet is NOFORK, just blindly runs it */
     557int run_nofork_applet(const struct bb_applet *a, char **argv);
     558int run_nofork_applet_prime(struct nofork_save_area *old, const struct bb_applet *a, char **argv);
     559
     560/* Helpers for daemonization.
     561 *
     562 * bb_daemonize(flags) = daemonize, does not compile on NOMMU
     563 *
     564 * bb_daemonize_or_rexec(flags, argv) = daemonizes on MMU (and ignores argv),
     565 *      rexec's itself on NOMMU with argv passed as command line.
     566 * Thus bb_daemonize_or_rexec may cause your <applet>_main() to be re-executed
     567 * from the start. (It will detect it and not reexec again second time).
     568 * You have to audit carefully that you don't do something twice as a result
     569 * (opening files/sockets, parsing config files etc...)!
     570 *
     571 * Both of the above will redirect fd 0,1,2 to /dev/null and drop ctty
     572 * (will do setsid()).
     573 *
     574 * forkexit_or_rexec(argv) = bare-bones "fork + parent exits" on MMU,
     575 *      "vfork + re-exec ourself" on NOMMU. No fd redirection, no setsid().
     576 *      Currently used for openvt. On MMU ignores argv.
     577 *
     578 * Helper for network daemons in foreground mode:
     579 *
     580 * bb_sanitize_stdio() = make sure that fd 0,1,2 are opened by opening them
     581 * to /dev/null if they are not.
     582 */
     583enum {
     584    DAEMON_CHDIR_ROOT = 1,
     585    DAEMON_DEVNULL_STDIO = 2,
     586    DAEMON_CLOSE_EXTRA_FDS = 4,
     587    DAEMON_ONLY_SANITIZE = 8, /* internal use */
     588};
     589#if BB_MMU
     590  void forkexit_or_rexec(void);
     591  enum { re_execed = 0 };
     592# define forkexit_or_rexec(argv)            forkexit_or_rexec()
     593# define bb_daemonize_or_rexec(flags, argv) bb_daemonize_or_rexec(flags)
     594# define bb_daemonize(flags)                bb_daemonize_or_rexec(flags, bogus)
     595#else
     596  void re_exec(char **argv) ATTRIBUTE_NORETURN;
     597  void forkexit_or_rexec(char **argv);
     598  extern bool re_execed;
     599# define fork()          BUG_fork_is_unavailable_on_nommu()
     600# define daemon(a,b)     BUG_daemon_is_unavailable_on_nommu()
     601# define bb_daemonize(a) BUG_bb_daemonize_is_unavailable_on_nommu()
     602#endif
     603void bb_daemonize_or_rexec(int flags, char **argv);
     604void bb_sanitize_stdio(void);
     605
     606
     607extern const char *opt_complementary;
     608#if ENABLE_GETOPT_LONG
     609#define No_argument "\0"
     610#define Required_argument "\001"
     611#define Optional_argument "\002"
     612extern const char *applet_long_options;
     613#endif
     614extern uint32_t option_mask32;
     615extern uint32_t getopt32(char **argv, const char *applet_opts, ...);
     616
     617
     618typedef struct llist_t {
     619    char *data;
     620    struct llist_t *link;
     621} llist_t;
     622void llist_add_to(llist_t **old_head, void *data);
     623void llist_add_to_end(llist_t **list_head, void *data);
     624void *llist_pop(llist_t **elm);
     625void llist_unlink(llist_t **head, llist_t *elm);
     626void llist_free(llist_t *elm, void (*freeit)(void *data));
     627llist_t *llist_rev(llist_t *list);
     628/* BTW, surprisingly, changing API to
     629 *   llist_t *llist_add_to(llist_t *old_head, void *data)
     630 * etc does not result in smaller code... */
     631
     632/* start_stop_daemon and udhcpc are special - they want
     633 * to create pidfiles regardless of FEATURE_PIDFILE */
     634#if ENABLE_FEATURE_PIDFILE || defined(WANT_PIDFILE)
     635/* True only if we created pidfile which is *file*, not /dev/null etc */
     636extern smallint wrote_pidfile;
     637void write_pidfile(const char *path);
     638#define remove_pidfile(path) do { if (wrote_pidfile) unlink(path); } while (0)
     639#else
     640enum { wrote_pidfile = 0 };
     641#define write_pidfile(path)  ((void)0)
     642#define remove_pidfile(path) ((void)0)
     643#endif
     644
     645enum {
     646    LOGMODE_NONE = 0,
     647    LOGMODE_STDIO = (1 << 0),
     648    LOGMODE_SYSLOG = (1 << 1) * ENABLE_FEATURE_SYSLOG,
     649    LOGMODE_BOTH = LOGMODE_SYSLOG + LOGMODE_STDIO,
     650};
     651extern const char *msg_eol;
     652extern smallint logmode;
     653extern int die_sleep;
     654extern int xfunc_error_retval;
     655extern jmp_buf die_jmp;
     656extern void xfunc_die(void) ATTRIBUTE_NORETURN;
     657extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE;
     658extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
     659extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
     660extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
     661extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
     662extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
     663extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2)));
     664extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN;
     665extern void bb_perror_nomsg(void);
     666extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2)));
     667extern void bb_verror_msg(const char *s, va_list p, const char *strerr);
     668
     669
     670/* applets which are useful from another applets */
     671int bb_cat(char** argv);
     672int bb_echo(char** argv);
     673int test_main(int argc, char** argv);
     674int kill_main(int argc, char **argv);
     675#if ENABLE_ROUTE
     676void bb_displayroutes(int noresolve, int netstatfmt);
     677#endif
     678int chown_main(int argc, char **argv);
     679#if ENABLE_GUNZIP
     680int gunzip_main(int argc, char **argv);
     681#endif
     682int bbunpack(char **argv,
     683    char* (*make_new_name)(char *filename),
     684    USE_DESKTOP(long long) int (*unpacker)(void)
     685);
     686
     687
     688/* Networking */
     689int create_icmp_socket(void);
     690int create_icmp6_socket(void);
     691/* interface.c */
     692/* This structure defines protocol families and their handlers. */
     693struct aftype {
     694    const char *name;
     695    const char *title;
     696    int af;
     697    int alen;
     698    char *(*print) (unsigned char *);
     699    const char *(*sprint) (struct sockaddr *, int numeric);
     700    int (*input) (/*int type,*/ const char *bufp, struct sockaddr *);
     701    void (*herror) (char *text);
     702    int (*rprint) (int options);
     703    int (*rinput) (int typ, int ext, char **argv);
     704
     705    /* may modify src */
     706    int (*getmask) (char *src, struct sockaddr * mask, char *name);
     707};
     708/* This structure defines hardware protocols and their handlers. */
     709struct hwtype {
     710    const char *name;
     711    const char *title;
     712    int type;
     713    int alen;
     714    char *(*print) (unsigned char *);
     715    int (*input) (const char *, struct sockaddr *);
     716    int (*activate) (int fd);
     717    int suppress_null_addr;
     718};
     719extern smallint interface_opt_a;
     720int display_interfaces(char *ifname);
     721const struct aftype *get_aftype(const char *name);
     722const struct hwtype *get_hwtype(const char *name);
     723const struct hwtype *get_hwntype(int type);
     724
     725
     726#ifndef BUILD_INDIVIDUAL
     727extern const struct bb_applet *find_applet_by_name(const char *name);
     728/* Returns only if applet is not found. */
     729extern void run_applet_and_exit(const char *name, char **argv);
     730extern void run_current_applet_and_exit(char **argv) ATTRIBUTE_NORETURN;
     731#endif
     732
     733extern int match_fstype(const struct mntent *mt, const char *fstypes);
     734extern struct mntent *find_mount_point(const char *name, const char *table);
     735extern void erase_mtab(const char * name);
     736extern unsigned int tty_baud_to_value(speed_t speed);
     737extern speed_t tty_value_to_baud(unsigned int value);
     738extern void bb_warn_ignoring_args(int n);
     739
     740extern int get_linux_version_code(void);
     741
     742extern char *query_loop(const char *device);
     743extern int del_loop(const char *device);
     744/* If *devname is not NULL, use that name, otherwise try to find free one,
     745 * malloc and return it in *devname.
     746 * return value: 1: read-only loopdev was setup, 0: rw, < 0: error */
     747extern int set_loop(char **devname, const char *file, unsigned long long offset);
     748
     749
     750//TODO: pass buf pointer or return allocated buf (avoid statics)?
     751char *bb_askpass(int timeout, const char * prompt);
    311752int bb_ask_confirmation(void);
    312753int klogctl(int type, char * b, int len);
    313754
    314 char *xgetcwd(char *cwd);
    315 char *xreadlink(const char *path);
     755extern int bb_parse_mode(const char* s, mode_t* theMode);
     756
    316757char *concat_path_file(const char *path, const char *filename);
    317758char *concat_subpath_file(const char *path, const char *filename);
     759const char *bb_basename(const char *name);
     760/* NB: can violate const-ness (similarly to strchr) */
    318761char *last_char_is(const char *s, int c);
    319762
    320 int read_package_field(const char *package_buffer, char **field_name, char **field_value);
    321 //#warning yuk!
    322 char *fgets_str(FILE *file, const char *terminating_string);
    323 
    324 extern int uncompress(int fd_in, int fd_out);
    325 extern int inflate(int in, int out);
    326 
    327 extern struct hostent *xgethostbyname(const char *name);
    328 extern struct hostent *xgethostbyname2(const char *name, int af);
    329 extern int create_icmp_socket(void);
    330 extern int create_icmp6_socket(void);
    331 extern int xconnect(struct sockaddr_in *s_addr);
    332 extern unsigned short bb_lookup_port(const char *port, const char *protocol, unsigned short default_port);
    333 extern void bb_lookup_host(struct sockaddr_in *s_in, const char *host);
    334 
    335 //#warning wrap this?
    336 char *dirname (char *path);
    337 
    338 int bb_make_directory (char *path, long mode, int flags);
    339 
    340 const char *u_signal_names(const char *str_sig, int *signo, int startnum);
     763
     764USE_DESKTOP(long long) int uncompress(int fd_in, int fd_out);
     765int inflate(int in, int out);
     766
     767
     768int bb_make_directory(char *path, long mode, int flags);
     769
     770int get_signum(const char *name);
     771const char *get_signame(int number);
     772
    341773char *bb_simplify_path(const char *path);
    342774
    343 enum {  /* DO NOT CHANGE THESE VALUES!  cp.c depends on them. */
     775#define FAIL_DELAY 3
     776extern void bb_do_delay(int seconds);
     777extern void change_identity(const struct passwd *pw);
     778extern const char *change_identity_e2str(const struct passwd *pw);
     779extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args);
     780#if ENABLE_SELINUX
     781extern void renew_current_security_context(void);
     782extern void set_current_security_context(security_context_t sid);
     783extern context_t set_security_context_component(security_context_t cur_context,
     784                        char *user, char *role, char *type, char *range);
     785extern void setfscreatecon_or_die(security_context_t scontext);
     786#endif
     787extern void selinux_or_die(void);
     788extern int restricted_shell(const char *shell);
     789extern void setup_environment(const char *shell, int loginshell, int changeenv, const struct passwd *pw);
     790extern int correct_password(const struct passwd *pw);
     791/* Returns a ptr to static storage */
     792extern char *pw_encrypt(const char *clear, const char *salt);
     793extern int obscure(const char *old, const char *newval, const struct passwd *pwdp);
     794extern int index_in_str_array(const char *const string_array[], const char *key);
     795extern int index_in_strings(const char *strings, const char *key);
     796extern int index_in_substr_array(const char *const string_array[], const char *key);
     797extern int index_in_substrings(const char *strings, const char *key);
     798extern void print_login_issue(const char *issue_file, const char *tty);
     799extern void print_login_prompt(void);
     800
     801/* rnd is additional random input. New one is returned.
     802 * Useful if you call crypt_make_salt many times in a row:
     803 * rnd = crypt_make_salt(buf1, 4, 0);
     804 * rnd = crypt_make_salt(buf2, 4, rnd);
     805 * rnd = crypt_make_salt(buf3, 4, rnd);
     806 * (otherwise we risk having same salt generated)
     807 */
     808extern int crypt_make_salt(char *p, int cnt, int rnd);
     809
     810/* Returns number of lines changed, or -1 on error */
     811extern int update_passwd(const char *filename, const char *username,
     812            const char *new_pw);
     813
     814/* NB: typically you want to pass fd 0, not 1. Think 'applet | grep something' */
     815int get_terminal_width_height(int fd, int *width, int *height);
     816
     817int ioctl_or_perror(int fd, int request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5)));
     818void ioctl_or_perror_and_die(int fd, int request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5)));
     819#if ENABLE_IOCTL_HEX2STR_ERROR
     820int bb_ioctl_or_warn(int fd, int request, void *argp, const char *ioctl_name);
     821void bb_xioctl(int fd, int request, void *argp, const char *ioctl_name);
     822#define ioctl_or_warn(fd,request,argp) bb_ioctl_or_warn(fd,request,argp,#request)
     823#define xioctl(fd,request,argp)        bb_xioctl(fd,request,argp,#request)
     824#else
     825int bb_ioctl_or_warn(int fd, int request, void *argp);
     826void bb_xioctl(int fd, int request, void *argp);
     827#define ioctl_or_warn(fd,request,argp) bb_ioctl_or_warn(fd,request,argp)
     828#define xioctl(fd,request,argp)        bb_xioctl(fd,request,argp)
     829#endif
     830
     831char *is_in_ino_dev_hashtable(const struct stat *statbuf);
     832void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
     833void reset_ino_dev_hashtable(void);
     834#ifdef __GLIBC__
     835/* At least glibc has horrendously large inline for this, so wrap it */
     836unsigned long long bb_makedev(unsigned int major, unsigned int minor);
     837#undef makedev
     838#define makedev(a,b) bb_makedev(a,b)
     839#endif
     840
     841
     842#if ENABLE_FEATURE_EDITING
     843/* It's NOT just ENABLEd or disabled. It's a number: */
     844#ifdef CONFIG_FEATURE_EDITING_HISTORY
     845#define MAX_HISTORY (CONFIG_FEATURE_EDITING_HISTORY + 0)
     846#else
     847#define MAX_HISTORY 0
     848#endif
     849typedef struct line_input_t {
     850    int flags;
     851    const char *path_lookup;
     852#if MAX_HISTORY
     853    int cnt_history;
     854    int cur_history;
     855    USE_FEATURE_EDITING_SAVEHISTORY(const char *hist_file;)
     856    char *history[MAX_HISTORY + 1];
     857#endif
     858} line_input_t;
     859enum {
     860    DO_HISTORY = 1 * (MAX_HISTORY > 0),
     861    SAVE_HISTORY = 2 * (MAX_HISTORY > 0) * ENABLE_FEATURE_EDITING_SAVEHISTORY,
     862    TAB_COMPLETION = 4 * ENABLE_FEATURE_TAB_COMPLETION,
     863    USERNAME_COMPLETION = 8 * ENABLE_FEATURE_USERNAME_COMPLETION,
     864    VI_MODE = 0x10 * ENABLE_FEATURE_EDITING_VI,
     865    WITH_PATH_LOOKUP = 0x20,
     866    FOR_SHELL = DO_HISTORY | SAVE_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION,
     867};
     868line_input_t *new_line_input_t(int flags);
     869int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state);
     870#else
     871int read_line_input(const char* prompt, char* command, int maxsize);
     872#define read_line_input(prompt, command, maxsize, state) \
     873    read_line_input(prompt, command, maxsize)
     874#endif
     875
     876
     877#ifndef COMM_LEN
     878#ifdef TASK_COMM_LEN
     879enum { COMM_LEN = TASK_COMM_LEN };
     880#else
     881/* synchronize with sizeof(task_struct.comm) in /usr/include/linux/sched.h */
     882enum { COMM_LEN = 16 };
     883#endif
     884#endif
     885typedef struct {
     886    DIR *dir;
     887/* Fields are set to 0/NULL if failed to determine (or not requested) */
     888    /*char *cmd;*/
     889    char *argv0;
     890    /*char *exe;*/
     891    USE_SELINUX(char *context;)
     892    /* Everything below must contain no ptrs to malloc'ed data:
     893     * it is memset(0) for each process in procps_scan() */
     894    unsigned vsz, rss; /* we round it to kbytes */
     895    unsigned long stime, utime;
     896    unsigned pid;
     897    unsigned ppid;
     898    unsigned pgid;
     899    unsigned sid;
     900    unsigned uid;
     901    unsigned gid;
     902    unsigned tty_major,tty_minor;
     903    char state[4];
     904    /* basename of executable in exec(2), read from /proc/N/stat
     905     * (if executable is symlink or script, it is NOT replaced
     906     * by link target or interpreter name) */
     907    char comm[COMM_LEN];
     908    /* user/group? - use passwd/group parsing functions */
     909} procps_status_t;
     910enum {
     911    PSSCAN_PID      = 1 << 0,
     912    PSSCAN_PPID     = 1 << 1,
     913    PSSCAN_PGID     = 1 << 2,
     914    PSSCAN_SID      = 1 << 3,
     915    PSSCAN_UIDGID   = 1 << 4,
     916    PSSCAN_COMM     = 1 << 5,
     917    /* PSSCAN_CMD      = 1 << 6, - use read_cmdline instead */
     918    PSSCAN_ARGV0    = 1 << 7,
     919    /* PSSCAN_EXE      = 1 << 8, - not implemented */
     920    PSSCAN_STATE    = 1 << 9,
     921    PSSCAN_VSZ      = 1 << 10,
     922    PSSCAN_RSS      = 1 << 11,
     923    PSSCAN_STIME    = 1 << 12,
     924    PSSCAN_UTIME    = 1 << 13,
     925    PSSCAN_TTY      = 1 << 14,
     926    USE_SELINUX(PSSCAN_CONTEXT  = 1 << 15,)
     927    /* These are all retrieved from proc/NN/stat in one go: */
     928    PSSCAN_STAT     = PSSCAN_PPID | PSSCAN_PGID | PSSCAN_SID
     929                    | PSSCAN_COMM | PSSCAN_STATE
     930                    | PSSCAN_VSZ | PSSCAN_RSS
     931            | PSSCAN_STIME | PSSCAN_UTIME
     932            | PSSCAN_TTY,
     933};
     934procps_status_t* alloc_procps_scan(int flags);
     935void free_procps_scan(procps_status_t* sp);
     936procps_status_t* procps_scan(procps_status_t* sp, int flags);
     937/* Format cmdline (up to col chars) into char buf[col+1] */
     938/* Puts [comm] if cmdline is empty (-> process is a kernel thread) */
     939void read_cmdline(char *buf, int col, unsigned pid, const char *comm);
     940pid_t *find_pid_by_name(const char* procName);
     941pid_t *pidlist_reverse(pid_t *pidList);
     942
     943
     944extern const char bb_uuenc_tbl_base64[];
     945extern const char bb_uuenc_tbl_std[];
     946void bb_uuencode(char *store, const void *s, int length, const char *tbl);
     947
     948typedef struct sha1_ctx_t {
     949    uint32_t count[2];
     950    uint32_t hash[5];
     951    uint32_t wbuf[16];
     952} sha1_ctx_t;
     953void sha1_begin(sha1_ctx_t *ctx);
     954void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx);
     955void *sha1_end(void *resbuf, sha1_ctx_t *ctx);
     956
     957typedef struct md5_ctx_t {
     958    uint32_t A;
     959    uint32_t B;
     960    uint32_t C;
     961    uint32_t D;
     962    uint64_t total;
     963    uint32_t buflen;
     964    char buffer[128];
     965} md5_ctx_t;
     966void md5_begin(md5_ctx_t *ctx);
     967void md5_hash(const void *data, size_t length, md5_ctx_t *ctx);
     968void *md5_end(void *resbuf, md5_ctx_t *ctx);
     969
     970uint32_t *crc32_filltable(uint32_t *tbl256, int endian);
     971
     972
     973enum {  /* DO NOT CHANGE THESE VALUES!  cp.c, mv.c, install.c depend on them. */
    344974    FILEUTILS_PRESERVE_STATUS = 1,
    345975    FILEUTILS_DEREFERENCE = 2,
    346976    FILEUTILS_RECUR = 4,
    347977    FILEUTILS_FORCE = 8,
    348     FILEUTILS_INTERACTIVE = 16
    349 };
    350 
    351 extern const char *bb_applet_name;
    352 
    353 extern const char * const bb_msg_full_version;
    354 extern const char * const bb_msg_memory_exhausted;
    355 extern const char * const bb_msg_invalid_date;
    356 extern const char * const bb_msg_io_error;
    357 extern const char * const bb_msg_read_error;
    358 extern const char * const bb_msg_write_error;
    359 extern const char * const bb_msg_name_longer_than_foo;
    360 extern const char * const bb_msg_unknown;
    361 extern const char * const bb_msg_can_not_create_raw_socket;
    362 extern const char * const bb_msg_perm_denied_are_you_root;
    363 extern const char * const bb_msg_requires_arg;
    364 extern const char * const bb_msg_invalid_arg;
    365 extern const char * const bb_msg_standard_input;
    366 extern const char * const bb_msg_standard_output;
    367 
    368 extern const char * const bb_path_nologin_file;
    369 extern const char * const bb_path_passwd_file;
    370 extern const char * const bb_path_shadow_file;
    371 extern const char * const bb_path_gshadow_file;
    372 extern const char * const bb_path_group_file;
    373 extern const char * const bb_path_securetty_file;
    374 extern const char * const bb_path_motd_file;
    375 extern const char * const bb_path_wtmp_file;
    376 extern const char * const bb_dev_null;
     978    FILEUTILS_INTERACTIVE = 0x10,
     979    FILEUTILS_MAKE_HARDLINK = 0x20,
     980    FILEUTILS_MAKE_SOFTLINK = 0x40,
     981#if ENABLE_SELINUX
     982    FILEUTILS_PRESERVE_SECURITY_CONTEXT = 0x80,
     983    FILEUTILS_SET_SECURITY_CONTEXT = 0x100
     984#endif
     985};
     986
     987#define FILEUTILS_CP_OPTSTR "pdRfils" USE_SELINUX("c")
     988extern const struct bb_applet *current_applet;
     989extern const char *applet_name;
     990/* "BusyBox vN.N.N (timestamp or extra_vestion)" */
     991extern const char bb_banner[];
     992extern const char bb_msg_memory_exhausted[];
     993extern const char bb_msg_invalid_date[];
     994extern const char bb_msg_read_error[];
     995extern const char bb_msg_write_error[];
     996extern const char bb_msg_unknown[];
     997extern const char bb_msg_can_not_create_raw_socket[];
     998extern const char bb_msg_perm_denied_are_you_root[];
     999extern const char bb_msg_requires_arg[];
     1000extern const char bb_msg_invalid_arg[];
     1001extern const char bb_msg_standard_input[];
     1002extern const char bb_msg_standard_output[];
     1003
     1004extern const char bb_str_default[];
     1005/* NB: (bb_hexdigits_upcase[i] | 0x20) -> lowercase hex digit */
     1006extern const char bb_hexdigits_upcase[];
     1007
     1008extern const char bb_path_mtab_file[];
     1009extern const char bb_path_passwd_file[];
     1010extern const char bb_path_shadow_file[];
     1011extern const char bb_path_gshadow_file[];
     1012extern const char bb_path_group_file[];
     1013extern const char bb_path_motd_file[];
     1014extern const char bb_path_wtmp_file[];
     1015extern const char bb_dev_null[];
     1016extern const char bb_busybox_exec_path[];
     1017/* util-linux manpage says /sbin:/bin:/usr/sbin:/usr/bin,
     1018 * but I want to save a few bytes here */
     1019extern const char bb_PATH_root_path[]; /* "PATH=/sbin:/usr/sbin:/bin:/usr/bin" */
     1020#define bb_default_root_path (bb_PATH_root_path + sizeof("PATH"))
     1021#define bb_default_path      (bb_PATH_root_path + sizeof("PATH=/sbin:/usr/sbin"))
     1022
     1023extern const int const_int_0;
     1024extern const int const_int_1;
     1025
    3771026
    3781027#ifndef BUFSIZ
    3791028#define BUFSIZ 4096
    3801029#endif
    381 extern char bb_common_bufsiz1[BUFSIZ+1];
    382 
    383 /*
    384  * You can change LIBBB_DEFAULT_LOGIN_SHELL, but don`t use,
    385  * use bb_default_login_shell and next defines,
    386  * if you LIBBB_DEFAULT_LOGIN_SHELL change,
    387  * don`t lose change increment constant!
    388  */
     1030/* Providing hard guarantee on minimum size (think of BUFSIZ == 128) */
     1031enum { COMMON_BUFSIZE = (BUFSIZ >= 256*sizeof(void*) ? BUFSIZ+1 : 256*sizeof(void*)) };
     1032extern char bb_common_bufsiz1[COMMON_BUFSIZE];
     1033/* This struct is deliberately not defined. */
     1034/* See docs/keep_data_small.txt */
     1035struct globals;
     1036/* '*const' ptr makes gcc optimize code much better.
     1037 * Magic prevents ptr_to_globals from going into rodata.
     1038 * If you want to assign a value, use PTR_TO_GLOBALS = xxx */
     1039extern struct globals *const ptr_to_globals;
     1040#define PTR_TO_GLOBALS (*(struct globals**)&ptr_to_globals)
     1041
     1042
     1043/* You can change LIBBB_DEFAULT_LOGIN_SHELL, but don't use it,
     1044 * use bb_default_login_shell and following defines.
     1045 * If you change LIBBB_DEFAULT_LOGIN_SHELL,
     1046 * don't forget to change increment constant. */
    3891047#define LIBBB_DEFAULT_LOGIN_SHELL      "-/bin/sh"
    390 
    391 extern const char * const bb_default_login_shell;
     1048extern const char bb_default_login_shell[];
    3921049/* "/bin/sh" */
    3931050#define DEFAULT_SHELL     (bb_default_login_shell+1)
     
    3961053
    3971054
    398 extern const char bb_path_mtab_file[];
    399 
    400 extern int bb_default_error_retval;
    401 
    402 #ifdef CONFIG_FEATURE_DEVFS
     1055#if ENABLE_FEATURE_DEVFS
    4031056# define CURRENT_VC "/dev/vc/0"
    4041057# define VC_1 "/dev/vc/1"
     
    4211074# define VC_FORMAT "/dev/vc/%d"
    4221075# define LOOP_FORMAT "/dev/loop/%d"
     1076# define LOOP_NAMESIZE (sizeof("/dev/loop/") + sizeof(int)*3 + 1)
     1077# define LOOP_NAME "/dev/loop/"
    4231078# define FB_0 "/dev/fb/0"
    4241079#else
     
    4401095# define VC_FORMAT "/dev/tty%d"
    4411096# define LOOP_FORMAT "/dev/loop%d"
     1097# define LOOP_NAMESIZE (sizeof("/dev/loop") + sizeof(int)*3 + 1)
     1098# define LOOP_NAME "/dev/loop"
    4421099# define FB_0 "/dev/fb0"
    4431100#endif
    444 
    445 //#warning put these in .o files
    4461101
    4471102/* The following devices are the same on devfs and non-devfs systems.  */
    4481103#define CURRENT_TTY "/dev/tty"
    449 #define CONSOLE_DEV "/dev/console"
    450 
    451 int is_in_ino_dev_hashtable(const struct stat *statbuf, char **name);
    452 void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name);
    453 void reset_ino_dev_hashtable(void);
    454 
    455 char *bb_xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
    456 
    457 #define FAIL_DELAY    3
    458 extern void bb_do_delay(int seconds);
    459 extern void change_identity ( const struct passwd *pw );
    460 extern const char *change_identity_e2str ( const struct passwd *pw );
    461 extern void run_shell ( const char *shell, int loginshell, const char *command, const char **additional_args);
    462 #ifdef CONFIG_SELINUX
    463 extern void renew_current_security_context(void);
    464 extern void set_current_security_context(security_context_t sid);
    465 #endif
    466 extern int run_parts(char **args, const unsigned char test_mode, char **env);
    467 extern int restricted_shell ( const char *shell );
    468 extern void setup_environment ( const char *shell, int loginshell, int changeenv, const struct passwd *pw );
    469 extern int correct_password ( const struct passwd *pw );
    470 extern char *pw_encrypt(const char *clear, const char *salt);
    471 extern struct spwd *pwd_to_spwd(const struct passwd *pw);
    472 extern int obscure(const char *old, const char *newval, const struct passwd *pwdp);
    473 
    474 extern int bb_xopen(const char *pathname, int flags);
    475 extern int bb_xopen3(const char *pathname, int flags, int mode);
    476 extern ssize_t bb_xread(int fd, void *buf, size_t count);
    477 extern void bb_xread_all(int fd, void *buf, size_t count);
    478 extern unsigned char bb_xread_char(int fd);
    479 
    480 #ifndef COMM_LEN
    481 #ifdef TASK_COMM_LEN
    482 #define COMM_LEN TASK_COMM_LEN
    483 #else
    484 /* synchronize with sizeof(task_struct.comm) in /usr/include/linux/sched.h */
    485 #define COMM_LEN 16
    486 #endif
    487 #endif
    488 typedef struct {
    489     int pid;
    490     char user[9];
    491     char state[4];
    492     unsigned long rss;
    493     int ppid;
    494 #ifdef CONFIG_FEATURE_TOP_CPU_USAGE_PERCENTAGE
    495     unsigned pcpu;
    496     unsigned pscpu;
    497     unsigned long stime, utime;
    498 #endif
    499     char *cmd;
    500 
    501     /* basename of executable file in call to exec(2),
    502         size from kernel headers */
    503     char short_cmd[COMM_LEN];
    504 } procps_status_t;
    505 
    506 extern procps_status_t * procps_scan(int save_user_arg0);
    507 extern int compare_string_array(const char * const string_array[], const char *key);
    508 
    509 extern int my_query_module(const char *name, int which, void **buf, size_t *bufsize, size_t *ret);
    510 
    511 extern void print_login_issue(const char *issue_file, const char *tty);
    512 extern void print_login_prompt(void);
    513 
    514 #ifdef BB_NOMMU
    515 extern void vfork_daemon(int nochdir, int noclose);
    516 extern void vfork_daemon_rexec(int nochdir, int noclose,
    517         int argc, char **argv, char *foreground_opt);
    518 #endif
    519 
    520 extern int get_terminal_width_height(int fd, int *width, int *height);
    521 extern unsigned long get_ug_id(const char *s, long (*__bb_getxxnam)(const char *));
    522 
    523 typedef struct _sha1_ctx_t_ {
    524     uint32_t count[2];
    525     uint32_t hash[5];
    526     uint32_t wbuf[16];
    527 } sha1_ctx_t;
    528 
    529 void sha1_begin(sha1_ctx_t *ctx);
    530 void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx);
    531 void *sha1_end(void *resbuf, sha1_ctx_t *ctx);
    532 
    533 typedef struct _md5_ctx_t_ {
    534     uint32_t A;
    535     uint32_t B;
    536     uint32_t C;
    537     uint32_t D;
    538     uint64_t total;
    539     uint32_t buflen;
    540     char buffer[128];
    541 } md5_ctx_t;
    542 
    543 void md5_begin(md5_ctx_t *ctx);
    544 void md5_hash(const void *data, size_t length, md5_ctx_t *ctx);
    545 void *md5_end(void *resbuf, md5_ctx_t *ctx);
    546 
    547 extern uint32_t *bb_crc32_filltable (int endian);
     1104#define DEV_CONSOLE "/dev/console"
     1105
    5481106
    5491107#ifndef RB_POWER_OFF
     
    5521110#endif
    5531111
    554 extern const char BB_BANNER[];
     1112/* Make sure we call functions instead of macros.  */
     1113#undef isalnum
     1114#undef isalpha
     1115#undef isascii
     1116#undef isblank
     1117#undef iscntrl
     1118#undef isgraph
     1119#undef islower
     1120#undef isprint
     1121#undef ispunct
     1122#undef isspace
     1123#undef isupper
     1124#undef isxdigit
     1125
     1126/* This one is more efficient - we save ~400 bytes */
     1127#undef isdigit
     1128#define isdigit(a) ((unsigned)((a) - '0') <= 9)
     1129
     1130
     1131#ifdef DMALLOC
     1132#include <dmalloc.h>
     1133#endif
     1134
     1135
     1136#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
    5551137
    5561138#endif /* __LIBBUSYBOX_H__ */
  • branches/stable/mindi-busybox/include/platform.h

    r902 r1770  
    1212#if defined __GNUC__ && defined __GNUC_MINOR__
    1313# define __GNUC_PREREQ(maj, min) \
    14             ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
     14        ((__GNUC__ << 16) + __GNUC_MINOR__ >= ((maj) << 16) + (min))
    1515#else
    1616# define __GNUC_PREREQ(maj, min) 0
     
    3535
    3636#undef inline
    37 #if __STDC_VERSION__ > 199901L
     37#if defined(__STDC_VERSION__) && __STDC_VERSION__ > 199901L
    3838/* it's a keyword */
    3939#else
     
    5454# define ATTRIBUTE_ALIGNED(m) __attribute__ ((__aligned__(m)))
    5555# if __GNUC_PREREQ (3,0)
    56 #  define ATTRIBUTE_ALWAYS_INLINE __attribute__ ((always_inline)) inline
     56#  define ALWAYS_INLINE __attribute__ ((always_inline)) inline
     57#  if !ENABLE_WERROR
     58#   define ATTRIBUTE_DEPRECATED __attribute__ ((__deprecated__))
     59#   define ATTRIBUTE_UNUSED_RESULT __attribute__ ((warn_unused_result))
     60#  else
     61#   define ATTRIBUTE_DEPRECATED /* n/a */
     62#   define ATTRIBUTE_UNUSED_RESULT /* n/a */
     63#  endif
    5764# else
    58 #  define ATTRIBUTE_ALWAYS_INLINE inline
     65#  define ALWAYS_INLINE inline
     66#  define ATTRIBUTE_DEPRECATED /* n/a */
     67#  define ATTRIBUTE_UNUSED_RESULT /* n/a */
    5968# endif
    6069
     
    134143
    135144/* ---- Compiler dependent settings ------------------------- */
     145#if (defined __digital__ && defined __unix__)
     146# undef HAVE_MNTENT_H
     147#else
     148# define HAVE_MNTENT_H 1
     149#endif /* ___digital__ && __unix__ */
     150
     151/* linux/loop.h relies on __u64. Make sure we have that as a proper type
     152 * until userspace is widely fixed.  */
    136153#ifndef __GNUC__
    137154#if defined __INTEL_COMPILER
     
    141158#endif /* ifndef __GNUC__ */
    142159
    143 #if (defined __digital__ && defined __unix__)
    144 # undef HAVE_MNTENT_H
    145 #else
    146 # define HAVE_MNTENT_H 1
    147 #endif /* ___digital__ && __unix__ */
    148 
    149160/*----- Kernel versioning ------------------------------------*/
    150161#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
     
    159170#endif
    160171
    161 // Don't perpetuate e2fsck crap into the headers.  Clean up e2fsck instead.
     172/* Don't perpetuate e2fsck crap into the headers.  Clean up e2fsck instead. */
    162173
    163174#if defined __GLIBC__ || defined __UCLIBC__ \
     
    170181/* Largest integral types.  */
    171182#if __BIG_ENDIAN__
    172 typedef long int                intmax_t;
    173 typedef unsigned long int       uintmax_t;
     183typedef long                intmax_t;
     184typedef unsigned long       uintmax_t;
    174185#else
    175186__extension__
    176 typedef long long int           intmax_t;
     187typedef long long           intmax_t;
    177188__extension__
    178 typedef unsigned long long int  uintmax_t;
    179 #endif
    180 #endif
    181 
    182 /* uclibc does not implement daemon for no-mmu systems.
     189typedef unsigned long long  uintmax_t;
     190#endif
     191#endif
     192
     193/* Size-saving "small" ints (arch-dependent) */
     194#if defined(i386) || defined(__x86_64__) || defined(__mips__) || defined(__cris__)
     195/* add other arches which benefit from this... */
     196typedef signed char smallint;
     197typedef unsigned char smalluint;
     198#else
     199/* for arches where byte accesses generate larger code: */
     200typedef int smallint;
     201typedef unsigned smalluint;
     202#endif
     203
     204/* ISO C Standard:  7.16  Boolean type and values  <stdbool.h> */
     205#if (defined __digital__ && defined __unix__)
     206/* old system without (proper) C99 support */
     207#define bool smalluint
     208#else
     209/* modern system, so use it */
     210#include <stdbool.h>
     211#endif
     212
     213/* Try to defeat gcc's alignment of "char message[]"-like data */
     214#if 1 /* if needed: !defined(arch1) && !defined(arch2) */
     215#define ALIGN1 __attribute__((aligned(1)))
     216#define ALIGN2 __attribute__((aligned(2)))
     217#else
     218/* Arches which MUST have 2 or 4 byte alignment for everything are here */
     219#define ALIGN1
     220#define ALIGN2
     221#endif
     222
     223
     224/* uclibc does not implement daemon() for no-mmu systems.
    183225 * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably.
    184226 * For earlier versions there is no reliable way to check if we are building
     
    188230#if defined __UCLIBC__ && __UCLIBC_MAJOR__ >= 0 && __UCLIBC_MINOR__ >= 9 && \
    189231    __UCLIBC_SUBLEVEL__ > 28 && !defined __ARCH_USE_MMU__
    190 #define BB_NOMMU
     232#define BB_MMU 0
     233#define BB_NOMMU 1
     234#define USE_FOR_NOMMU(...) __VA_ARGS__
     235#define USE_FOR_MMU(...)
     236#else
     237#define BB_MMU 1
     238/* BB_NOMMU is not defined in this case! */
     239#define USE_FOR_NOMMU(...)
     240#define USE_FOR_MMU(...) __VA_ARGS__
    191241#endif
    192242
     
    194244 * libbb.  This would require a platform.c.  It's not going to be cleaned
    195245 * out of the tree, so stop saying it should be. */
     246#if !defined(__dietlibc__)
     247/* Needed for: glibc */
     248/* Not needed for: dietlibc */
     249/* Others: ?? (add as needed) */
    196250#define fdprintf dprintf
     251#endif
     252
     253#if defined(__dietlibc__)
     254static ALWAYS_INLINE char* strchrnul(const char *s, char c)
     255{
     256    while (*s && *s != c) ++s;
     257    return (char*)s;
     258}
     259#endif
     260
     261/* Don't use lchown with glibc older than 2.1.x ... uClibc lacks it */
     262#if (defined __GLIBC__ && __GLIBC__ <= 2 && __GLIBC_MINOR__ < 1) || \
     263    defined __UC_LIBC__
     264# define lchown chown
     265#endif
    197266
    198267/* THIS SHOULD BE CLEANED OUT OF THE TREE ENTIRELY */
     
    209278#define PRIu32 "u"
    210279
    211 /* use legacy setpgrp(pidt_,pid_t) for now.  move to platform.c */
    212 #define bb_setpgrp do{pid_t __me = getpid();setpgrp(__me,__me);}while(0)
     280/* use legacy setpgrp(pid_t,pid_t) for now.  move to platform.c */
     281#define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me,__me); } while (0)
    213282
    214283#if !defined ADJ_OFFSET_SINGLESHOT && defined MOD_CLKA && defined MOD_OFFSET
     
    226295
    227296#else
    228 #define bb_setpgrp setpgrp()
     297#define bb_setpgrp() setpgrp()
    229298#endif
    230299
    231300#if defined(__linux__)
    232301#include <sys/mount.h>
     302/* Make sure we have all the new mount flags we actually try to use. */
     303#ifndef MS_BIND
     304#define MS_BIND        (1<<12)
     305#endif
     306#ifndef MS_MOVE
     307#define MS_MOVE        (1<<13)
     308#endif
     309#ifndef MS_RECURSIVE
     310#define MS_RECURSIVE   (1<<14)
     311#endif
     312#ifndef MS_SILENT
     313#define MS_SILENT      (1<<15)
     314#endif
     315
     316/* The shared subtree stuff, which went in around 2.6.15. */
     317#ifndef MS_UNBINDABLE
     318#define MS_UNBINDABLE  (1<<17)
     319#endif
     320#ifndef MS_PRIVATE
     321#define MS_PRIVATE     (1<<18)
     322#endif
     323#ifndef MS_SLAVE
     324#define MS_SLAVE       (1<<19)
     325#endif
     326#ifndef MS_SHARED
     327#define MS_SHARED      (1<<20)
     328#endif
     329
     330
    233331#if !defined(BLKSSZGET)
    234332#define BLKSSZGET _IO(0x12, 104)
  • branches/stable/mindi-busybox/include/pwd_.h

    r821 r1770  
     1/* vi: set sw=4 ts=4: */
    12/* Copyright (C) 1991,92,95,96,97,98,99,2001 Free Software Foundation, Inc.
    23   This file is part of the GNU C Library.
     
    2122 */
    2223
    23 #if !defined CONFIG_USE_BB_PWD_GRP
     24#if !ENABLE_USE_BB_PWD_GRP
     25
    2426#include <pwd.h>
    2527
     
    2729
    2830#ifndef _PWD_H
    29 #define _PWD_H  1
    30 
    31 #include <sys/types.h>
    32 #include <features.h>
    33 #include <stdio.h>
     31#define _PWD_H 1
    3432
    3533/* The passwd structure.  */
    36 struct passwd
    37 {
    38     char *pw_name;      /* Username.  */
    39     char *pw_passwd;        /* Password.  */
    40     uid_t pw_uid;           /* User ID.  */
    41     gid_t pw_gid;           /* Group ID.  */
    42     char *pw_gecos;     /* Real name.  */
    43     char *pw_dir;           /* Home directory.  */
    44     char *pw_shell;     /* Shell program.  */
     34struct passwd {
     35    char *pw_name;          /* Username.  */
     36    char *pw_passwd;        /* Password.  */
     37    uid_t pw_uid;           /* User ID.  */
     38    gid_t pw_gid;           /* Group ID.  */
     39    char *pw_gecos;         /* Real name.  */
     40    char *pw_dir;           /* Home directory.  */
     41    char *pw_shell;         /* Shell program.  */
    4542};
    4643
    4744
     45#define setpwent    bb_internal_setpwent
     46#define endpwent    bb_internal_endpwent
     47#define getpwent    bb_internal_getpwent
     48#define fgetpwent   bb_internal_fgetpwent
     49#define putpwent    bb_internal_putpwent
     50#define getpwuid    bb_internal_getpwuid
     51#define getpwnam    bb_internal_getpwnam
     52#define getpwent_r  bb_internal_getpwent_r
     53#define getpwuid_r  bb_internal_getpwuid_r
     54#define getpwnam_r  bb_internal_getpwnam_r
     55#define fgetpwent_r bb_internal_fgetpwent_r
     56#define getpw       bb_internal_getpw
     57
     58
     59/* All function names below should be remapped by #defines above
     60 * in order to not collide with libc names.
     61 * In theory it isn't necessary, but I saw weird interactions at link time.
     62 * Let's play safe */
     63
     64
    4865/* Rewind the password-file stream.  */
    49 extern void setpwent (void);
     66extern void setpwent(void);
    5067
    5168/* Close the password-file stream.  */
    52 extern void endpwent (void);
     69extern void endpwent(void);
    5370
    5471/* Read an entry from the password-file stream, opening it if necessary.  */
    55 extern struct passwd *getpwent (void);
     72extern struct passwd *getpwent(void);
    5673
    5774/* Read an entry from STREAM.  */
    58 extern struct passwd *fgetpwent (FILE *__stream);
     75extern struct passwd *fgetpwent(FILE *__stream);
    5976
    6077/* Write the given entry onto the given stream.  */
    61 extern int putpwent (__const struct passwd *__restrict __p,
     78extern int putpwent(__const struct passwd *__restrict __p,
    6279             FILE *__restrict __f);
    6380
    6481/* Search for an entry with a matching user ID.  */
    65 extern struct passwd *getpwuid (uid_t __uid);
     82extern struct passwd *getpwuid(uid_t __uid);
    6683
    6784/* Search for an entry with a matching username.  */
    68 extern struct passwd *getpwnam (__const char *__name);
     85extern struct passwd *getpwnam(__const char *__name);
    6986
    7087/* Reentrant versions of some of the functions above.
     
    7693   POSIX people would choose.  */
    7794
    78 extern int getpwent_r (struct passwd *__restrict __resultbuf,
     95extern int getpwent_r(struct passwd *__restrict __resultbuf,
    7996               char *__restrict __buffer, size_t __buflen,
    8097               struct passwd **__restrict __result);
    8198
    82 extern int getpwuid_r (uid_t __uid,
     99extern int getpwuid_r(uid_t __uid,
    83100               struct passwd *__restrict __resultbuf,
    84101               char *__restrict __buffer, size_t __buflen,
    85102               struct passwd **__restrict __result);
    86103
    87 extern int getpwnam_r (__const char *__restrict __name,
     104extern int getpwnam_r(__const char *__restrict __name,
    88105               struct passwd *__restrict __resultbuf,
    89106               char *__restrict __buffer, size_t __buflen,
    90107               struct passwd **__restrict __result);
    91108
    92 
    93109/* Read an entry from STREAM.  This function is not standardized and
    94110   probably never will.  */
    95 extern int fgetpwent_r (FILE *__restrict __stream,
     111extern int fgetpwent_r(FILE *__restrict __stream,
    96112            struct passwd *__restrict __resultbuf,
    97113            char *__restrict __buffer, size_t __buflen,
     
    101117   in the given buffer.  This knows the format that the caller
    102118   will expect, but this need not be the format of the password file.  */
    103 extern int getpw (uid_t __uid, char *__buffer);
     119extern int getpw(uid_t __uid, char *__buffer);
    104120
    105121#endif /* pwd.h  */
  • branches/stable/mindi-busybox/include/shadow_.h

    r821 r1770  
     1/* vi: set sw=4 ts=4: */
    12/* Copyright (C) 1996, 1997, 1998, 1999 Free Software Foundation, Inc.
    23   This file is part of the GNU C Library.
     
    1718   02111-1307 USA.  */
    1819
    19 /* Declaration of types and functions for shadow password suite. */
     20/* Declaration of types and functions for shadow password suite */
    2021
    21 #if !defined CONFIG_USE_BB_SHADOW
     22#if !ENABLE_USE_BB_SHADOW
     23
    2224#include <shadow.h>
     25
    2326#else
    2427
    2528#ifndef _SHADOW_H
    26 #define _SHADOW_H   1
     29#define _SHADOW_H 1
    2730
    28 #include <stdio.h>
     31/* Paths to the user database files */
     32#ifndef _PATH_SHADOW
     33#define _PATH_SHADOW "/etc/shadow"
     34#endif
    2935
    30 /* Paths to the user database files.  */
    31 #ifndef _PATH_SHADOW
    32 #define _PATH_SHADOW    "/etc/shadow"
    33 #endif
    34 #define SHADOW _PATH_SHADOW
    35 
    36 
    37 /* Structure of the password file.  */
    38 struct spwd
    39 {
    40     char *sp_namp;      /* Login name.  */
    41     char *sp_pwdp;      /* Encrypted password.  */
    42     long int sp_lstchg;     /* Date of last change.  */
    43     long int sp_min;        /* Minimum number of days between changes.  */
    44     long int sp_max;        /* Maximum number of days between changes.  */
    45     long int sp_warn;       /* Number of days to warn user to change
    46                    the password.  */
    47     long int sp_inact;      /* Number of days the account may be
    48                    inactive.  */
    49     long int sp_expire;     /* Number of days since 1970-01-01 until
    50                    account expires.  */
    51     unsigned long int sp_flag;  /* Reserved.  */
     36/* Structure of the password file */
     37struct spwd {
     38    char *sp_namp;          /* Login name */
     39    char *sp_pwdp;          /* Encrypted password */
     40    long sp_lstchg;         /* Date of last change */
     41    long sp_min;            /* Minimum number of days between changes */
     42    long sp_max;            /* Maximum number of days between changes */
     43    long sp_warn;           /* Number of days to warn user to change the password */
     44    long sp_inact;          /* Number of days the account may be inactive */
     45    long sp_expire;         /* Number of days since 1970-01-01 until account expires */
     46    unsigned long sp_flag;  /* Reserved */
    5247};
    5348
    5449
    55 /* Open database for reading.  */
    56 extern void setspent (void);
     50#define setspent    bb_internal_setspent
     51#define endspent    bb_internal_endspent
     52#define getspent    bb_internal_getspent
     53#define getspnam    bb_internal_getspnam
     54#define sgetspent   bb_internal_sgetspent
     55#define fgetspent   bb_internal_fgetspent
     56#define putspent    bb_internal_putspent
     57#define getspent_r  bb_internal_getspent_r
     58#define getspnam_r  bb_internal_getspnam_r
     59#define sgetspent_r bb_internal_sgetspent_r
     60#define fgetspent_r bb_internal_fgetspent_r
     61#define lckpwdf     bb_internal_lckpwdf
     62#define ulckpwdf    bb_internal_ulckpwdf
    5763
    58 /* Close database.  */
    59 extern void endspent (void);
    6064
    61 /* Get next entry from database, perhaps after opening the file.  */
    62 extern struct spwd *getspent (void);
     65/* All function names below should be remapped by #defines above
     66 * in order to not collide with libc names.
     67 * In theory it isn't necessary, but I saw weird interactions at link time.
     68 * Let's play safe */
    6369
    64 /* Get shadow entry matching NAME.  */
    65 extern struct spwd *getspnam (__const char *__name);
    6670
    67 /* Read shadow entry from STRING. */
    68 extern struct spwd *sgetspent (__const char *__string);
     71/* Open database for reading */
     72extern void setspent(void);
    6973
    70 /* Read next shadow entry from STREAM. */
    71 extern struct spwd *fgetspent (FILE *__stream);
     74/* Close database */
     75extern void endspent(void);
    7276
    73 /* Write line containing shadow password entry to stream. */
    74 extern int putspent (__const struct spwd *__p, FILE *__stream);
     77/* Get next entry from database, perhaps after opening the file */
     78extern struct spwd *getspent(void);
    7579
    76 /* Reentrant versions of some of the functions above.  */
    77 extern int getspent_r (struct spwd *__result_buf, char *__buffer,
     80/* Get shadow entry matching NAME */
     81extern struct spwd *getspnam(__const char *__name);
     82
     83/* Read shadow entry from STRING */
     84extern struct spwd *sgetspent(__const char *__string);
     85
     86/* Read next shadow entry from STREAM */
     87extern struct spwd *fgetspent(FILE *__stream);
     88
     89/* Write line containing shadow password entry to stream */
     90extern int putspent(__const struct spwd *__p, FILE *__stream);
     91
     92/* Reentrant versions of some of the functions above */
     93extern int getspent_r(struct spwd *__result_buf, char *__buffer,
    7894               size_t __buflen, struct spwd **__result);
    7995
    80 extern int getspnam_r (__const char *__name, struct spwd *__result_buf,
     96extern int getspnam_r(__const char *__name, struct spwd *__result_buf,
    8197               char *__buffer, size_t __buflen,
    8298               struct spwd **__result);
    8399
    84 extern int sgetspent_r (__const char *__string, struct spwd *__result_buf,
     100extern int sgetspent_r(__const char *__string, struct spwd *__result_buf,
    85101            char *__buffer, size_t __buflen,
    86102            struct spwd **__result);
    87103
    88 extern int fgetspent_r (FILE *__stream, struct spwd *__result_buf,
     104extern int fgetspent_r(FILE *__stream, struct spwd *__result_buf,
    89105            char *__buffer, size_t __buflen,
    90106            struct spwd **__result);
    91 /* Protect password file against multi writers. */
    92 extern int lckpwdf (void);
     107/* Protect password file against multi writers */
     108extern int lckpwdf(void);
    93109
    94 /* Unlock password file. */
    95 extern int ulckpwdf (void);
     110/* Unlock password file */
     111extern int ulckpwdf(void);
    96112
    97113#endif /* shadow.h */
  • branches/stable/mindi-busybox/include/unarchive.h

    r821 r1770  
    1111#define ARCHIVE_NOPRESERVE_PERM         64
    1212
    13 #include <sys/types.h>
    14 #include <stdio.h>
    15 #include "libbb.h"
    16 
    17 typedef struct file_headers_s {
     13typedef struct file_header_t {
    1814    char *name;
    19     char *link_name;
     15    char *link_target;
    2016    off_t size;
    2117    uid_t uid;
     
    2622} file_header_t;
    2723
    28 typedef struct archive_handle_s {
    29     /* define if the header and data component should processed */
    30     char (*filter)(struct archive_handle_s *);
     24typedef struct archive_handle_t {
     25    /* define if the header and data component should be processed */
     26    char (*filter)(struct archive_handle_t *);
    3127    llist_t *accept;
    3228    /* List of files that have been rejected */
     
    4238
    4339    /* process the data component, e.g. extract to filesystem */
    44     void (*action_data)(struct archive_handle_s *);
     40    void (*action_data)(struct archive_handle_t *);
    4541
    4642    /* How to process any sub archive, e.g. get_header_tar_gz */
    47     char (*action_data_subarchive)(struct archive_handle_s *);
     43    char (*action_data_subarchive)(struct archive_handle_t *);
    4844
    4945    /* Contains the handle to a sub archive */
    50     struct archive_handle_s *sub_archive;
     46    struct archive_handle_t *sub_archive;
    5147
    5248    /* The raw stream as read from disk or stdin */
     
    5753
    5854    /* Function that skips data: read_by_char or read_by_skip */
    59     void (*seek)(const struct archive_handle_s *archive_handle, const unsigned int amount);
     55    void (*seek)(const struct archive_handle_t *archive_handle, const unsigned amount);
    6056
    6157    /* Temporary storage */
     
    6662
    6763} archive_handle_t;
     64
    6865
    6966extern archive_handle_t *init_handle(void);
     
    8582extern void header_verbose_list(const file_header_t *file_header);
    8683
    87 extern void check_header_gzip(int src_fd);
     84extern void check_header_gzip_or_die(int src_fd);
    8885
    8986extern char get_header_ar(archive_handle_t *archive_handle);
     
    9491extern char get_header_tar_gz(archive_handle_t *archive_handle);
    9592
    96 extern void seek_by_jump(const archive_handle_t *archive_handle, const unsigned int amount);
    97 extern void seek_by_char(const archive_handle_t *archive_handle, const unsigned int amount);
     93extern void seek_by_jump(const archive_handle_t *archive_handle, const unsigned amount);
     94extern void seek_by_read(const archive_handle_t *archive_handle, const unsigned amount);
    9895
    99 extern void archive_xread_all(const archive_handle_t *archive_handle, void *buf, const size_t count);
    10096extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count);
    10197
    10298extern void data_align(archive_handle_t *archive_handle, const unsigned short boundary);
    10399extern const llist_t *find_list_entry(const llist_t *list, const char *filename);
     100extern const llist_t *find_list_entry2(const llist_t *list, const char *filename);
    104101
    105 extern int uncompressStream(int src_fd, int dst_fd);
    106 extern void inflate_init(unsigned int bufsize);
    107 extern void inflate_cleanup(void);
    108 extern int inflate_unzip(int in, int out);
    109 extern int inflate_gunzip(int in, int out);
    110 extern int unlzma(int src_fd, int dst_fd);
     102/* A bit of bunzip2 internals are exposed for compressed help support: */
     103typedef struct bunzip_data bunzip_data;
     104int start_bunzip(bunzip_data **bdp, int in_fd, const unsigned char *inbuf, int len);
     105int read_bunzip(bunzip_data *bd, char *outbuf, int len);
     106void dealloc_bunzip(bunzip_data *bd);
    111107
    112 extern int open_transformer(int src_fd, int (*transformer)(int src_fd, int dst_fd));
     108typedef struct inflate_unzip_result {
     109    off_t bytes_out;
     110    uint32_t crc;
     111} inflate_unzip_result;
    113112
     113extern USE_DESKTOP(long long) int unpack_bz2_stream(int src_fd, int dst_fd);
     114extern USE_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, unsigned bufsize, int src_fd, int dst_fd);
     115extern USE_DESKTOP(long long) int unpack_gz_stream(int src_fd, int dst_fd);
     116extern USE_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd);
     117
     118#if BB_MMU
     119extern int open_transformer(int src_fd,
     120    USE_DESKTOP(long long) int (*transformer)(int src_fd, int dst_fd));
     121#define open_transformer(src_fd, transformer, transform_prog, ...) open_transformer(src_fd, transformer)
     122#else
     123extern int open_transformer(int src_fd, const char *transform_prog, ...);
     124#define open_transformer(src_fd, transformer, transform_prog, ...) open_transformer(src_fd, transform_prog, __VA_ARGS__)
     125#endif
    114126
    115127#endif
  • branches/stable/mindi-busybox/include/usage.h

    r821 r1770  
     1/* vi: set sw=8 ts=8: */
     2/*
     3 * This file suffers from chronically incorrect tabification
     4 * of messages. Before editing this file:
     5 * 1. Switch you editor to 8-space tab mode.
     6 * 2. Do not use \t in messages, use real tab character.
     7 * 3. Start each source line with message as follows:
     8 *    |<7 spaces>"text with tabs"....
     9 */
     10
    111#ifndef __BB_USAGE_H__
    212#define __BB_USAGE_H__
    313
    414#define addgroup_trivial_usage \
    5     "[-g GID] group_name [user_name]"
     15       "[-g GID]"USE_FEATURE_ADDUSER_TO_GROUP(" [user_name]")" group_name"
    616#define addgroup_full_usage \
    7     "Adds a group to the system\n\n" \
    8     "Options:\n" \
    9     "\t-g GID\t\tspecify gid"
     17       "Add a group to the system"USE_FEATURE_ADDUSER_TO_GROUP(" or add an user to a group") \
     18       "\n\nOptions:\n" \
     19       "    -g GID  Specify gid"
    1020
    1121#define adduser_trivial_usage \
    12     "[OPTIONS] user_name"
     22       "[OPTIONS] user_name"
    1323#define adduser_full_usage \
    14     "Adds a user to the system\n\n" \
    15     "Options:\n" \
    16     "\t-h DIR\t\tAssign home directory DIR\n" \
    17     "\t-g GECOS\tAssign gecos field GECOS\n" \
    18     "\t-s SHELL\tAssign login shell SHELL\n" \
    19     "\t-G\t\tAdd the user to existing group GROUP\n" \
    20     "\t-S\t\tcreate a system user (ignored)\n" \
    21     "\t-D\t\tDo not assign a password (logins still possible via ssh)\n" \
    22     "\t-H\t\tDo not create the home directory"
     24       "Add a user to the system" \
     25       "\n\nOptions:\n" \
     26       "    -h DIR      Home directory\n" \
     27       "    -g GECOS    GECOS field\n" \
     28       "    -s SHELL    Login shell\n" \
     29       "    -G GROUP    Add user to existing group\n" \
     30       "    -S      Create a system user (ignored)\n" \
     31       "    -D      Do not assign a password (logins still possible via ssh)\n" \
     32       "    -H      Do not create home directory"
    2333
    2434#define adjtimex_trivial_usage \
    25     "[-q] [-o offset] [-f frequency] [-p timeconstant] [-t tick]"
     35       "[-q] [-o offset] [-f frequency] [-p timeconstant] [-t tick]"
    2636#define adjtimex_full_usage \
    27     "Reads and optionally sets system timebase parameters.\n" \
    28     "See adjtimex(2).\n\n" \
    29     "Options:\n" \
    30     "\t-q\t\tquiet mode - do not print\n" \
    31     "\t-o offset\ttime offset, microseconds\n" \
    32     "\t-f frequency\tfrequency adjust, integer kernel units (65536 is 1ppm)\n" \
    33     "\t\t\t(positive values make the system clock run fast)\n" \
    34     "\t-t tick\t\tmicroseconds per tick, usually 10000\n" \
    35     "\t-p timeconstant"
     37       "Read and optionally set system timebase parameters.\n" \
     38       "See adjtimex(2)." \
     39       "\n\nOptions:\n" \
     40       "    -q      Quiet\n" \
     41       "    -o offset   Time offset, microseconds\n" \
     42       "    -f frequency    Frequency adjust, integer kernel units (65536 is 1ppm)\n" \
     43       "            (positive values make the system clock run faster)\n" \
     44       "    -t tick     Microseconds per tick, usually 10000\n" \
     45       "    -p timeconstant"
    3646
    3747#define ar_trivial_usage \
    38     "[-o] [-v] [-p] [-t] [-x] ARCHIVE FILES"
     48       "[-o] [-v] [-p] [-t] [-x] ARCHIVE FILES"
    3949#define ar_full_usage \
    40     "Extract or list FILES from an ar archive.\n\n" \
    41     "Options:\n" \
    42     "\t-o\t\tpreserve original dates\n" \
    43     "\t-p\t\textract to stdout\n" \
    44     "\t-t\t\tlist\n" \
    45     "\t-x\t\textract\n" \
    46     "\t-v\t\tverbosely list files processed"
     50       "Extract or list FILES from an ar archive" \
     51       "\n\nOptions:\n" \
     52       "    -o  Preserve original dates\n" \
     53       "    -p  Extract to stdout\n" \
     54       "    -t  List\n" \
     55       "    -x  Extract\n" \
     56       "    -v  Verbose"
     57
     58#define arp_trivial_usage \
     59       "\n" \
     60       "[-vn]   [-H type] [-i if] -a [hostname]\n" \
     61       "[-v]          [-i if] -d hostname [pub]\n" \
     62       "[-v]    [-H type] [-i if] -s hostname hw_addr [temp]\n" \
     63       "[-v]    [-H type] [-i if] -s hostname hw_addr [netmask nm] pub\n" \
     64       "[-v]    [-H type] [-i if] -Ds hostname ifa [netmask nm] pub\n"
     65#define arp_full_usage \
     66       "Manipulate the system ARP cache" \
     67       "\n\nOptions:" \
     68       "\n  -a      Display (all) hosts" \
     69       "\n  -s      Set a new ARP entry" \
     70       "\n  -d      Delete a specified entry" \
     71       "\n  -v      Verbose" \
     72       "\n  -n      Don't resolve names" \
     73       "\n  -i if       Specify network interface (e.g. eth0)" \
     74       "\n  -D      Read <hwaddr> from given device" \
     75       "\n  -A, -p      Specify protocol family" \
     76       "\n  -H hwtype   Specify hardware address type"
    4777
    4878#define arping_trivial_usage \
    49     "[-fqbDUA] [-c count] [-w timeout] [-i device] [-s sender] target"
     79       "[-fqbDUA] [-c count] [-w timeout] [-i device] [-s sender] target"
    5080#define arping_full_usage \
    51     "Ping hosts by ARP requests/replies.\n\n" \
    52     "Options:\n" \
    53     "\t-f\t\tQuit on first ARP reply\n" \
    54     "\t-q\t\tBe quiet\n" \
    55     "\t-b\t\tKeep broadcasting, don't go unicast\n" \
    56     "\t-D\t\tDuplicated address detection mode\n" \
    57     "\t-U\t\tUnsolicited ARP mode, update your neighbours\n" \
    58     "\t-A\t\tARP answer mode, update your neighbours\n" \
    59     "\t-c count\tStop after sending count ARP request packets\n" \
    60     "\t-w timeout\tTime to wait for ARP reply, in seconds\n" \
    61     "\t-i device\tOutgoing interface name, default is eth0\n" \
    62     "\t-s sender\tSet specific sender IP address\n" \
    63     "\ttarget\t\tTarget IP address of ARP request"
     81       "Ping hosts by ARP requests/replies" \
     82       "\n\nOptions:\n" \
     83       "    -f      Quit on first ARP reply\n" \
     84       "    -q      Quiet\n" \
     85       "    -b      Keep broadcasting, don't go unicast\n" \
     86       "    -D      Duplicated address detection mode\n" \
     87       "    -U      Unsolicited ARP mode, update your neighbours\n" \
     88       "    -A      ARP answer mode, update your neighbours\n" \
     89       "    -c count    Stop after sending count ARP request packets\n" \
     90       "    -w timeout  Time to wait for ARP reply, in seconds\n" \
     91       "    -I device   Outgoing interface name, default is eth0\n" \
     92       "    -s sender   Set specific sender IP address\n" \
     93       "    target      Target IP address of ARP request"
    6494
    6595#define ash_trivial_usage \
    66     "[FILE]...\n" \
    67     "or: ash -c command [args]..."
     96       "[FILE]...\n" \
     97       "or: ash -c command [args]..."
    6898#define ash_full_usage \
    69     "The ash shell (command interpreter)"
     99       "The ash shell (command interpreter)"
    70100
    71101#define awk_trivial_usage \
    72     "[OPTION]... [program-text] [FILE ...]"
     102       "[OPTION]... [program-text] [FILE ...]"
    73103#define awk_full_usage \
    74     "Options:\n" \
    75     "\t-v var=val\tassign value 'val' to variable 'var'\n" \
    76     "\t-F sep\t\tuse 'sep' as field separator\n" \
    77     "\t-f progname\tread program source from file 'progname'"
     104       "Options:\n" \
     105       "    -v var=val  Set variable\n" \
     106       "    -F sep      Use 'sep' as field separator\n" \
     107       "    -f filename Read program from file"
    78108
    79109#define basename_trivial_usage \
    80     "FILE [SUFFIX]"
     110       "FILE [SUFFIX]"
    81111#define basename_full_usage \
    82     "Strips directory path and suffixes from FILE.\n" \
    83     "If specified, also removes any trailing SUFFIX."
     112       "Strip directory path and suffixes from FILE.\n" \
     113       "If specified, also remove any trailing SUFFIX."
    84114#define basename_example_usage \
    85     "$ basename /usr/local/bin/foo\n" \
    86     "foo\n" \
    87     "$ basename /usr/local/bin/\n" \
    88     "bin\n" \
    89     "$ basename /foo/bar.txt .txt\n" \
    90     "bar"
     115       "$ basename /usr/local/bin/foo\n" \
     116       "foo\n" \
     117       "$ basename /usr/local/bin/\n" \
     118       "bin\n" \
     119       "$ basename /foo/bar.txt .txt\n" \
     120       "bar"
    91121
    92122#define bunzip2_trivial_usage \
    93     "[OPTION]... [FILE]"
     123       "[OPTION]... [FILE]"
    94124#define bunzip2_full_usage \
    95     "Uncompress FILE (or standard input if FILE is '-' or omitted).\n\n" \
    96     "Options:\n" \
    97     "\t-c\tWrite output to standard output\n" \
    98     "\t-f\tForce"
     125       "Uncompress FILE (or standard input if FILE is '-' or omitted)" \
     126       "\n\nOptions:\n" \
     127       "    -c  Write output to standard output\n" \
     128       "    -f  Force"
    99129
    100130#define busybox_notes_usage \
    101     "Hello world!\n"
     131       "Hello world!\n"
    102132
    103133#define bzcat_trivial_usage \
    104     "FILE"
     134       "FILE"
    105135#define bzcat_full_usage \
    106     "Uncompress to stdout."
     136       "Uncompress to stdout"
    107137
    108138#define unlzma_trivial_usage \
    109     "[OPTION]... [FILE]"
     139       "[OPTION]... [FILE]"
    110140#define unlzma_full_usage \
    111     "Uncompress FILE (or standard input if FILE is '-' or omitted).\n\n" \
    112     "Options:\n" \
    113     "\t-c\tWrite output to standard output\n" \
    114     "\t-f\tForce"
     141       "Uncompress FILE (or standard input if FILE is '-' or omitted)" \
     142       "\n\nOptions:\n" \
     143       "    -c  Write output to standard output\n" \
     144       "    -f  Force"
    115145
    116146#define lzmacat_trivial_usage \
    117     "FILE"
     147       "FILE"
    118148#define lzmacat_full_usage \
    119     "Uncompress to stdout."
     149       "Uncompress to stdout"
    120150
    121151#define cal_trivial_usage \
    122     "[-jy] [[month] year]"
     152       "[-jy] [[month] year]"
    123153#define cal_full_usage \
    124     "Display a calendar.\n" \
    125     "\nOptions:\n" \
    126     "\t-j\tUse julian dates\n" \
    127     "\t-y\tDisplay the entire year"
     154       "Display a calendar" \
     155       "\n\nOptions:" \
     156       "\n  -j  Use julian dates" \
     157       "\n  -y  Display the entire year"
    128158
    129159#define cat_trivial_usage \
    130     "[-u] [FILE]..."
     160       "[-u] [FILE]..."
    131161#define cat_full_usage \
    132     "Concatenates FILE(s) and prints them to stdout.\n\n" \
    133     "Options:\n" \
    134     "\t-u\tignored since unbuffered i/o is always used"
     162       "Concatenate FILE(s) and print them to stdout" \
     163       "\n\nOptions:" \
     164       "\n  -u  Use unbuffered i/o (ignored)"
    135165#define cat_example_usage \
    136     "$ cat /proc/uptime\n" \
    137     "110716.72 17.67"
     166       "$ cat /proc/uptime\n" \
     167       "110716.72 17.67"
    138168
    139169#define catv_trivial_usage \
    140     "[-etv] [FILE]..."
     170       "[-etv] [FILE]..."
    141171#define catv_full_usage \
    142     "Display nonprinting characters as ^x or M-x.\n\n"\
    143     "\t-e\tEnd each line with $\n" \
    144     "\t-t\tShow tabs as ^I\n" \
    145     "\t-v\tDon't use ^x or M-x escapes."
     172       "Display nonprinting characters as ^x or M-x" \
     173       "\n\nOptions:\n" \
     174       "    -e  End each line with $\n" \
     175       "    -t  Show tabs as ^I\n" \
     176       "    -v  Don't use ^x or M-x escapes"
    146177#define chattr_trivial_usage \
    147     "[-R] [-+=AacDdijsStTu] [-v version] files..."
     178       "[-R] [-+=AacDdijsStTu] [-v version] files..."
    148179#define chattr_full_usage \
    149     "change file attributes on an ext2 fs\n\n" \
    150     "Modifiers:\n" \
    151     "\t-\tremove attributes\n" \
    152     "\t+\tadd attributes\n" \
    153     "\t=\tset attributes\n" \
    154     "Attributes:\n" \
    155     "\tA\tdon't track atime\n" \
    156     "\ta\tappend mode only\n" \
    157     "\tc\tenable compress\n" \
    158     "\tD\twrite dir contents synchronously\n" \
    159     "\td\tdo not backup with dump\n" \
    160     "\ti\tcannot be modified (immutable)\n" \
    161     "\tj\twrite all data to journal first\n" \
    162     "\ts\tzero disk storage when deleted\n" \
    163     "\tS\twrite file contents synchronously\n" \
    164     "\tt\tdisable tail-merging of partial blocks with other files\n" \
    165     "\tu\tallow file to be undeleted\n" \
    166     "Options:\n" \
    167     "\t-R\trecursively list subdirectories\n" \
    168     "\t-v\tset the file's version/generation number"
     180       "Change file attributes on an ext2 fs\n\n" \
     181       "Modifiers:\n" \
     182       "    -   Remove attributes\n" \
     183       "    +   Add attributes\n" \
     184       "    =   Set attributes\n" \
     185       "Attributes:\n" \
     186       "    A   Don't track atime\n" \
     187       "    a   Append mode only\n" \
     188       "    c   Enable compress\n" \
     189       "    D   Write dir contents synchronously\n" \
     190       "    d   Do not backup with dump\n" \
     191       "    i   Cannot be modified (immutable)\n" \
     192       "    j   Write all data to journal first\n" \
     193       "    s   Zero disk storage when deleted\n" \
     194       "    S   Write file contents synchronously\n" \
     195       "    t   Disable tail-merging of partial blocks with other files\n" \
     196       "    u   Allow file to be undeleted\n" \
     197       "Options:\n" \
     198       "    -R  Recursively list subdirectories\n" \
     199       "    -v  Set the file's version/generation number"
     200
     201#define chcon_trivial_usage \
     202       "[OPTIONS] CONTEXT FILE...\n" \
     203       "    chcon [OPTIONS] [-u USER] [-r ROLE] [-l RANGE] [-t TYPE] FILE...\n" \
     204       "    chcon [OPTIONS] --reference=RFILE FILE...\n"
     205#define chcon_full_usage \
     206       "Change the security context of each FILE to CONTEXT\n" \
     207       "\n  -v, --verbose       Verbose" \
     208       "\n  -c, --changes       Report changes made" \
     209       "\n  -h, --no-dereference    Affect symlinks instead of their targets" \
     210       "\n  -f, --silent, --quiet   Suppress most error messages" \
     211       "\n  --reference=RFILE   Use RFILE's group instead of using a CONTEXT value" \
     212       "\n  -u, --user=USER     Set user USER in the target security context" \
     213       "\n  -r, --role=ROLE     Set role ROLE in the target security context" \
     214       "\n  -t, --type=TYPE     Set type TYPE in the target security context" \
     215       "\n  -l, --range=RANGE   Set range RANGE in the target security context" \
     216       "\n  -R, --recursive     Recurse subdirectories" \
     217
     218#define chmod_trivial_usage \
     219       "[-R"USE_DESKTOP("cvf")"] MODE[,MODE]... FILE..."
     220#define chmod_full_usage \
     221       "Each MODE is one or more of the letters ugoa, one of the\n" \
     222       "symbols +-= and one or more of the letters rwxst" \
     223       "\n\nOptions:" \
     224       "\n  -R  Recurse directories" \
     225    USE_DESKTOP( \
     226       "\n  -c  List changed files" \
     227       "\n  -v  List all files" \
     228       "\n  -f  Hide errors" \
     229    )
     230#define chmod_example_usage \
     231       "$ ls -l /tmp/foo\n" \
     232       "-rw-rw-r--    1 root     root            0 Apr 12 18:25 /tmp/foo\n" \
     233       "$ chmod u+x /tmp/foo\n" \
     234       "$ ls -l /tmp/foo\n" \
     235       "-rwxrw-r--    1 root     root            0 Apr 12 18:25 /tmp/foo*\n" \
     236       "$ chmod 444 /tmp/foo\n" \
     237       "$ ls -l /tmp/foo\n" \
     238       "-r--r--r--    1 root     root            0 Apr 12 18:25 /tmp/foo\n"
    169239
    170240#define chgrp_trivial_usage \
    171     "[OPTION]... GROUP FILE..."
     241       "[-RhLHP"USE_DESKTOP("cvf")"]... GROUP FILE..."
    172242#define chgrp_full_usage \
    173     "Change the group membership of each FILE to GROUP.\n" \
    174     "\nOptions:\n" \
    175     "\t-R\tChanges files and directories recursively"
     243       "Change the group membership of each FILE to GROUP" \
     244       "\n\nOptions:" \
     245       "\n  -R  Recurse directories" \
     246       "\n  -h  Affect symlinks instead of symlink targets" \
     247       "\n  -L  Traverse all symlinks to directories" \
     248       "\n  -H  Traverse symlinks on command line only" \
     249       "\n  -P  Do not traverse symlinks (default)" \
     250    USE_DESKTOP( \
     251       "\n  -c  List changed files" \
     252       "\n  -v  Verbose" \
     253       "\n  -f  Hide errors" \
     254    )
    176255#define chgrp_example_usage \
    177     "$ ls -l /tmp/foo\n" \
    178     "-r--r--r--    1 andersen andersen        0 Apr 12 18:25 /tmp/foo\n" \
    179     "$ chgrp root /tmp/foo\n" \
    180     "$ ls -l /tmp/foo\n" \
    181     "-r--r--r--    1 andersen root            0 Apr 12 18:25 /tmp/foo\n"
    182 
    183 #define chmod_trivial_usage \
    184     "[-R] MODE[,MODE]... FILE..."
    185 #define chmod_full_usage \
    186     "Each MODE is one or more of the letters ugoa, one of the\n" \
    187     "symbols +-= and one or more of the letters rwxst.\n\n" \
    188     "Options:\n" \
    189     "\t-R\tChanges files and directories recursively"
    190 #define chmod_example_usage \
    191     "$ ls -l /tmp/foo\n" \
    192     "-rw-rw-r--    1 root     root            0 Apr 12 18:25 /tmp/foo\n" \
    193     "$ chmod u+x /tmp/foo\n" \
    194     "$ ls -l /tmp/foo\n" \
    195     "-rwxrw-r--    1 root     root            0 Apr 12 18:25 /tmp/foo*\n" \
    196     "$ chmod 444 /tmp/foo\n" \
    197     "$ ls -l /tmp/foo\n" \
    198     "-r--r--r--    1 root     root            0 Apr 12 18:25 /tmp/foo\n"
     256       "$ ls -l /tmp/foo\n" \
     257       "-r--r--r--    1 andersen andersen        0 Apr 12 18:25 /tmp/foo\n" \
     258       "$ chgrp root /tmp/foo\n" \
     259       "$ ls -l /tmp/foo\n" \
     260       "-r--r--r--    1 andersen root            0 Apr 12 18:25 /tmp/foo\n"
    199261
    200262#define chown_trivial_usage \
    201     "[ -Rh ]... OWNER[<.|:>[GROUP]] FILE..."
     263       "[-RhLHP"USE_DESKTOP("cvf")"]... OWNER[<.|:>[GROUP]] FILE..."
    202264#define chown_full_usage \
    203     "Change the owner and/or group of each FILE to OWNER and/or GROUP.\n" \
    204     "\nOptions:\n" \
    205     "\t-R\tChanges files and directories recursively\n" \
    206     "\t-h\tDo not dereference symbolic links"
     265       "Change the owner and/or group of each FILE to OWNER and/or GROUP" \
     266       "\n\nOptions:" \
     267       "\n  -R  Recurse directories" \
     268       "\n  -h  Affect symlinks instead of symlink targets" \
     269       "\n  -L  Traverse all symlinks to directories" \
     270       "\n  -H  Traverse symlinks on command line only" \
     271       "\n  -P  Do not traverse symlinks (default)" \
     272    USE_DESKTOP( \
     273       "\n  -c  List changed files" \
     274       "\n  -v  List all files" \
     275       "\n  -f  Hide errors" \
     276    )
    207277#define chown_example_usage \
    208     "$ ls -l /tmp/foo\n" \
    209     "-r--r--r--    1 andersen andersen        0 Apr 12 18:25 /tmp/foo\n" \
    210     "$ chown root /tmp/foo\n" \
    211     "$ ls -l /tmp/foo\n" \
    212     "-r--r--r--    1 root     andersen        0 Apr 12 18:25 /tmp/foo\n" \
    213     "$ chown root.root /tmp/foo\n" \
    214     "ls -l /tmp/foo\n" \
    215     "-r--r--r--    1 root     root            0 Apr 12 18:25 /tmp/foo\n"
     278       "$ ls -l /tmp/foo\n" \
     279       "-r--r--r--    1 andersen andersen        0 Apr 12 18:25 /tmp/foo\n" \
     280       "$ chown root /tmp/foo\n" \
     281       "$ ls -l /tmp/foo\n" \
     282       "-r--r--r--    1 root     andersen        0 Apr 12 18:25 /tmp/foo\n" \
     283       "$ chown root.root /tmp/foo\n" \
     284       "ls -l /tmp/foo\n" \
     285       "-r--r--r--    1 root     root            0 Apr 12 18:25 /tmp/foo\n"
     286
     287#define chpst_trivial_usage \
     288       "[-vP012] [-u user[:group]] [-U user[:group]] [-e dir] " \
     289       "[-/ dir] [-n nice] [-m bytes] [-d bytes] [-o files] " \
     290       "[-p processes] [-f bytes] [-c bytes] prog args"
     291#define chpst_full_usage \
     292       "Change the process state and run specified program" \
     293       "\n\nOptions:\n" \
     294       "    -u user[:grp]   Set uid and gid\n" \
     295       "    -U user[:grp]   Set environment variables UID and GID\n" \
     296       "    -e dir      Set environment variables as specified by files\n" \
     297       "            in the directory: file=1st_line_of_file\n" \
     298       "    -/ dir      Chroot to dir\n" \
     299       "    -n inc      Add inc to nice value\n" \
     300       "    -m bytes    Limit data segment, stack segment, locked physical pages,\n" \
     301       "            and total of all segment per process to bytes bytes each\n" \
     302       "    -d bytes    Limit data segment\n" \
     303       "    -o n        Limit the number of open file descriptors per process to n\n" \
     304       "    -p n        Limit number of processes per uid to n\n" \
     305       "    -f bytes    Limit output file size to bytes bytes\n" \
     306       "    -c bytes    Limit core file size to bytes bytes\n" \
     307       "    -v      Verbose\n" \
     308       "    -P      Run prog in a new process group\n" \
     309       "    -0      Close standard input\n" \
     310       "    -1      Close standard output\n" \
     311       "    -2      Close standard error"
     312#define setuidgid_trivial_usage \
     313       "account prog args"
     314#define setuidgid_full_usage \
     315       "Set uid and gid to account's uid and gid, removing all supplementary\n" \
     316       "groups, then run prog"
     317#define envuidgid_trivial_usage \
     318       "account prog args"
     319#define envuidgid_full_usage \
     320       "Set $UID to account's uid and $GID to account's gid, then run prog"
     321#define envdir_trivial_usage \
     322       "dir prog args"
     323#define envdir_full_usage \
     324       "Set various environment variables as specified by files\n" \
     325       "in the directory dir, then run prog"
     326#define softlimit_trivial_usage \
     327       "[-a allbytes] [-c corebytes] [-d databytes] [-f filebytes] " \
     328       "[-l lockbytes] [-m membytes] [-o openfiles] [-p processes] " \
     329       "[-r residentbytes] [-s stackbytes] [-t cpusecs] prog args"
     330#define softlimit_full_usage \
     331       "Set soft resource limits, then run prog" \
     332       "\n\nOptions:\n" \
     333       "    -m n    Same as -d n -s n -l n -a n\n" \
     334       "    -d n    Limit the data segment per process to n bytes\n" \
     335       "    -s n    Limit the stack segment per process to n bytes\n" \
     336       "    -l n    Limit the locked physical pages per process to n bytes\n" \
     337       "    -a n    Limit the total of all segments per process to n bytes\n" \
     338       "    -o n    Limit the number of open file descriptors per process to n\n" \
     339       "    -p n    Limit the number of processes per uid to n\n" \
     340       "Options controlling file sizes:\n" \
     341       "    -f n    Limit output file sizes to n bytes\n" \
     342       "    -c n    Limit core file sizes to n bytes\n" \
     343       "Efficiency opts:\n" \
     344       "    -r n    Limit the resident set size to n bytes. This limit is not\n" \
     345       "        enforced unless physical memory is full\n" \
     346       "    -t n    Limit the CPU time to n seconds. This limit is not enforced\n" \
     347       "        except that the process receives a SIGXCPU signal after n seconds\n" \
     348       "\n" \
     349       "Some options may have no effect on some operating systems\n" \
     350       "n may be =, indicating that soft limit should be set equal to hard limit"
    216351
    217352#define chroot_trivial_usage \
    218     "NEWROOT [COMMAND...]"
     353       "NEWROOT [COMMAND...]"
    219354#define chroot_full_usage \
    220     "Run COMMAND with root directory set to NEWROOT."
     355       "Run COMMAND with root directory set to NEWROOT"
    221356#define chroot_example_usage \
    222     "$ ls -l /bin/ls\n" \
    223     "lrwxrwxrwx    1 root     root          12 Apr 13 00:46 /bin/ls -> /BusyBox\n" \
    224     "# mount /dev/hdc1 /mnt -t minix\n" \
    225     "# chroot /mnt\n" \
    226     "# ls -l /bin/ls\n" \
    227     "-rwxr-xr-x    1 root     root        40816 Feb  5 07:45 /bin/ls*\n"
     357       "$ ls -l /bin/ls\n" \
     358       "lrwxrwxrwx    1 root     root          12 Apr 13 00:46 /bin/ls -> /BusyBox\n" \
     359       "# mount /dev/hdc1 /mnt -t minix\n" \
     360       "# chroot /mnt\n" \
     361       "# ls -l /bin/ls\n" \
     362       "-rwxr-xr-x    1 root     root        40816 Feb  5 07:45 /bin/ls*\n"
    228363
    229364#define chvt_trivial_usage \
    230     "N"
     365       "N"
    231366#define chvt_full_usage \
    232     "Changes the foreground virtual terminal to /dev/ttyN"
     367       "Change the foreground virtual terminal to /dev/ttyN"
    233368
    234369#define cksum_trivial_usage \
    235     "FILES..."
     370       "FILES..."
    236371#define cksum_full_usage \
    237     "Calculates the CRC32 checksums of FILES."
     372       "Calculate the CRC32 checksums of FILES"
    238373
    239374#define clear_trivial_usage \
    240     ""
     375       ""
    241376#define clear_full_usage \
    242     "Clear screen."
     377       "Clear screen"
    243378
    244379#define cmp_trivial_usage \
    245     "[-l] [-s] FILE1 [FILE2]"
     380       "[-l] [-s] FILE1 [FILE2" USE_DESKTOP(" [SKIP1 [SKIP2]") "]]"
    246381#define cmp_full_usage \
    247     "Compares FILE1 vs stdin if FILE2 is not specified.\n\n" \
    248     "Options:\n" \
    249     "\t-l\tWrite the byte numbers (decimal) and values (octal)\n" \
    250     "\t\t  for all differing bytes\n" \
    251     "\t-s\tquiet mode - do not print"
     382       "Compares FILE1 vs stdin if FILE2 is not specified" \
     383       "\n\nOptions:\n" \
     384       "    -l  Write the byte numbers (decimal) and values (octal)\n" \
     385       "        for all differing bytes\n" \
     386       "    -s  Quiet"
    252387
    253388#define comm_trivial_usage \
    254     "[-123] FILE1 FILE2"
     389       "[-123] FILE1 FILE2"
    255390#define comm_full_usage \
    256     "Compares FILE1 to FILE2, or to stdin if = is specified.\n\n" \
    257     "Options:\n" \
    258     "\t-1\tSuppress lines unique to FILE1\n" \
    259     "\t-2\tSuppress lines unique to FILE2\n" \
    260     "\t-3\tSuppress lines common to both files"
     391       "Compare FILE1 to FILE2, or to stdin if - is specified" \
     392       "\n\nOptions:\n" \
     393       "    -1  Suppress lines unique to FILE1\n" \
     394       "    -2  Suppress lines unique to FILE2\n" \
     395       "    -3  Suppress lines common to both files"
    261396
    262397#define bbconfig_trivial_usage \
    263     ""
     398       ""
    264399#define bbconfig_full_usage \
    265     "Print the config file which built busybox"
     400       "Print the config file which built busybox"
     401
     402#define bbsh_trivial_usage \
     403       "[FILE]...\n" \
     404       "or: bbsh -c command [args]..."
     405#define bbsh_full_usage \
     406       "The bbsh shell (command interpreter)"
     407
     408#define chrt_trivial_usage \
     409       "[OPTION]... [prio] [pid | command [arg]...]"
     410#define chrt_full_usage \
     411       "manipulate real-time attributes of a process" \
     412       "\n\nOptions:\n" \
     413       "    -p  operate on pid\n" \
     414       "    -r  set scheduling policy to SCHED_RR\n" \
     415       "    -f  set scheduling policy to SCHED_FIFO\n" \
     416       "    -o  set scheduling policy to SCHED_OTHER\n" \
     417       "    -m  show min and max priorities"
     418
     419#define chrt_example_usage \
     420       "$ chrt -r 4 sleep 900; x=$!\n" \
     421       "$ chrt -f -p 3 $x\n" \
     422       "You need CAP_SYS_NICE privileges to set scheduling attributes of a process"
    266423
    267424#define cp_trivial_usage \
    268     "[OPTION]... SOURCE DEST"
     425       "[OPTION]... SOURCE DEST"
    269426#define cp_full_usage \
    270     "Copies SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY.\n" \
    271     "\n" \
    272     "\t-a\tSame as -dpR\n" \
    273     "\t-d,-P\tPreserves links\n" \
    274     "\t-H,-L\tDereference all symlinks (implied by default)\n" \
    275     "\t-p\tPreserves file attributes if possible\n" \
    276     "\t-f\tforce (implied; ignored) - always set\n" \
    277     "\t-i\tinteractive, prompt before overwrite\n" \
    278     "\t-R,-r\tCopies directories recursively"
     427       "Copy SOURCE to DEST, or multiple SOURCE(s) to DIRECTORY" \
     428       "\n\nOptions:" \
     429       "\n  -a  Same as -dpR" \
     430    USE_SELINUX( \
     431       "\n  -c  Preserves security context" \
     432    ) \
     433       "\n  -d,-P   Preserve links" \
     434       "\n  -H,-L   Dereference all symlinks (default)" \
     435       "\n  -p  Preserve file attributes if possible" \
     436       "\n  -f  Force overwrite" \
     437       "\n  -i  Prompt before overwrite" \
     438       "\n  -R,-r   Recurse directories" \
     439       "\n  -l,-s   Create (sym)links"
    279440
    280441#define cpio_trivial_usage \
    281     "-[dimtuv][F cpiofile]"
     442       "-[dimtuv][F cpiofile]"
    282443#define cpio_full_usage \
    283     "Extract or list files from a cpio archive\n" \
    284     "Main operation mode:\n" \
    285     "\td\t\tmake leading directories\n" \
    286     "\ti\t\textract\n" \
    287     "\tm\t\tpreserve mtime\n" \
    288     "\tt\t\tlist\n" \
    289     "\tv\t\tverbose\n" \
    290     "\tu\t\tunconditional overwrite\n" \
    291     "\tF\t\tinput from file"
     444       "Extract or list files from a cpio archive\n" \
     445       "Main operation mode:\n" \
     446       "    d   Make leading directories\n" \
     447       "    i   Extract\n" \
     448       "    m   Preserve mtime\n" \
     449       "    t   List\n" \
     450       "    v   Verbose\n" \
     451       "    u   Unconditional overwrite\n" \
     452       "    F   Input from file"
    292453
    293454#define crond_trivial_usage \
    294     "-d[#] -c <crondir> -f -b"
     455       "-d[#] -c crondir -f -b"
    295456#define crond_full_usage \
    296     "\t-d [#] -l [#] -S -L logfile -f -b -c dir\n" \
    297     "\t-d num\tdebug level\n" \
    298     "\t-l num\tlog level (8 - default)\n" \
    299     "\t-S\tlog to syslogd (default)\n" \
    300     "\t-L file\tlog to file\n" \
    301     "\t-f\trun in foreground\n" \
    302     "\t-b\trun in background (default)\n" \
    303     "\t-c dir\tworking dir"
     457       "    -d [#] -l [#] -S -L logfile -f -b -c dir\n" \
     458       "    -d num  Debug level\n" \
     459       "    -l num  Log level (8 - default)\n" \
     460       "    -S  Log to syslogd (default)\n" \
     461       "    -L file Log to file\n" \
     462       "    -f  Run in foreground\n" \
     463       "    -b  Run in background (default)\n" \
     464       "    -c dir  Working dir"
    304465
    305466#define crontab_trivial_usage \
    306     "[-c dir] {file|-}|[-u|-l|-e|-d user]"
     467       "[-c dir] {file|-}|[-u|-l|-e|-d user]"
    307468#define crontab_full_usage \
    308     "\tfile <opts>  replace crontab from file\n" \
    309     "\t-    <opts>  replace crontab from stdin\n" \
    310     "\t-u user      specify user\n" \
    311     "\t-l [user]    list crontab for user\n" \
    312     "\t-e [user]    edit crontab for user\n" \
    313     "\t-d [user]    delete crontab for user\n" \
    314     "\t-c dir       specify crontab directory"
    315 
     469       "    file [opts] Replace crontab from file\n" \
     470       "    - [opts]    Replace crontab from stdin\n" \
     471       "    -u user     Specify user\n" \
     472       "    -l [user]   List crontab for user\n" \
     473       "    -e [user]   Edit crontab for user\n" \
     474       "    -d [user]   Delete crontab for user\n" \
     475       "    -c dir      Specify crontab directory"
     476
     477#define cryptpw_trivial_usage \
     478       "[-a des|md5] [string]"
     479#define cryptpw_full_usage \
     480       "Outputs crypted string.\n" \
     481       "If string isn't supplied on cmdline, reads it from stdin.\n" \
     482       "\nOptions:" \
     483       "\n  -a  Algorithm to use (default: md5)"
    316484
    317485#define cut_trivial_usage \
    318     "[OPTION]... [FILE]..."
     486       "[OPTION]... [FILE]..."
    319487#define cut_full_usage \
    320     "Prints selected fields from each input FILE to standard output.\n\n" \
    321     "Options:\n" \
    322     "\t-b LIST\t\tOutput only bytes from LIST\n" \
    323     "\t-c LIST\t\tOutput only characters from LIST\n" \
    324     "\t-d CHAR\t\tUse CHAR instead of tab as the field delimiter\n" \
    325     "\t-s\t\tOutput only the lines containing delimiter\n" \
    326     "\t-f N\t\tPrint only these fields\n" \
    327     "\t-n\t\tIgnored"
     488       "Print selected fields from each input FILE to standard output" \
     489       "\n\nOptions:\n" \
     490       "    -b LIST Output only bytes from LIST\n" \
     491       "    -c LIST Output only characters from LIST\n" \
     492       "    -d CHAR Use CHAR instead of tab as the field delimiter\n" \
     493       "    -s  Output only the lines containing delimiter\n" \
     494       "    -f N    Print only these fields\n" \
     495       "    -n  Ignored"
    328496#define cut_example_usage \
    329     "$ echo \"Hello world\" | cut -f 1 -d ' '\n" \
    330     "Hello\n" \
    331     "$ echo \"Hello world\" | cut -f 2 -d ' '\n" \
    332     "world\n"
     497       "$ echo \"Hello world\" | cut -f 1 -d ' '\n" \
     498       "Hello\n" \
     499       "$ echo \"Hello world\" | cut -f 2 -d ' '\n" \
     500       "world\n"
    333501
    334502#define date_trivial_usage \
    335     "[OPTION]... [MMDDhhmm[[CC]YY][.ss]] [+FORMAT]"
     503       "[OPTION]... [MMDDhhmm[[CC]YY][.ss]] [+FORMAT]"
    336504#define date_full_usage \
    337     "Displays the current time in the given FORMAT, or sets the system date.\n" \
    338     "\nOptions:\n" \
    339     "\t-R\t\tOutputs RFC-822 compliant date string\n" \
    340     "\t-d STRING\tDisplays time described by STRING, not `now'\n" \
    341 USE_FEATURE_DATE_ISOFMT( \
    342     "\t-I[TIMESPEC]\tOutputs an ISO-8601 compliant date/time string\n" \
    343     "\t\t\tTIMESPEC=`date' (or missing) for date only,\n" \
    344     "\t\t\t`hours', `minutes', or `seconds' for date and,\n" \
    345     "\t\t\ttime to the indicated precision\n" \
    346     "\t-D hint\t\tUse 'hint' as date format, via strptime()\n" \
    347 ) \
    348     "\t-s\t\tSets time described by STRING\n" \
    349     "\t-r FILE\t\tDisplays the last modification time of FILE\n" \
    350     "\t-u\t\tPrints or sets Coordinated Universal Time"
     505       "Display current time in the given FORMAT, or set system date" \
     506       "\n\nOptions:\n" \
     507       "    -R      Outputs RFC-822 compliant date string\n" \
     508       "    -d STRING   Displays time described by STRING, not 'now'\n" \
     509    USE_FEATURE_DATE_ISOFMT( \
     510       "    -I[TIMESPEC]    Outputs an ISO-8601 compliant date/time string\n" \
     511       "            TIMESPEC='date' (or missing) for date only,\n" \
     512       "            'hours', 'minutes', or 'seconds' for date and,\n" \
     513       "            time to the indicated precision\n" \
     514       "    -D hint     Use 'hint' as date format, via strptime()\n" \
     515    ) \
     516       "    -s      Sets time described by STRING\n" \
     517       "    -r FILE     Displays the last modification time of FILE\n" \
     518       "    -u      Prints or sets Coordinated Universal Time"
    351519#define date_example_usage \
    352     "$ date\n" \
    353     "Wed Apr 12 18:52:41 MDT 2000\n"
     520       "$ date\n" \
     521       "Wed Apr 12 18:52:41 MDT 2000\n"
    354522
    355523#define dc_trivial_usage \
    356     "expression ..."
     524       "expression ..."
    357525#define dc_full_usage \
    358     "This is a Tiny RPN calculator that understands the\n" \
    359     "following operations: +, add, -, sub, *, mul, /, div, %, mod, " \
    360     "**, exp, and, or, not, eor.\n" \
    361     "For example: 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16.\n" \
    362     "\nOptions:\n" \
    363     "p - Prints the value on the top of the stack, without altering the stack\n" \
    364     "f - Prints the entire contents of the stack without altering anything\n" \
    365     "o - Pops the value off the top of the stack and uses it to set the output radix\n" \
    366     "    Only 10 and 16 are supported"
     526       "This is a Tiny RPN calculator that understands the\n" \
     527       "following operations: +, add, -, sub, *, mul, /, div, %, mod, " \
     528       "**, exp, and, or, not, eor.\n" \
     529       "For example: 'dc 2 2 add' -> 4, and 'dc 8 8 \\* 2 2 + /' -> 16." \
     530       "\n\nOptions:\n" \
     531       "p - Prints the value on the top of the stack, without altering the stack\n" \
     532       "f - Prints the entire contents of the stack without altering anything\n" \
     533       "o - Pops the value off the top of the stack and uses it to set the output radix\n" \
     534       "    Only 10 and 16 are supported"
    367535#define dc_example_usage \
    368     "$ dc 2 2 + p\n" \
    369     "4\n" \
    370     "$ dc 8 8 \\* 2 2 + / p\n" \
    371     "16\n" \
    372     "$ dc 0 1 and p\n" \
    373     "0\n" \
    374     "$ dc 0 1 or p\n" \
    375     "1\n" \
    376     "$ echo 72 9 div 8 mul p | dc\n" \
    377     "64\n"
     536       "$ dc 2 2 + p\n" \
     537       "4\n" \
     538       "$ dc 8 8 \\* 2 2 + / p\n" \
     539       "16\n" \
     540       "$ dc 0 1 and p\n" \
     541       "0\n" \
     542       "$ dc 0 1 or p\n" \
     543       "1\n" \
     544       "$ echo 72 9 div 8 mul p | dc\n" \
     545       "64\n"
    378546
    379547#define dd_trivial_usage \
    380     "[if=FILE] [of=FILE] " USE_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n" \
    381     "\t  [seek=N]" USE_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync]")
     548       "[if=FILE] [of=FILE] " USE_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n" \
     549       "    [seek=N]" USE_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync]")
    382550#define dd_full_usage \
    383     "Copy a file, converting and formatting according to options\n\n" \
    384     "\tif=FILE\t\tread from FILE instead of stdin\n" \
    385     "\tof=FILE\t\twrite to FILE instead of stdout\n" \
    386     "\tbs=N\t\tread and write N bytes at a time\n" \
    387     USE_FEATURE_DD_IBS_OBS("\tibs=N\t\tread N bytes at a time\n") \
    388     USE_FEATURE_DD_IBS_OBS("\tobs=N\t\twrite N bytes at a time\n") \
    389     "\tcount=N\t\tcopy only N input blocks\n" \
    390     "\tskip=N\t\tskip N input blocks\n" \
    391     "\tseek=N\t\tskip N output blocks\n" \
     551       "Copy a file with converting and formatting" \
     552       "\n\nOptions:\n" \
     553       "    if=FILE     Read from FILE instead of stdin\n" \
     554       "    of=FILE     Write to FILE instead of stdout\n" \
     555       "    bs=N        Read and write N bytes at a time\n" \
    392556    USE_FEATURE_DD_IBS_OBS( \
    393         "\tconv=notrunc\tdon't truncate output file\n" \
    394         "\tconv=noerror\tcontinue after read errors\n" \
    395         "\tconv=sync\tpad blocks with zeros\n" \
    396     ) \
    397     "\n" \
    398     "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \
    399     "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)"
     557       "    ibs=N       Read N bytes at a time\n") \
     558    USE_FEATURE_DD_IBS_OBS( \
     559       "    obs=N       Write N bytes at a time\n") \
     560       "    count=N     Copy only N input blocks\n" \
     561       "    skip=N      Skip N input blocks\n" \
     562       "    seek=N      Skip N output blocks\n" \
     563    USE_FEATURE_DD_IBS_OBS( \
     564       "    conv=notrunc    Don't truncate output file\n" \
     565       "    conv=noerror    Continue after read errors\n" \
     566       "    conv=sync   Pad blocks with zeros\n") \
     567       "\n" \
     568       "Numbers may be suffixed by c (x1), w (x2), b (x512), kD (x1000), k (x1024),\n" \
     569       "MD (x1000000), M (x1048576), GD (x1000000000) or G (x1073741824)"
    400570#define dd_example_usage \
    401     "$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4\n" \
    402     "4+0 records in\n" \
    403     "4+0 records out\n"
     571       "$ dd if=/dev/zero of=/dev/ram1 bs=1M count=4\n" \
     572       "4+0 records in\n" \
     573       "4+0 records out\n"
    404574
    405575#define deallocvt_trivial_usage \
    406     "[N]"
     576       "[N]"
    407577#define deallocvt_full_usage \
    408     "Deallocate unused virtual terminal /dev/ttyN"
     578      "Deallocate unused virtual terminal /dev/ttyN"
    409579
    410580#define delgroup_trivial_usage \
    411     "GROUP"
     581    USE_FEATURE_DEL_USER_FROM_GROUP("[USER] ")"GROUP"
    412582#define delgroup_full_usage \
    413      "Deletes group GROUP from the system"
     583       "Delete group GROUP from the system" \
     584    USE_FEATURE_DEL_USER_FROM_GROUP(" or user USER from group GROUP")
    414585
    415586#define deluser_trivial_usage \
    416     "USER"
     587       "USER"
    417588#define deluser_full_usage \
    418      "Deletes user USER from the system"
     589       "Delete user USER from the system"
    419590
    420591#define devfsd_trivial_usage \
    421     "mntpnt [-v]" \
     592       "mntpnt [-v]" \
    422593    USE_DEVFSD_FG_NP("[-fg][-np]" )
    423594#define devfsd_full_usage \
    424     "Optional daemon for managing devfs permissions and old device name symlinks.\n" \
    425     "\nOptions:\n" \
    426     "\tmntpnt\tThe mount point where devfs is mounted.\n\n" \
    427     "\t-v\tPrint the protocol version numbers for devfsd\n" \
    428     "\t\tand the kernel-side protocol version and exits." \
    429     USE_DEVFSD_FG_NP( "\n\n\t-fg\tRun the daemon in the foreground.\n\n" \
    430     "\t-np\tExit  after  parsing  the configuration file\n" \
    431     "\t\tand processing synthetic REGISTER events.\n" \
    432     "\t\tDo not poll for events.")
     595       "Manage devfs permissions and old device name symlinks" \
     596       "\n\nOptions:" \
     597       "\n  mntpnt  The mount point where devfs is mounted" \
     598       "\n  -v  Print the protocol version numbers for devfsd" \
     599       "\n      and the kernel-side protocol version and exits" \
     600    USE_DEVFSD_FG_NP( \
     601       "\n  -fg Run the daemon in the foreground" \
     602       "\n  -np Exit after parsing the configuration file" \
     603       "\n      and processing synthetic REGISTER events," \
     604       "\n      do not poll for events")
    433605
    434606#define df_trivial_usage \
    435     "[-" USE_FEATURE_HUMAN_READABLE("hm") "k] [FILESYSTEM ...]"
     607       "[-" USE_FEATURE_HUMAN_READABLE("hm") "k] [FILESYSTEM ...]"
    436608#define df_full_usage \
    437     "Print the filesystem space used and space available.\n\n" \
    438     "Options:\n" \
     609       "Print the filesystem space used and space available" \
    439610    USE_FEATURE_HUMAN_READABLE( \
    440         "\n\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
    441         "\t-m\tprint sizes in megabytes\n" \
    442         "\t-k\tprint sizes in kilobytes(default)" \
    443     ) \
    444     SKIP_FEATURE_HUMAN_READABLE("\n\t-k\tignored")
     611       "\n\nOptions control size display:" \
     612       "\n  -h  Human readable (e.g. 1K 243M 2G)" \
     613       "\n  -m  1024*1024 blocks" \
     614       "\n  -k  1024 blocks") \
     615    SKIP_FEATURE_HUMAN_READABLE( \
     616       "\n\nOptions:" \
     617       "\n  -k  Ignored")
    445618#define df_example_usage \
    446     "$ df\n" \
    447     "Filesystem           1k-blocks      Used Available Use% Mounted on\n" \
    448     "/dev/sda3              8690864   8553540    137324  98% /\n" \
    449     "/dev/sda1                64216     36364     27852  57% /boot\n" \
    450     "$ df /dev/sda3\n" \
    451     "Filesystem           1k-blocks      Used Available Use% Mounted on\n" \
    452     "/dev/sda3              8690864   8553540    137324  98% /\n"
     619       "$ df\n" \
     620       "Filesystem           1k-blocks      Used Available Use% Mounted on\n" \
     621       "/dev/sda3              8690864   8553540    137324  98% /\n" \
     622       "/dev/sda1                64216     36364     27852  57% /boot\n" \
     623       "$ df /dev/sda3\n" \
     624       "Filesystem           1k-blocks      Used Available Use% Mounted on\n" \
     625       "/dev/sda3              8690864   8553540    137324  98% /\n"
     626
     627#define dhcprelay_trivial_usage \
     628       "[client_device_list] [server_device]"
     629#define dhcprelay_full_usage \
     630       "Relay dhcp requests from client devices to server device"
     631
     632#define dhcprelay_trivial_usage \
     633       "[client_device_list] [server_device]"
     634#define dhcprelay_full_usage \
     635       "Relay dhcp requests from client devices to server device"
    453636
    454637#define diff_trivial_usage \
    455     "[-abdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2"
     638       "[-abdiNqrTstw] [-L LABEL] [-S FILE] [-U LINES] FILE1 FILE2"
    456639#define diff_full_usage \
    457     "Compare files line by line and output the differences between them.\n" \
    458     "This diff implementation only supports unified diffs.\n\n" \
    459     "Options:\n" \
    460     "\t-a\tTreat all files as text\n" \
    461     "\t-b\tIgnore changes in the amount of whitespace\n" \
    462     "\t-d\tTry hard to find a smaller set of changes\n" \
    463     "\t-i\tIgnore case differences\n" \
    464     "\t-L\tUse LABEL instead of the filename in the unified header\n" \
    465     "\t-N\tTreat absent files as empty\n" \
    466     "\t-q\tOutput only whether files differ\n" \
    467     "\t-r\tRecursively compare any subdirectories\n" \
    468     "\t-S\tStart with FILE when comparing directories\n" \
    469     "\t-T\tMake tabs line up by prefixing a tab when necessary\n" \
    470     "\t-s\tReport when two files are the same\n" \
    471     "\t-t\tExpand tabs to spaces in output\n" \
    472     "\t-U\tOutput LINES lines of context\n" \
    473     "\t-w\tIgnore all whitespace\n"
     640       "Compare files line by line and output the differences between them.\n" \
     641       "This diff implementation only supports unified diffs." \
     642       "\n\nOptions:\n" \
     643       "    -a  Treat all files as text\n" \
     644       "    -b  Ignore changes in the amount of whitespace\n" \
     645       "    -d  Try hard to find a smaller set of changes\n" \
     646       "    -i  Ignore case differences\n" \
     647       "    -L  Use LABEL instead of the filename in the unified header\n" \
     648       "    -N  Treat absent files as empty\n" \
     649       "    -q  Output only whether files differ\n" \
     650       "    -r  Recursively compare subdirectories\n" \
     651       "    -S  Start with FILE when comparing directories\n" \
     652       "    -T  Make tabs line up by prefixing a tab when necessary\n" \
     653       "    -s  Report when two files are the same\n" \
     654       "    -t  Expand tabs to spaces in output\n" \
     655       "    -U  Output LINES lines of context\n" \
     656       "    -w  Ignore all whitespace"
    474657
    475658#define dirname_trivial_usage \
    476     "FILENAME"
     659       "FILENAME"
    477660#define dirname_full_usage \
    478     "Strips non-directory suffix from FILENAME"
     661       "Strip non-directory suffix from FILENAME"
    479662#define dirname_example_usage \
    480     "$ dirname /tmp/foo\n" \
    481     "/tmp\n" \
    482     "$ dirname /tmp/foo/\n" \
    483     "/tmp\n"
     663       "$ dirname /tmp/foo\n" \
     664       "/tmp\n" \
     665       "$ dirname /tmp/foo/\n" \
     666       "/tmp\n"
    484667
    485668#define dmesg_trivial_usage \
    486     "[-c] [-n LEVEL] [-s SIZE]"
     669       "[-c] [-n LEVEL] [-s SIZE]"
    487670#define dmesg_full_usage \
    488     "Prints or controls the kernel ring buffer\n\n" \
    489     "Options:\n" \
    490     "\t-c\t\tClears the ring buffer's contents after printing\n" \
    491     "\t-n LEVEL\tSets console logging level\n" \
    492     "\t-s SIZE\t\tUse a buffer of size SIZE"
     671       "Print or control the kernel ring buffer" \
     672       "\n\nOptions:\n" \
     673       "    -c      Clears the ring buffer's contents after printing\n" \
     674       "    -n LEVEL    Sets console logging level\n" \
     675       "    -s SIZE     Use a buffer of size SIZE"
    493676
    494677#define dnsd_trivial_usage \
    495         "[-c config] [-t seconds] [-p port] [-i iface-ip] [-d]"
     678       "[-c config] [-t seconds] [-p port] [-i iface-ip] [-d]"
    496679#define dnsd_full_usage \
    497         "Small and static DNS server daemon\n\n" \
    498     "Options:\n" \
    499     "\t-c\t\tconfig filename\n" \
    500     "\t-t\t\tTTL in seconds\n" \
    501     "\t-p\t\tlistening port\n" \
    502     "\t-i\t\tlistening iface ip (default all)\n" \
    503     "\t-d\t\tdaemonize"
     680       "Small and static DNS server daemon" \
     681       "\n\nOptions:\n" \
     682       "    -c  Config filename\n" \
     683       "    -t  TTL in seconds\n" \
     684       "    -p  Listening port\n" \
     685       "    -i  Listening ip (default all)\n" \
     686       "    -d  Daemonize"
    504687
    505688#define dos2unix_trivial_usage \
    506     "[option] [FILE]"
     689       "[option] [FILE]"
    507690#define dos2unix_full_usage \
    508     "Converts FILE from dos format to unix format. When no option\n" \
    509     "is given, the input is converted to the opposite output format.\n" \
    510     "When no file is given, uses stdin for input and stdout for output.\n\n" \
    511     "Options:\n" \
    512     "\t-u\toutput will be in UNIX format\n" \
    513     "\t-d\toutput will be in DOS format"
     691       "Convert FILE from dos format to unix format. When no option\n" \
     692       "is given, the input is converted to the opposite output format.\n" \
     693       "When no file is given, use stdin for input and stdout for output." \
     694       "\n\nOptions:\n" \
     695       "    -u  Output will be in UNIX format\n" \
     696       "    -d  Output will be in DOS format"
    514697
    515698#define dpkg_trivial_usage \
    516     "[-ilCPru] [-F option] package_name"
     699       "[-ilCPru] [-F option] package_name"
    517700#define dpkg_full_usage \
    518     "dpkg is a utility to install, remove and manage Debian packages.\n\n" \
    519     "Options:\n" \
    520     "\t-i\t\tInstall the package\n" \
    521     "\t-l\t\tList of installed packages\n" \
    522     "\t-C\t\tConfigure an unpackaged package\n" \
    523     "\t-F depends\tIgnore dependency problems\n" \
    524     "\t-P\t\tPurge all files of a package\n" \
    525     "\t-r\t\tRemove all but the configuration files for a package\n" \
    526     "\t-u\t\tUnpack a package, but don't configure it"
     701       "Install, remove and manage Debian packages" \
     702       "\n\nOptions:\n" \
     703       "    -i      Install the package\n" \
     704       "    -l      List of installed packages\n" \
     705       "    -C      Configure an unpackaged package\n" \
     706       "    -F depends  Ignore dependency problems\n" \
     707       "    -P      Purge all files of a package\n" \
     708       "    -r      Remove all but the configuration files for a package\n" \
     709       "    -u      Unpack a package, but don't configure it"
    527710
    528711#define dpkg_deb_trivial_usage \
    529     "[-cefxX] FILE [argument]"
     712       "[-cefxX] FILE [argument]"
    530713#define dpkg_deb_full_usage \
    531     "Perform actions on Debian packages (.debs)\n\n" \
    532     "Options:\n" \
    533     "\t-c\tList contents of filesystem tree\n" \
    534     "\t-e\tExtract control files to [argument] directory\n" \
    535     "\t-f\tDisplay control field name starting with [argument]\n" \
    536     "\t-x\tExtract packages filesystem tree to directory\n" \
    537     "\t-X\tVerbose extract"
     714       "Perform actions on Debian packages (.debs)" \
     715       "\n\nOptions:\n" \
     716       "    -c  List contents of filesystem tree\n" \
     717       "    -e  Extract control files to [argument] directory\n" \
     718       "    -f  Display control field name starting with [argument]\n" \
     719       "    -x  Extract packages filesystem tree to directory\n" \
     720       "    -X  Verbose extract"
    538721#define dpkg_deb_example_usage \
    539     "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n"
     722       "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n"
    540723
    541724#define du_trivial_usage \
    542     "[-aHLdclsx" USE_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..."
     725       "[-aHLdclsx" USE_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..."
    543726#define du_full_usage \
    544     "Summarizes disk space used for each FILE and/or directory.\n" \
    545     "Disk space is printed in units of " \
     727       "Summarize disk space used for each FILE and/or directory.\n" \
     728       "Disk space is printed in units of " \
    546729    USE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("1024") \
    547730    SKIP_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("512") \
    548     " bytes.\n\n" \
    549     "Options:\n" \
    550     "\t-a\tshow sizes of files in addition to directories\n" \
    551     "\t-H\tfollow symbolic links that are FILE command line args\n" \
    552     "\t-L\tfollow all symbolic links encountered\n" \
    553     "\t-d N\tlimit output to directories (and files with -a) of depth < N\n" \
    554     "\t-c\toutput a grand total\n" \
    555     "\t-l\tcount sizes many times if hard linked\n" \
    556     "\t-s\tdisplay only a total for each argument\n" \
    557     "\t-x\tskip directories on different filesystems\n" \
     731       " bytes." \
     732       "\n\nOptions:\n" \
     733       "    -a  Show sizes of files in addition to directories\n" \
     734       "    -H  Follow symlinks that are FILE command line args\n" \
     735       "    -L  Follow all symlinks encountered\n" \
     736       "    -d N    Limit output to directories (and files with -a) of depth < N\n" \
     737       "    -c  Output a grand total\n" \
     738       "    -l  Count sizes many times if hard linked\n" \
     739       "    -s  Display only a total for each argument\n" \
     740       "    -x  Skip directories on different filesystems\n" \
    558741    USE_FEATURE_HUMAN_READABLE( \
    559         "\t-h\tprint sizes in human readable format (e.g., 1K 243M 2G )\n" \
    560         "\t-m\tprint sizes in megabytes\n" \
     742       "    -h  Print sizes in human readable format (e.g., 1K 243M 2G )\n" \
     743       "    -m  Print sizes in megabytes\n" \
    561744    ) \
    562     "\t-k\tprint sizes in kilobytes" \
     745       "    -k  Print sizes in kilobytes" \
    563746    USE_FEATURE_DU_DEFAULT_BLOCKSIZE_1K("(default)")
    564747#define du_example_usage \
    565     "$ du\n" \
    566     "16      ./CVS\n" \
    567     "12      ./kernel-patches/CVS\n" \
    568     "80      ./kernel-patches\n" \
    569     "12      ./tests/CVS\n" \
    570     "36      ./tests\n" \
    571     "12      ./scripts/CVS\n" \
    572     "16      ./scripts\n" \
    573     "12      ./docs/CVS\n" \
    574     "104     ./docs\n" \
    575     "2417    .\n"
     748       "$ du\n" \
     749       "16      ./CVS\n" \
     750       "12      ./kernel-patches/CVS\n" \
     751       "80      ./kernel-patches\n" \
     752       "12      ./tests/CVS\n" \
     753       "36      ./tests\n" \
     754       "12      ./scripts/CVS\n" \
     755       "16      ./scripts\n" \
     756       "12      ./docs/CVS\n" \
     757       "104     ./docs\n" \
     758       "2417    .\n"
    576759
    577760#define dumpkmap_trivial_usage \
    578     "> keymap"
     761       "> keymap"
    579762#define dumpkmap_full_usage \
    580     "Prints out a binary keyboard translation table to standard output."
     763       "Print out a binary keyboard translation table to standard output"
    581764#define dumpkmap_example_usage \
    582     "$ dumpkmap > keymap\n"
     765       "$ dumpkmap > keymap\n"
    583766
    584767#define dumpleases_trivial_usage \
    585     "[-r|-a] [-f LEASEFILE]"
     768       "[-r|-a] [-f LEASEFILE]"
    586769#define dumpleases_full_usage \
    587     "Displays the DHCP leases granted by udhcpd.\n\n" \
    588     "Options:\n" \
    589     "\t-f,\t--file=FILENAME\tLeases file to load\n" \
    590     "\t-r,\t--remaining\tInterpret lease times as time remaining\n" \
    591     "\t-a,\t--absolute\tInterpret lease times as expire time"
     770       "Display DHCP leases granted by udhcpd" \
     771       "\n\nOptions:\n" \
     772       "    -f, --file=FILENAME Leases file to load\n" \
     773       "    -r, --remaining     Interpret lease times as time remaining\n" \
     774       "    -a, --absolute      Interpret lease times as expire time"
    592775
    593776#define e2fsck_trivial_usage \
    594     "[-panyrcdfvstDFSV] [-b superblock] [-B blocksize] " \
    595     "[-I inode_buffer_blocks] [-P process_inode_size] " \
    596     "[-l|-L bad_blocks_file] [-C fd] [-j external_journal] " \
    597     "[-E extended-options] device"
     777       "[-panyrcdfvstDFSV] [-b superblock] [-B blocksize] " \
     778       "[-I inode_buffer_blocks] [-P process_inode_size] " \
     779       "[-l|-L bad_blocks_file] [-C fd] [-j external_journal] " \
     780       "[-E extended-options] device"
    598781#define e2fsck_full_usage \
    599     "Check a Linux ext2/ext3 file system.\n\n" \
    600     "Options:\n" \
    601     "\t-p\tAutomatic repair (no questions)\n" \
    602     "\t-n\tMake no changes to the filesystem\n" \
    603     "\t-y\tAssume 'yes' to all questions\n" \
    604     "\t-c\tCheck for bad blocks and add them to the badblock list\n" \
    605     "\t-f\tForce checking even if filesystem is marked clean\n" \
    606     "\t-v\tBe verbose\n" \
    607     "\t-b superblock\tUse alternative superblock\n" \
    608     "\t-B blocksize\tForce blocksize when looking for superblock\n" \
    609     "\t-j journal\tSet location of the external journal\n" \
    610     "\t-l file\tAdd to badblocks list\n" \
    611     "\t-L file\tSet badblocks list"
     782       "Check ext2/ext3 file system" \
     783       "\n\nOptions:\n" \
     784       "    -p      Automatic repair (no questions)\n" \
     785       "    -n      Make no changes to the filesystem\n" \
     786       "    -y      Assume 'yes' to all questions\n" \
     787       "    -c      Check for bad blocks and add them to the badblock list\n" \
     788       "    -f      Force checking even if filesystem is marked clean\n" \
     789       "    -v      Verbose\n" \
     790       "    -b superblock   Use alternative superblock\n" \
     791       "    -B blocksize    Force blocksize when looking for superblock\n" \
     792       "    -j journal  Set location of the external journal\n" \
     793       "    -l file     Add to badblocks list\n" \
     794       "    -L file     Set badblocks list"
    612795
    613796#define echo_trivial_usage \
    614797    USE_FEATURE_FANCY_ECHO("[-neE] ") "[ARG ...]"
    615798#define echo_full_usage \
    616     "Prints the specified ARGs to stdout\n\n" \
     799       "Print the specified ARGs to stdout" \
    617800    USE_FEATURE_FANCY_ECHO( \
    618         "Options:\n" \
    619         "\t-n\tsuppress trailing newline\n" \
    620         "\t-e\tinterpret backslash-escaped characters (i.e., \\t=tab)\n" \
    621         "\t-E\tdisable interpretation of backslash-escaped characters" \
     801       "\n\nOptions:\n" \
     802       "    -n  Suppress trailing newline\n" \
     803       "    -e  Interpret backslash-escaped characters (i.e., \\t=tab)\n" \
     804       "    -E  Disable interpretation of backslash-escaped characters" \
    622805    )
    623806#define echo_example_usage \
    624     "$ echo \"Erik is cool\"\n" \
    625     "Erik is cool\n" \
    626     USE_FEATURE_FANCY_ECHO("$  echo -e \"Erik\\nis\\ncool\"\n" \
    627     "Erik\n" \
    628     "is\n" \
    629     "cool\n" \
    630     "$ echo \"Erik\\nis\\ncool\"\n" \
    631     "Erik\\nis\\ncool\n")
     807       "$ echo \"Erik is cool\"\n" \
     808       "Erik is cool\n" \
     809    USE_FEATURE_FANCY_ECHO("$ echo -e \"Erik\\nis\\ncool\"\n" \
     810       "Erik\n" \
     811       "is\n" \
     812       "cool\n" \
     813       "$ echo \"Erik\\nis\\ncool\"\n" \
     814       "Erik\\nis\\ncool\n")
    632815
    633816#define eject_trivial_usage \
    634     "[-t] [DEVICE]"
     817       "[-t] [-T] [DEVICE]"
    635818#define eject_full_usage \
    636     "Eject specified DEVICE (or default /dev/cdrom).\n\n" \
    637     "Options:\n" \
    638     "\t-t\tclose tray"
     819       "Eject specified DEVICE (or default /dev/cdrom)" \
     820       "\n\nOptions:\n" \
     821       "    -t  Close tray\n" \
     822       "    -T  Open/close tray (toggle)"
    639823
    640824#define ed_trivial_usage ""
     
    642826
    643827#define env_trivial_usage \
    644     "[-iu] [-] [name=value]... [command]"
     828       "[-iu] [-] [name=value]... [command]"
    645829#define env_full_usage \
    646     "Prints the current environment or runs a program after setting\n" \
    647     "up the specified environment.\n\n" \
    648     "Options:\n" \
    649     "\t-, -i\tstart with an empty environment\n" \
    650     "\t-u\tremove variable from the environment"
     830       "Print the current environment or run a program after setting\n" \
     831       "up the specified environment" \
     832       "\n\nOptions:\n" \
     833       "    -, -i   Start with an empty environment\n" \
     834       "    -u  Remove variable from the environment"
    651835
    652836#define ether_wake_trivial_usage \
    653     "[-b] [-i iface] [-p aa:bb:cc:dd[:ee:ff]] MAC"
     837       "[-b] [-i iface] [-p aa:bb:cc:dd[:ee:ff]] MAC"
    654838#define ether_wake_full_usage \
    655     "Send a magic packet to wake up sleeping machines.\n" \
    656     "MAC must be a station address (00:11:22:33:44:55) or\n" \
    657     "    a hostname with a known 'ethers' entry.\n\n" \
    658     "Options:\n" \
    659     "\t-b\t\tSend wake-up packet to the broadcast address\n" \
    660     "\t-i iface\tUse interface ifname instead of the default \"eth0\"\n" \
    661     "\t-p pass\tAppend the four or six byte password PW to the packet"
     839       "Send a magic packet to wake up sleeping machines.\n" \
     840       "MAC must be a station address (00:11:22:33:44:55) or\n" \
     841       "a hostname with a known 'ethers' entry." \
     842       "\n\nOptions:\n" \
     843       "    -b      Send wake-up packet to the broadcast address\n" \
     844       "    -i iface    Use interface ifname instead of the default \"eth0\"\n" \
     845       "    -p pass     Append the four or six byte password PW to the packet"
     846
     847#define expand_trivial_usage \
     848       "[-i] [-t NUM] [FILE|-]"
     849#define expand_full_usage \
     850       "Convert tabs to spaces, writing to standard output." \
     851       "\n\nOptions:" \
     852       "\n  -i" USE_FEATURE_EXPAND_LONG_OPTIONS(",--initial") \
     853       "    Do not convert tabs after non blanks" \
     854       "\n  -t" USE_FEATURE_EXPAND_LONG_OPTIONS(",--tabs=N") \
     855       "    Tabstops every N chars"
    662856
    663857#define expr_trivial_usage \
    664     "EXPRESSION"
     858       "EXPRESSION"
    665859#define expr_full_usage \
    666     "Prints the value of EXPRESSION to standard output.\n\n" \
    667     "EXPRESSION may be:\n" \
    668     "\tARG1 |  ARG2 ARG1 if it is neither null nor 0, otherwise ARG2\n" \
    669     "\tARG1 &  ARG2 ARG1 if neither argument is null or 0, otherwise 0\n" \
    670     "\tARG1 <  ARG2 ARG1 is less than ARG2\n" \
    671     "\tARG1 <= ARG2 ARG1 is less than or equal to ARG2\n" \
    672     "\tARG1 =  ARG2 ARG1 is equal to ARG2\n" \
    673     "\tARG1 != ARG2 ARG1 is unequal to ARG2\n" \
    674     "\tARG1 >= ARG2 ARG1 is greater than or equal to ARG2\n" \
    675     "\tARG1 >  ARG2 ARG1 is greater than ARG2\n" \
    676     "\tARG1 +  ARG2 arithmetic sum of ARG1 and ARG2\n" \
    677     "\tARG1 -  ARG2 arithmetic difference of ARG1 and ARG2\n" \
    678     "\tARG1 *  ARG2 arithmetic product of ARG1 and ARG2\n" \
    679     "\tARG1 /  ARG2 arithmetic quotient of ARG1 divided by ARG2\n" \
    680     "\tARG1 %  ARG2 arithmetic remainder of ARG1 divided by ARG2\n" \
    681     "\tSTRING : REGEXP             anchored pattern match of REGEXP in STRING\n" \
    682     "\tmatch STRING REGEXP         same as STRING : REGEXP\n" \
    683     "\tsubstr STRING POS LENGTH    substring of STRING, POS counted from 1\n" \
    684     "\tindex STRING CHARS          index in STRING where any CHARS is found,\n" \
    685     "\t                            or 0\n" \
    686     "\tlength STRING               length of STRING\n" \
    687     "\tquote TOKEN                 interpret TOKEN as a string, even if\n" \
    688     "\t                            it is a keyword like `match' or an\n" \
    689     "\t                            operator like `/'\n" \
    690     "\t( EXPRESSION )              value of EXPRESSION\n\n" \
    691     "Beware that many operators need to be escaped or quoted for shells.\n" \
    692     "Comparisons are arithmetic if both ARGs are numbers, else\n" \
    693     "lexicographical.  Pattern matches return the string matched between \n" \
    694     "\\( and \\) or null; if \\( and \\) are not used, they return the number \n" \
    695     "of characters matched or 0."
     860       "Print the value of EXPRESSION to standard output.\n\n" \
     861       "EXPRESSION may be:\n" \
     862       "    ARG1 |  ARG2    ARG1 if it is neither null nor 0, otherwise ARG2\n" \
     863       "    ARG1 &  ARG2    ARG1 if neither argument is null or 0, otherwise 0\n" \
     864       "    ARG1 <  ARG2    ARG1 is less than ARG2\n" \
     865       "    ARG1 <= ARG2    ARG1 is less than or equal to ARG2\n" \
     866       "    ARG1 =  ARG2    ARG1 is equal to ARG2\n" \
     867       "    ARG1 != ARG2    ARG1 is unequal to ARG2\n" \
     868       "    ARG1 >= ARG2    ARG1 is greater than or equal to ARG2\n" \
     869       "    ARG1 >  ARG2    ARG1 is greater than ARG2\n" \
     870       "    ARG1 +  ARG2    Sum of ARG1 and ARG2\n" \
     871       "    ARG1 -  ARG2    Difference of ARG1 and ARG2\n" \
     872       "    ARG1 *  ARG2    Product of ARG1 and ARG2\n" \
     873       "    ARG1 /  ARG2    Quotient of ARG1 divided by ARG2\n" \
     874       "    ARG1 %  ARG2    Remainder of ARG1 divided by ARG2\n" \
     875       "    STRING : REGEXP     Anchored pattern match of REGEXP in STRING\n" \
     876       "    match STRING REGEXP Same as STRING : REGEXP\n" \
     877       "    substr STRING POS LENGTH Substring of STRING, POS counted from 1\n" \
     878       "    index STRING CHARS  Index in STRING where any CHARS is found, or 0\n" \
     879       "    length STRING       Length of STRING\n" \
     880       "    quote TOKEN     Interpret TOKEN as a string, even if\n" \
     881       "                it is a keyword like 'match' or an\n" \
     882       "                operator like '/'\n" \
     883       "    (EXPRESSION)        Value of EXPRESSION\n\n" \
     884       "Beware that many operators need to be escaped or quoted for shells.\n" \
     885       "Comparisons are arithmetic if both ARGs are numbers, else\n" \
     886       "lexicographical. Pattern matches return the string matched between\n" \
     887       "\\( and \\) or null; if \\( and \\) are not used, they return the number\n" \
     888       "of characters matched or 0."
    696889
    697890#define fakeidentd_trivial_usage \
    698     "[-b ip] [STRING]"
     891       "[-fiw] [-b ADDR] [STRING]"
    699892#define fakeidentd_full_usage \
    700     "Returns a set string to auth requests\n\n" \
    701     "\t-b\tBind to ip address\n" \
    702     "\tSTRING\tThe ident answer string (default is nobody)"
     893       "Provide fake ident (auth) service" \
     894       "\n\nOptions:" \
     895       "\n  -f  Run in foreground" \
     896       "\n  -i  Inetd mode" \
     897       "\n  -w  Inetd 'wait' mode" \
     898       "\n  -b ADDR Bind to specified address" \
     899       "\n  STRING  Ident answer string (default is 'nobody')"
    703900
    704901#define false_trivial_usage \
    705     ""
     902       ""
    706903#define false_full_usage \
    707     "Return an exit code of FALSE (1)."
     904       "Return an exit code of FALSE (1)"
    708905#define false_example_usage \
    709     "$ false\n" \
    710     "$ echo $?\n" \
    711     "1\n"
     906       "$ false\n" \
     907       "$ echo $?\n" \
     908       "1\n"
    712909
    713910#define fbset_trivial_usage \
    714     "[options] [mode]"
     911       "[options] [mode]"
    715912#define fbset_full_usage \
    716     "Show and modify frame buffer settings"
     913       "Show and modify frame buffer settings"
    717914#define fbset_example_usage \
    718     "$ fbset\n" \
    719     "mode \"1024x768-76\"\n" \
    720     "\t# D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz\n" \
    721     "\tgeometry 1024 768 1024 768 16\n" \
    722     "\ttimings 12714 128 32 16 4 128 4\n" \
    723     "\taccel false\n" \
    724     "\trgba 5/11,6/5,5/0,0/0\n" \
    725     "endmode\n"
     915       "$ fbset\n" \
     916       "mode \"1024x768-76\"\n" \
     917       "    # D: 78.653 MHz, H: 59.949 kHz, V: 75.694 Hz\n" \
     918       "    geometry 1024 768 1024 768 16\n" \
     919       "    timings 12714 128 32 16 4 128 4\n" \
     920       "    accel false\n" \
     921       "    rgba 5/11,6/5,5/0,0/0\n" \
     922       "endmode\n"
    726923
    727924#define fdflush_trivial_usage \
    728     "DEVICE"
     925       "DEVICE"
    729926#define fdflush_full_usage \
    730     "Forces floppy disk drive to detect disk change"
     927       "Force floppy disk drive to detect disk change"
    731928
    732929#define fdformat_trivial_usage \
    733     "[-n] DEVICE"
     930       "[-n] DEVICE"
    734931#define fdformat_full_usage \
    735     "Low-level formats a floppy disk\n\n" \
    736     "Options:\n" \
    737     "\t-n\tDon't verify after format"
     932       "Format floppy disk" \
     933       "\n\nOptions:\n" \
     934       "    -n  Don't verify after format"
    738935
    739936#define fdisk_trivial_usage \
    740     "[-luv] [-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK"
     937       "[-luv] [-C CYLINDERS] [-H HEADS] [-S SECTORS] [-b SSZ] DISK"
    741938#define fdisk_full_usage \
    742     "Change partition table\n" \
    743     "Options:\n" \
    744     "\t-l  List partition table(s)\n" \
    745     "\t-u  Give Start and End in sector (instead of cylinder) units\n" \
    746     "\t-s PARTITION  Give partition size(s) in blocks\n" \
    747     "\t-b 2048: (for certain MO disks) use 2048-byte sectors\n" \
    748     "\t-C CYLINDERS  Set the number of cylinders\n" \
    749     "\t-H HEADS  Set the number of heads\n" \
    750     "\t-S SECTORS  Set the number of sectors\n" \
    751     "\t-v  Give fdisk version"
     939       "Change partition table" \
     940       "\n\nOptions:\n" \
     941       "    -l      List partition table(s)\n" \
     942       "    -u      Give Start and End in sector (instead of cylinder) units\n" \
     943       "    -s PARTITION    Give partition size(s) in blocks\n" \
     944       "    -b 2048     (for certain MO disks) use 2048-byte sectors\n" \
     945       "    -C CYLINDERS    Set the number of cylinders\n" \
     946       "    -H HEADS    Set the number of heads\n" \
     947       "    -S SECTORS  Set the number of sectors\n" \
     948       "    -v      Give fdisk version"
    752949
    753950#define find_trivial_usage \
    754     "[PATH...] [EXPRESSION]"
     951       "[PATH...] [EXPRESSION]"
    755952#define find_full_usage \
    756     "Search for files in a directory hierarchy.  The default PATH is\n" \
    757     "the current directory; default EXPRESSION is '-print'\n" \
    758     "\nEXPRESSION may consist of:\n" \
    759     "\t-follow\t\tDereference symbolic links\n" \
    760     "\t-name PATTERN\tFile name (leading directories removed) matches PATTERN\n" \
    761     "\t-print\t\tPrint (default and assumed)\n" \
     953       "Search for files in a directory hierarchy. The default PATH is\n" \
     954       "the current directory, default EXPRESSION is '-print'\n" \
     955     "\nEXPRESSION may consist of:" \
     956     "\n    -follow     Dereference symlinks" \
     957    USE_FEATURE_FIND_XDEV( \
     958     "\n    -xdev       Don't descend directories on other filesystems") \
     959    USE_FEATURE_FIND_MAXDEPTH( \
     960     "\n    -maxdepth N Descend at most N levels. -maxdepth 0 applies" \
     961     "\n            tests/actions to command line arguments only") \
     962     "\n    -name PATTERN   File name (w/o directory name) matches PATTERN" \
     963    USE_FEATURE_FIND_PATH( \
     964     "\n    -path PATTERN   Path matches PATTERN") \
     965    USE_FEATURE_FIND_REGEX( \
     966     "\n    -regex PATTERN  Path matches regex PATTERN") \
     967    USE_FEATURE_FIND_TYPE( \
     968     "\n    -type X     File type is X (X is one of: f,d,l,b,c,...)") \
     969    USE_FEATURE_FIND_PERM( \
     970     "\n    -perm NNN   Permissions match any of (+NNN), all of (-NNN)," \
     971     "\n            or exactly (NNN)") \
     972    USE_FEATURE_FIND_MTIME( \
     973     "\n    -mtime DAYS Modified time is greater than (+N), less than (-N)," \
     974     "\n            or exactly (N) days") \
     975    USE_FEATURE_FIND_MMIN( \
     976     "\n    -mmin MINS  Modified time is greater than (+N), less than (-N)," \
     977     "\n            or exactly (N) minutes") \
     978    USE_FEATURE_FIND_NEWER( \
     979     "\n    -newer FILE Modified time is more recent than FILE's") \
     980    USE_FEATURE_FIND_INUM( \
     981     "\n    -inum N     File has inode number N") \
     982    USE_FEATURE_FIND_USER( \
     983     "\n    -user NAME  File is owned by user NAME (numeric user ID allowed)") \
     984    USE_FEATURE_FIND_GROUP( \
     985     "\n    -group NAME File belongs to group NAME (numeric group ID allowed)") \
     986    USE_FEATURE_FIND_DEPTH( \
     987     "\n    -depth      Process directory name after traversing it") \
     988    USE_FEATURE_FIND_SIZE( \
     989     "\n    -size N[bck]    File size is N (c:bytes,k:kbytes,b:512 bytes(def.))." \
     990     "\n            +/-N: file size is bigger/smaller than N") \
     991     "\n    -print      Print (default and assumed)" \
    762992    USE_FEATURE_FIND_PRINT0( \
    763     "\t-print0\t\tDelimit output with null characters rather than\n\t\t\tnewlines" \
    764 ) USE_FEATURE_FIND_TYPE( \
    765     "\n\t-type X\t\tFiletype matches X (where X is one of: f,d,l,b,c,...)" \
    766 ) USE_FEATURE_FIND_PERM( \
    767     "\n\t-perm PERMS\tPermissions match any of (+NNN); all of (-NNN);\n\t\t\tor exactly (NNN)" \
    768 ) USE_FEATURE_FIND_MTIME( \
    769     "\n\t-mtime DAYS\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) days" \
    770 ) USE_FEATURE_FIND_MMIN( \
    771     "\n\t-mmin MINS\tModified time is greater than (+N); less than (-N);\n\t\t\tor exactly (N) minutes" \
    772 ) USE_FEATURE_FIND_NEWER( \
    773     "\n\t-newer FILE\tModified time is more recent than FILE's" \
    774 ) USE_FEATURE_FIND_INUM( \
    775     "\n\t-inum N\t\tFile has inode number N" \
    776 ) USE_FEATURE_FIND_EXEC( \
    777     "\n\t-exec CMD\tExecute CMD with all instances of {} replaced by the" \
    778     "\n\t\t\tfiles matching EXPRESSION")
     993     "\n    -print0     Delimit output with null characters rather than" \
     994     "\n            newlines") \
     995    USE_FEATURE_FIND_CONTEXT ( \
     996     "\n    -context    File has specified security context") \
     997    USE_FEATURE_FIND_EXEC( \
     998     "\n    -exec CMD ARG ; Execute CMD with all instances of {} replaced by the" \
     999     "\n            matching files") \
     1000    USE_FEATURE_FIND_PRUNE( \
     1001     "\n    -prune      Stop traversing current subtree") \
     1002    USE_FEATURE_FIND_DELETE( \
     1003     "\n    -delete     Delete files, turns on -depth option") \
     1004    USE_FEATURE_FIND_PAREN( \
     1005     "\n    (EXPR)      Group an expression") \
    7791006
    7801007#define find_example_usage \
    781     "$ find / -name passwd\n" \
    782     "/etc/passwd\n"
     1008       "$ find / -name passwd\n" \
     1009       "/etc/passwd\n"
    7831010
    7841011#define fold_trivial_usage \
    785     "[-bs] [-w WIDTH] [FILE]"
     1012       "[-bs] [-w WIDTH] [FILE]"
    7861013#define fold_full_usage \
    787     "Wrap input lines in each FILE (standard input by default), writing to\n" \
    788     "standard output.\n\n" \
    789     "Options:\n" \
    790     "\t-b\tcount bytes rather than columns\n" \
    791     "\t-s\tbreak at spaces\n" \
    792     "\t-w\tuse WIDTH columns instead of 80"
     1014       "Wrap input lines in each FILE (standard input by default), writing to\n" \
     1015       "standard output" \
     1016       "\n\nOptions:\n" \
     1017       "    -b  Count bytes rather than columns\n" \
     1018       "    -s  Break at spaces\n" \
     1019       "    -w  Use WIDTH columns instead of 80"
    7931020
    7941021#define free_trivial_usage \
    795     ""
     1022       ""
    7961023#define free_full_usage \
    797     "Displays the amount of free and used system memory"
     1024       "Display the amount of free and used system memory"
    7981025#define free_example_usage \
    799     "$ free\n" \
    800     "              total         used         free       shared      buffers\n" \
    801     "  Mem:       257628       248724         8904        59644        93124\n" \
    802     " Swap:       128516         8404       120112\n" \
    803     "Total:       386144       257128       129016\n" \
     1026       "$ free\n" \
     1027       "              total         used         free       shared      buffers\n" \
     1028       "  Mem:       257628       248724         8904        59644        93124\n" \
     1029       " Swap:       128516         8404       120112\n" \
     1030       "Total:       386144       257128       129016\n" \
    8041031
    8051032#define freeramdisk_trivial_usage \
    806     "DEVICE"
     1033       "DEVICE"
    8071034#define freeramdisk_full_usage \
    808     "Frees all memory used by the specified ramdisk."
     1035       "Free all memory used by the specified ramdisk"
    8091036#define freeramdisk_example_usage \
    810     "$ freeramdisk /dev/ram2\n"
     1037       "$ freeramdisk /dev/ram2\n"
    8111038
    8121039#define fsck_trivial_usage \
    813     "[-ANPRTV] [ -C [ fd ] ] [-t fstype] [fs-options] [filesys ...]"
     1040       "[-ANPRTV] [-C fd] [-t fstype] [fs-options] [filesys ...]"
    8141041#define fsck_full_usage \
    815     "Check and repair filesystems.\n\n" \
    816     "Options:\n" \
    817     "\t-A\tWalk /etc/fstab and check all filesystems\n" \
    818     "\t-N\tDon't execute, just show what would be done\n" \
    819     "\t-P\tWhen using -A, check filesystems in parallel\n" \
    820     "\t-R\tWhen using -A, skip the root filesystem\n" \
    821     "\t-T\tDon't show title on startup\n" \
    822     "\t-V\tVerbose mode\n" \
    823     "\t-C\tWrite status information to specified filedescriptor\n" \
    824     "\t-t\tList of filesystem types to check"
     1042       "Check and repair filesystems" \
     1043       "\n\nOptions:\n" \
     1044       "    -A  Walk /etc/fstab and check all filesystems\n" \
     1045       "    -N  Don't execute, just show what would be done\n" \
     1046       "    -P  When using -A, check filesystems in parallel\n" \
     1047       "    -R  When using -A, skip the root filesystem\n" \
     1048       "    -T  Don't show title on startup\n" \
     1049       "    -V  Verbose\n" \
     1050       "    -C n    Write status information to specified filedescriptor\n" \
     1051       "    -t type List of filesystem types to check"
    8251052
    8261053#define fsck_minix_trivial_usage \
    827     "[-larvsmf] /dev/name"
     1054       "[-larvsmf] /dev/name"
    8281055#define fsck_minix_full_usage \
    829     "Performs a consistency check for MINIX filesystems.\n\n" \
    830     "Options:\n" \
    831     "\t-l\tLists all filenames\n" \
    832     "\t-r\tPerform interactive repairs\n" \
    833     "\t-a\tPerform automatic repairs\n" \
    834     "\t-v\tverbose\n" \
    835     "\t-s\tOutputs super-block information\n" \
    836     "\t-m\tActivates MINIX-like \"mode not cleared\" warnings\n" \
    837     "\t-f\tForce file system check"
     1056       "Perform a consistency check for MINIX filesystems" \
     1057       "\n\nOptions:\n" \
     1058       "    -l  Lists all filenames\n" \
     1059       "    -r  Perform interactive repairs\n" \
     1060       "    -a  Perform automatic repairs\n" \
     1061       "    -v  Verbose\n" \
     1062       "    -s  Outputs super-block information\n" \
     1063       "    -m  Activates MINIX-like \"mode not cleared\" warnings\n" \
     1064       "    -f  Force file system check"
    8381065
    8391066#define ftpget_trivial_usage \
    840     "[options] remote-host local-file remote-file"
     1067       "[options] remote-host local-file remote-file"
    8411068#define ftpget_full_usage \
    842     "Retrieve a remote file via FTP.\n\n" \
    843     "Options:\n" \
    844     "\t-c, --continue         Continue a previous transfer\n" \
    845     "\t-v, --verbose          Verbose\n" \
    846     "\t-u, --username         Username to be used\n" \
    847     "\t-p, --password         Password to be used\n" \
    848     "\t-P, --port             Port number to be used"
     1069       "Retrieve a remote file via FTP" \
     1070       "\n\nOptions:\n" \
     1071       "    -c, --continue  Continue a previous transfer\n" \
     1072       "    -v, --verbose   Verbose\n" \
     1073       "    -u, --username  Username to be used\n" \
     1074       "    -p, --password  Password to be used\n" \
     1075       "    -P, --port  Port number to be used"
    8491076
    8501077#define ftpput_trivial_usage \
    851     "[options] remote-host remote-file local-file"
     1078       "[options] remote-host remote-file local-file"
    8521079#define ftpput_full_usage \
    853     "Store a local file on a remote machine via FTP.\n\n" \
    854     "Options:\n" \
    855     "\t-v, --verbose          Verbose\n" \
    856     "\t-u, --username         Username to be used\n" \
    857     "\t-p, --password         Password to be used\n" \
    858     "\t-P, --port             Port number to be used"
     1080       "Store a local file on a remote machine via FTP" \
     1081       "\n\nOptions:\n" \
     1082       "    -v, --verbose   Verbose\n" \
     1083       "    -u, --username  Username to be used\n" \
     1084       "    -p, --password  Password to be used\n" \
     1085       "    -P, --port  Port number to be used"
    8591086
    8601087#define fuser_trivial_usage \
    861     "[options] file OR port/proto"
     1088       "[options] file OR port/proto"
    8621089#define fuser_full_usage \
    863     "Options:\n" \
    864     "\t-m         Show all processes on the same mounted fs\n" \
    865     "\t-k         Kill all processes that match.\n" \
    866     "\t-s         Don't print or kill anything.\n" \
    867     "\t-4         When using port/proto only search IPv4 space\n" \
    868     "\t-6         When using port/proto only search IPv6 space\n" \
    869     "\t-SIGNAL    When used with -k, this signal will be used to kill"
     1090       "Options:\n" \
     1091       "    -m  Show all processes on the same mounted fs\n" \
     1092       "    -k  Kill all processes that match\n" \
     1093       "    -s  Don't print or kill anything\n" \
     1094       "    -4  When using port/proto only search IPv4 space\n" \
     1095       "    -6  When using port/proto only search IPv6 space\n" \
     1096       "    -SIGNAL When used with -k, this signal will be used to kill"
     1097
     1098#define getenforce_trivial_usage
     1099#define getenforce_full_usage
    8701100
    8711101#define getopt_trivial_usage \
    872     "[OPTIONS]..."
     1102       "[OPTIONS]..."
    8731103#define getopt_full_usage \
    874     "Parse command options\n" \
    875     "\t-a, --alternative        Allow long options starting with single -\n" \
    876     "\t-l, --longoptions=longopts   Long options to be recognized\n" \
    877     "\t-n, --name=progname      The name under which errors are reported\n" \
    878     "\t-o, --options=optstring  Short options to be recognized\n" \
    879     "\t-q, --quiet          Disable error reporting by getopt(3)\n" \
    880     "\t-Q, --quiet-output       No normal output\n" \
    881     "\t-s, --shell=shell        Set shell quoting conventions\n" \
    882     "\t-T, --test           Test for getopt(1) version\n" \
    883     "\t-u, --unquoted       Do not quote the output"
     1104       "Parse command options\n" \
     1105       "    -a, --alternative       Allow long options starting with single -\n" \
     1106       "    -l, --longoptions=longopts  Long options to be recognized\n" \
     1107       "    -n, --name=progname     The name under which errors are reported\n" \
     1108       "    -o, --options=optstring     Short options to be recognized\n" \
     1109       "    -q, --quiet         Disable error reporting by getopt(3)\n" \
     1110       "    -Q, --quiet-output      No normal output\n" \
     1111       "    -s, --shell=shell       Set shell quoting conventions\n" \
     1112       "    -T, --test          Test for getopt(1) version\n" \
     1113       "    -u, --unquoted          Do not quote the output"
    8841114#define getopt_example_usage \
    885     "$ cat getopt.test\n" \
    886     "#!/bin/sh\n" \
    887     "GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \\\n" \
    888     "       -n 'example.busybox' -- \"$@\"`\n" \
    889     "if [ $? != 0 ] ; then  exit 1 ; fi\n" \
    890     "eval set -- \"$GETOPT\"\n" \
    891     "while true ; do\n" \
    892     " case $1 in\n" \
    893     "   -a|--a-long) echo \"Option a\" ; shift ;;\n" \
    894     "   -b|--b-long) echo \"Option b, argument `$2'\" ; shift 2 ;;\n" \
    895     "   -c|--c-long)\n" \
    896     "     case \"$2\" in\n" \
    897     "       \"\") echo \"Option c, no argument\"; shift 2 ;;\n" \
    898     "       *)  echo \"Option c, argument `$2'\" ; shift 2 ;;\n" \
    899     "     esac ;;\n" \
    900     "   --) shift ; break ;;\n" \
    901     "   *) echo \"Internal error!\" ; exit 1 ;;\n" \
    902     " esac\n" \
    903     "done\n"
     1115       "$ cat getopt.test\n" \
     1116       "#!/bin/sh\n" \
     1117       "GETOPT=`getopt -o ab:c:: --long a-long,b-long:,c-long:: \\\n" \
     1118       "       -n 'example.busybox' -- \"$@\"`\n" \
     1119       "if [ $? != 0 ]; then  exit 1; fi\n" \
     1120       "eval set -- \"$GETOPT\"\n" \
     1121       "while true; do\n" \
     1122       " case $1 in\n" \
     1123       "   -a|--a-long) echo \"Option a\"; shift;;\n" \
     1124       "   -b|--b-long) echo \"Option b, argument '$2'\"; shift 2;;\n" \
     1125       "   -c|--c-long)\n" \
     1126       "     case \"$2\" in\n" \
     1127       "       \"\") echo \"Option c, no argument\"; shift 2;;\n" \
     1128       "       *)  echo \"Option c, argument '$2'\"; shift 2;;\n" \
     1129       "     esac;;\n" \
     1130       "   --) shift; break;;\n" \
     1131       "   *) echo \"Internal error!\"; exit 1;;\n" \
     1132       " esac\n" \
     1133       "done\n"
     1134
     1135#define getsebool_trivial_usage \
     1136       "-a or getsebool boolean..."
     1137#define getsebool_full_usage \
     1138       "    -a  Show all SELinux booleans"
    9041139
    9051140#define getty_trivial_usage \
    906     "[OPTIONS]... baud_rate,... line [termtype]"
     1141       "[OPTIONS]... baud_rate,... line [termtype]"
    9071142#define getty_full_usage \
    908     "Opens a tty, prompts for a login name, then invokes /bin/login\n\n" \
    909     "Options:\n" \
    910     "\t-h\t\tEnable hardware (RTS/CTS) flow control\n" \
    911     "\t-i\t\tDo not display /etc/issue before running login\n" \
    912     "\t-L\t\tLocal line, so do not do carrier detect\n" \
    913     "\t-m\t\tGet baud rate from modem's CONNECT status message\n" \
    914     "\t-w\t\tWait for a CR or LF before sending /etc/issue\n" \
    915     "\t-n\t\tDo not prompt the user for a login name\n" \
    916     "\t-f issue_file\tDisplay issue_file instead of /etc/issue\n" \
    917     "\t-l login_app\tInvoke login_app instead of /bin/login\n" \
    918     "\t-t timeout\tTerminate after timeout if no username is read\n" \
    919     "\t-I initstring\tSets the init string to send before anything else\n" \
    920     "\t-H login_host\tLog login_host into the utmp file as the hostname"
     1143       "Open a tty, prompt for a login name, then invoke /bin/login" \
     1144       "\n\nOptions:\n" \
     1145       "    -h      Enable hardware (RTS/CTS) flow control\n" \
     1146       "    -i      Do not display /etc/issue before running login\n" \
     1147       "    -L      Local line, so do not do carrier detect\n" \
     1148       "    -m      Get baud rate from modem's CONNECT status message\n" \
     1149       "    -w      Wait for a CR or LF before sending /etc/issue\n" \
     1150       "    -n      Do not prompt the user for a login name\n" \
     1151       "    -f issue_file   Display issue_file instead of /etc/issue\n" \
     1152       "    -l login_app    Invoke login_app instead of /bin/login\n" \
     1153       "    -t timeout  Terminate after timeout if no username is read\n" \
     1154       "    -I initstring   Sets the init string to send before anything else\n" \
     1155       "    -H login_host   Log login_host into the utmp file as the hostname"
    9211156
    9221157#define grep_trivial_usage \
    923     "[-ihHnqvs" \
     1158       "[-HhrilLnqvso" \
     1159    USE_DESKTOP("w") \
     1160       "eF" \
    9241161    USE_FEATURE_GREP_EGREP_ALIAS("E") \
    9251162    USE_FEATURE_GREP_CONTEXT("ABC") \
    926     "] PATTERN [FILEs...]"
     1163       "] PATTERN [FILEs...]"
    9271164#define grep_full_usage \
    928     "Search for PATTERN in each FILE or standard input.\n\n" \
    929     "Options:\n" \
    930     "\t-H\tprefix output lines with filename where match was found\n" \
    931     "\t-h\tsuppress the prefixing filename on output\n" \
    932     "\t-i\tignore case distinctions\n" \
    933     "\t-l\tlist names of files that match\n" \
    934     "\t-L\tlist names of files that do not match\n" \
    935     "\t-n\tprint line number with output lines\n" \
    936     "\t-q\tbe quiet. Returns 0 if PATTERN was found, 1 otherwise\n" \
    937     "\t-v\tselect non-matching lines\n" \
    938     "\t-s\tsuppress file open/read error messages\n" \
    939     "\t-c\tonly print count of matching lines\n" \
    940     "\t-f\tread PATTERN from file\n" \
    941     "\t-e\tPATTERN is a regular expression\n" \
    942     "\t-F\tPATTERN is a set of newline-separated strings" \
    943     USE_FEATURE_GREP_EGREP_ALIAS("\n\t-E\tPATTERN is an extended regular expression") \
    944     USE_FEATURE_GREP_CONTEXT("\n\t-A\tprint NUM lines of trailing context") \
    945     USE_FEATURE_GREP_CONTEXT("\n\t-B\tprint NUM lines of leading context") \
    946     USE_FEATURE_GREP_CONTEXT("\n\t-C\tprint NUM lines of output context")
     1165       "Search for PATTERN in each FILE or standard input" \
     1166       "\n\nOptions:" \
     1167       "\n  -H  Prefix output lines with filename where match was found" \
     1168       "\n  -h  Suppress the prefixing filename on output" \
     1169       "\n  -r  Recurse subdirectories" \
     1170       "\n  -i  Ignore case distinctions" \
     1171       "\n  -l  List names of files that match" \
     1172       "\n  -L  List names of files that do not match" \
     1173       "\n  -n  Print line number with output lines" \
     1174       "\n  -q  Quiet. Returns 0 if PATTERN was found, 1 otherwise" \
     1175       "\n  -v  Select non-matching lines" \
     1176       "\n  -s  Suppress file open/read error messages" \
     1177       "\n  -c  Only print count of matching lines" \
     1178       "\n  -o  Show only the part of a line that matches PATTERN" \
     1179       "\n  -m MAX  Match up to MAX times per file" \
     1180    USE_DESKTOP( \
     1181       "\n  -w  Match whole words only") \
     1182       "\n  -F  PATTERN is a set of newline-separated strings" \
     1183    USE_FEATURE_GREP_EGREP_ALIAS( \
     1184       "\n  -E  PATTERN is an extended regular expression") \
     1185       "\n  -e PTRN Pattern to match" \
     1186       "\n  -f FILE Read pattern from file" \
     1187    USE_FEATURE_GREP_CONTEXT( \
     1188       "\n  -A  Print NUM lines of trailing context" \
     1189       "\n  -B  Print NUM lines of leading context" \
     1190       "\n  -C  Print NUM lines of output context") \
    9471191
    9481192#define grep_example_usage \
    949     "$ grep root /etc/passwd\n" \
    950     "root:x:0:0:root:/root:/bin/bash\n" \
    951     "$ grep ^[rR]oo. /etc/passwd\n" \
    952     "root:x:0:0:root:/root:/bin/bash\n"
     1193       "$ grep root /etc/passwd\n" \
     1194       "root:x:0:0:root:/root:/bin/bash\n" \
     1195       "$ grep ^[rR]oo. /etc/passwd\n" \
     1196       "root:x:0:0:root:/root:/bin/bash\n"
    9531197
    9541198#define gunzip_trivial_usage \
    955     "[OPTION]... FILE"
     1199       "[OPTION]... FILE"
    9561200#define gunzip_full_usage \
    957     "Uncompress FILE (or standard input if FILE is '-').\n\n" \
    958     "Options:\n" \
    959     "\t-c\tWrite output to standard output\n" \
    960     "\t-f\tForce read when source is a terminal\n" \
    961     "\t-t\tTest compressed file integrity"
     1201       "Uncompress FILE (or standard input if FILE is '-')" \
     1202       "\n\nOptions:\n" \
     1203       "    -c  Write output to standard output\n" \
     1204       "    -f  Force read when source is a terminal\n" \
     1205       "    -t  Test compressed file integrity"
    9621206#define gunzip_example_usage \
    963     "$ ls -la /tmp/BusyBox*\n" \
    964     "-rw-rw-r--    1 andersen andersen   557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz\n" \
    965     "$ gunzip /tmp/BusyBox-0.43.tar.gz\n" \
    966     "$ ls -la /tmp/BusyBox*\n" \
    967     "-rw-rw-r--    1 andersen andersen  1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n"
     1207       "$ ls -la /tmp/BusyBox*\n" \
     1208       "-rw-rw-r--    1 andersen andersen   557009 Apr 11 10:55 /tmp/BusyBox-0.43.tar.gz\n" \
     1209       "$ gunzip /tmp/BusyBox-0.43.tar.gz\n" \
     1210       "$ ls -la /tmp/BusyBox*\n" \
     1211       "-rw-rw-r--    1 andersen andersen  1761280 Apr 14 17:47 /tmp/BusyBox-0.43.tar\n"
    9681212
    9691213#define gzip_trivial_usage \
    970     "[OPTION]... [FILE]..."
     1214       "[OPTION]... [FILE]..."
    9711215#define gzip_full_usage \
    972     "Compress FILE(s) with maximum compression.\n" \
    973     "When FILE is '-' or unspecified, reads standard input.  Implies -c.\n\n" \
    974     "Options:\n" \
    975     "\t-c\tWrite output to standard output instead of FILE.gz\n" \
    976     "\t-d\tDecompress\n" \
    977     "\t-f\tForce write when destination is a terminal"
     1216       "Compress FILE(s) with maximum compression.\n" \
     1217       "When FILE is '-' or unspecified, reads standard input. Implies -c." \
     1218       "\n\nOptions:\n" \
     1219       "    -c  Write output to standard output instead of FILE.gz\n" \
     1220       "    -d  Decompress\n" \
     1221       "    -f  Force write when destination is a terminal"
    9781222#define gzip_example_usage \
    979     "$ ls -la /tmp/busybox*\n" \
    980     "-rw-rw-r--    1 andersen andersen  1761280 Apr 14 17:47 /tmp/busybox.tar\n" \
    981     "$ gzip /tmp/busybox.tar\n" \
    982     "$ ls -la /tmp/busybox*\n" \
    983     "-rw-rw-r--    1 andersen andersen   554058 Apr 14 17:49 /tmp/busybox.tar.gz\n"
     1223       "$ ls -la /tmp/busybox*\n" \
     1224       "-rw-rw-r--    1 andersen andersen  1761280 Apr 14 17:47 /tmp/busybox.tar\n" \
     1225       "$ gzip /tmp/busybox.tar\n" \
     1226       "$ ls -la /tmp/busybox*\n" \
     1227       "-rw-rw-r--    1 andersen andersen   554058 Apr 14 17:49 /tmp/busybox.tar.gz\n"
    9841228
    9851229#define halt_trivial_usage \
    986     "[-d<delay>] [-n<nosync>] [-f<force>]"
     1230       "[-d delay] [-n] [-f]"
    9871231#define halt_full_usage \
    988     "Halt the system.\n" \
    989     "Options:\n" \
    990     "\t-d\t\tdelay interval for halting\n" \
    991     "\t-n\t\tno call to sync()\n" \
    992     "\t-f\t\tforce halt (don't go through init)"
     1232       "Halt the system" \
     1233       "\n\nOptions:\n" \
     1234       "    -d  Delay interval for halting\n" \
     1235       "    -n  No call to sync()\n" \
     1236       "    -f  Force halt (don't go through init)"
    9931237
    9941238#define hdparm_trivial_usage \
    995     "[options] [device] .."
     1239       "[options] [device] .."
    9961240#define hdparm_full_usage \
    997     USE_FEATURE_HDPARM_GET_IDENTITY("\tIf no device name is specified try to read from stdin.\n") \
    998     "\nOptions:\n" \
    999     "\t-a   get/set fs readahead\n" \
    1000     "\t-A   set drive read-lookahead flag (0/1)\n" \
    1001     "\t-b   get/set bus state (0 == off, 1 == on, 2 == tristate)\n" \
    1002     "\t-B   set Advanced Power Management setting (1-255)\n" \
    1003     "\t-c   get/set IDE 32-bit IO setting\n" \
    1004     "\t-C   check IDE power mode status\n" \
    1005     USE_FEATURE_HDPARM_HDIO_GETSET_DMA("\t-d   get/set using_dma flag\n") \
    1006     "\t-D   enable/disable drive defect-mgmt\n" \
    1007     "\t-f   flush buffer cache for device on exit\n" \
    1008     "\t-g   display drive geometry\n" \
    1009     "\t-h   display terse usage information\n" \
    1010     USE_FEATURE_HDPARM_GET_IDENTITY("\t-i   display drive identification\n") \
    1011     USE_FEATURE_HDPARM_GET_IDENTITY("\t-I   detailed/current information directly from drive\n") \
    1012     "\t-k   get/set keep_settings_over_reset flag (0/1)\n" \
    1013     "\t-K   set drive keep_features_over_reset flag (0/1)\n" \
    1014     "\t-L   set drive doorlock (0/1) (removable harddisks only)\n" \
    1015     "\t-m   get/set multiple sector count\n" \
    1016     "\t-n   get/set ignore-write-errors flag (0/1)\n" \
    1017     "\t-p   set PIO mode on IDE interface chipset (0,1,2,3,4,...)\n" \
    1018     "\t-P   set drive prefetch count\n" \
    1019     "\t-q   change next setting quietly\n" \
    1020     "\t-Q   get/set DMA tagged-queuing depth (if supported)\n" \
    1021     "\t-r   get/set readonly flag (DANGEROUS to set)\n" \
    1022     USE_FEATURE_HDPARM_HDIO_SCAN_HWIF("\t-R   register an IDE interface (DANGEROUS)\n") \
    1023     "\t-S   set standby (spindown) timeout\n" \
    1024     "\t-t   perform device read timings\n" \
    1025     "\t-T   perform cache read timings\n" \
    1026     "\t-u   get/set unmaskirq flag (0/1)\n" \
    1027     USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF("\t-U   un-register an IDE interface (DANGEROUS)\n") \
    1028     "\t-v   defaults; same as -mcudkrag for IDE drives\n" \
    1029     "\t-V   display program version and exit immediately\n" \
    1030     USE_FEATURE_HDPARM_HDIO_DRIVE_RESET("\t-w   perform device reset (DANGEROUS)\n") \
    1031     "\t-W   set drive write-caching flag (0/1) (DANGEROUS)\n" \
    1032     USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF("\t-x   tristate device for hotswap (0/1) (DANGEROUS)\n") \
    1033     "\t-X   set IDE xfer mode (DANGEROUS)\n" \
    1034     "\t-y   put IDE drive in standby mode\n" \
    1035     "\t-Y   put IDE drive to sleep\n" \
    1036     "\t-Z   disable Seagate auto-powersaving mode\n" \
    1037     "\t-z   re-read partition table"
     1241    USE_FEATURE_HDPARM_GET_IDENTITY( \
     1242       "If no device name is specified try to read from stdin.\n\n") \
     1243       "Options:\n" \
     1244       "    -a  Get/set fs readahead\n" \
     1245       "    -A  Set drive read-lookahead flag (0/1)\n" \
     1246       "    -b  Get/set bus state (0 == off, 1 == on, 2 == tristate)\n" \
     1247       "    -B  Set Advanced Power Management setting (1-255)\n" \
     1248       "    -c  Get/set IDE 32-bit IO setting\n" \
     1249       "    -C  Check IDE power mode status\n" \
     1250    USE_FEATURE_HDPARM_HDIO_GETSET_DMA( \
     1251       "    -d  Get/set using_dma flag\n") \
     1252       "    -D  Enable/disable drive defect-mgmt\n" \
     1253       "    -f  Flush buffer cache for device on exit\n" \
     1254       "    -g  Display drive geometry\n" \
     1255       "    -h  Display terse usage information\n" \
     1256    USE_FEATURE_HDPARM_GET_IDENTITY( \
     1257       "    -i  Display drive identification\n") \
     1258    USE_FEATURE_HDPARM_GET_IDENTITY( \
     1259       "    -I  Detailed/current information directly from drive\n") \
     1260       "    -k  Get/set keep_settings_over_reset flag (0/1)\n" \
     1261       "    -K  Set drive keep_features_over_reset flag (0/1)\n" \
     1262       "    -L  Set drive doorlock (0/1) (removable harddisks only)\n" \
     1263       "    -m  Get/set multiple sector count\n" \
     1264       "    -n  Get/set ignore-write-errors flag (0/1)\n" \
     1265       "    -p  Set PIO mode on IDE interface chipset (0,1,2,3,4,...)\n" \
     1266       "    -P  Set drive prefetch count\n" \
     1267       "    -q  Change next setting quietly\n" \
     1268       "    -Q  Get/set DMA tagged-queuing depth (if supported)\n" \
     1269       "    -r  Get/set readonly flag (DANGEROUS to set)\n" \
     1270    USE_FEATURE_HDPARM_HDIO_SCAN_HWIF( \
     1271       "    -R  Register an IDE interface (DANGEROUS)\n") \
     1272       "    -S  Set standby (spindown) timeout\n" \
     1273       "    -t  Perform device read timings\n" \
     1274       "    -T  Perform cache read timings\n" \
     1275       "    -u  Get/set unmaskirq flag (0/1)\n" \
     1276    USE_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF( \
     1277       "    -U  Un-register an IDE interface (DANGEROUS)\n") \
     1278       "    -v  Defaults; same as -mcudkrag for IDE drives\n" \
     1279       "    -V  Display program version and exit immediately\n" \
     1280    USE_FEATURE_HDPARM_HDIO_DRIVE_RESET( \
     1281       "    -w  Perform device reset (DANGEROUS)\n") \
     1282       "    -W  Set drive write-caching flag (0/1) (DANGEROUS)\n" \
     1283    USE_FEATURE_HDPARM_HDIO_TRISTATE_HWIF( \
     1284       "    -x  Tristate device for hotswap (0/1) (DANGEROUS)\n") \
     1285       "    -X  Set IDE xfer mode (DANGEROUS)\n" \
     1286       "    -y  Put IDE drive in standby mode\n" \
     1287       "    -Y  Put IDE drive to sleep\n" \
     1288       "    -Z  Disable Seagate auto-powersaving mode\n" \
     1289       "    -z  Re-read partition table"
    10381290
    10391291#define head_trivial_usage \
    1040     "[OPTION]... [FILE]..."
     1292       "[OPTION]... [FILE]..."
    10411293#define head_full_usage \
    1042     "Print first 10 lines of each FILE to standard output.\n" \
    1043     "With more than one FILE, precede each with a header giving the\n" \
    1044     "file name. With no FILE, or when FILE is -, read standard input.\n\n" \
    1045     "Options:\n" \
    1046     "\t-n NUM\t\tPrint first NUM lines instead of first 10" \
     1294       "Print first 10 lines of each FILE to standard output.\n" \
     1295       "With more than one FILE, precede each with a header giving the\n" \
     1296       "file name. With no FILE, or when FILE is -, read standard input." \
     1297       "\n\nOptions:" \
     1298       "\n  -n NUM  Print first NUM lines instead of first 10" \
    10471299    USE_FEATURE_FANCY_HEAD( \
    1048     "\n\t-c NUM\t\toutput the first NUM bytes\n" \
    1049     "\t-q\t\tnever output headers giving file names\n" \
    1050     "\t-v\t\talways output headers giving file names" )
     1300       "\n  -c NUM  Output the first NUM bytes" \
     1301       "\n  -q  Never output headers giving file names" \
     1302       "\n  -v  Always output headers giving file names")
    10511303#define head_example_usage \
    1052     "$ head -n 2 /etc/passwd\n" \
    1053     "root:x:0:0:root:/root:/bin/bash\n" \
    1054     "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n"
     1304       "$ head -n 2 /etc/passwd\n" \
     1305       "root:x:0:0:root:/root:/bin/bash\n" \
     1306       "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\n"
    10551307
    10561308#define hexdump_trivial_usage \
    1057     "[-[bcCdefnosvx]] [OPTION] FILE"
     1309       "[-[bcCdefnosvx]] [OPTION] FILE"
    10581310#define hexdump_full_usage \
    1059     "The hexdump utility is a filter which displays the specified files,\n" \
    1060     "or the standard input, if no files are specified, in a user specified\n" \
    1061     "format\n" \
    1062     "\t-b\t\tOne-byte octal display\n" \
    1063     "\t-c\t\tOne-byte character display\n" \
    1064     "\t-C\t\tCanonical hex+ASCII, 16 bytes per line\n" \
    1065     "\t-d\t\tTwo-byte decimal display\n" \
    1066     "\t-e FORMAT STRING\n" \
    1067     "\t-f FORMAT FILE\n" \
    1068     "\t-n LENGTH\tInterpret only length bytes of input\n" \
    1069     "\t-o\t\tTwo-byte octal display\n" \
    1070     "\t-s OFFSET\tSkip offset byte\n" \
    1071     "\t-v\t\tdisplay all input data\n" \
    1072     "\t-x\t\tTwo-byte hexadecimal display"
     1311       "Display file(s) or standard input in a user specified format" \
     1312       "\n\nOptions:\n" \
     1313       "    -b      One-byte octal display\n" \
     1314       "    -c      One-byte character display\n" \
     1315       "    -C      Canonical hex+ASCII, 16 bytes per line\n" \
     1316       "    -d      Two-byte decimal display\n" \
     1317       "    -e FORMAT STRING\n" \
     1318       "    -f FORMAT FILE\n" \
     1319       "    -n LENGTH   Interpret only length bytes of input\n" \
     1320       "    -o      Two-byte octal display\n" \
     1321       "    -s OFFSET   Skip offset bytes\n" \
     1322       "    -v      Display all input data\n" \
     1323       "    -x      Two-byte hexadecimal display"
    10731324
    10741325#define hostid_trivial_usage \
    1075     ""
     1326       ""
    10761327#define hostid_full_usage \
    1077     "Print out a unique 32-bit identifier for the machine."
     1328       "Print out a unique 32-bit identifier for the machine"
    10781329
    10791330#define hostname_trivial_usage \
    1080     "[OPTION] {hostname | -F FILE}"
     1331       "[OPTION] {hostname | -F FILE}"
    10811332#define hostname_full_usage \
    1082     "Get or set the hostname or DNS domain name. If a hostname is given\n" \
    1083     "(or FILE with the -F parameter), the host name will be set.\n\n" \
    1084     "Options:\n" \
    1085     "\t-s\tShort\n" \
    1086     "\t-i\tAddresses for the hostname\n" \
    1087     "\t-d\tDNS domain name\n" \
    1088     "\t-f\tFully qualified domain name\n" \
    1089     "\t-F FILE\tUse the contents of FILE to specify the hostname"
     1333       "Get or set the hostname or DNS domain name. If a hostname is given\n" \
     1334       "(or FILE with the -F parameter), the host name will be set." \
     1335       "\n\nOptions:\n" \
     1336       "    -s  Short\n" \
     1337       "    -i  Addresses for the hostname\n" \
     1338       "    -d  DNS domain name\n" \
     1339       "    -f  Fully qualified domain name\n" \
     1340       "    -F FILE Use the contents of FILE to specify the hostname"
    10901341#define hostname_example_usage \
    1091     "$ hostname\n" \
    1092     "sage\n"
     1342       "$ hostname\n" \
     1343       "sage\n"
    10931344
    10941345#define httpd_trivial_usage \
    1095     "[-c <conf file>]" \
    1096     USE_FEATURE_HTTPD_WITHOUT_INETD(" [-p <port>]") \
    1097     USE_FEATURE_HTTPD_SETUID(" [-u user]") \
    1098     USE_FEATURE_HTTPD_BASIC_AUTH(" [-r <realm>]") \
     1346       "[-c conffile]" \
     1347       " [-p [ip:]port]" \
     1348       " [-i] [-f] [-v[v]]" \
     1349    USE_FEATURE_HTTPD_SETUID(" [-u user[:grp]]") \
     1350    USE_FEATURE_HTTPD_BASIC_AUTH(" [-r realm]") \
    10991351    USE_FEATURE_HTTPD_AUTH_MD5(" [-m pass]") \
    1100     " [-h home]" \
    1101     " [-d/-e <string>]"
     1352       " [-h home]" \
     1353       " [-d/-e string]"
    11021354#define httpd_full_usage \
    1103     "Listens for incoming http server requests.\n\n" \
    1104     "Options:\n" \
    1105     "\t-c FILE\t\tSpecifies configuration file. (default httpd.conf)\n" \
    1106     USE_FEATURE_HTTPD_WITHOUT_INETD("\t-p PORT\tServer port (default 80)\n") \
    1107     USE_FEATURE_HTTPD_SETUID("\t-u USER\tSet uid to USER after listening privileges port\n") \
    1108     USE_FEATURE_HTTPD_BASIC_AUTH("\t-r REALM\tAuthentication Realm for Basic Authentication\n") \
    1109     USE_FEATURE_HTTPD_AUTH_MD5("\t-m PASS\t\tCrypt PASS with md5 algorithm\n") \
    1110     "\t-h HOME  \tSpecifies http HOME directory (default ./)\n" \
    1111     "\t-e STRING\tHtml encode STRING\n" \
    1112     "\t-d STRING\tURL decode STRING"
     1355       "Listen for incoming HTTP requests" \
     1356       "\n\nOptions:" \
     1357       "\n  -c FILE     Configuration file (default httpd.conf)" \
     1358       "\n  -p [IP:]PORT    Bind to ip:port (default *:80)" \
     1359       "\n  -i      Inetd mode" \
     1360       "\n  -f      Do not daemonize" \
     1361       "\n  -v[v]       Verbose" \
     1362    USE_FEATURE_HTTPD_SETUID( \
     1363       "\n  -u USER[:GRP]   Set uid/gid after binding to port") \
     1364    USE_FEATURE_HTTPD_BASIC_AUTH( \
     1365       "\n  -r REALM    Authentication Realm for Basic Authentication") \
     1366    USE_FEATURE_HTTPD_AUTH_MD5( \
     1367       "\n  -m PASS     Crypt PASS with md5 algorithm") \
     1368       "\n  -h HOME     Home directory (default .)" \
     1369       "\n  -e STRING   HTML encode STRING" \
     1370       "\n  -d STRING   URL decode STRING" \
    11131371
    11141372#define hwclock_trivial_usage \
    1115     "[-r|--show] [-s|--hctosys] [-w|--systohc] [-l|--localtime] [-u|--utc]"
     1373       "[-r|--show] [-s|--hctosys] [-w|--systohc]" \
     1374       " [-l|--localtime] [-u|--utc]" \
     1375       " [-f FILE]"
    11161376#define hwclock_full_usage \
    1117     "Query and set the hardware clock (RTC)\n\n" \
    1118     "Options:\n" \
    1119     "\t-r\tread hardware clock and print result\n" \
    1120     "\t-s\tset the system time from the hardware clock\n" \
    1121     "\t-w\tset the hardware clock to the current system time\n" \
    1122     "\t-u\tthe hardware clock is kept in coordinated universal time\n" \
    1123     "\t-l\tthe hardware clock is kept in local time"
    1124 
    1125 #ifdef CONFIG_SELINUX
    1126 #  define USAGE_SELINUX(a) a
    1127 #else
    1128 #  define USAGE_SELINUX(a)
    1129 #endif
     1377       "Query and set a hardware clock (RTC)" \
     1378       "\n\nOptions:\n" \
     1379       "    -r  Read hardware clock and print result\n" \
     1380       "    -s  Set the system time from the hardware clock\n" \
     1381       "    -w  Set the hardware clock to the current system time\n" \
     1382       "    -u  The hardware clock is kept in coordinated universal time\n" \
     1383       "    -l  The hardware clock is kept in local time\n" \
     1384       "    -f FILE Use the specified clock (e.g. /dev/rtc2)"
    11301385
    11311386#define id_trivial_usage \
    1132     "[OPTIONS]... [USERNAME]"
     1387       "[OPTIONS]... [USERNAME]"
    11331388#define id_full_usage \
    1134     "Print information for USERNAME or the current user\n\n" \
    1135     "Options:\n" \
    1136     USAGE_SELINUX("\t-c\tprints only the security context\n") \
    1137     "\t-g\tprints only the group ID\n" \
    1138     "\t-u\tprints only the user ID\n" \
    1139     "\t-n\tprint a name instead of a number\n" \
    1140     "\t-r\tprints the real user ID instead of the effective ID"
     1389       "Print information for USERNAME or the current user" \
     1390       "\n\nOptions:\n" \
     1391    USE_SELINUX( \
     1392       "    -Z  prints only the security context\n" \
     1393    ) \
     1394       "    -g  Prints only the group ID\n" \
     1395       "    -u  Prints only the user ID\n" \
     1396       "    -n  Print a name instead of a number\n" \
     1397       "    -r  Prints the real user ID instead of the effective ID"
    11411398#define id_example_usage \
    1142     "$ id\n" \
    1143     "uid=1000(andersen) gid=1000(andersen)\n"
    1144 
    1145 #ifdef CONFIG_FEATURE_IFCONFIG_SLIP
    1146 #  define USAGE_SIOCSKEEPALIVE(a) a
    1147 #else
    1148 #  define USAGE_SIOCSKEEPALIVE(a)
    1149 #endif
    1150 #ifdef CONFIG_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
    1151 #  define USAGE_IFCONFIG_MII(a) a
    1152 #else
    1153 #  define USAGE_IFCONFIG_MII(a)
    1154 #endif
    1155 #ifdef CONFIG_FEATURE_IFCONFIG_HW
    1156 #  define USAGE_IFCONFIG_HW(a) a
    1157 #else
    1158 #  define USAGE_IFCONFIG_HW(a)
    1159 #endif
    1160 #ifdef CONFIG_FEATURE_IFCONFIG_STATUS
    1161 #  define USAGE_IFCONFIG_OPT_A(a) a
    1162 #else
    1163 #  define USAGE_IFCONFIG_OPT_A(a)
    1164 #endif
    1165 #ifdef CONFIG_FEATURE_IPV6
    1166 #  define USAGE_IPV6(a) a
    1167 #else
    1168 #  define USAGE_IPV6(a)
    1169 #endif
     1399       "$ id\n" \
     1400       "uid=1000(andersen) gid=1000(andersen)\n"
    11701401
    11711402#define ifconfig_trivial_usage \
    1172     USAGE_IFCONFIG_OPT_A("[-a]") " <interface> [<address>]"
     1403    USE_FEATURE_IFCONFIG_STATUS("[-a]") " interface [address]"
    11731404#define ifconfig_full_usage \
    1174     "configure a network interface\n\n" \
    1175     "Options:\n" \
    1176     USAGE_IPV6("\t[add <address>[/<prefixlen>]]\n") \
    1177     USAGE_IPV6("\t[del <address>[/<prefixlen>]]\n") \
    1178     "\t[[-]broadcast [<address>]]  [[-]pointopoint [<address>]]\n" \
    1179     "\t[netmask <address>]  [dstaddr <address>]\n" \
    1180     USAGE_SIOCSKEEPALIVE("\t[outfill <NN>] [keepalive <NN>]\n") \
    1181     "\t" USAGE_IFCONFIG_HW("[hw ether <address>]  ") \
    1182     "[metric <NN>]  [mtu <NN>]\n" \
    1183     "\t[[-]trailers]  [[-]arp]  [[-]allmulti]\n" \
    1184     "\t[multicast]  [[-]promisc]  [txqueuelen <NN>]  [[-]dynamic]\n" \
    1185     USAGE_IFCONFIG_MII("\t[mem_start <NN>]  [io_addr <NN>]  [irq <NN>]\n") \
    1186     "\t[up|down] ..."
     1405       "Configure a network interface" \
     1406       "\n\nOptions:\n" \
     1407    USE_FEATURE_IPV6( \
     1408       "    [add ADDRESS[/PREFIXLEN]]\n") \
     1409    USE_FEATURE_IPV6( \
     1410       "    [del ADDRESS[/PREFIXLEN]]\n") \
     1411       "    [[-]broadcast [ADDRESS]] [[-]pointopoint [ADDRESS]]\n" \
     1412       "    [netmask ADDRESS] [dstaddr ADDRESS]\n" \
     1413    USE_FEATURE_IFCONFIG_SLIP( \
     1414       "    [outfill NN] [keepalive NN]\n") \
     1415       "    " USE_FEATURE_IFCONFIG_HW("[hw ether ADDRESS] ") "[metric NN] [mtu NN]\n" \
     1416       "    [[-]trailers] [[-]arp] [[-]allmulti]\n" \
     1417       "    [multicast] [[-]promisc] [txqueuelen NN] [[-]dynamic]\n" \
     1418    USE_FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ( \
     1419       "    [mem_start NN] [io_addr NN] [irq NN]\n") \
     1420       "    [up|down] ..."
    11871421
    11881422#define ifup_trivial_usage \
    1189     "<-ahinv> <ifaces...>"
     1423       "[-ahinv] ifaces..."
    11901424#define ifup_full_usage \
    1191     "ifup <options> <ifaces...>\n\n" \
    1192     "Options:\n" \
    1193     "\t-h\tthis help\n" \
    1194     "\t-a\tde/configure all interfaces automatically\n" \
    1195     "\t-i FILE\tuse FILE for interface definitions\n" \
    1196     "\t-n\tprint out what would happen, but don't do it\n" \
    1197     "\t\t\t(note that this option doesn't disable mappings)\n" \
    1198     "\t-v\tprint out what would happen before doing it\n" \
    1199     "\t-m\tdon't run any mappings\n" \
    1200     "\t-f\tforce de/configuration"
     1425       "Options:\n" \
     1426       "    -a  De/configure all interfaces automatically\n" \
     1427       "    -i FILE Use FILE for interface definitions\n" \
     1428       "    -n  Print out what would happen, but don't do it\n" \
     1429       "        (note that this option doesn't disable mappings)\n" \
     1430       "    -v  Print out what would happen before doing it\n" \
     1431       "    -m  Don't run any mappings\n" \
     1432       "    -f  Force de/configuration"
    12011433
    12021434#define ifdown_trivial_usage \
    1203     "<-ahinv> <ifaces...>"
     1435       "[-ahinv] ifaces..."
    12041436#define ifdown_full_usage \
    1205     "ifdown <options> <ifaces...>\n\n" \
    1206     "Options:\n" \
    1207     "\t-h\tthis help\n" \
    1208     "\t-a\tde/configure all interfaces automatically\n" \
    1209     "\t-i FILE\tuse FILE for interface definitions\n" \
    1210     "\t-n\tprint out what would happen, but don't do it\n" \
    1211     "\t\t(note that this option doesn't disable mappings)\n" \
    1212     "\t-v\tprint out what would happen before doing it\n" \
    1213     "\t-m\tdon't run any mappings\n" \
    1214     "\t-f\tforce de/configuration"
     1437       "Options:\n" \
     1438       "    -a  De/configure all interfaces automatically\n" \
     1439       "    -i FILE Use FILE for interface definitions\n" \
     1440       "    -n  Print out what would happen, but don't do it\n" \
     1441       "        (note that this option doesn't disable mappings)\n" \
     1442       "    -v  Print out what would happen before doing it\n" \
     1443       "    -m  Don't run any mappings\n" \
     1444       "    -f  Force de/configuration"
    12151445
    12161446#define inetd_trivial_usage \
    1217     "[-f] [-q len] [conf]"
     1447       "[-f] [-q len] [conf]"
    12181448#define inetd_full_usage \
    1219     "Listens for network connections and launches programs\n\n" \
    1220     "Option:\n" \
    1221     "\t-f\tRun as a foreground progress\n" \
    1222     "\t-q\tSets the size of the socket listen queue to\n" \
    1223     "\t\tthe specified value. Default is 128"
     1449       "Listen for network connections and launch programs" \
     1450       "\n\nOptions:\n" \
     1451       "    -f  Run in foreground\n" \
     1452       "    -q N    Set the size of the socket listen queue to N\n" \
     1453       "        (default: 128)"
    12241454
    12251455#define init_trivial_usage \
    1226     ""
     1456       ""
    12271457#define init_full_usage \
    1228     "Init is the parent of all processes."
     1458       "Init is the parent of all processes"
    12291459#define init_notes_usage \
    12301460"This version of init is designed to be run only by the kernel.\n" \
    12311461"\n" \
    1232 "BusyBox init doesn't support multiple runlevels.  The runlevels field of\n" \
    1233 "the /etc/inittab file is completely ignored by BusyBox init. If you want \n" \
     1462"BusyBox init doesn't support multiple runlevels. The runlevels field of\n" \
     1463"the /etc/inittab file is completely ignored by BusyBox init. If you want\n" \
    12341464"runlevels, use sysvinit.\n" \
    12351465"\n" \
    1236 "BusyBox init works just fine without an inittab.  If no inittab is found, \n" \
     1466"BusyBox init works just fine without an inittab. If no inittab is found,\n" \
    12371467"it has the following default behavior:\n" \
    12381468"\n" \
     
    12581488"       WARNING: This field has a non-traditional meaning for BusyBox init!\n" \
    12591489"       The id field is used by BusyBox init to specify the controlling tty for\n" \
    1260 "       the specified process to run on.  The contents of this field are\n" \
    1261 "       appended to \"/dev/\" and used as-is.  There is no need for this field to\n" \
    1262 "       be unique, although if it isn't you may have strange results.  If this\n" \
    1263 "       field is left blank, the controlling tty is set to the console.  Also\n" \
     1490"       the specified process to run on. The contents of this field are\n" \
     1491"       appended to \"/dev/\" and used as-is. There is no need for this field to\n" \
     1492"       be unique, although if it isn't you may have strange results. If this\n" \
     1493"       field is left blank, the controlling tty is set to the console. Also\n" \
    12641494"       note that if BusyBox detects that a serial console is in use, then only\n" \
    12651495"       entries whose controlling tty is either the serial console or /dev/null\n" \
    1266 "       will be run.  BusyBox init does nothing with utmp. We don't need no\n" \
     1496"       will be run. BusyBox init does nothing with utmp. We don't need no\n" \
    12671497"       stinkin' utmp.\n" \
    12681498"\n" \
     
    12821512"       Run only-once actions:\n" \
    12831513"\n" \
    1284 "           'sysinit' is the first item run on boot.  init waits until all\n" \
    1285 "           sysinit actions are completed before continuing.  Following the\n" \
     1514"           'sysinit' is the first item run on boot. init waits until all\n" \
     1515"           sysinit actions are completed before continuing. Following the\n" \
    12861516"           completion of all sysinit actions, all 'wait' actions are run.\n" \
    1287 "           'wait' actions, like  'sysinit' actions, cause init to wait until\n" \
    1288 "           the specified task completes.  'once' actions are asynchronous,\n" \
    1289 "           therefore, init does not wait for them to complete.  'restart' is\n" \
    1290 "           the action taken to restart the init process.  By default this should\n" \
     1517"           'wait' actions, like 'sysinit' actions, cause init to wait until\n" \
     1518"           the specified task completes. 'once' actions are asynchronous,\n" \
     1519"           therefore, init does not wait for them to complete. 'restart' is\n" \
     1520"           the action taken to restart the init process. By default this should\n" \
    12911521"           simply run /sbin/init, but can be a script which runs pivot_root or it\n" \
    1292 "           can do all sorts of other interesting things.  The 'ctrlaltdel' init\n" \
     1522"           can do all sorts of other interesting things. The 'ctrlaltdel' init\n" \
    12931523"           actions are run when the system detects that someone on the system\n" \
    1294 "                       console has pressed the CTRL-ALT-DEL key combination. Typically one\n" \
    1295 "                       wants to run 'reboot' at this point to cause the system to reboot.\n" \
     1524"           console has pressed the CTRL-ALT-DEL key combination. Typically one\n" \
     1525"           wants to run 'reboot' at this point to cause the system to reboot.\n" \
    12961526"           Finally the 'shutdown' action specifies the actions to taken when\n" \
    1297 "                       init is told to reboot. Unmounting filesystems and disabling swap\n" \
    1298 "                       is a very good here\n" \
     1527"           init is told to reboot. Unmounting filesystems and disabling swap\n" \
     1528"           is a very good here.\n" \
    12991529"\n" \
    13001530"       Run repeatedly actions:\n" \
    13011531"\n" \
    1302 "           'respawn' actions are run after the 'once' actions.  When a process\n" \
     1532"           'respawn' actions are run after the 'once' actions. When a process\n" \
    13031533"           started with a 'respawn' action exits, init automatically restarts\n" \
    1304 "           it.  Unlike sysvinit, BusyBox init does not stop processes from\n" \
    1305 "           respawning out of control.  The 'askfirst' actions acts just like\n" \
     1534"           it. Unlike sysvinit, BusyBox init does not stop processes from\n" \
     1535"           respawning out of control. The 'askfirst' actions acts just like\n" \
    13061536"           respawn, except that before running the specified process it\n" \
    13071537"           displays the line \"Please press Enter to activate this console.\"\n" \
     
    13101540"\n" \
    13111541"       Unrecognized actions (like initdefault) will cause init to emit an\n" \
    1312 "       error message, and then go along with its business.  All actions are\n" \
     1542"       error message, and then go along with its business. All actions are\n" \
    13131543"       run in the order they appear in /etc/inittab.\n" \
    13141544"\n" \
     
    13191549"Example /etc/inittab file:\n" \
    13201550"\n" \
    1321 "   # This is run first except when booting in single-user mode.\n" \
     1551"   # This is run first except when booting in single-user mode\n" \
    13221552"   #\n" \
    13231553"   ::sysinit:/etc/init.d/rcS\n" \
     
    13431573"   #::respawn:/sbin/getty -L ttyS1 9600 vt100\n" \
    13441574"   #\n" \
    1345 "   # Example how to put a getty on a modem line.\n" \
     1575"   # Example how to put a getty on a modem line\n" \
    13461576"   #::respawn:/sbin/getty 57600 ttyS2\n" \
    13471577"   \n" \
     
    13541584"   ::shutdown:/sbin/swapoff -a\n"
    13551585
    1356 #ifdef CONFIG_FEATURE_INSMOD_LOAD_MAP
    1357 #  define USAGE_INSMOD_MAP(a) a
    1358 #else
    1359 #  define USAGE_INSMOD_MAP(a)
     1586#define insmod_trivial_usage \
     1587       "[OPTION]... MODULE [symbol=value]..."
     1588#define insmod_full_usage \
     1589       "Load the specified kernel modules into the kernel" \
     1590       "\n\nOptions:\n" \
     1591       "    -f  Force module to load into the wrong kernel version\n" \
     1592       "    -k  Make module autoclean-able\n" \
     1593       "    -v  Verbose\n" \
     1594       "    -q  Quiet\n" \
     1595       "    -L  Lock to prevent simultaneous loads of a module\n" \
     1596    USE_FEATURE_INSMOD_LOAD_MAP( \
     1597       "    -m  Output load map to stdout\n") \
     1598       "    -o NAME Set internal module name to NAME\n" \
     1599       "    -x  Do not export externs"
     1600
     1601#define install_trivial_usage \
     1602       "[-cgmops] [sources] dest|directory"
     1603#define install_full_usage \
     1604       "Copy files and set attributes" \
     1605       "\n\nOptions:\n" \
     1606       "    -c  Copy the file, default\n" \
     1607       "    -d  Create directories\n" \
     1608       "    -g  Set group ownership\n" \
     1609       "    -m  Set permission modes\n" \
     1610       "    -o  Set ownership\n" \
     1611       "    -p  Preserve date\n" \
     1612       "    -s  Strip symbol tables" \
     1613    USE_SELINUX( \
     1614       "\n  -Z  Set security context of copy" \
     1615    )
     1616/* would need to make the " | " optional depending on more than one selected */
     1617#define ip_trivial_usage \
     1618       "[OPTIONS] {" \
     1619    USE_FEATURE_IP_ADDRESS("address | ") \
     1620    USE_FEATURE_IP_ROUTE("route | ") \
     1621    USE_FEATURE_IP_LINK("link | ") \
     1622    USE_FEATURE_IP_TUNNEL("tunnel | ") \
     1623    USE_FEATURE_IP_RULE("rule") \
     1624       "} {COMMAND}"
     1625#define ip_full_usage \
     1626       "ip [OPTIONS] OBJECT {COMMAND}\n" \
     1627       "where OBJECT := {" \
     1628    USE_FEATURE_IP_ADDRESS("address | ") \
     1629    USE_FEATURE_IP_ROUTE("route | ") \
     1630    USE_FEATURE_IP_LINK("link | ") \
     1631    USE_FEATURE_IP_TUNNEL("tunnel | ") \
     1632    USE_FEATURE_IP_RULE("rule") \
     1633       "}\n" \
     1634       "OPTIONS := { -f[amily] { inet | inet6 | link } | -o[neline] }"
     1635
     1636#define ipaddr_trivial_usage \
     1637       "{ {add|del} IFADDR dev STRING | {show|flush}\n" \
     1638       "        [dev STRING] [to PREFIX] }"
     1639#define ipaddr_full_usage \
     1640       "ipaddr {add|delete} IFADDR dev STRING\n" \
     1641       "ipaddr {show|flush} [dev STRING] [scope SCOPE-ID]\n" \
     1642       "    [to PREFIX] [label PATTERN]\n" \
     1643       "    IFADDR := PREFIX | ADDR peer PREFIX\n" \
     1644       "    [broadcast ADDR] [anycast ADDR]\n" \
     1645       "    [label STRING] [scope SCOPE-ID]\n" \
     1646       "    SCOPE-ID := [host | link | global | NUMBER]"
     1647
     1648#define ipcalc_trivial_usage \
     1649       "[OPTION]... ADDRESS[[/]NETMASK] [NETMASK]"
     1650#define ipcalc_full_usage \
     1651       "Calculate IP network settings from a IP address" \
     1652       "\n\nOptions:" \
     1653       "\n  -b  --broadcast Display calculated broadcast address" \
     1654       "\n  -n  --network   Display calculated network address" \
     1655       "\n  -m  --netmask   Display default netmask for IP" \
     1656    USE_FEATURE_IPCALC_FANCY( \
     1657       "\n  -p  --prefix    Display the prefix for IP/NETMASK" \
     1658       "\n  -h  --hostname  Display first resolved host name" \
     1659       "\n  -s  --silent    Don't ever display error messages")
     1660
     1661#define ipcrm_trivial_usage \
     1662       "[-[MQS] key] [-[mqs] id]"
     1663#define ipcrm_full_usage \
     1664       "The upper-case options MQS are used to remove a shared memory segment by a\n" \
     1665       "segment by a shmkey value. The lower-case options mqs are used\n" \
     1666       "to remove a segment by shmid value.\n" \
     1667       "\n\nOptions:\n" \
     1668       "    -[mM]   Remove the memory segment after the last detach\n" \
     1669       "    -[qQ]   Remove the message queue\n" \
     1670       "    -[sS]   Remove the semaphore"
     1671
     1672#define ipcs_trivial_usage \
     1673       "[[-smq] -i shmid] | [[-asmq] [-tcplu]]"
     1674#define ipcs_full_usage \
     1675       "    -i  Specify a specific resource id\n" \
     1676       "Resource specification:\n" \
     1677       "    -m  Shared memory segments\n" \
     1678       "    -q  Message queues\n" \
     1679       "    -s  Semaphore arrays\n" \
     1680       "    -a  All (default)\n" \
     1681       "Output format:\n" \
     1682       "    -t  Time\n" \
     1683       "    -c  Creator\n" \
     1684       "    -p  Pid\n" \
     1685       "    -l  Limits\n" \
     1686       "    -u  Summary"
     1687
     1688#define iplink_trivial_usage \
     1689       "{ set DEVICE { up | down | arp { on | off } | show [DEVICE] }"
     1690#define iplink_full_usage \
     1691       "iplink set DEVICE { up | down | arp | multicast { on | off } |\n" \
     1692       "            dynamic { on | off } |\n" \
     1693       "            mtu MTU }\n" \
     1694       "iplink show [DEVICE]"
     1695
     1696#define iproute_trivial_usage \
     1697       "{ list | flush | { add | del | change | append |\n" \
     1698       "        replace | monitor } ROUTE }"
     1699#define iproute_full_usage \
     1700       "iproute { list | flush } SELECTOR\n" \
     1701       "iproute get ADDRESS [from ADDRESS iif STRING]\n" \
     1702       "            [oif STRING]  [tos TOS]\n" \
     1703       "iproute { add | del | change | append | replace | monitor } ROUTE\n" \
     1704       "            SELECTOR := [root PREFIX] [match PREFIX] [proto RTPROTO]\n" \
     1705       "            ROUTE := [TYPE] PREFIX [tos TOS] [proto RTPROTO]"
     1706
     1707#define iprule_trivial_usage \
     1708       "{[list | add | del] RULE}"
     1709#define iprule_full_usage \
     1710       "iprule [list | add | del] SELECTOR ACTION\n" \
     1711       "    SELECTOR := [from PREFIX] [to PREFIX] [tos TOS] [fwmark FWMARK]\n" \
     1712       "            [dev STRING] [pref NUMBER]\n" \
     1713       "    ACTION := [table TABLE_ID] [nat ADDRESS]\n" \
     1714       "            [prohibit | reject | unreachable]\n" \
     1715       "            [realms [SRCREALM/]DSTREALM]\n" \
     1716       "    TABLE_ID := [local | main | default | NUMBER]"
     1717
     1718#define iptunnel_trivial_usage \
     1719       "{ add | change | del | show } [NAME]\n" \
     1720       "    [mode { ipip | gre | sit }]\n" \
     1721       "    [remote ADDR] [local ADDR] [ttl TTL]"
     1722#define iptunnel_full_usage \
     1723       "iptunnel { add | change | del | show } [NAME]\n" \
     1724       "    [mode { ipip | gre | sit }] [remote ADDR] [local ADDR]\n" \
     1725       "    [[i|o]seq] [[i|o]key KEY] [[i|o]csum]\n" \
     1726       "    [ttl TTL] [tos TOS] [[no]pmtudisc] [dev PHYS_DEV]"
     1727
     1728#define kill_trivial_usage \
     1729       "[-l] [-signal] process-id [process-id ...]"
     1730#define kill_full_usage \
     1731       "Send a signal (default is TERM) to the specified process(es)" \
     1732       "\n\nOptions:\n" \
     1733       "    -l  List all signal names and numbers"
     1734#define kill_example_usage \
     1735       "$ ps | grep apache\n" \
     1736       "252 root     root     S [apache]\n" \
     1737       "263 www-data www-data S [apache]\n" \
     1738       "264 www-data www-data S [apache]\n" \
     1739       "265 www-data www-data S [apache]\n" \
     1740       "266 www-data www-data S [apache]\n" \
     1741       "267 www-data www-data S [apache]\n" \
     1742       "$ kill 252\n"
     1743
     1744#define killall_trivial_usage \
     1745       "[-l] [-q] [-signal] process-name [process-name ...]"
     1746#define killall_full_usage \
     1747       "Send a signal (default is TERM) to the specified process(es)" \
     1748       "\n\nOptions:\n" \
     1749       "    -l  List all signal names and numbers\n" \
     1750       "    -q  Do not complain if no processes were killed"
     1751#define killall_example_usage \
     1752       "$ killall apache\n"
     1753
     1754#define killall5_trivial_usage \
     1755       "[-l] [-signal]"
     1756#define killall5_full_usage \
     1757       "Send a signal (default is TERM) to all processes outside current session" \
     1758       "\n\nOptions:\n" \
     1759       "    -l  List all signal names and numbers\n" \
     1760
     1761#define klogd_trivial_usage \
     1762       "[-c n] [-n]"
     1763#define klogd_full_usage \
     1764       "Kernel logger" \
     1765       "\n\nOptions:\n" \
     1766       "    -c n    Sets the default log level of console messages to n\n" \
     1767       "    -n  Run as foreground process"
     1768
     1769#define length_trivial_usage \
     1770       "STRING"
     1771#define length_full_usage \
     1772       "Print out the length of the specified STRING"
     1773#define length_example_usage \
     1774       "$ length Hello\n" \
     1775       "5\n"
     1776
     1777#define less_trivial_usage \
     1778       "[-EMNmh~?] FILE1 FILE2..."
     1779#define less_full_usage \
     1780       "View a file or list of files. The position within files can be\n" \
     1781       "changed, and files can be manipulated in various ways." \
     1782       "\n\nOptions:\n" \
     1783       "    -E  Quit once the end of a file is reached\n" \
     1784       "    -M  Display a status line containing the current line numbers\n" \
     1785       "        and the percentage through the file\n" \
     1786       "    -N  Prefix line numbers to each line\n" \
     1787       "    -m  Display a status line containing the percentage through the\n" \
     1788       "        file\n" \
     1789       "    -~  Suppress ~s displayed when input past the end of the file is\n" \
     1790       "        reached"
     1791
     1792#define setarch_trivial_usage \
     1793       "personality program [args ...]"
     1794#define setarch_full_usage \
     1795       "Personality may be:\n" \
     1796       "    linux32     Set 32bit uname emulation\n" \
     1797       "    linux64     Set 64bit uname emulation"
     1798
     1799#define ln_trivial_usage \
     1800       "[OPTION] TARGET... LINK_NAME|DIRECTORY"
     1801#define ln_full_usage \
     1802       "Create a link named LINK_NAME or DIRECTORY to the specified TARGET.\n" \
     1803       "You may use '--' to indicate that all following arguments are non-options." \
     1804       "\n\nOptions:\n" \
     1805       "    -s  Make symlinks instead of hardlinks\n" \
     1806       "    -f  Remove existing destination files\n" \
     1807       "    -n  No dereference symlinks - treat like normal file\n" \
     1808       "    -b  Make a backup of the target (if exists) before link operation\n" \
     1809       "    -S suf  Use suffix instead of ~ when making backup files"
     1810#define ln_example_usage \
     1811       "$ ln -s BusyBox /tmp/ls\n" \
     1812       "$ ls -l /tmp/ls\n" \
     1813       "lrwxrwxrwx    1 root     root            7 Apr 12 18:39 ls -> BusyBox*\n"
     1814
     1815#define load_policy_trivial_usage \
     1816       "[FILE]"
     1817#define load_policy_full_usage
     1818
     1819#define loadfont_trivial_usage \
     1820       "< font"
     1821#define loadfont_full_usage \
     1822       "Load a console font from standard input"
     1823#define loadfont_example_usage \
     1824       "$ loadfont < /etc/i18n/fontname\n"
     1825
     1826#define loadkmap_trivial_usage \
     1827       "< keymap"
     1828#define loadkmap_full_usage \
     1829       "Load a binary keyboard translation table from standard input"
     1830#define loadkmap_example_usage \
     1831       "$ loadkmap < /etc/i18n/lang-keymap\n"
     1832
     1833#define logger_trivial_usage \
     1834       "[OPTION]... [MESSAGE]"
     1835#define logger_full_usage \
     1836       "Write MESSAGE to the system log. If MESSAGE is omitted, log stdin." \
     1837       "\n\nOptions:\n" \
     1838       "    -s  Log to stderr as well as the system log\n" \
     1839       "    -t TAG  Log using the specified tag (defaults to user name)\n" \
     1840       "    -p PRIO Enter the message with the specified priority.\n" \
     1841       "        This may be numerical or a 'facility.level' pair."
     1842#define logger_example_usage \
     1843       "$ logger \"hello\"\n"
     1844
     1845#define login_trivial_usage \
     1846       "[OPTION]... [username] [ENV=VAR ...]"
     1847#define login_full_usage \
     1848       "Begin a new session on the system" \
     1849       "\n\nOptions:\n" \
     1850       "    -f  Do not authenticate (user already authenticated)\n" \
     1851       "    -h  Name of the remote host for this login\n" \
     1852       "    -p  Preserve environment"
     1853
     1854#define logname_trivial_usage \
     1855       ""
     1856#define logname_full_usage \
     1857       "Print the name of the current user"
     1858#define logname_example_usage \
     1859       "$ logname\n" \
     1860       "root\n"
     1861
     1862#define logread_trivial_usage \
     1863       "[OPTION]..."
     1864#define logread_full_usage \
     1865       "Show the messages from syslogd (using circular buffer)" \
     1866       "\n\nOptions:\n" \
     1867       "    -f  Output data as the log grows"
     1868
     1869#define losetup_trivial_usage \
     1870       "[-o OFFSET] [-d] LOOPDEVICE [FILE]]"
     1871#define losetup_full_usage \
     1872       "(Dis)associate LOOPDEVICE with FILE, or display current associations" \
     1873       "\n\nOptions:\n" \
     1874       "    -d      Disassociate LOOPDEVICE\n" \
     1875       "    -o OFFSET   Start OFFSET bytes into FILE"
     1876#define losetup_notes_usage \
     1877       "No arguments will display all current associations.\n" \
     1878       "One argument (losetup /dev/loop1) will display the current association\n" \
     1879       "(if any), or disassociate it (with -d). The display shows the offset\n" \
     1880       "and filename of the file the loop device is currently bound to.\n\n" \
     1881       "Two arguments (losetup /dev/loop1 file.img) create a new association,\n" \
     1882       "with an optional offset (-o 12345). Encryption is not yet supported.\n\n"
     1883
     1884#define ls_trivial_usage \
     1885       "[-1Aa" USE_FEATURE_LS_TIMESTAMPS("c") "Cd" \
     1886    USE_FEATURE_LS_TIMESTAMPS("e") USE_FEATURE_LS_FILETYPES("F") "iln" \
     1887    USE_FEATURE_LS_FILETYPES("p") USE_FEATURE_LS_FOLLOWLINKS("L") \
     1888    USE_FEATURE_LS_RECURSIVE("R") USE_FEATURE_LS_SORTFILES("rS") "s" \
     1889    USE_FEATURE_AUTOWIDTH("T") USE_FEATURE_LS_TIMESTAMPS("tu") \
     1890    USE_FEATURE_LS_SORTFILES("v") USE_FEATURE_AUTOWIDTH("w") "x" \
     1891    USE_FEATURE_LS_SORTFILES("X") USE_FEATURE_HUMAN_READABLE("h") "k" \
     1892    USE_SELINUX("K") "] [filenames...]"
     1893#define ls_full_usage \
     1894       "List directory contents" \
     1895       "\n\nOptions:" \
     1896       "\n  -1  List files in a single column" \
     1897       "\n  -A  Do not list implied . and .." \
     1898       "\n  -a  Do not hide entries starting with ." \
     1899       "\n  -C  List entries by columns" \
     1900    USE_FEATURE_LS_TIMESTAMPS( \
     1901       "\n  -c  With -l: show ctime") \
     1902    USE_FEATURE_LS_COLOR( \
     1903       "\n  --color[={always,never,auto}]   Control coloring") \
     1904       "\n  -d  List directory entries instead of contents" \
     1905    USE_FEATURE_LS_TIMESTAMPS( \
     1906       "\n  -e  List both full date and full time") \
     1907    USE_FEATURE_LS_FILETYPES( \
     1908       "\n  -F  Append indicator (one of */=@|) to entries") \
     1909       "\n  -i  List the i-node for each file" \
     1910       "\n  -l  Use a long listing format" \
     1911       "\n  -n  List numeric UIDs and GIDs instead of names" \
     1912    USE_FEATURE_LS_FILETYPES( \
     1913       "\n  -p  Append indicator (one of /=@|) to entries") \
     1914    USE_FEATURE_LS_FOLLOWLINKS( \
     1915       "\n  -L  List entries pointed to by symlinks") \
     1916    USE_FEATURE_LS_RECURSIVE( \
     1917       "\n  -R  List subdirectories recursively") \
     1918    USE_FEATURE_LS_SORTFILES( \
     1919       "\n  -r  Sort the listing in reverse order") \
     1920    USE_FEATURE_LS_SORTFILES( \
     1921       "\n  -S  Sort the listing by file size") \
     1922       "\n  -s  List the size of each file, in blocks" \
     1923    USE_FEATURE_AUTOWIDTH( \
     1924       "\n  -T NUM  Assume Tabstop every NUM columns") \
     1925    USE_FEATURE_LS_TIMESTAMPS( \
     1926       "\n  -t  With -l: show modification time") \
     1927    USE_FEATURE_LS_TIMESTAMPS( \
     1928       "\n  -u  With -l: show access time") \
     1929    USE_FEATURE_LS_SORTFILES( \
     1930       "\n  -v  Sort the listing by version") \
     1931    USE_FEATURE_AUTOWIDTH( \
     1932       "\n  -w NUM  Assume the terminal is NUM columns wide") \
     1933       "\n  -x  List entries by lines instead of by columns" \
     1934    USE_FEATURE_LS_SORTFILES( \
     1935       "\n  -X  Sort the listing by extension") \
     1936    USE_FEATURE_HUMAN_READABLE( \
     1937       "\n  -h  Print sizes in human readable format (e.g., 1K 243M 2G)") \
     1938    USE_SELINUX( \
     1939       "\n  -k  Print security context") \
     1940    USE_SELINUX( \