diff options
author | Denys Vlasenko | 2016-11-23 14:46:56 +0100 |
---|---|---|
committer | Denys Vlasenko | 2016-11-23 14:46:56 +0100 |
commit | af3f42011628585cd5c8f5c1fd4b43f2e370a23d (patch) | |
tree | 125ee16d5080008fcf459ad55d91af1dcd488ef9 /coreutils | |
parent | 5b966c6180c139fba6846d632fd9bc0c34a8e1bc (diff) | |
download | busybox-af3f42011628585cd5c8f5c1fd4b43f2e370a23d.zip busybox-af3f42011628585cd5c8f5c1fd4b43f2e370a23d.tar.gz |
Convert all coreutils/* applets to "new style" applet definitions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
Diffstat (limited to 'coreutils')
75 files changed, 950 insertions, 859 deletions
diff --git a/coreutils/Config.src b/coreutils/Config.src index b9dde12..a35198a 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 5a64fee..c93aa63 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 ab0c972..ace0148 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 12c46b1..af02608 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 00c38d4..6597888 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 0e71368..1aeebe1 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 7076db6..8dca63c 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 a21c6d5..80913f5 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 247aa3b..50b06d7 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 633e66b..5c067c1 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 8a8a39f..aeec018 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 cd45095..b6a1278 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 2630c0d..4ecdaaf 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 84449c7..a33a825 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 ff3214d..9d4a7df 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 4dc3029..3d1ba2e 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 06b2920..fdcdae6 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 101067c..6593818 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 ccb74a1..03986ad 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 5f10473..03e31a0 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 1c41745..fd0d9b7 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 cdfc30e..e91eddb 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 8d376ff..bb59af4 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 efc4354..5d2fbf2 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 0591a6c..b8f17c6 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 0e73063..01f9bce 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 652a41c..596a2bc 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 9388b02..176e91e 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 e5b1f51..5b47de1 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 1f3e1c4..ab7ac1e 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 8aa51cc..e685892 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 1688148..0e2abac 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 10b9615..a9b1c95 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 344b4e6..0f35c70 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 6f7b004..3afe76c 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 ef58325..66509a9 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 aa04504..466ef5c 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 5057175..1cc318f 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 ce75991..3676ee6 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 63853fd..d848968 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 fb11fcf..4b05ee7 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 bd5db70..fbd6494 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 9ee7350..6c8e115 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 bb3ad04..05dee49 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 d73ef4d..1b223b3 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 c513b55..0c2d544 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 d0ad81d..cec34cb 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 0792a1c..8979941 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 8986192..ed4946b 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 0ffbd16..ad2d6b5 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 34a4199..1ccce93 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 19d58a2..50918a1 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 ddcfcf2..b918ec6 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 52967ea..e818d57 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 ec9ed2a..c55293d 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 e65d9cd..5e189f6 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 94d669d..ca5617c 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 57ad0f3..99f58dd 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 a68e944..602d067 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 bf8dc47..81c9b7d 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 293a968..92d5a71 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 2f49d5a..f552096 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 89f8929..6a9493f 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 8d845f2..253fe00 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 4517505..359e5bc 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 fd677d2..4d98fde 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 ec7bde4..be550b5 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 3b7d0fb..2879638 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 2e4eb57..7bc30c2 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 37b254d..ddce254 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 673ef36..917cdae 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 a410e40..7383714 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 f694d0c..ac19dc7 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 30b17ca..6357128 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 5d799f0..81d8755 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) { |