aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Denys Vlasenko <vda.linux@googlemail.com>2016-11-23 14:46:56 +0100
committerGravatar Denys Vlasenko <vda.linux@googlemail.com>2016-11-23 14:46:56 +0100
commitaf3f42011628585cd5c8f5c1fd4b43f2e370a23d (patch)
tree125ee16d5080008fcf459ad55d91af1dcd488ef9
parent5b966c6180c139fba6846d632fd9bc0c34a8e1bc (diff)
downloadbusybox-af3f42011628585cd5c8f5c1fd4b43f2e370a23d.tar.gz
busybox-af3f42011628585cd5c8f5c1fd4b43f2e370a23d.tar.bz2
Convert all coreutils/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
-rw-r--r--coreutils/Config.src644
-rw-r--r--coreutils/Kbuild.src73
-rw-r--r--coreutils/basename.c13
-rw-r--r--coreutils/cal.c18
-rw-r--r--coreutils/cat.c16
-rw-r--r--coreutils/catv.c11
-rw-r--r--coreutils/chgrp.c9
-rw-r--r--coreutils/chmod.c9
-rw-r--r--coreutils/chown.c17
-rw-r--r--coreutils/chroot.c10
-rw-r--r--coreutils/cksum.c9
-rw-r--r--coreutils/comm.c10
-rw-r--r--coreutils/cp.c22
-rw-r--r--coreutils/cut.c10
-rw-r--r--coreutils/date.c11
-rw-r--r--coreutils/dd.c6
-rw-r--r--coreutils/df.c28
-rw-r--r--coreutils/dirname.c10
-rw-r--r--coreutils/dos2unix.c22
-rw-r--r--coreutils/du.c24
-rw-r--r--coreutils/echo.c24
-rw-r--r--coreutils/env.c26
-rw-r--r--coreutils/expand.c31
-rw-r--r--coreutils/expr.c25
-rw-r--r--coreutils/false.c9
-rw-r--r--coreutils/fold.c9
-rw-r--r--coreutils/fsync.c9
-rw-r--r--coreutils/head.c19
-rw-r--r--coreutils/hostid.c5
-rw-r--r--coreutils/id.c11
-rw-r--r--coreutils/install.c16
-rw-r--r--coreutils/ln.c9
-rw-r--r--coreutils/logname.c16
-rw-r--r--coreutils/ls.c70
-rw-r--r--coreutils/mkdir.c24
-rw-r--r--coreutils/mkfifo.c10
-rw-r--r--coreutils/mknod.c10
-rw-r--r--coreutils/mv.c23
-rw-r--r--coreutils/nice.c9
-rw-r--r--coreutils/nohup.c9
-rw-r--r--coreutils/od.c9
-rw-r--r--coreutils/printenv.c9
-rw-r--r--coreutils/printf.c11
-rw-r--r--coreutils/pwd.c11
-rw-r--r--coreutils/readlink.c17
-rw-r--r--coreutils/realpath.c15
-rw-r--r--coreutils/rm.c16
-rw-r--r--coreutils/rmdir.c17
-rw-r--r--coreutils/seq.c9
-rw-r--r--coreutils/sleep.c44
-rw-r--r--coreutils/sort.c21
-rw-r--r--coreutils/split.c19
-rw-r--r--coreutils/stat.c3
-rw-r--r--coreutils/stty.c10
-rw-r--r--coreutils/sum.c9
-rw-r--r--coreutils/sync.c7
-rw-r--r--coreutils/tac.c14
-rw-r--r--coreutils/tail.c30
-rw-r--r--coreutils/tee.c17
-rw-r--r--coreutils/test.c13
-rw-r--r--coreutils/touch.c14
-rw-r--r--coreutils/tr.c7
-rw-r--r--coreutils/true.c9
-rw-r--r--coreutils/truncate.c4
-rw-r--r--coreutils/tty.c10
-rw-r--r--coreutils/uname.c25
-rw-r--r--coreutils/uniq.c9
-rw-r--r--coreutils/unlink.c5
-rw-r--r--coreutils/usleep.c9
-rw-r--r--coreutils/uudecode.c9
-rw-r--r--coreutils/uuencode.c9
-rw-r--r--coreutils/wc.c25
-rw-r--r--coreutils/who.c8
-rw-r--r--coreutils/whoami.c12
-rw-r--r--coreutils/yes.c17
-rw-r--r--include/applets.src.h70
76 files changed, 950 insertions, 929 deletions
diff --git a/coreutils/Config.src b/coreutils/Config.src
index b9dde1209..a35198a3b 100644
--- a/coreutils/Config.src
+++ b/coreutils/Config.src
@@ -7,656 +7,12 @@ menu "Coreutils"
INSERT
-config CAL
- bool "cal"
- default y
- help
- cal is used to display a monthly calendar.
-
-config CATV
- bool "catv"
- default y
- help
- Display nonprinting characters as escape sequences (like some
- implementations' cat -v option).
-
-config CHGRP
- bool "chgrp"
- default y
- help
- chgrp is used to change the group ownership of files.
-
-config CHMOD
- bool "chmod"
- default y
- help
- chmod is used to change the access permission of files.
-
-config CHOWN
- bool "chown"
- default y
- help
- chown is used to change the user and/or group ownership
- of files.
-
-config FEATURE_CHOWN_LONG_OPTIONS
- bool "Enable long options"
- default y
- depends on CHOWN && LONG_OPTS
- help
- Enable use of long options
-
-config CHROOT
- bool "chroot"
- default y
- help
- chroot is used to change the root directory and run a command.
- The default command is `/bin/sh'.
-
-config CKSUM
- bool "cksum"
- default y
- help
- cksum is used to calculate the CRC32 checksum of a file.
-
-config COMM
- bool "comm"
- default y
- help
- comm is used to compare two files line by line and return
- a three-column output.
-
-config CP
- bool "cp"
- default y
- help
- cp is used to copy files and directories.
-
-config FEATURE_CP_LONG_OPTIONS
- bool "Enable long options for cp"
- default y
- depends on CP && LONG_OPTS
- help
- Enable long options for cp.
- Also add support for --parents option.
-
-config CUT
- bool "cut"
- default y
- help
- cut is used to print selected parts of lines from
- each file to stdout.
-
-config DF
- bool "df"
- default y
- help
- df reports the amount of disk space used and available
- on filesystems.
-
-config FEATURE_DF_FANCY
- bool "Enable -a, -i, -B"
- default y
- depends on DF
- help
- This option enables -a, -i and -B.
-
- -a Show all filesystems
- -i Inodes
- -B <SIZE> Blocksize
-
-config DIRNAME
- bool "dirname"
- default y
- help
- dirname is used to strip a non-directory suffix from
- a file name.
-
-config DOS2UNIX
- bool "dos2unix/unix2dos"
- default y
- help
- dos2unix is used to convert a text file from DOS format to
- UNIX format, and vice versa.
-
-config UNIX2DOS
- bool
- default y
- depends on DOS2UNIX
- help
- unix2dos is used to convert a text file from UNIX format to
- DOS format, and vice versa.
-
-config DU
- bool "du (default blocksize of 512 bytes)"
- default y
- help
- du is used to report the amount of disk space used
- for specified files.
-
-config FEATURE_DU_DEFAULT_BLOCKSIZE_1K
- bool "Use a default blocksize of 1024 bytes (1K)"
- default y
- depends on DU
- help
- Use a blocksize of (1K) instead of the default 512b.
-
-config ECHO
- bool "echo (basic SuSv3 version taking no options)"
- default y
- help
- echo is used to print a specified string to stdout.
-
-# this entry also appears in shell/Config.in, next to the echo builtin
-config FEATURE_FANCY_ECHO
- bool "Enable echo options (-n and -e)"
- default y
- depends on ECHO || ASH_BUILTIN_ECHO || HUSH
- help
- This adds options (-n and -e) to echo.
-
-config ENV
- bool "env"
- default y
- help
- env is used to set an environment variable and run
- a command; without options it displays the current
- environment.
-
-config FEATURE_ENV_LONG_OPTIONS
- bool "Enable long options"
- default y
- depends on ENV && LONG_OPTS
- help
- Support long options for the env applet.
-
-config EXPAND
- bool "expand"
- default y
- help
- By default, convert all tabs to spaces.
-
-config FEATURE_EXPAND_LONG_OPTIONS
- bool "Enable long options"
- default y
- depends on EXPAND && LONG_OPTS
- help
- Support long options for the expand applet.
-
-config EXPR
- bool "expr"
- default y
- help
- expr is used to calculate numbers and print the result
- to standard output.
-
-config EXPR_MATH_SUPPORT_64
- bool "Extend Posix numbers support to 64 bit"
- default y
- depends on EXPR
- help
- Enable 64-bit math support in the expr applet. This will make
- the applet slightly larger, but will allow computation with very
- large numbers.
-
-config FALSE
- bool "false"
- default y
- help
- false returns an exit code of FALSE (1).
-
-config FOLD
- bool "fold"
- default y
- help
- Wrap text to fit a specific width.
-
-config FSYNC
- bool "fsync"
- default y
- help
- fsync is used to flush file-related cached blocks to disk.
-
-config HEAD
- bool "head"
- default y
- help
- head is used to print the first specified number of lines
- from files.
-
-config FEATURE_FANCY_HEAD
- bool "Enable head options (-c, -q, and -v)"
- default y
- depends on HEAD
- help
- This enables the head options (-c, -q, and -v).
-
-config INSTALL
- bool "install"
- default y
- help
- Copy files and set attributes.
-
-config FEATURE_INSTALL_LONG_OPTIONS
- bool "Enable long options"
- default y
- depends on INSTALL && LONG_OPTS
- help
- Support long options for the install applet.
-
####config LENGTH
#### bool "length"
#### default y
#### help
#### length is used to print out the length of a specified string.
-config LN
- bool "ln"
- default y
- help
- ln is used to create hard or soft links between files.
-
-config LOGNAME
- bool "logname"
- default y
- help
- logname is used to print the current user's login name.
-
-config LS
- bool "ls"
- default y
- help
- ls is used to list the contents of directories.
-
-config FEATURE_LS_FILETYPES
- bool "Enable filetyping options (-p and -F)"
- default y
- depends on LS
- help
- Enable the ls options (-p and -F).
-
-config FEATURE_LS_FOLLOWLINKS
- bool "Enable symlinks dereferencing (-L)"
- default y
- depends on LS
- help
- Enable the ls option (-L).
-
-config FEATURE_LS_RECURSIVE
- bool "Enable recursion (-R)"
- default y
- depends on LS
- help
- Enable the ls option (-R).
-
-config FEATURE_LS_SORTFILES
- bool "Sort the file names"
- default y
- depends on LS
- help
- Allow ls to sort file names alphabetically.
-
-config FEATURE_LS_TIMESTAMPS
- bool "Show file timestamps"
- default y
- depends on LS
- help
- Allow ls to display timestamps for files.
-
-config FEATURE_LS_USERNAME
- bool "Show username/groupnames"
- default y
- depends on LS
- help
- Allow ls to display username/groupname for files.
-
-config FEATURE_LS_COLOR
- bool "Allow use of color to identify file types"
- default y
- depends on LS && LONG_OPTS
- help
- This enables the --color option to ls.
-
-config FEATURE_LS_COLOR_IS_DEFAULT
- bool "Produce colored ls output by default"
- default y
- depends on FEATURE_LS_COLOR
- help
- Saying yes here will turn coloring on by default,
- even if no "--color" option is given to the ls command.
- This is not recommended, since the colors are not
- configurable, and the output may not be legible on
- many output screens.
-
-config MKDIR
- bool "mkdir"
- default y
- help
- mkdir is used to create directories with the specified names.
-
-config FEATURE_MKDIR_LONG_OPTIONS
- bool "Enable long options"
- default y
- depends on MKDIR && LONG_OPTS
- help
- Support long options for the mkdir applet.
-
-config MKFIFO
- bool "mkfifo"
- default y
- help
- mkfifo is used to create FIFOs (named pipes).
- The `mknod' program can also create FIFOs.
-
-config MKNOD
- bool "mknod"
- default y
- help
- mknod is used to create FIFOs or block/character special
- files with the specified names.
-
-config MV
- bool "mv"
- default y
- help
- mv is used to move or rename files or directories.
-
-config FEATURE_MV_LONG_OPTIONS
- bool "Enable long options"
- default y
- depends on MV && LONG_OPTS
- help
- Support long options for the mv applet.
-
-config NICE
- bool "nice"
- default y
- help
- nice runs a program with modified scheduling priority.
-
-config NOHUP
- bool "nohup"
- default y
- help
- run a command immune to hangups, with output to a non-tty.
-
-config OD
- bool "od"
- default y
- help
- od is used to dump binary files in octal and other formats.
-
-config PRINTENV
- bool "printenv"
- default y
- help
- printenv is used to print all or part of environment.
-
-config PRINTF
- bool "printf"
- default y
- help
- printf is used to format and print specified strings.
- It's similar to `echo' except it has more options.
-
-config PWD
- bool "pwd"
- default y
- help
- pwd is used to print the current directory.
-
-config READLINK
- bool "readlink"
- default y
- help
- This program reads a symbolic link and returns the name
- of the file it points to
-
-config FEATURE_READLINK_FOLLOW
- bool "Enable canonicalization by following all symlinks (-f)"
- default y
- depends on READLINK
- help
- Enable the readlink option (-f).
-
-config REALPATH
- bool "realpath"
- default y
- help
- Return the canonicalized absolute pathname.
- This isn't provided by GNU shellutils, but where else does it belong.
-
-config RM
- bool "rm"
- default y
- help
- rm is used to remove files or directories.
-
-config RMDIR
- bool "rmdir"
- default y
- help
- rmdir is used to remove empty directories.
-
-config FEATURE_RMDIR_LONG_OPTIONS
- bool "Enable long options"
- default y
- depends on RMDIR && LONG_OPTS
- help
- Support long options for the rmdir applet, including
- --ignore-fail-on-non-empty for compatibility with GNU rmdir.
-
-config SEQ
- bool "seq"
- default y
- help
- print a sequence of numbers
-
-config SLEEP
- bool "sleep"
- default y
- help
- sleep is used to pause for a specified number of seconds.
- It comes in 3 versions:
- - small: takes one integer parameter
- - fancy: takes multiple integer arguments with suffixes:
- sleep 1d 2h 3m 15s
- - fancy with fractional numbers:
- sleep 2.3s 4.5h sleeps for 16202.3 seconds
- Last one is "the most compatible" with coreutils sleep,
- but it adds around 1k of code.
-
-config FEATURE_FANCY_SLEEP
- bool "Enable multiple arguments and s/m/h/d suffixes"
- default y
- depends on SLEEP
- help
- Allow sleep to pause for specified minutes, hours, and days.
-
-config FEATURE_FLOAT_SLEEP
- bool "Enable fractional arguments"
- default y
- depends on FEATURE_FANCY_SLEEP
- help
- Allow for fractional numeric parameters.
-
-config SORT
- bool "sort"
- default y
- help
- sort is used to sort lines of text in specified files.
-
-config FEATURE_SORT_BIG
- bool "Full SuSv3 compliant sort (support -ktcsbdfiozgM)"
- default y
- depends on SORT
- help
- Without this, sort only supports -r, -u, and an integer version
- of -n. Selecting this adds sort keys, floating point support, and
- more. This adds a little over 3k to a nonstatic build on x86.
-
- The SuSv3 sort standard is available at:
- http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
-
-config SPLIT
- bool "split"
- default y
- help
- split a file into pieces.
-
-config FEATURE_SPLIT_FANCY
- bool "Fancy extensions"
- default y
- depends on SPLIT
- help
- Add support for features not required by SUSv3.
- Supports additional suffixes 'b' for 512 bytes,
- 'g' for 1GiB for the -b option.
-
-config STTY
- bool "stty"
- default y
- help
- stty is used to change and print terminal line settings.
-
-config SUM
- bool "sum"
- default y
- help
- checksum and count the blocks in a file
-
-config TAC
- bool "tac"
- default y
- help
- tac is used to concatenate and print files in reverse.
-
-config TAIL
- bool "tail"
- default y
- help
- tail is used to print the last specified number of lines
- from files.
-
-config FEATURE_FANCY_TAIL
- bool "Enable extra tail options (-q, -s, -v, and -F)"
- default y
- depends on TAIL
- help
- The options (-q, -s, -v and -F) are provided by GNU tail, but
- are not specific in the SUSv3 standard.
-
- -q Never output headers giving file names
- -s SEC Wait SEC seconds between reads with -f
- -v Always output headers giving file names
- -F Same as -f, but keep retrying
-
-config TEE
- bool "tee"
- default y
- help
- tee is used to read from standard input and write
- to standard output and files.
-
-config FEATURE_TEE_USE_BLOCK_IO
- bool "Enable block I/O (larger/faster) instead of byte I/O"
- default y
- depends on TEE
- help
- Enable this option for a faster tee, at expense of size.
-
-config TRUE
- bool "true"
- default y
- help
- true returns an exit code of TRUE (0).
-
-config TTY
- bool "tty"
- default y
- help
- tty is used to print the name of the current terminal to
- standard output.
-
-config UNAME
- bool "uname"
- default y
- help
- uname is used to print system information.
-
-config UNAME_OSNAME
- string "Operating system name"
- default "GNU/Linux"
- depends on UNAME
- help
- Sets the operating system name reported by uname -o. The
- default is "GNU/Linux".
-
-config UNEXPAND
- bool "unexpand"
- default y
- help
- By default, convert only leading sequences of blanks to tabs.
-
-config FEATURE_UNEXPAND_LONG_OPTIONS
- bool "Enable long options"
- default y
- depends on UNEXPAND && LONG_OPTS
- help
- Support long options for the unexpand applet.
-
-config UNIQ
- bool "uniq"
- default y
- help
- uniq is used to remove duplicate lines from a sorted file.
-
-config USLEEP
- bool "usleep"
- default y
- help
- usleep is used to pause for a specified number of microseconds.
-
-config UUDECODE
- bool "uudecode"
- default y
- help
- uudecode is used to decode a uuencoded file.
-
-config UUENCODE
- bool "uuencode"
- default y
- help
- uuencode is used to uuencode a file.
-
-config WC
- bool "wc"
- default y
- help
- wc is used to print the number of bytes, words, and lines,
- in specified files.
-
-config FEATURE_WC_LARGE
- bool "Support very large files in wc"
- default y
- depends on WC
- help
- Use "unsigned long long" in wc for counter variables.
-
-config WHOAMI
- bool "whoami"
- default y
- help
- whoami is used to print the username of the current
- user id (same as id -un).
-
-config YES
- bool "yes"
- default y
- help
- yes is used to repeatedly output a specific string, or
- the default string `y'.
-
comment "Common options"
config FEATURE_VERBOSE
diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src
index 5a64fee35..c93aa63a1 100644
--- a/coreutils/Kbuild.src
+++ b/coreutils/Kbuild.src
@@ -9,70 +9,15 @@ libs-y += libcoreutils/
lib-y:=
INSERT
-lib-$(CONFIG_CAL) += cal.o
-lib-$(CONFIG_CATV) += catv.o
-lib-$(CONFIG_CHGRP) += chgrp.o chown.o
-lib-$(CONFIG_CHMOD) += chmod.o
-lib-$(CONFIG_CHOWN) += chown.o
+
+#lib-$(CONFIG_LENGTH) += length.o
+
+lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty
+lib-$(CONFIG_LESS) += cat.o # less too
+lib-$(CONFIG_CRONTAB) += cat.o # crontab -l
lib-$(CONFIG_ADDUSER) += chown.o # used by adduser
lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser
-lib-$(CONFIG_CHROOT) += chroot.o
-lib-$(CONFIG_CKSUM) += cksum.o
-lib-$(CONFIG_COMM) += comm.o
-lib-$(CONFIG_CP) += cp.o
-lib-$(CONFIG_CUT) += cut.o
-lib-$(CONFIG_DD) += dd.o
-lib-$(CONFIG_DF) += df.o
-lib-$(CONFIG_DIRNAME) += dirname.o
-lib-$(CONFIG_DOS2UNIX) += dos2unix.o
-lib-$(CONFIG_DU) += du.o
-lib-$(CONFIG_ECHO) += echo.o
-lib-$(CONFIG_ASH) += echo.o # used by ash
-lib-$(CONFIG_HUSH) += echo.o # used by hush
-lib-$(CONFIG_ENV) += env.o
-lib-$(CONFIG_EXPR) += expr.o
-lib-$(CONFIG_EXPAND) += expand.o
-lib-$(CONFIG_FALSE) += false.o
-lib-$(CONFIG_FOLD) += fold.o
-lib-$(CONFIG_FSYNC) += fsync.o
-lib-$(CONFIG_INSTALL) += install.o
-#lib-$(CONFIG_LENGTH) += length.o
-lib-$(CONFIG_LN) += ln.o
-lib-$(CONFIG_LOGNAME) += logname.o
-lib-$(CONFIG_LS) += ls.o
-lib-$(CONFIG_FTPD) += ls.o
-lib-$(CONFIG_MKDIR) += mkdir.o
-lib-$(CONFIG_MKFIFO) += mkfifo.o
-lib-$(CONFIG_MKNOD) += mknod.o
-lib-$(CONFIG_MV) += mv.o
-lib-$(CONFIG_NICE) += nice.o
-lib-$(CONFIG_NOHUP) += nohup.o
-lib-$(CONFIG_OD) += od.o
-lib-$(CONFIG_PRINTENV) += printenv.o
-lib-$(CONFIG_PRINTF) += printf.o
+lib-$(CONFIG_ASH) += echo.o # used by ash
+lib-$(CONFIG_HUSH) += echo.o # used by hush
+lib-$(CONFIG_FTPD) += ls.o # used by ftpd
lib-$(CONFIG_ASH_BUILTIN_PRINTF) += printf.o
-lib-$(CONFIG_PWD) += pwd.o
-lib-$(CONFIG_READLINK) += readlink.o
-lib-$(CONFIG_REALPATH) += realpath.o
-lib-$(CONFIG_RM) += rm.o
-lib-$(CONFIG_RMDIR) += rmdir.o
-lib-$(CONFIG_SEQ) += seq.o
-lib-$(CONFIG_SLEEP) += sleep.o
-lib-$(CONFIG_SPLIT) += split.o
-lib-$(CONFIG_SORT) += sort.o
-lib-$(CONFIG_STAT) += stat.o
-lib-$(CONFIG_STTY) += stty.o
-lib-$(CONFIG_SUM) += sum.o
-lib-$(CONFIG_TAC) += tac.o
-lib-$(CONFIG_TEE) += tee.o
-lib-$(CONFIG_TRUE) += true.o
-lib-$(CONFIG_TTY) += tty.o
-lib-$(CONFIG_UNAME) += uname.o
-lib-$(CONFIG_UNEXPAND) += expand.o
-lib-$(CONFIG_UNIQ) += uniq.o
-lib-$(CONFIG_USLEEP) += usleep.o
-lib-$(CONFIG_UUDECODE) += uudecode.o
-lib-$(CONFIG_UUENCODE) += uuencode.o
-lib-$(CONFIG_WC) += wc.o
-lib-$(CONFIG_WHOAMI) += whoami.o
-lib-$(CONFIG_YES) += yes.o
diff --git a/coreutils/basename.c b/coreutils/basename.c
index ab0c972ed..ace0148c0 100644
--- a/coreutils/basename.c
+++ b/coreutils/basename.c
@@ -14,12 +14,6 @@
* 2) Don't check for options, as per SUSv3.
* 3) Save some space by using strcmp(). Calling strncmp() here was silly.
*/
-
-/* BB_AUDIT SUSv3 compliant */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/basename.html */
-
-//kbuild:lib-$(CONFIG_BASENAME) += basename.o
-
//config:config BASENAME
//config: bool "basename"
//config: default y
@@ -28,6 +22,13 @@
//config: leaving just the filename itself. Enable this option if you wish
//config: to enable the 'basename' utility.
+//applet:IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename))
+
+//kbuild:lib-$(CONFIG_BASENAME) += basename.o
+
+/* BB_AUDIT SUSv3 compliant */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/basename.html */
+
//usage:#define basename_trivial_usage
//usage: "FILE [SUFFIX]"
//usage:#define basename_full_usage "\n\n"
diff --git a/coreutils/cal.c b/coreutils/cal.c
index 12c46b14f..af02608f0 100644
--- a/coreutils/cal.c
+++ b/coreutils/cal.c
@@ -6,17 +6,25 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
+ *
+ * Major size reduction... over 50% (>1.5k) on i386.
+ */
+//config:config CAL
+//config: bool "cal"
+//config: default y
+//config: help
+//config: cal is used to display a monthly calendar.
+
+//applet:IF_CAL(APPLET(cal, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_CAL) += cal.o
/* BB_AUDIT SUSv3 compliant with -j and -y extensions (from util-linux). */
/* BB_AUDIT BUG: The output of 'cal -j 1752' is incorrect. The upstream
* BB_AUDIT BUG: version in util-linux seems to be broken as well. */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/cal.html */
-/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
- *
- * Major size reduction... over 50% (>1.5k) on i386.
- */
-
//usage:#define cal_trivial_usage
//usage: "[-jy] [[MONTH] YEAR]"
//usage:#define cal_full_usage "\n\n"
diff --git a/coreutils/cat.c b/coreutils/cat.c
index 00c38d486..65978887e 100644
--- a/coreutils/cat.c
+++ b/coreutils/cat.c
@@ -6,15 +6,6 @@
*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 compliant */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
-
-//kbuild:lib-$(CONFIG_CAT) += cat.o
-//kbuild:lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty
-//kbuild:lib-$(CONFIG_LESS) += cat.o # less too
-//kbuild:lib-$(CONFIG_CRONTAB) += cat.o # crontab -l
-
//config:config CAT
//config: bool "cat"
//config: default y
@@ -22,6 +13,13 @@
//config: cat is used to concatenate files and print them to the standard
//config: output. Enable this option if you wish to enable the 'cat' utility.
+//applet:IF_CAT(APPLET_NOFORK(cat, cat, BB_DIR_BIN, BB_SUID_DROP, cat))
+
+//kbuild:lib-$(CONFIG_CAT) += cat.o
+
+/* BB_AUDIT SUSv3 compliant */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
+
//usage:#define cat_trivial_usage
//usage: "[FILE]..."
//usage:#define cat_full_usage "\n\n"
diff --git a/coreutils/catv.c b/coreutils/catv.c
index 0e71368a5..1aeebe1d9 100644
--- a/coreutils/catv.c
+++ b/coreutils/catv.c
@@ -10,6 +10,17 @@
/* See "Cat -v considered harmful" at
* http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */
+//config:config CATV
+//config: bool "catv"
+//config: default y
+//config: help
+//config: Display nonprinting characters as escape sequences (like some
+//config: implementations' cat -v option).
+
+//applet:IF_CATV(APPLET(catv, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_CATV) += catv.o
+
//usage:#define catv_trivial_usage
//usage: "[-etv] [FILE]..."
//usage:#define catv_full_usage "\n\n"
diff --git a/coreutils/chgrp.c b/coreutils/chgrp.c
index 7076db62f..8dca63cf7 100644
--- a/coreutils/chgrp.c
+++ b/coreutils/chgrp.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config CHGRP
+//config: bool "chgrp"
+//config: default y
+//config: help
+//config: chgrp is used to change the group ownership of files.
+
+//applet:IF_CHGRP(APPLET_NOEXEC(chgrp, chgrp, BB_DIR_BIN, BB_SUID_DROP, chgrp))
+
+//kbuild:lib-$(CONFIG_CHGRP) += chgrp.o chown.o
/* BB_AUDIT SUSv3 defects - none? */
/* BB_AUDIT GNU defects - unsupported long options. */
diff --git a/coreutils/chmod.c b/coreutils/chmod.c
index a21c6d501..80913f542 100644
--- a/coreutils/chmod.c
+++ b/coreutils/chmod.c
@@ -9,6 +9,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config CHMOD
+//config: bool "chmod"
+//config: default y
+//config: help
+//config: chmod is used to change the access permission of files.
+
+//applet:IF_CHMOD(APPLET_NOEXEC(chmod, chmod, BB_DIR_BIN, BB_SUID_DROP, chmod))
+
+//kbuild:lib-$(CONFIG_CHMOD) += chmod.o
/* BB_AUDIT SUSv3 compliant */
/* BB_AUDIT GNU defects - unsupported long options. */
diff --git a/coreutils/chown.c b/coreutils/chown.c
index 247aa3bf1..50b06d73a 100644
--- a/coreutils/chown.c
+++ b/coreutils/chown.c
@@ -6,6 +6,23 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config CHOWN
+//config: bool "chown"
+//config: default y
+//config: help
+//config: chown is used to change the user and/or group ownership
+//config: of files.
+//config:
+//config:config FEATURE_CHOWN_LONG_OPTIONS
+//config: bool "Enable long options"
+//config: default y
+//config: depends on CHOWN && LONG_OPTS
+//config: help
+//config: Enable use of long options
+
+//applet:IF_CHOWN(APPLET_NOEXEC(chown, chown, BB_DIR_BIN, BB_SUID_DROP, chown))
+
+//kbuild:lib-$(CONFIG_CHOWN) += chown.o
/* BB_AUDIT SUSv3 defects - none? */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */
diff --git a/coreutils/chroot.c b/coreutils/chroot.c
index 633e66b38..5c067c1bd 100644
--- a/coreutils/chroot.c
+++ b/coreutils/chroot.c
@@ -6,6 +6,16 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config CHROOT
+//config: bool "chroot"
+//config: default y
+//config: help
+//config: chroot is used to change the root directory and run a command.
+//config: The default command is `/bin/sh'.
+
+//applet:IF_CHROOT(APPLET(chroot, BB_DIR_USR_SBIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_CHROOT) += chroot.o
/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
diff --git a/coreutils/cksum.c b/coreutils/cksum.c
index 8a8a39f68..aeec0188d 100644
--- a/coreutils/cksum.c
+++ b/coreutils/cksum.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config CKSUM
+//config: bool "cksum"
+//config: default y
+//config: help
+//config: cksum is used to calculate the CRC32 checksum of a file.
+
+//applet:IF_CKSUM(APPLET_NOEXEC(cksum, cksum, BB_DIR_USR_BIN, BB_SUID_DROP, cksum))
+
+//kbuild:lib-$(CONFIG_CKSUM) += cksum.o
//usage:#define cksum_trivial_usage
//usage: "FILES..."
diff --git a/coreutils/comm.c b/coreutils/comm.c
index cd450950b..b6a127809 100644
--- a/coreutils/comm.c
+++ b/coreutils/comm.c
@@ -6,6 +6,16 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config COMM
+//config: bool "comm"
+//config: default y
+//config: help
+//config: comm is used to compare two files line by line and return
+//config: a three-column output.
+
+//applet:IF_COMM(APPLET(comm, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_COMM) += comm.o
//usage:#define comm_trivial_usage
//usage: "[-123] FILE1 FILE2"
diff --git a/coreutils/cp.c b/coreutils/cp.c
index 2630c0d59..4ecdaafda 100644
--- a/coreutils/cp.c
+++ b/coreutils/cp.c
@@ -7,13 +7,29 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/cp.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Size reduction.
*/
+//config:config CP
+//config: bool "cp"
+//config: default y
+//config: help
+//config: cp is used to copy files and directories.
+//config:
+//config:config FEATURE_CP_LONG_OPTIONS
+//config: bool "Enable long options for cp"
+//config: default y
+//config: depends on CP && LONG_OPTS
+//config: help
+//config: Enable long options for cp.
+//config: Also add support for --parents option.
+
+//applet:IF_CP(APPLET_NOEXEC(cp, cp, BB_DIR_BIN, BB_SUID_DROP, cp))
+
+//kbuild:lib-$(CONFIG_CP) += cp.o
+
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/cp.html */
//usage:#define cp_trivial_usage
//usage: "[OPTIONS] SOURCE... DEST"
diff --git a/coreutils/cut.c b/coreutils/cut.c
index 84449c775..a33a825f8 100644
--- a/coreutils/cut.c
+++ b/coreutils/cut.c
@@ -8,6 +8,16 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config CUT
+//config: bool "cut"
+//config: default y
+//config: help
+//config: cut is used to print selected parts of lines from
+//config: each file to stdout.
+
+//applet:IF_CUT(APPLET_NOEXEC(cut, cut, BB_DIR_USR_BIN, BB_SUID_DROP, cut))
+
+//kbuild:lib-$(CONFIG_CUT) += cut.o
//usage:#define cut_trivial_usage
//usage: "[OPTIONS] [FILE]..."
diff --git a/coreutils/date.c b/coreutils/date.c
index ff3214d85..9d4a7dfea 100644
--- a/coreutils/date.c
+++ b/coreutils/date.c
@@ -8,8 +8,7 @@
* bugfixes and cleanup by Bernhard Reutner-Fischer
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
-*/
-
+ */
/* This 'date' command supports only 2 time setting formats,
all the GNU strftime stuff (its in libc, lets use it),
setting time using UTC and displaying it, as well as
@@ -19,10 +18,6 @@
/* Input parsing code is always bulky - used heavy duty libc stuff as
much as possible, missed out a lot of bounds checking */
-//applet:IF_DATE(APPLET(date, BB_DIR_BIN, BB_SUID_DROP))
-
-//kbuild:lib-$(CONFIG_DATE) += date.o
-
//config:config DATE
//config: bool "date"
//config: default y
@@ -63,6 +58,10 @@
//config: the same format. With it on, 'date DATE' additionally supports
//config: MMDDhhmm[[YY]YY][.ss] format.
+//applet:IF_DATE(APPLET(date, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_DATE) += date.o
+
/* GNU coreutils 6.9 man page:
* date [OPTION]... [+FORMAT]
* date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 4dc302926..3d1ba2ee6 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -2,12 +2,10 @@
/*
* Mini dd implementation for busybox
*
- *
* Copyright (C) 2000,2001 Matt Kraai
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
//config:config DD
//config: bool "dd"
//config: default y
@@ -53,6 +51,10 @@
//config: help
//config: Enables support for status=noxfer/none option.
+//applet:IF_DD(APPLET_NOEXEC(dd, dd, BB_DIR_BIN, BB_SUID_DROP, dd))
+
+//kbuild:lib-$(CONFIG_DD) += dd.o
+
//usage:#define dd_trivial_usage
//usage: "[if=FILE] [of=FILE] " IF_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n"
//usage: " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync] [iflag=skip_bytes]")
diff --git a/coreutils/df.c b/coreutils/df.c
index 06b292018..fdcdae675 100644
--- a/coreutils/df.c
+++ b/coreutils/df.c
@@ -7,10 +7,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 _NOT_ compliant -- option -t missing. */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/df.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Size reduction. Removed floating point dependency. Added error checking
@@ -21,6 +17,30 @@
*
* Implement -P and -B; better coreutils compat; cleanup
*/
+//config:config DF
+//config: bool "df"
+//config: default y
+//config: help
+//config: df reports the amount of disk space used and available
+//config: on filesystems.
+//config:
+//config:config FEATURE_DF_FANCY
+//config: bool "Enable -a, -i, -B"
+//config: default y
+//config: depends on DF
+//config: help
+//config: This option enables -a, -i and -B.
+//config:
+//config: -a Show all filesystems
+//config: -i Inodes
+//config: -B <SIZE> Blocksize
+
+//applet:IF_DF(APPLET(df, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_DF) += df.o
+
+/* BB_AUDIT SUSv3 _NOT_ compliant -- option -t missing. */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/df.html */
//usage:#define df_trivial_usage
//usage: "[-Pk"
diff --git a/coreutils/dirname.c b/coreutils/dirname.c
index 101067c90..659381886 100644
--- a/coreutils/dirname.c
+++ b/coreutils/dirname.c
@@ -6,6 +6,16 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config DIRNAME
+//config: bool "dirname"
+//config: default y
+//config: help
+//config: dirname is used to strip a non-directory suffix from
+//config: a file name.
+
+//applet:IF_DIRNAME(APPLET_NOFORK(dirname, dirname, BB_DIR_USR_BIN, BB_SUID_DROP, dirname))
+
+//kbuild:lib-$(CONFIG_DIRNAME) += dirname.o
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c
index ccb74a113..03986ad39 100644
--- a/coreutils/dos2unix.c
+++ b/coreutils/dos2unix.c
@@ -10,7 +10,27 @@
* dos2unix filters reading input from stdin and writing output to stdout.
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
-*/
+ */
+//config:config DOS2UNIX
+//config: bool "dos2unix/unix2dos"
+//config: default y
+//config: help
+//config: dos2unix is used to convert a text file from DOS format to
+//config: UNIX format, and vice versa.
+//config:
+//config:config UNIX2DOS
+//config: bool
+//config: default y
+//config: depends on DOS2UNIX
+//config: help
+//config: unix2dos is used to convert a text file from UNIX format to
+//config: DOS format, and vice versa.
+
+//applet:IF_DOS2UNIX(APPLET_NOEXEC(dos2unix, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, dos2unix))
+//applet:IF_UNIX2DOS(APPLET_NOEXEC(unix2dos, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, unix2dos))
+
+//kbuild:lib-$(CONFIG_DOS2UNIX) += dos2unix.o
+//kbuild:lib-$(CONFIG_UNIX2DOS) += dos2unix.o
//usage:#define dos2unix_trivial_usage
//usage: "[-ud] [FILE]"
diff --git a/coreutils/du.c b/coreutils/du.c
index 5f104736b..03e31a0e4 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -8,10 +8,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 compliant (unless default blocksize set to 1k) */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/du.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Mostly rewritten for SUSv3 compliance and to fix bugs/defects.
@@ -22,6 +18,26 @@
* 3) Added error checking of output.
* 4) Fixed busybox bug #1284 involving long overflow with human_readable.
*/
+//config:config DU
+//config: bool "du (default blocksize of 512 bytes)"
+//config: default y
+//config: help
+//config: du is used to report the amount of disk space used
+//config: for specified files.
+//config:
+//config:config FEATURE_DU_DEFAULT_BLOCKSIZE_1K
+//config: bool "Use a default blocksize of 1024 bytes (1K)"
+//config: default y
+//config: depends on DU
+//config: help
+//config: Use a blocksize of (1K) instead of the default 512b.
+
+//applet:IF_DU(APPLET(du, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_DU) += du.o
+
+/* BB_AUDIT SUSv3 compliant (unless default blocksize set to 1k) */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/du.html */
//usage:#define du_trivial_usage
//usage: "[-aHLdclsx" IF_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..."
diff --git a/coreutils/echo.c b/coreutils/echo.c
index 1c4174559..fd0d9b780 100644
--- a/coreutils/echo.c
+++ b/coreutils/echo.c
@@ -9,10 +9,6 @@
*
* Original copyright notice is retained at the end of this file.
*/
-
-/* BB_AUDIT SUSv3 compliant -- unless configured as fancy echo. */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/echo.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Because of behavioral differences, implemented configurable SUSv3
@@ -22,6 +18,26 @@
* 2) SUSv3 specifies that octal escapes are of the form \0{#{#{#}}}.
* The previous version did not allow 4-digit octals.
*/
+//config:config ECHO
+//config: bool "echo (basic SuSv3 version taking no options)"
+//config: default y
+//config: help
+//config: echo is used to print a specified string to stdout.
+//config:
+//config:# this entry also appears in shell/Config.in, next to the echo builtin
+//config:config FEATURE_FANCY_ECHO
+//config: bool "Enable echo options (-n and -e)"
+//config: default y
+//config: depends on ECHO || ASH_BUILTIN_ECHO || HUSH
+//config: help
+//config: This adds options (-n and -e) to echo.
+
+//applet:IF_ECHO(APPLET_NOFORK(echo, echo, BB_DIR_BIN, BB_SUID_DROP, echo))
+
+//kbuild:lib-$(CONFIG_ECHO) += echo.o
+
+/* BB_AUDIT SUSv3 compliant -- unless configured as fancy echo. */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/echo.html */
//usage:#define echo_trivial_usage
//usage: IF_FEATURE_FANCY_ECHO("[-neE] ") "[ARG]..."
diff --git a/coreutils/env.c b/coreutils/env.c
index cdfc30e14..e91eddb5c 100644
--- a/coreutils/env.c
+++ b/coreutils/env.c
@@ -11,16 +11,11 @@
*
* Modified for BusyBox by Erik Andersen <andersen@codepoet.org>
*/
-
-/* BB_AUDIT SUSv3 compliant */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/env.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Fixed bug involving exit return codes if execvp fails. Also added
* output error checking.
*/
-
/*
* Modified by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003
* - correct "-" option usage
@@ -28,8 +23,27 @@
* - GNU long option support
* - use xfunc_error_retval
*/
+//config:config ENV
+//config: bool "env"
+//config: default y
+//config: help
+//config: env is used to set an environment variable and run
+//config: a command; without options it displays the current
+//config: environment.
+//config:
+//config:config FEATURE_ENV_LONG_OPTIONS
+//config: bool "Enable long options"
+//config: default y
+//config: depends on ENV && LONG_OPTS
+//config: help
+//config: Support long options for the env applet.
-/* This is a NOEXEC applet. Be very careful! */
+//applet:IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env))
+
+//kbuild:lib-$(CONFIG_ENV) += env.o
+
+/* BB_AUDIT SUSv3 compliant */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/env.html */
//usage:#define env_trivial_usage
//usage: "[-iu] [-] [name=value]... [PROG ARGS]"
diff --git a/coreutils/expand.c b/coreutils/expand.c
index 8d376ff4e..bb59af46d 100644
--- a/coreutils/expand.c
+++ b/coreutils/expand.c
@@ -20,6 +20,37 @@
*
* Caveat: this versions of expand and unexpand don't accept tab lists.
*/
+//config:config EXPAND
+//config: bool "expand"
+//config: default y
+//config: help
+//config: By default, convert all tabs to spaces.
+//config:
+//config:config FEATURE_EXPAND_LONG_OPTIONS
+//config: bool "Enable long options"
+//config: default y
+//config: depends on EXPAND && LONG_OPTS
+//config: help
+//config: Support long options for the expand applet.
+//config:
+//config:config UNEXPAND
+//config: bool "unexpand"
+//config: default y
+//config: help
+//config: By default, convert only leading sequences of blanks to tabs.
+//config:
+//config:config FEATURE_UNEXPAND_LONG_OPTIONS
+//config: bool "Enable long options"
+//config: default y
+//config: depends on UNEXPAND && LONG_OPTS
+//config: help
+//config: Support long options for the unexpand applet.
+
+//applet:IF_EXPAND(APPLET(expand, BB_DIR_USR_BIN, BB_SUID_DROP))
+//applet:IF_UNEXPAND(APPLET_ODDNAME(unexpand, expand, BB_DIR_USR_BIN, BB_SUID_DROP, unexpand))
+
+//kbuild:lib-$(CONFIG_EXPAND) += expand.o
+//kbuild:lib-$(CONFIG_UNEXPAND) += expand.o
//usage:#define expand_trivial_usage
//usage: "[-i] [-t N] [FILE]..."
diff --git a/coreutils/expr.c b/coreutils/expr.c
index efc435443..5d2fbf2f7 100644
--- a/coreutils/expr.c
+++ b/coreutils/expr.c
@@ -13,7 +13,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
/* This program evaluates expressions. Each token (operator, operand,
* parenthesis) of the expression must be a separate argument. The
* parser used is a reasonably general one, though any incarnation of
@@ -21,9 +20,27 @@
*
* No parse tree is needed; a new node is evaluated immediately.
* One function can handle multiple operators all of equal precedence,
- * provided they all associate ((x op x) op x). */
-
-/* no getopt needed */
+ * provided they all associate ((x op x) op x).
+ */
+//config:config EXPR
+//config: bool "expr"
+//config: default y
+//config: help
+//config: expr is used to calculate numbers and print the result
+//config: to standard output.
+//config:
+//config:config EXPR_MATH_SUPPORT_64
+//config: bool "Extend Posix numbers support to 64 bit"
+//config: default y
+//config: depends on EXPR
+//config: help
+//config: Enable 64-bit math support in the expr applet. This will make
+//config: the applet slightly larger, but will allow computation with very
+//config: large numbers.
+
+//applet:IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_EXPR) += expr.o
//usage:#define expr_trivial_usage
//usage: "EXPRESSION"
diff --git a/coreutils/false.c b/coreutils/false.c
index 0591a6cdc..b8f17c6a6 100644
--- a/coreutils/false.c
+++ b/coreutils/false.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config FALSE
+//config: bool "false"
+//config: default y
+//config: help
+//config: false returns an exit code of FALSE (1).
+
+//applet:IF_FALSE(APPLET_NOFORK(false, false, BB_DIR_BIN, BB_SUID_DROP, false))
+
+//kbuild:lib-$(CONFIG_FALSE) += false.o
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/000095399/utilities/false.html */
diff --git a/coreutils/fold.c b/coreutils/fold.c
index 0e7306377..01f9bce74 100644
--- a/coreutils/fold.c
+++ b/coreutils/fold.c
@@ -9,6 +9,15 @@
Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config FOLD
+//config: bool "fold"
+//config: default y
+//config: help
+//config: Wrap text to fit a specific width.
+
+//applet:IF_FOLD(APPLET_NOEXEC(fold, fold, BB_DIR_USR_BIN, BB_SUID_DROP, fold))
+
+//kbuild:lib-$(CONFIG_FOLD) += fold.o
//usage:#define fold_trivial_usage
//usage: "[-bs] [-w WIDTH] [FILE]..."
diff --git a/coreutils/fsync.c b/coreutils/fsync.c
index 652a41c33..596a2bcaf 100644
--- a/coreutils/fsync.c
+++ b/coreutils/fsync.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config FSYNC
+//config: bool "fsync"
+//config: default y
+//config: help
+//config: fsync is used to flush file-related cached blocks to disk.
+
+//applet:IF_FSYNC(APPLET_NOFORK(fsync, fsync, BB_DIR_BIN, BB_SUID_DROP, fsync))
+
+//kbuild:lib-$(CONFIG_FSYNC) += fsync.o
//usage:#define fsync_trivial_usage
//usage: "[-d] FILE..."
diff --git a/coreutils/head.c b/coreutils/head.c
index 9388b026a..176e91e3a 100644
--- a/coreutils/head.c
+++ b/coreutils/head.c
@@ -6,13 +6,28 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config HEAD
+//config: bool "head"
+//config: default y
+//config: help
+//config: head is used to print the first specified number of lines
+//config: from files.
+//config:
+//config:config FEATURE_FANCY_HEAD
+//config: bool "Enable head options (-c, -q, and -v)"
+//config: default y
+//config: depends on HEAD
+//config: help
+//config: This enables the head options (-c, -q, and -v).
+
+//applet:IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head))
+
+//kbuild:lib-$(CONFIG_HEAD) += head.o
/* BB_AUDIT SUSv3 compliant */
/* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */
-//kbuild:lib-$(CONFIG_HEAD) += head.o
-
//usage:#define head_trivial_usage
//usage: "[OPTIONS] [FILE]..."
//usage:#define head_full_usage "\n\n"
diff --git a/coreutils/hostid.c b/coreutils/hostid.c
index e5b1f5188..5b47de1bc 100644
--- a/coreutils/hostid.c
+++ b/coreutils/hostid.c
@@ -6,9 +6,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
-
//config:config HOSTID
//config: bool "hostid"
//config: default y
@@ -20,6 +17,8 @@
//kbuild:lib-$(CONFIG_HOSTID) += hostid.o
+/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
+
//usage:#define hostid_trivial_usage
//usage: ""
//usage:#define hostid_full_usage "\n\n"
diff --git a/coreutils/id.c b/coreutils/id.c
index 1f3e1c4c2..ab7ac1e55 100644
--- a/coreutils/id.c
+++ b/coreutils/id.c
@@ -7,31 +7,30 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 compliant. */
/* Hacked by Tito Ragusa (C) 2004 to handle usernames of whatever
* length and to be more similar to GNU id.
* -Z option support: by Yuichi Nakamura <ynakam@hitachisoft.jp>
* Added -G option Tito Ragusa (C) 2008 for SUSv3.
*/
-
//config:config ID
//config: bool "id"
//config: default y
//config: help
//config: id displays the current user and group ID names.
-
+//config:
//config:config GROUPS
//config: bool "groups"
//config: default y
//config: help
//config: Print the group names associated with current user id.
+//applet:IF_GROUPS(APPLET_NOEXEC(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups))
+//applet:IF_ID( APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id ))
+
//kbuild:lib-$(CONFIG_GROUPS) += id.o
//kbuild:lib-$(CONFIG_ID) += id.o
-//applet:IF_GROUPS(APPLET_NOEXEC(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups))
-//applet:IF_ID( APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id ))
+/* BB_AUDIT SUSv3 compliant. */
//usage:#define id_trivial_usage
//usage: "[OPTIONS] [USER]"
diff --git a/coreutils/install.c b/coreutils/install.c
index 8aa51cc34..e68589229 100644
--- a/coreutils/install.c
+++ b/coreutils/install.c
@@ -5,6 +5,22 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config INSTALL
+//config: bool "install"
+//config: default y
+//config: help
+//config: Copy files and set attributes.
+//config:
+//config:config FEATURE_INSTALL_LONG_OPTIONS
+//config: bool "Enable long options"
+//config: default y
+//config: depends on INSTALL && LONG_OPTS
+//config: help
+//config: Support long options for the install applet.
+
+//applet:IF_INSTALL(APPLET(install, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_INSTALL) += install.o
/* -v, -b, -c are ignored */
//usage:#define install_trivial_usage
diff --git a/coreutils/ln.c b/coreutils/ln.c
index 168814801..0e2abace4 100644
--- a/coreutils/ln.c
+++ b/coreutils/ln.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config LN
+//config: bool "ln"
+//config: default y
+//config: help
+//config: ln is used to create hard or soft links between files.
+
+//applet:IF_LN(APPLET_NOEXEC(ln, ln, BB_DIR_BIN, BB_SUID_DROP, ln))
+
+//kbuild:lib-$(CONFIG_LN) += ln.o
/* BB_AUDIT SUSv3 compliant */
/* BB_AUDIT GNU options missing: -d, -F, -i, and -v. */
diff --git a/coreutils/logname.c b/coreutils/logname.c
index 10b9615a1..a9b1c956d 100644
--- a/coreutils/logname.c
+++ b/coreutils/logname.c
@@ -6,10 +6,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 compliant */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/logname.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* SUSv3 specifies the string used is that returned from getlogin().
@@ -19,6 +15,18 @@
* correct course of action wrt SUSv3 for a failing getlogin() is
* a diagnostic message and an error return.
*/
+//config:config LOGNAME
+//config: bool "logname"
+//config: default y
+//config: help
+//config: logname is used to print the current user's login name.
+
+//applet:IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname))
+
+//kbuild:lib-$(CONFIG_LOGNAME) += logname.o
+
+/* BB_AUDIT SUSv3 compliant */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/logname.html */
//usage:#define logname_trivial_usage
//usage: ""
diff --git a/coreutils/ls.c b/coreutils/ls.c
index 344b4e61e..0f35c70d5 100644
--- a/coreutils/ls.c
+++ b/coreutils/ls.c
@@ -4,7 +4,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
/* [date unknown. Perhaps before year 2000]
* To achieve a small memory footprint, this version of 'ls' doesn't do any
* file sorting, and only has the most essential command line switches
@@ -28,6 +27,75 @@
* [2009-03]
* ls sorts listing now, and supports almost all options.
*/
+//config:config LS
+//config: bool "ls"
+//config: default y
+//config: help
+//config: ls is used to list the contents of directories.
+//config:
+//config:config FEATURE_LS_FILETYPES
+//config: bool "Enable filetyping options (-p and -F)"
+//config: default y
+//config: depends on LS
+//config: help
+//config: Enable the ls options (-p and -F).
+//config:
+//config:config FEATURE_LS_FOLLOWLINKS
+//config: bool "Enable symlinks dereferencing (-L)"
+//config: default y
+//config: depends on LS
+//config: help
+//config: Enable the ls option (-L).
+//config:
+//config:config FEATURE_LS_RECURSIVE
+//config: bool "Enable recursion (-R)"
+//config: default y
+//config: depends on LS
+//config: help
+//config: Enable the ls option (-R).
+//config:
+//config:config FEATURE_LS_SORTFILES
+//config: bool "Sort the file names"
+//config: default y
+//config: depends on LS
+//config: help
+//config: Allow ls to sort file names alphabetically.
+//config:
+//config:config FEATURE_LS_TIMESTAMPS
+//config: bool "Show file timestamps"
+//config: default y
+//config: depends on LS
+//config: help
+//config: Allow ls to display timestamps for files.
+//config:
+//config:config FEATURE_LS_USERNAME
+//config: bool "Show username/groupnames"
+//config: default y
+//config: depends on LS
+//config: help
+//config: Allow ls to display username/groupname for files.
+//config:
+//config:config FEATURE_LS_COLOR
+//config: bool "Allow use of color to identify file types"
+//config: default y
+//config: depends on LS && LONG_OPTS
+//config: help
+//config: This enables the --color option to ls.
+//config:
+//config:config FEATURE_LS_COLOR_IS_DEFAULT
+//config: bool "Produce colored ls output by default"
+//config: default y
+//config: depends on FEATURE_LS_COLOR
+//config: help
+//config: Saying yes here will turn coloring on by default,
+//config: even if no "--color" option is given to the ls command.
+//config: This is not recommended, since the colors are not
+//config: configurable, and the output may not be legible on
+//config: many output screens.
+
+//applet:IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls))
+
+//kbuild:lib-$(CONFIG_LS) += ls.o
//usage:#define ls_trivial_usage
//usage: "[-1AaCxd"
diff --git a/coreutils/mkdir.c b/coreutils/mkdir.c
index 6f7b004dd..3afe76c28 100644
--- a/coreutils/mkdir.c
+++ b/coreutils/mkdir.c
@@ -6,18 +6,32 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 compliant */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkdir.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Fixed broken permission setting when -p was used; especially in
* conjunction with -m.
*/
-
/* Nov 28, 2006 Yoshinori Sato <ysato@users.sourceforge.jp>: Add SELinux Support.
*/
+//config:config MKDIR
+//config: bool "mkdir"
+//config: default y
+//config: help
+//config: mkdir is used to create directories with the specified names.
+//config:
+//config:config FEATURE_MKDIR_LONG_OPTIONS
+//config: bool "Enable long options"
+//config: default y
+//config: depends on MKDIR && LONG_OPTS
+//config: help
+//config: Support long options for the mkdir applet.
+
+//applet:IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir))
+
+//kbuild:lib-$(CONFIG_MKDIR) += mkdir.o
+
+/* BB_AUDIT SUSv3 compliant */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkdir.html */
//usage:#define mkdir_trivial_usage
//usage: "[OPTIONS] DIRECTORY..."
diff --git a/coreutils/mkfifo.c b/coreutils/mkfifo.c
index ef58325b3..66509a9c0 100644
--- a/coreutils/mkfifo.c
+++ b/coreutils/mkfifo.c
@@ -6,6 +6,16 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config MKFIFO
+//config: bool "mkfifo"
+//config: default y
+//config: help
+//config: mkfifo is used to create FIFOs (named pipes).
+//config: The 'mknod' program can also create FIFOs.
+
+//applet:IF_MKFIFO(APPLET_NOEXEC(mkfifo, mkfifo, BB_DIR_USR_BIN, BB_SUID_DROP, mkfifo))
+
+//kbuild:lib-$(CONFIG_MKFIFO) += mkfifo.o
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkfifo.html */
diff --git a/coreutils/mknod.c b/coreutils/mknod.c
index aa0450481..466ef5c06 100644
--- a/coreutils/mknod.c
+++ b/coreutils/mknod.c
@@ -6,6 +6,16 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config MKNOD
+//config: bool "mknod"
+//config: default y
+//config: help
+//config: mknod is used to create FIFOs or block/character special
+//config: files with the specified names.
+
+//applet:IF_MKNOD(APPLET_NOEXEC(mknod, mknod, BB_DIR_BIN, BB_SUID_DROP, mknod))
+
+//kbuild:lib-$(CONFIG_MKNOD) += mknod.o
/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
diff --git a/coreutils/mv.c b/coreutils/mv.c
index 50571755b..1cc318fd1 100644
--- a/coreutils/mv.c
+++ b/coreutils/mv.c
@@ -7,14 +7,26 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Size reduction and improved error checking.
*/
-
-#include "libbb.h"
-#include "libcoreutils/coreutils.h"
+//config:config MV
+//config: bool "mv"
+//config: default y
+//config: help
+//config: mv is used to move or rename files or directories.
+//config:
+//config:config FEATURE_MV_LONG_OPTIONS
+//config: bool "Enable long options"
+//config: default y
+//config: depends on MV && LONG_OPTS
+//config: help
+//config: Support long options for the mv applet.
+
+//applet:IF_MV(APPLET(mv, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_MV) += mv.o
//usage:#define mv_trivial_usage
//usage: "[-fin] SOURCE DEST\n"
@@ -28,6 +40,9 @@
//usage:#define mv_example_usage
//usage: "$ mv /tmp/foo /bin/bar\n"
+#include "libbb.h"
+#include "libcoreutils/coreutils.h"
+
#if ENABLE_FEATURE_MV_LONG_OPTIONS
static const char mv_longopts[] ALIGN1 =
"interactive\0" No_argument "i"
diff --git a/coreutils/nice.c b/coreutils/nice.c
index ce759916f..3676ee663 100644
--- a/coreutils/nice.c
+++ b/coreutils/nice.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config NICE
+//config: bool "nice"
+//config: default y
+//config: help
+//config: nice runs a program with modified scheduling priority.
+
+//applet:IF_NICE(APPLET(nice, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_NICE) += nice.o
//usage:#define nice_trivial_usage
//usage: "[-n ADJUST] [PROG ARGS]"
diff --git a/coreutils/nohup.c b/coreutils/nohup.c
index 63853fd55..d8489686d 100644
--- a/coreutils/nohup.c
+++ b/coreutils/nohup.c
@@ -9,6 +9,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config NOHUP
+//config: bool "nohup"
+//config: default y
+//config: help
+//config: run a command immune to hangups, with output to a non-tty.
+
+//applet:IF_NOHUP(APPLET(nohup, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_NOHUP) += nohup.o
//usage:#define nohup_trivial_usage
//usage: "PROG ARGS"
diff --git a/coreutils/od.c b/coreutils/od.c
index fb11fcfe3..4b05ee77c 100644
--- a/coreutils/od.c
+++ b/coreutils/od.c
@@ -10,6 +10,15 @@
*
* Original copyright notice is retained at the end of this file.
*/
+//config:config OD
+//config: bool "od"
+//config: default y
+//config: help
+//config: od is used to dump binary files in octal and other formats.
+
+//applet:IF_OD(APPLET(od, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_OD) += od.o
//usage:#if !ENABLE_DESKTOP
//usage:#define od_trivial_usage
diff --git a/coreutils/printenv.c b/coreutils/printenv.c
index bd5db7073..fbd64945d 100644
--- a/coreutils/printenv.c
+++ b/coreutils/printenv.c
@@ -7,6 +7,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config PRINTENV
+//config: bool "printenv"
+//config: default y
+//config: help
+//config: printenv is used to print all or part of environment.
+
+//applet:IF_PRINTENV(APPLET_NOFORK(printenv, printenv, BB_DIR_BIN, BB_SUID_DROP, printenv))
+
+//kbuild:lib-$(CONFIG_PRINTENV) += printenv.o
//usage:#define printenv_trivial_usage
//usage: "[VARIABLE]..."
diff --git a/coreutils/printf.c b/coreutils/printf.c
index 9ee7350d0..6c8e115d8 100644
--- a/coreutils/printf.c
+++ b/coreutils/printf.c
@@ -38,6 +38,17 @@
/* 19990508 Busy Boxed! Dave Cinege */
+//config:config PRINTF
+//config: bool "printf"
+//config: default y
+//config: help
+//config: printf is used to format and print specified strings.
+//config: It's similar to `echo' except it has more options.
+
+//applet:IF_PRINTF(APPLET_NOFORK(printf, printf, BB_DIR_USR_BIN, BB_SUID_DROP, printf))
+
+//kbuild:lib-$(CONFIG_PRINTF) += printf.o
+
//usage:#define printf_trivial_usage
//usage: "FORMAT [ARG]..."
//usage:#define printf_full_usage "\n\n"
diff --git a/coreutils/pwd.c b/coreutils/pwd.c
index bb3ad04fc..05dee497b 100644
--- a/coreutils/pwd.c
+++ b/coreutils/pwd.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config PWD
+//config: bool "pwd"
+//config: default y
+//config: help
+//config: pwd is used to print the current directory.
+
+//applet:IF_PWD(APPLET_NOFORK(pwd, pwd, BB_DIR_BIN, BB_SUID_DROP, pwd))
+
+//kbuild:lib-$(CONFIG_PWD) += pwd.o
//usage:#define pwd_trivial_usage
//usage: ""
@@ -18,8 +27,6 @@
#include "libbb.h"
-/* This is a NOFORK applet. Be very careful! */
-
static int logical_getcwd(void)
{
struct stat st1;
diff --git a/coreutils/readlink.c b/coreutils/readlink.c
index d73ef4ddb..1b223b3c5 100644
--- a/coreutils/readlink.c
+++ b/coreutils/readlink.c
@@ -6,6 +6,23 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config READLINK
+//config: bool "readlink"
+//config: default y
+//config: help
+//config: This program reads a symbolic link and returns the name
+//config: of the file it points to
+//config:
+//config:config FEATURE_READLINK_FOLLOW
+//config: bool "Enable canonicalization by following all symlinks (-f)"
+//config: default y
+//config: depends on READLINK
+//config: help
+//config: Enable the readlink option (-f).
+
+//applet:IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_READLINK) += readlink.o
//usage:#define readlink_trivial_usage
//usage: IF_FEATURE_READLINK_FOLLOW("[-fnv] ") "FILE"
diff --git a/coreutils/realpath.c b/coreutils/realpath.c
index c513b5549..0c2d544e4 100644
--- a/coreutils/realpath.c
+++ b/coreutils/realpath.c
@@ -1,7 +1,4 @@
/* vi: set sw=4 ts=4: */
-
-/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Now does proper error checking on output and returns a failure exit code
@@ -9,6 +6,18 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config REALPATH
+//config: bool "realpath"
+//config: default y
+//config: help
+//config: Return the canonicalized absolute pathname.
+//config: This isn't provided by GNU shellutils, but where else does it belong.
+
+//applet:IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_REALPATH) += realpath.o
+
+/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
//usage:#define realpath_trivial_usage
//usage: "FILE..."
diff --git a/coreutils/rm.c b/coreutils/rm.c
index d0ad81dfc..cec34cb9d 100644
--- a/coreutils/rm.c
+++ b/coreutils/rm.c
@@ -6,14 +6,22 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 compliant */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/rm.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Size reduction.
*/
+//config:config RM
+//config: bool "rm"
+//config: default y
+//config: help
+//config: rm is used to remove files or directories.
+
+//applet:IF_RM(APPLET_NOFORK(rm, rm, BB_DIR_BIN, BB_SUID_DROP, rm))
+
+//kbuild:lib-$(CONFIG_RM) += rm.o
+
+/* BB_AUDIT SUSv3 compliant */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/rm.html */
//usage:#define rm_trivial_usage
//usage: "[-irf] FILE..."
diff --git a/coreutils/rmdir.c b/coreutils/rmdir.c
index 0792a1c8e..8979941ce 100644
--- a/coreutils/rmdir.c
+++ b/coreutils/rmdir.c
@@ -6,6 +6,23 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config RMDIR
+//config: bool "rmdir"
+//config: default y
+//config: help
+//config: rmdir is used to remove empty directories.
+//config:
+//config:config FEATURE_RMDIR_LONG_OPTIONS
+//config: bool "Enable long options"
+//config: default y
+//config: depends on RMDIR && LONG_OPTS
+//config: help
+//config: Support long options for the rmdir applet, including
+//config: --ignore-fail-on-non-empty for compatibility with GNU rmdir.
+
+//applet:IF_RMDIR(APPLET_NOFORK(rmdir, rmdir, BB_DIR_BIN, BB_SUID_DROP, rmdir))
+
+//kbuild:lib-$(CONFIG_RMDIR) += rmdir.o
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/rmdir.html */
diff --git a/coreutils/seq.c b/coreutils/seq.c
index 898619293..ed4946b05 100644
--- a/coreutils/seq.c
+++ b/coreutils/seq.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2, see file LICENSE in this source tree.
*/
+//config:config SEQ
+//config: bool "seq"
+//config: default y
+//config: help
+//config: print a sequence of numbers
+
+//applet:IF_SEQ(APPLET_NOFORK(seq, seq, BB_DIR_USR_BIN, BB_SUID_DROP, seq))
+
+//kbuild:lib-$(CONFIG_SEQ) += seq.o
//usage:#define seq_trivial_usage
//usage: "[-w] [-s SEP] [FIRST [INC]] LAST"
diff --git a/coreutils/sleep.c b/coreutils/sleep.c
index 0ffbd16eb..ad2d6b526 100644
--- a/coreutils/sleep.c
+++ b/coreutils/sleep.c
@@ -6,17 +6,48 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 compliant */
-/* BB_AUDIT GNU issues -- fancy version matches except args must be ints. */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/sleep.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Rewritten to do proper arg and error checking.
* Also, added a 'fancy' configuration to accept multiple args with
* time suffixes for seconds, minutes, hours, and days.
*/
+//config:config SLEEP
+//config: bool "sleep"
+//config: default y
+//config: help
+//config: sleep is used to pause for a specified number of seconds.
+//config: It comes in 3 versions:
+//config: - small: takes one integer parameter
+//config: - fancy: takes multiple integer arguments with suffixes:
+//config: sleep 1d 2h 3m 15s
+//config: - fancy with fractional numbers:
+//config: sleep 2.3s 4.5h sleeps for 16202.3 seconds
+//config: Last one is "the most compatible" with coreutils sleep,
+//config: but it adds around 1k of code.
+//config:
+//config:config FEATURE_FANCY_SLEEP
+//config: bool "Enable multiple arguments and s/m/h/d suffixes"
+//config: default y
+//config: depends on SLEEP
+//config: help
+//config: Allow sleep to pause for specified minutes, hours, and days.
+//config:
+//config:config FEATURE_FLOAT_SLEEP
+//config: bool "Enable fractional arguments"
+//config: default y
+//config: depends on FEATURE_FANCY_SLEEP
+//config: help
+//config: Allow for fractional numeric parameters.
+
+/* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells */
+//applet:IF_SLEEP(APPLET(sleep, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_SLEEP) += sleep.o
+
+/* BB_AUDIT SUSv3 compliant */
+/* BB_AUDIT GNU issues -- fancy version matches except args must be ints. */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/sleep.html */
//usage:#define sleep_trivial_usage
//usage: IF_FEATURE_FANCY_SLEEP("[") "N" IF_FEATURE_FANCY_SLEEP("]...")
@@ -35,9 +66,6 @@
#include "libbb.h"
-/* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells */
-
-
#if ENABLE_FEATURE_FANCY_SLEEP || ENABLE_FEATURE_FLOAT_SLEEP
static const struct suffix_mult sfx[] = {
{ "s", 1 },
diff --git a/coreutils/sort.c b/coreutils/sort.c
index 34a41999b..1ccce93c5 100644
--- a/coreutils/sort.c
+++ b/coreutils/sort.c
@@ -11,6 +11,27 @@
* See SuS3 sort standard at:
* http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
*/
+//config:config SORT
+//config: bool "sort"
+//config: default y
+//config: help
+//config: sort is used to sort lines of text in specified files.
+//config:
+//config:config FEATURE_SORT_BIG
+//config: bool "Full SuSv3 compliant sort (support -ktcsbdfiozgM)"
+//config: default y
+//config: depends on SORT
+//config: help
+//config: Without this, sort only supports -r, -u, and an integer version
+//config: of -n. Selecting this adds sort keys, floating point support, and
+//config: more. This adds a little over 3k to a nonstatic build on x86.
+//config:
+//config: The SuSv3 sort standard is available at:
+//config: http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
+
+//applet:IF_SORT(APPLET_NOEXEC(sort, sort, BB_DIR_USR_BIN, BB_SUID_DROP, sort))
+
+//kbuild:lib-$(CONFIG_SORT) += sort.o
//usage:#define sort_trivial_usage
//usage: "[-nru"
diff --git a/coreutils/split.c b/coreutils/split.c
index 19d58a21b..50918a1ce 100644
--- a/coreutils/split.c
+++ b/coreutils/split.c
@@ -5,6 +5,25 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config SPLIT
+//config: bool "split"
+//config: default y
+//config: help
+//config: split a file into pieces.
+//config:
+//config:config FEATURE_SPLIT_FANCY
+//config: bool "Fancy extensions"
+//config: default y
+//config: depends on SPLIT
+//config: help
+//config: Add support for features not required by SUSv3.
+//config: Supports additional suffixes 'b' for 512 bytes,
+//config: 'g' for 1GiB for the -b option.
+
+//applet:IF_SPLIT(APPLET(split, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_SPLIT) += split.o
+
/* BB_AUDIT: SUSv3 compliant
* SUSv3 requirements:
* http://www.opengroup.org/onlinepubs/009695399/utilities/split.html
diff --git a/coreutils/stat.c b/coreutils/stat.c
index ddcfcf2d7..b918ec62e 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -36,6 +36,9 @@
//config: Without this, stat will not support the '-f' option to display
//config: information about filesystem status.
+//applet:IF_STAT(APPLET(stat, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_STAT) += stat.o
//usage:#define stat_trivial_usage
//usage: "[OPTIONS] FILE..."
diff --git a/coreutils/stty.c b/coreutils/stty.c
index 52967ea8f..e818d579c 100644
--- a/coreutils/stty.c
+++ b/coreutils/stty.c
@@ -18,8 +18,16 @@
David MacKenzie <djm@gnu.ai.mit.edu>
Special for busybox ported by Vladimir Oleynik <dzo@simtreas.ru> 2001
+*/
+//config:config STTY
+//config: bool "stty"
+//config: default y
+//config: help
+//config: stty is used to change and print terminal line settings.
+
+//applet:IF_STTY(APPLET(stty, BB_DIR_BIN, BB_SUID_DROP))
- */
+//kbuild:lib-$(CONFIG_STTY) += stty.o
//usage:#define stty_trivial_usage
//usage: "[-a|g] [-F DEVICE] [SETTING]..."
diff --git a/coreutils/sum.c b/coreutils/sum.c
index ec9ed2a11..c55293dc9 100644
--- a/coreutils/sum.c
+++ b/coreutils/sum.c
@@ -12,6 +12,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config SUM
+//config: bool "sum"
+//config: default y
+//config: help
+//config: checksum and count the blocks in a file
+
+//applet:IF_SUM(APPLET(sum, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_SUM) += sum.o
//usage:#define sum_trivial_usage
//usage: "[-rs] [FILE]..."
diff --git a/coreutils/sync.c b/coreutils/sync.c
index e65d9cd8d..5e189f6f4 100644
--- a/coreutils/sync.c
+++ b/coreutils/sync.c
@@ -7,8 +7,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
//config:config SYNC
//config: bool "sync"
//config: default y
@@ -22,9 +20,12 @@
//config: sync -d FILE... executes fdatasync() on each FILE.
//config: sync -f FILE... executes syncfs() on each FILE.
-//kbuild:lib-$(CONFIG_SYNC) += sync.o
//applet:IF_SYNC(APPLET_NOFORK(sync, sync, BB_DIR_BIN, BB_SUID_DROP, sync))
+//kbuild:lib-$(CONFIG_SYNC) += sync.o
+
+/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
+
//usage:#define sync_trivial_usage
//usage: ""IF_FEATURE_SYNC_FANCY("[-df] [FILE]...")
//usage:#define sync_full_usage "\n\n"
diff --git a/coreutils/tac.c b/coreutils/tac.c
index 94d669de1..ca5617c83 100644
--- a/coreutils/tac.c
+++ b/coreutils/tac.c
@@ -1,20 +1,26 @@
/* vi: set sw=4 ts=4: */
/*
* tac implementation for busybox
+ * tac - concatenate and print files in reverse
*
* Copyright (C) 2003 Yang Xiaopeng <yxp at hanwang.com.cn>
* Copyright (C) 2007 Natanael Copa <natanael.copa@gmail.com>
* Copyright (C) 2007 Tito Ragusa <farmatito@tiscali.it>
*
* Licensed under GPLv2, see file LICENSE in this source tree.
- *
*/
-
-/* tac - concatenate and print files in reverse */
-
/* Based on Yang Xiaopeng's (yxp at hanwang.com.cn) patch
* http://www.uclibc.org/lists/busybox/2003-July/008813.html
*/
+//config:config TAC
+//config: bool "tac"
+//config: default y
+//config: help
+//config: tac is used to concatenate and print files in reverse.
+
+//applet:IF_TAC(APPLET_NOEXEC(tac, tac, BB_DIR_USR_BIN, BB_SUID_DROP, tac))
+
+//kbuild:lib-$(CONFIG_TAC) += tac.o
//usage:#define tac_trivial_usage
//usage: "[FILE]..."
diff --git a/coreutils/tail.c b/coreutils/tail.c
index 57ad0f3b7..99f58ddd8 100644
--- a/coreutils/tail.c
+++ b/coreutils/tail.c
@@ -6,11 +6,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 compliant (need fancy for -c) */
-/* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/tail.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Pretty much rewritten to fix numerous bugs and reduce realloc() calls.
@@ -23,9 +18,34 @@
* 6) no check for lseek error
* 7) lseek attempted when count==0 even if arg was +0 (from top)
*/
+//config:config TAIL
+//config: bool "tail"
+//config: default y
+//config: help
+//config: tail is used to print the last specified number of lines
+//config: from files.
+//config:
+//config:config FEATURE_FANCY_TAIL
+//config: bool "Enable extra tail options (-q, -s, -v, and -F)"
+//config: default y
+//config: depends on TAIL
+//config: help
+//config: The options (-q, -s, -v and -F) are provided by GNU tail, but
+//config: are not specific in the SUSv3 standard.
+//config:
+//config: -q Never output headers giving file names
+//config: -s SEC Wait SEC seconds between reads with -f
+//config: -v Always output headers giving file names
+//config: -F Same as -f, but keep retrying
+
+//applet:IF_TAIL(APPLET(tail, BB_DIR_USR_BIN, BB_SUID_DROP))
//kbuild:lib-$(CONFIG_TAIL) += tail.o
+/* BB_AUDIT SUSv3 compliant (need fancy for -c) */
+/* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/tail.html */
+
//usage:#define tail_trivial_usage
//usage: "[OPTIONS] [FILE]..."
//usage:#define tail_full_usage "\n\n"
diff --git a/coreutils/tee.c b/coreutils/tee.c
index a68e9446f..602d06737 100644
--- a/coreutils/tee.c
+++ b/coreutils/tee.c
@@ -6,6 +6,23 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config TEE
+//config: bool "tee"
+//config: default y
+//config: help
+//config: tee is used to read from standard input and write
+//config: to standard output and files.
+//config:
+//config:config FEATURE_TEE_USE_BLOCK_IO
+//config: bool "Enable block I/O (larger/faster) instead of byte I/O"
+//config: default y
+//config: depends on TEE
+//config: help
+//config: Enable this option for a faster tee, at expense of size.
+
+//applet:IF_TEE(APPLET(tee, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_TEE) += tee.o
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/tee.html */
diff --git a/coreutils/test.c b/coreutils/test.c
index bf8dc47e8..81c9b7dfe 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -19,11 +19,6 @@
* Original copyright notice states:
* "This program is in the Public Domain."
*/
-
-//kbuild:lib-$(CONFIG_TEST) += test.o test_ptr_hack.o
-//kbuild:lib-$(CONFIG_ASH) += test.o test_ptr_hack.o
-//kbuild:lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o
-
//config:config TEST
//config: bool "test"
//config: default y
@@ -39,6 +34,14 @@
//config: help
//config: Enable 64-bit support in test.
+//applet:IF_TEST(APPLET_NOFORK([, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
+//applet:IF_TEST(APPLET_NOFORK([[, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
+//applet:IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
+
+//kbuild:lib-$(CONFIG_TEST) += test.o test_ptr_hack.o
+//kbuild:lib-$(CONFIG_ASH) += test.o test_ptr_hack.o
+//kbuild:lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o
+
/* "test --help" is special-cased to ignore --help */
//usage:#define test_trivial_usage NOUSAGE_STR
//usage:#define test_full_usage ""
diff --git a/coreutils/touch.c b/coreutils/touch.c
index 293a96890..92d5a718a 100644
--- a/coreutils/touch.c
+++ b/coreutils/touch.c
@@ -6,19 +6,12 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 _NOT_ compliant -- options -a, -m not supported. */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/touch.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Previous version called open() and then utime(). While this will be
* be necessary to implement -r and -t, it currently only makes things bigger.
* Also, exiting on a failure was a bug. All args should be processed.
*/
-
-#include "libbb.h"
-
//config:config TOUCH
//config: bool "touch"
//config: default y
@@ -45,6 +38,9 @@
//kbuild:lib-$(CONFIG_TOUCH) += touch.o
+/* BB_AUDIT SUSv3 _NOT_ compliant -- options -a, -m not supported. */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/touch.html */
+
//usage:#define touch_trivial_usage
//usage: "[-c]" IF_FEATURE_TOUCH_SUSV3(" [-d DATE] [-t DATE] [-r FILE]") " FILE..."
//usage:#define touch_full_usage "\n\n"
@@ -66,8 +62,6 @@
//usage: "$ ls -l /tmp/foo\n"
//usage: "-rw-rw-r-- 1 andersen andersen 0 Apr 15 01:11 /tmp/foo\n"
-/* This is a NOFORK applet. Be very careful! */
-
/* coreutils implements:
* -a change only the access time
* -c, --no-create
@@ -85,6 +79,8 @@
* change the specified time: WORD is access, atime, or use
*/
+#include "libbb.h"
+
int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int touch_main(int argc UNUSED_PARAM, char **argv)
{
diff --git a/coreutils/tr.c b/coreutils/tr.c
index 2f49d5a86..f552096f3 100644
--- a/coreutils/tr.c
+++ b/coreutils/tr.c
@@ -18,9 +18,6 @@
/* http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html
* TODO: graph, print
*/
-
-//kbuild:lib-$(CONFIG_TR) += tr.o
-
//config:config TR
//config: bool "tr"
//config: default y
@@ -47,6 +44,10 @@
//config: useful for cases when no other way of expressing a character
//config: is possible.
+//applet:IF_TR(APPLET(tr, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_TR) += tr.o
+
//usage:#define tr_trivial_usage
//usage: "[-cds] STRING1 [STRING2]"
//usage:#define tr_full_usage "\n\n"
diff --git a/coreutils/true.c b/coreutils/true.c
index 89f892961..6a9493f9d 100644
--- a/coreutils/true.c
+++ b/coreutils/true.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config TRUE
+//config: bool "true"
+//config: default y
+//config: help
+//config: true returns an exit code of TRUE (0).
+
+//applet:IF_TRUE(APPLET_NOFORK(true, true, BB_DIR_BIN, BB_SUID_DROP, true))
+
+//kbuild:lib-$(CONFIG_TRUE) += true.o
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/true.html */
diff --git a/coreutils/truncate.c b/coreutils/truncate.c
index 8d845f218..253fe0015 100644
--- a/coreutils/truncate.c
+++ b/coreutils/truncate.c
@@ -5,7 +5,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
//config:config TRUNCATE
//config: bool "truncate"
//config: default y
@@ -13,9 +12,10 @@
//config: truncate truncates files to a given size. If a file does
//config: not exist, it is created unless told otherwise.
-//kbuild:lib-$(CONFIG_TRUNCATE) += truncate.o
//applet:IF_TRUNCATE(APPLET_NOFORK(truncate, truncate, BB_DIR_USR_BIN, BB_SUID_DROP, truncate))
+//kbuild:lib-$(CONFIG_TRUNCATE) += truncate.o
+
//usage:#define truncate_trivial_usage
//usage: "[-c] -s SIZE FILE..."
//usage:#define truncate_full_usage "\n\n"
diff --git a/coreutils/tty.c b/coreutils/tty.c
index 45175054e..359e5bc93 100644
--- a/coreutils/tty.c
+++ b/coreutils/tty.c
@@ -6,6 +6,16 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config TTY
+//config: bool "tty"
+//config: default y
+//config: help
+//config: tty is used to print the name of the current terminal to
+//config: standard output.
+
+//applet:IF_TTY(APPLET(tty, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_TTY) += tty.o
/* BB_AUDIT SUSv4 compliant */
/* http://www.opengroup.org/onlinepubs/9699919799/utilities/tty.html */
diff --git a/coreutils/uname.c b/coreutils/uname.c
index fd677d27c..4d98fde25 100644
--- a/coreutils/uname.c
+++ b/coreutils/uname.c
@@ -4,10 +4,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 compliant */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/uname.html */
-
/* Option Example
* -s, --sysname SunOS
* -n, --nodename rocky8
@@ -37,7 +33,6 @@
* -a, --all: all of the above, in the order shown.
* If -p or -i is not known, don't show them
*/
-
/* Busyboxed by Erik Andersen
*
* Before 2003: Glenn McGrath and Manuel Novoa III
@@ -47,6 +42,26 @@
* Jan 2009:
* Fix handling of -a to not print "unknown", add -o and -i support.
*/
+//config:config UNAME
+//config: bool "uname"
+//config: default y
+//config: help
+//config: uname is used to print system information.
+//config:
+//config:config UNAME_OSNAME
+//config: string "Operating system name"
+//config: default "GNU/Linux"
+//config: depends on UNAME
+//config: help
+//config: Sets the operating system name reported by uname -o. The
+//config: default is "GNU/Linux".
+
+//applet:IF_UNAME(APPLET(uname, BB_DIR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_UNAME) += uname.o
+
+/* BB_AUDIT SUSv3 compliant */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/uname.html */
//usage:#define uname_trivial_usage
//usage: "[-amnrspvio]"
diff --git a/coreutils/uniq.c b/coreutils/uniq.c
index ec7bde418..be550b5cd 100644
--- a/coreutils/uniq.c
+++ b/coreutils/uniq.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config UNIQ
+//config: bool "uniq"
+//config: default y
+//config: help
+//config: uniq is used to remove duplicate lines from a sorted file.
+
+//applet:IF_UNIQ(APPLET(uniq, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_UNIQ) += uniq.o
/* BB_AUDIT SUSv3 compliant */
/* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */
diff --git a/coreutils/unlink.c b/coreutils/unlink.c
index 3b7d0fb2b..2879638d3 100644
--- a/coreutils/unlink.c
+++ b/coreutils/unlink.c
@@ -5,17 +5,16 @@
*
* Licensed under GPLv2, see LICENSE in this source tree
*/
-
//config:config UNLINK
//config: bool "unlink"
//config: default y
//config: help
//config: unlink deletes a file by calling unlink()
-//kbuild:lib-$(CONFIG_UNLINK) += unlink.o
-
//applet:IF_UNLINK(APPLET(unlink, BB_DIR_USR_BIN, BB_SUID_DROP))
+//kbuild:lib-$(CONFIG_UNLINK) += unlink.o
+
//usage:#define unlink_trivial_usage
//usage: "FILE"
//usage:#define unlink_full_usage "\n\n"
diff --git a/coreutils/usleep.c b/coreutils/usleep.c
index 2e4eb5721..7bc30c2a2 100644
--- a/coreutils/usleep.c
+++ b/coreutils/usleep.c
@@ -6,6 +6,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config USLEEP
+//config: bool "usleep"
+//config: default y
+//config: help
+//config: usleep is used to pause for a specified number of microseconds.
+
+//applet:IF_USLEEP(APPLET_NOFORK(usleep, usleep, BB_DIR_BIN, BB_SUID_DROP, usleep))
+
+//kbuild:lib-$(CONFIG_USLEEP) += usleep.o
/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
diff --git a/coreutils/uudecode.c b/coreutils/uudecode.c
index 37b254d30..ddce2548b 100644
--- a/coreutils/uudecode.c
+++ b/coreutils/uudecode.c
@@ -10,6 +10,15 @@
* Bugs: the spec doesn't mention anything about "`\n`\n" prior to the
* "end" line
*/
+//config:config UUDECODE
+//config: bool "uudecode"
+//config: default y
+//config: help
+//config: uudecode is used to decode a uuencoded file.
+
+//applet:IF_UUDECODE(APPLET(uudecode, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_UUDECODE) += uudecode.o
//usage:#define uudecode_trivial_usage
//usage: "[-o OUTFILE] [INFILE]"
diff --git a/coreutils/uuencode.c b/coreutils/uuencode.c
index 673ef36e7..917cdaea5 100644
--- a/coreutils/uuencode.c
+++ b/coreutils/uuencode.c
@@ -7,6 +7,15 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config UUENCODE
+//config: bool "uuencode"
+//config: default y
+//config: help
+//config: uuencode is used to uuencode a file.
+
+//applet:IF_UUENCODE(APPLET(uuencode, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_UUENCODE) += uuencode.o
//usage:#define uuencode_trivial_usage
//usage: "[-m] [FILE] STORED_FILENAME"
diff --git a/coreutils/wc.c b/coreutils/wc.c
index a410e407a..73837141e 100644
--- a/coreutils/wc.c
+++ b/coreutils/wc.c
@@ -6,10 +6,6 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 compliant. */
-/* http://www.opengroup.org/onlinepubs/007904975/utilities/wc.html */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Rewritten to fix a number of problems and do some size optimizations.
@@ -36,6 +32,27 @@
*
* for which 'wc -c' should output '0'.
*/
+//config:config WC
+//config: bool "wc"
+//config: default y
+//config: help
+//config: wc is used to print the number of bytes, words, and lines,
+//config: in specified files.
+//config:
+//config:config FEATURE_WC_LARGE
+//config: bool "Support very large files in wc"
+//config: default y
+//config: depends on WC
+//config: help
+//config: Use "unsigned long long" in wc for counter variables.
+
+//applet:IF_WC(APPLET(wc, BB_DIR_USR_BIN, BB_SUID_DROP))
+
+//kbuild:lib-$(CONFIG_WC) += wc.o
+
+/* BB_AUDIT SUSv3 compliant. */
+/* http://www.opengroup.org/onlinepubs/007904975/utilities/wc.html */
+
#include "libbb.h"
#include "unicode.h"
diff --git a/coreutils/who.c b/coreutils/who.c
index f694d0c60..ac19dc720 100644
--- a/coreutils/who.c
+++ b/coreutils/who.c
@@ -16,15 +16,13 @@
*
*----------------------------------------------------------------------
*/
-/* BB_AUDIT SUSv3 _NOT_ compliant -- missing options -b, -d, -l, -m, -p, -q, -r, -s, -t, -T, -u; Missing argument 'file'. */
-
//config:config WHO
//config: bool "who"
//config: default y
//config: depends on FEATURE_UTMP
//config: help
//config: who is used to show who is logged on.
-
+//config:
//config:config USERS
//config: bool "users"
//config: default y
@@ -33,11 +31,13 @@
//config: Print users currently logged on.
//applet:IF_USERS(APPLET_ODDNAME(users, who, BB_DIR_USR_BIN, BB_SUID_DROP, users))
-//applet:IF_WHO( APPLET( who, BB_DIR_USR_BIN, BB_SUID_DROP))
+//applet:IF_WHO(APPLET(who, BB_DIR_USR_BIN, BB_SUID_DROP))
//kbuild:lib-$(CONFIG_USERS) += who.o
//kbuild:lib-$(CONFIG_WHO) += who.o
+/* BB_AUDIT SUSv3 _NOT_ compliant -- missing options -b, -d, -l, -m, -p, -q, -r, -s, -t, -T, -u; Missing argument 'file'. */
+
//usage:#define users_trivial_usage
//usage: ""
//usage:#define users_full_usage "\n\n"
diff --git a/coreutils/whoami.c b/coreutils/whoami.c
index 30b17cab3..635712829 100644
--- a/coreutils/whoami.c
+++ b/coreutils/whoami.c
@@ -6,6 +6,16 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
+//config:config WHOAMI
+//config: bool "whoami"
+//config: default y
+//config: help
+//config: whoami is used to print the username of the current
+//config: user id (same as id -un).
+
+//applet:IF_WHOAMI(APPLET_NOFORK(whoami, whoami, BB_DIR_USR_BIN, BB_SUID_DROP, whoami))
+
+//kbuild:lib-$(CONFIG_WHOAMI) += whoami.o
/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
@@ -16,8 +26,6 @@
#include "libbb.h"
-/* This is a NOFORK applet. Be very careful! */
-
int whoami_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int whoami_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
{
diff --git a/coreutils/yes.c b/coreutils/yes.c
index 5d799f09b..81d875589 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -6,23 +6,30 @@
*
* Licensed under GPLv2 or later, see file LICENSE in this source tree.
*/
-
-/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
-
/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
*
* Size reductions and removed redundant applet name prefix from error messages.
*/
+//config:config YES
+//config: bool "yes"
+//config: default y
+//config: help
+//config: yes is used to repeatedly output a specific string, or
+//config: the default string `y'.
-#include "libbb.h"
+//applet:IF_YES(APPLET_NOFORK(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes))
-/* This is a NOFORK applet. Be very careful! */
+//kbuild:lib-$(CONFIG_YES) += yes.o
+
+/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
//usage:#define yes_trivial_usage
//usage: "[STRING]"
//usage:#define yes_full_usage "\n\n"
//usage: "Repeatedly output a line with STRING, or 'y'"
+#include "libbb.h"
+
int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
int yes_main(int argc UNUSED_PARAM, char **argv)
{
diff --git a/include/applets.src.h b/include/applets.src.h
index 23453b0ef..82907e2a5 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -73,98 +73,28 @@ s - suid type:
INSERT
-IF_TEST(APPLET_NOFORK([, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
-IF_TEST(APPLET_NOFORK([[, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
-IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename))
-IF_CAL(APPLET(cal, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_CAT(APPLET_NOFORK(cat, cat, BB_DIR_BIN, BB_SUID_DROP, cat))
-IF_CATV(APPLET(catv, BB_DIR_BIN, BB_SUID_DROP))
IF_CHCON(APPLET(chcon, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_CHGRP(APPLET_NOEXEC(chgrp, chgrp, BB_DIR_BIN, BB_SUID_DROP, chgrp))
-IF_CHMOD(APPLET_NOEXEC(chmod, chmod, BB_DIR_BIN, BB_SUID_DROP, chmod))
-IF_CHOWN(APPLET_NOEXEC(chown, chown, BB_DIR_BIN, BB_SUID_DROP, chown))
-IF_CHROOT(APPLET(chroot, BB_DIR_USR_SBIN, BB_SUID_DROP))
-IF_CKSUM(APPLET_NOEXEC(cksum, cksum, BB_DIR_USR_BIN, BB_SUID_DROP, cksum))
-IF_COMM(APPLET(comm, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_CP(APPLET_NOEXEC(cp, cp, BB_DIR_BIN, BB_SUID_DROP, cp))
-IF_CUT(APPLET_NOEXEC(cut, cut, BB_DIR_USR_BIN, BB_SUID_DROP, cut))
-IF_DD(APPLET_NOEXEC(dd, dd, BB_DIR_BIN, BB_SUID_DROP, dd))
-IF_DF(APPLET(df, BB_DIR_BIN, BB_SUID_DROP))
IF_DHCPRELAY(APPLET(dhcprelay, BB_DIR_USR_SBIN, BB_SUID_DROP))
-IF_DIRNAME(APPLET_NOFORK(dirname, dirname, BB_DIR_USR_BIN, BB_SUID_DROP, dirname))
-IF_DOS2UNIX(APPLET_NOEXEC(dos2unix, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, dos2unix))
-IF_DU(APPLET(du, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_DUMPLEASES(APPLET(dumpleases, BB_DIR_USR_BIN, BB_SUID_DROP))
//IF_E2FSCK(APPLET(e2fsck, BB_DIR_SBIN, BB_SUID_DROP))
//IF_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, BB_DIR_SBIN, BB_SUID_DROP, e2label))
-IF_ECHO(APPLET_NOFORK(echo, echo, BB_DIR_BIN, BB_SUID_DROP, echo))
-IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env))
-IF_EXPAND(APPLET(expand, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_FALSE(APPLET_NOFORK(false, false, BB_DIR_BIN, BB_SUID_DROP, false))
-IF_FOLD(APPLET_NOEXEC(fold, fold, BB_DIR_USR_BIN, BB_SUID_DROP, fold))
//IF_E2FSCK(APPLET_ODDNAME(fsck.ext2, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext2))
//IF_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext3))
-IF_FSYNC(APPLET_NOFORK(fsync, fsync, BB_DIR_BIN, BB_SUID_DROP, fsync))
IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
-IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head))
-IF_INSTALL(APPLET(install, BB_DIR_USR_BIN, BB_SUID_DROP))
//IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length))
-IF_LN(APPLET_NOEXEC(ln, ln, BB_DIR_BIN, BB_SUID_DROP, ln))
IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP))
-IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname))
-IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls))
IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP))
-IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir))
-IF_MKFIFO(APPLET_NOEXEC(mkfifo, mkfifo, BB_DIR_USR_BIN, BB_SUID_DROP, mkfifo))
-IF_MKNOD(APPLET_NOEXEC(mknod, mknod, BB_DIR_BIN, BB_SUID_DROP, mknod))
-IF_MV(APPLET(mv, BB_DIR_BIN, BB_SUID_DROP))
-IF_NICE(APPLET(nice, BB_DIR_BIN, BB_SUID_DROP))
-IF_NOHUP(APPLET(nohup, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_OD(APPLET(od, BB_DIR_USR_BIN, BB_SUID_DROP))
//IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_PRINTENV(APPLET_NOFORK(printenv, printenv, BB_DIR_BIN, BB_SUID_DROP, printenv))
-IF_PRINTF(APPLET_NOFORK(printf, printf, BB_DIR_USR_BIN, BB_SUID_DROP, printf))
-IF_PWD(APPLET_NOFORK(pwd, pwd, BB_DIR_BIN, BB_SUID_DROP, pwd))
-IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon))
-IF_RM(APPLET_NOFORK(rm, rm, BB_DIR_BIN, BB_SUID_DROP, rm))
-IF_RMDIR(APPLET_NOFORK(rmdir, rmdir, BB_DIR_BIN, BB_SUID_DROP, rmdir))
IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_SELINUXENABLED(APPLET(selinuxenabled, BB_DIR_USR_SBIN, BB_SUID_DROP))
-IF_SEQ(APPLET_NOFORK(seq, seq, BB_DIR_USR_BIN, BB_SUID_DROP, seq))
IF_SESTATUS(APPLET(sestatus, BB_DIR_USR_SBIN, BB_SUID_DROP))
IF_SETENFORCE(APPLET(setenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
IF_SETFILES(APPLET(setfiles, BB_DIR_SBIN, BB_SUID_DROP))
IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
-/* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells: */
-IF_SLEEP(APPLET(sleep, BB_DIR_BIN, BB_SUID_DROP))
-IF_SORT(APPLET_NOEXEC(sort, sort, BB_DIR_USR_BIN, BB_SUID_DROP, sort))
-IF_SPLIT(APPLET(split, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_STAT(APPLET(stat, BB_DIR_BIN, BB_SUID_DROP))
-IF_STTY(APPLET(stty, BB_DIR_BIN, BB_SUID_DROP))
-IF_SUM(APPLET(sum, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_TAC(APPLET_NOEXEC(tac, tac, BB_DIR_USR_BIN, BB_SUID_DROP, tac))
-IF_TAIL(APPLET(tail, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_TEE(APPLET(tee, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
-IF_TR(APPLET(tr, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_TRUE(APPLET_NOFORK(true, true, BB_DIR_BIN, BB_SUID_DROP, true))
-IF_TTY(APPLET(tty, BB_DIR_USR_BIN, BB_SUID_DROP))
IF_UDHCPC(APPLET(udhcpc, BB_DIR_SBIN, BB_SUID_DROP))
IF_UDHCPD(APPLET(udhcpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
-IF_UNAME(APPLET(uname, BB_DIR_BIN, BB_SUID_DROP))
-IF_UNEXPAND(APPLET_ODDNAME(unexpand, expand, BB_DIR_USR_BIN, BB_SUID_DROP, unexpand))
-IF_UNIQ(APPLET(uniq, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_UNIX2DOS(APPLET_NOEXEC(unix2dos, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, unix2dos))
-IF_USLEEP(APPLET_NOFORK(usleep, usleep, BB_DIR_BIN, BB_SUID_DROP, usleep))
-IF_UUDECODE(APPLET(uudecode, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_UUENCODE(APPLET(uuencode, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_WC(APPLET(wc, BB_DIR_USR_BIN, BB_SUID_DROP))
-IF_WHOAMI(APPLET_NOFORK(whoami, whoami, BB_DIR_USR_BIN, BB_SUID_DROP, whoami))
-IF_YES(APPLET_NOFORK(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes))
#if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \
&& !defined(MAKE_LINKS) && !defined(MAKE_SUID)