From 9655f95d0f501b03b33c7896b7b0c23d090aff81 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 11 Nov 2016 17:56:45 +0100 Subject: tar: handle pax-encoded utf8 filenames and link names. Closes 9406 Signed-off-by: Denys Vlasenko --- archival/libarchive/get_header_tar.c | 32 +++++++++++++++++++++++++------- testsuite/tar.tests | 20 ++++++++++++++++++++ testsuite/tar.utf8.tar.bz2 | Bin 0 -> 519 bytes 3 files changed, 45 insertions(+), 7 deletions(-) create mode 100644 testsuite/tar.utf8.tar.bz2 diff --git a/archival/libarchive/get_header_tar.c b/archival/libarchive/get_header_tar.c index ea91a883e..c7e3bc16e 100644 --- a/archival/libarchive/get_header_tar.c +++ b/archival/libarchive/get_header_tar.c @@ -113,11 +113,19 @@ static void process_pax_hdr(archive_handle_t *archive_handle, unsigned sz, int g value = end + 1; # if ENABLE_FEATURE_TAR_GNU_EXTENSIONS - if (!global && is_prefixed_with(value, "path=")) { - value += sizeof("path=") - 1; - free(archive_handle->tar__longname); - archive_handle->tar__longname = xstrdup(value); - continue; + if (!global) { + if (is_prefixed_with(value, "path=")) { + value += sizeof("path=") - 1; + free(archive_handle->tar__longname); + archive_handle->tar__longname = xstrdup(value); + continue; + } + if (is_prefixed_with(value, "linkpath=")) { + value += sizeof("linkpath=") - 1; + free(archive_handle->tar__linkname); + archive_handle->tar__linkname = xstrdup(value); + continue; + } } # endif @@ -179,7 +187,13 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) * the message and we don't check whether we indeed * saw zero block directly before this. */ if (i == 0) { - bb_error_msg("short read"); + /* GNU tar 1.29 will be silent if tar archive ends abruptly + * (if there are no zero blocks at all, and last read returns zero, + * not short read 0 < len < 512). Complain only if + * the very first read fails. Grrr. + */ + if (archive_handle->offset == 0) + bb_error_msg("short read"); /* this merely signals end of archive, not exit(1): */ return EXIT_FAILURE; } @@ -195,7 +209,11 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle) archive_handle->offset += i; /* If there is no filename its an empty header */ - if (tar.name[0] == 0 && tar.prefix[0] == 0) { + if (tar.name[0] == 0 && tar.prefix[0] == 0 + /* Have seen a tar archive with pax 'x' header supplying UTF8 filename, + * with actual file having all name fields NUL-filled. Check this: */ + && !p_longname + ) { if (archive_handle->tar__end) { /* Second consecutive empty header - end of archive. * Read until the end to empty the pipe from gz or bz2 diff --git a/testsuite/tar.tests b/testsuite/tar.tests index c44b7ad07..ffcbe9ba9 100755 --- a/testsuite/tar.tests +++ b/testsuite/tar.tests @@ -299,6 +299,26 @@ l4/V8LDoe90yiWJhOJvIypgEfxdyRThQkBVn/bI= " SKIP= +optional UNICODE_SUPPORT +testing "Pax-encoded UTF8 names and symlinks" '\ +tar xvf ../tar.utf8.tar.bz2 2>&1; echo $? +export LANG=en_US.UTF-8 +ls -l etc/ssl/certs/* | sed "s:.*etc/:etc/:" +unset LANG +rm -rf etc usr +' "\ +etc/ssl/certs/3b2716e5.0 +etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem +etc/ssl/certs/f80cc7f6.0 +usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt +0 +etc/ssl/certs/3b2716e5.0 -> EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem +etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem -> /usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt +etc/ssl/certs/f80cc7f6.0 -> EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem +" \ +"" "" +SKIP= + cd .. && rm -rf tar.tempdir || exit 1 diff --git a/testsuite/tar.utf8.tar.bz2 b/testsuite/tar.utf8.tar.bz2 new file mode 100644 index 000000000..0398e1aea Binary files /dev/null and b/testsuite/tar.utf8.tar.bz2 differ -- cgit v1.2.3-55-g6feb From 67fd2f2858ac63d46f42ef3c096b007ac7362849 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 13 Nov 2016 22:35:10 +0100 Subject: dnsdomainname: split it from "hostname", make it independently selectable Signed-off-by: Denys Vlasenko --- include/applets.src.h | 2 -- networking/Config.src | 6 ------ networking/Kbuild.src | 1 - networking/hostname.c | 26 ++++++++++++++++++++++++-- 4 files changed, 24 insertions(+), 11 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index 248d539c4..dbc45953c 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -112,7 +112,6 @@ 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_DMESG(APPLET(dmesg, BB_DIR_BIN, BB_SUID_DROP)) IF_DNSD(APPLET(dnsd, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_HOSTNAME(APPLET_ODDNAME(dnsdomainname, hostname, BB_DIR_BIN, BB_SUID_DROP, dnsdomainname)) 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_DUMPKMAP(APPLET(dumpkmap, BB_DIR_BIN, BB_SUID_DROP)) @@ -158,7 +157,6 @@ IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd)) IF_HDPARM(APPLET(hdparm, BB_DIR_SBIN, BB_SUID_DROP)) IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head)) IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump)) -IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP)) IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP)) IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP)) diff --git a/networking/Config.src b/networking/Config.src index eb0536a7c..398a5ee25 100644 --- a/networking/Config.src +++ b/networking/Config.src @@ -160,12 +160,6 @@ config FEATURE_FTPGETPUT_LONG_OPTIONS help Support long options for the ftpget/ftpput applet. -config HOSTNAME - bool "hostname" - default y - help - Show or set the system's host name. - config HTTPD bool "httpd" default y diff --git a/networking/Kbuild.src b/networking/Kbuild.src index 79f54824b..e14070647 100644 --- a/networking/Kbuild.src +++ b/networking/Kbuild.src @@ -16,7 +16,6 @@ lib-$(CONFIG_FAKEIDENTD) += isrv_identd.o isrv.o lib-$(CONFIG_FTPD) += ftpd.o lib-$(CONFIG_FTPGET) += ftpgetput.o lib-$(CONFIG_FTPPUT) += ftpgetput.o -lib-$(CONFIG_HOSTNAME) += hostname.o lib-$(CONFIG_HTTPD) += httpd.o lib-$(CONFIG_IFCONFIG) += ifconfig.o interface.o lib-$(CONFIG_IFENSLAVE) += ifenslave.o interface.o diff --git a/networking/hostname.c b/networking/hostname.c index b3e352242..04a051ede 100644 --- a/networking/hostname.c +++ b/networking/hostname.c @@ -10,6 +10,24 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config HOSTNAME +//config: bool "hostname" +//config: default y +//config: help +//config: Show or set the system's host name. +//config: +//config:config DNSDOMAINNAME +//config: bool "dnsdomainname" +//config: default y +//config: help +//config: Alias to "hostname -d". + +//applet:IF_DNSDOMAINNAME(APPLET_ODDNAME(dnsdomainname, hostname, BB_DIR_BIN, BB_SUID_DROP, dnsdomainname)) +//applet:IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild: lib-$(CONFIG_HOSTNAME) += hostname.o +//kbuild: lib-$(CONFIG_DNSDOMAINNAME) += hostname.o + //usage:#define hostname_trivial_usage //usage: "[OPTIONS] [HOSTNAME | -F FILE]" //usage:#define hostname_full_usage "\n\n" @@ -131,8 +149,12 @@ int hostname_main(int argc UNUSED_PARAM, char **argv) opts = getopt32(argv, "dfisF:v", &hostname_str); argv += optind; buf = safe_gethostname(); - if (applet_name[0] == 'd') /* dnsdomainname? */ - opts = OPT_d; + if (ENABLE_DNSDOMAINNAME) { + if (!ENABLE_HOSTNAME || applet_name[0] == 'd') { + /* dnsdomainname */ + opts = OPT_d; + } + } if (opts & OPT_dfi) { /* Cases when we need full hostname (or its part) */ -- cgit v1.2.3-55-g6feb From c314ca9016530aae61b4e50242ba6a6e09b2914a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 13 Nov 2016 22:56:04 +0100 Subject: Make setarch/linux32/linux64 independently selectable Signed-off-by: Denys Vlasenko --- util-linux/setarch.c | 29 ++++++++++++++++++++++++----- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/util-linux/setarch.c b/util-linux/setarch.c index 2e989ec2a..ec473e9cb 100644 --- a/util-linux/setarch.c +++ b/util-linux/setarch.c @@ -15,12 +15,28 @@ //config: specified program (usually a shell). It only makes sense to have //config: this util on a system that supports both 64bit and 32bit userland //config: (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...). +//config: +//config:config LINUX32 +//config: bool "linux32" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Alias to "setarch linux32". +//config: +//config:config LINUX64 +//config: bool "linux64" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Alias to "setarch linux64". //applet:IF_SETARCH(APPLET(setarch, BB_DIR_BIN, BB_SUID_DROP)) -//applet:IF_SETARCH(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32)) -//applet:IF_SETARCH(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64)) +//applet:IF_LINUX32(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32)) +//applet:IF_LINUX64(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64)) //kbuild:lib-$(CONFIG_SETARCH) += setarch.o +//kbuild:lib-$(CONFIG_LINUX32) += setarch.o +//kbuild:lib-$(CONFIG_LINUX64) += setarch.o //usage:#define setarch_trivial_usage //usage: "PERSONALITY [-R] PROG ARGS" @@ -58,12 +74,15 @@ int setarch_main(int argc UNUSED_PARAM, char **argv) if (ENABLE_SETARCH && applet_name[0] == 's' && argv[1] && is_prefixed_with(argv[1], "linux") ) { - applet_name = argv[1]; argv++; + applet_name = argv[0]; } - if (applet_name[5] == '6') /* linux64 */ + if ((!ENABLE_SETARCH && !ENABLE_LINUX32) || applet_name[5] == '6') + /* linux64 */ pers = PER_LINUX; - else if (applet_name[5] == '3') /* linux32 */ + else + if ((!ENABLE_SETARCH && !ENABLE_LINUX64) || applet_name[5] == '3') + /* linux32 */ pers = PER_LINUX32; else bb_show_usage(); -- cgit v1.2.3-55-g6feb From 97e9a72c71d0238c9f241612ce4af923c16954c7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 14 Nov 2016 04:55:04 +0100 Subject: Make halt/poweroff/reboot independently selectable Signed-off-by: Denys Vlasenko --- init/halt.c | 41 ++++++++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 9 deletions(-) diff --git a/init/halt.c b/init/halt.c index 29e60657b..b7fb10869 100644 --- a/init/halt.c +++ b/init/halt.c @@ -7,22 +7,28 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ -//applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP)) -//applet:IF_HALT(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff)) -//applet:IF_HALT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot)) - -//kbuild:lib-$(CONFIG_HALT) += halt.o - //config:config HALT -//config: bool "poweroff, halt, and reboot" +//config: bool "halt" +//config: default y +//config: help +//config: Stop all processes and halt the system. +//config: +//config:config POWEROFF +//config: bool "poweroff" //config: default y //config: help -//config: Stop all processes and either halt, reboot, or power off the system. +//config: Stop all processes and power off the system. +//config: +//config:config REBOOT +//config: bool "reboot" +//config: default y +//config: help +//config: Stop all processes and reboot the system. //config: //config:config FEATURE_CALL_TELINIT //config: bool "Call telinit on shutdown and reboot" //config: default y -//config: depends on HALT && !INIT +//config: depends on (HALT || POWEROFF || REBOOT) && !INIT //config: help //config: Call an external program (normally telinit) to facilitate //config: a switch to a proper runlevel. @@ -39,6 +45,14 @@ //config: to facilitate proper shutdown, this path is to be used when //config: locating telinit executable. +//applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP)) +//applet:IF_POWEROFF(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff)) +//applet:IF_REBOOT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot)) + +//kbuild:lib-$(CONFIG_HALT) += halt.o +//kbuild:lib-$(CONFIG_POWEROFF) += halt.o +//kbuild:lib-$(CONFIG_REBOOT) += halt.o + //usage:#define halt_trivial_usage //usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]") //usage:#define halt_full_usage "\n\n" @@ -109,6 +123,15 @@ int halt_main(int argc UNUSED_PARAM, char **argv) int which, flags, rc; /* Figure out which applet we're running */ + if (ENABLE_HALT && !ENABLE_POWEROFF && !ENABLE_REBOOT) + which = 0; + else + if (!ENABLE_HALT && ENABLE_POWEROFF && !ENABLE_REBOOT) + which = 1; + else + if (!ENABLE_HALT && !ENABLE_POWEROFF && ENABLE_REBOOT) + which = 2; + else for (which = 0; "hpr"[which] != applet_name[0]; which++) continue; -- cgit v1.2.3-55-g6feb From 1924e99ad3513990f317c4295c35d5861521555a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 14 Nov 2016 05:09:48 +0100 Subject: Make grep/egrep/fgrep independently selectable Signed-off-by: Denys Vlasenko --- findutils/grep.c | 52 ++++++++++++++++++++++------------------------------ testsuite/grep.tests | 2 +- 2 files changed, 23 insertions(+), 31 deletions(-) diff --git a/findutils/grep.c b/findutils/grep.c index 1fa605f6f..547e3d576 100644 --- a/findutils/grep.c +++ b/findutils/grep.c @@ -18,45 +18,41 @@ * (C) 2006 Jac Goudsmit added -o option */ -//applet:IF_GREP(APPLET(grep, BB_DIR_BIN, BB_SUID_DROP)) -//applet:IF_FEATURE_GREP_EGREP_ALIAS(APPLET_ODDNAME(egrep, grep, BB_DIR_BIN, BB_SUID_DROP, egrep)) -//applet:IF_FEATURE_GREP_FGREP_ALIAS(APPLET_ODDNAME(fgrep, grep, BB_DIR_BIN, BB_SUID_DROP, fgrep)) - -//kbuild:lib-$(CONFIG_GREP) += grep.o - //config:config GREP //config: bool "grep" //config: default y //config: help //config: grep is used to search files for a specified pattern. //config: -//config:config FEATURE_GREP_EGREP_ALIAS -//config: bool "Enable extended regular expressions (egrep & grep -E)" +//config:config EGREP +//config: bool "egrep" //config: default y -//config: depends on GREP //config: help -//config: Enabled support for extended regular expressions. Extended -//config: regular expressions allow for alternation (foo|bar), grouping, -//config: and various repetition operators. +//config: Alias to "grep -E" //config: -//config:config FEATURE_GREP_FGREP_ALIAS -//config: bool "Alias fgrep to grep -F" +//config:config FGREP +//config: bool "fgrep" //config: default y -//config: depends on GREP //config: help -//config: fgrep sees the search pattern as a normal string rather than -//config: regular expressions. -//config: grep -F always works, this just creates the fgrep alias. +//config: Alias to "grep -F" //config: //config:config FEATURE_GREP_CONTEXT //config: bool "Enable before and after context flags (-A, -B and -C)" //config: default y -//config: depends on GREP +//config: depends on GREP || EGREP //config: help //config: Print the specified number of leading (-B) and/or trailing (-A) //config: context surrounding our matching lines. //config: Print the specified number of context lines (-C). +//applet:IF_GREP(APPLET(grep, BB_DIR_BIN, BB_SUID_DROP)) +//applet:IF_EGREP(APPLET_ODDNAME(egrep, grep, BB_DIR_BIN, BB_SUID_DROP, egrep)) +//applet:IF_FGREP(APPLET_ODDNAME(fgrep, grep, BB_DIR_BIN, BB_SUID_DROP, fgrep)) + +//kbuild:lib-$(CONFIG_GREP) += grep.o +//kbuild:lib-$(CONFIG_EGREP) += grep.o +//kbuild:lib-$(CONFIG_FGREP) += grep.o + #include "libbb.h" #include "common_bufsiz.h" #include "xregex.h" @@ -64,9 +60,7 @@ /* options */ //usage:#define grep_trivial_usage -//usage: "[-HhnlLoqvsriw" -//usage: "F" -//usage: IF_FEATURE_GREP_EGREP_ALIAS("E") +//usage: "[-HhnlLoqvsriwFE" //usage: IF_EXTRA_COMPAT("z") //usage: "] [-m N] " //usage: IF_FEATURE_GREP_CONTEXT("[-A/B/C N] ") @@ -88,9 +82,7 @@ //usage: "\n -w Match whole words only" //usage: "\n -x Match whole lines only" //usage: "\n -F PATTERN is a literal (not regexp)" -//usage: IF_FEATURE_GREP_EGREP_ALIAS( //usage: "\n -E PATTERN is an extended regexp" -//usage: ) //usage: IF_EXTRA_COMPAT( //usage: "\n -z Input is NUL terminated" //usage: ) @@ -117,7 +109,7 @@ #define OPTSTR_GREP \ "lnqvscFiHhe:*f:*Lorm:+wx" \ IF_FEATURE_GREP_CONTEXT("A:+B:+C:+") \ - IF_FEATURE_GREP_EGREP_ALIAS("E") \ + "E" \ IF_EXTRA_COMPAT("z") \ "aI" /* ignored: -a "assume all files to be text" */ @@ -144,7 +136,7 @@ enum { IF_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */ IF_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */ IF_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */ - IF_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */ + OPTBIT_E, /* extended regexp */ IF_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */ OPT_l = 1 << OPTBIT_l, OPT_n = 1 << OPTBIT_n, @@ -167,7 +159,7 @@ enum { OPT_A = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0, OPT_B = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0, OPT_C = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0, - OPT_E = IF_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0, + OPT_E = 1 << OPTBIT_E, OPT_z = IF_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0, }; @@ -744,7 +736,7 @@ int grep_main(int argc UNUSED_PARAM, char **argv) } } - if (ENABLE_FEATURE_GREP_FGREP_ALIAS && applet_name[0] == 'f') + if (ENABLE_FGREP && applet_name[0] == 'f') option_mask32 |= OPT_F; #if !ENABLE_EXTRA_COMPAT @@ -752,8 +744,8 @@ int grep_main(int argc UNUSED_PARAM, char **argv) reflags = REG_NOSUB; #endif - if (ENABLE_FEATURE_GREP_EGREP_ALIAS - && (applet_name[0] == 'e' || (option_mask32 & OPT_E)) + if ((ENABLE_EGREP && applet_name[0] == 'e') + || (option_mask32 & OPT_E) ) { reflags |= REG_EXTENDED; } diff --git a/testsuite/grep.tests b/testsuite/grep.tests index f6d9f2105..ed4ba455e 100755 --- a/testsuite/grep.tests +++ b/testsuite/grep.tests @@ -96,7 +96,7 @@ testing "grep -x -F (partial match 1)" "grep -x -F foo input ; echo \$?" \ testing "grep -x -F (partial match 2)" "grep -x -F foo input ; echo \$?" \ "1\n" "bar foo\n" "" -optional FEATURE_GREP_EGREP_ALIAS +optional EGREP testing "grep -E supports extended regexps" "grep -E fo+" "foo\n" "" \ "b\ar\nfoo\nbaz" testing "grep is also egrep" "egrep foo" "foo\n" "" "foo\nbar\n" -- cgit v1.2.3-55-g6feb From f417ffd88f194bbfd18605882ee242190c1bab34 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 14 Nov 2016 17:30:50 +0100 Subject: Make swapon and swapoff individually selectable. For example, without swapoff, code shrinks by 277 bytes. Signed-off-by: Denys Vlasenko --- include/applets.src.h | 2 -- util-linux/Config.src | 28 --------------------------- util-linux/Kbuild.src | 1 - util-linux/swaponoff.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++- 4 files changed, 50 insertions(+), 32 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index dbc45953c..f2c754b74 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -287,8 +287,6 @@ IF_STAT(APPLET(stat, BB_DIR_BIN, BB_SUID_DROP)) IF_STRINGS(APPLET(strings, BB_DIR_USR_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_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapoff)) -IF_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapon)) IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP)) IF_BB_SYSCTL(APPLET(sysctl, BB_DIR_SBIN, BB_SUID_DROP)) IF_TAC(APPLET_NOEXEC(tac, tac, BB_DIR_USR_BIN, BB_SUID_DROP, tac)) diff --git a/util-linux/Config.src b/util-linux/Config.src index 922cabdb8..ee0d8a632 100644 --- a/util-linux/Config.src +++ b/util-linux/Config.src @@ -489,34 +489,6 @@ config SCRIPTREPLAY This program replays a typescript, using timing information given by script -t. -config SWAPONOFF - bool "swaponoff" - default y - select PLATFORM_LINUX - help - This option enables both the 'swapon' and the 'swapoff' utilities. - Once you have created some swap space using 'mkswap', you also need - to enable your swap space with the 'swapon' utility. The 'swapoff' - utility is used, typically at system shutdown, to disable any swap - space. If you are not using any swap space, you can leave this - option disabled. - -config FEATURE_SWAPON_DISCARD - bool "Support discard option -d" - default y - depends on SWAPONOFF - help - Enable support for discarding swap area blocks at swapon and/or as - the kernel frees them. This option enables both the -d option on - 'swapon' and the 'discard' option for swap entries in /etc/fstab. - -config FEATURE_SWAPON_PRI - bool "Support priority option -p" - default y - depends on SWAPONOFF - help - Enable support for setting swap device priority in swapon. - config SWITCH_ROOT bool "switch_root" default y diff --git a/util-linux/Kbuild.src b/util-linux/Kbuild.src index 0b87c52ac..5ee5cf7ff 100644 --- a/util-linux/Kbuild.src +++ b/util-linux/Kbuild.src @@ -40,6 +40,5 @@ lib-$(CONFIG_READPROFILE) += readprofile.o lib-$(CONFIG_RTCWAKE) += rtcwake.o lib-$(CONFIG_SCRIPT) += script.o lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o -lib-$(CONFIG_SWAPONOFF) += swaponoff.o lib-$(CONFIG_SWITCH_ROOT) += switch_root.o lib-$(CONFIG_UMOUNT) += umount.o diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 6713852e5..0a2d23f50 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -7,6 +7,47 @@ * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config SWAPON +//config: bool "swapon" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This option enables the 'swapon' utility. +//config: Once you have created some swap space using 'mkswap', you also need +//config: to enable your swap space with the 'swapon' utility. The 'swapoff' +//config: utility is used, typically at system shutdown, to disable any swap +//config: space. If you are not using any swap space, you can leave this +//config: option disabled. +//config: +//config:config FEATURE_SWAPON_DISCARD +//config: bool "Support discard option -d" +//config: default y +//config: depends on SWAPON +//config: help +//config: Enable support for discarding swap area blocks at swapon and/or as +//config: the kernel frees them. This option enables both the -d option on +//config: 'swapon' and the 'discard' option for swap entries in /etc/fstab. +//config: +//config:config FEATURE_SWAPON_PRI +//config: bool "Support priority option -p" +//config: default y +//config: depends on SWAPON +//config: help +//config: Enable support for setting swap device priority in swapon. +//config: +//config:config SWAPOFF +//config: bool "swapoff" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This option enables the 'swapoff' utility. + +//applet:IF_SWAPON(APPLET_ODDNAME(swapon, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapon)) +//applet:IF_SWAPOFF(APPLET_ODDNAME(swapoff, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapoff)) + +//kbuild:lib-$(CONFIG_SWAPON) += swaponoff.o +//kbuild:lib-$(CONFIG_SWAPOFF) += swaponoff.o + //usage:#define swapon_trivial_usage //usage: "[-a] [-e]" IF_FEATURE_SWAPON_DISCARD(" [-d[POL]]") IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]" //usage:#define swapon_full_usage "\n\n" @@ -74,7 +115,15 @@ struct globals { #endif #define INIT_G() do { setup_common_bufsiz(); } while (0) -#define do_swapoff (applet_name[5] == 'f') +#if ENABLE_SWAPOFF +# if ENABLE_SWAPON +# define do_swapoff (applet_name[5] == 'f') +# else +# define do_swapoff 1 +# endif +#else +# define do_swapoff 0 +#endif /* Command line options */ enum { -- cgit v1.2.3-55-g6feb From a8c696bf09d8151323f6e99348c4bc8989f829c8 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 14 Nov 2016 18:31:07 +0100 Subject: Make ifup and ifdown individually selectable. Signed-off-by: Denys Vlasenko --- include/applets.src.h | 2 - networking/Config.src | 105 --------------------------------------- networking/Kbuild.src | 1 - networking/ifupdown.c | 135 +++++++++++++++++++++++++++++++++++++++++++++++--- 4 files changed, 127 insertions(+), 116 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index f2c754b74..36e1f0266 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -160,10 +160,8 @@ IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP)) IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP)) -IF_IFUPDOWN(APPLET_ODDNAME(ifdown, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifdown)) IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP)) IF_IFPLUGD(APPLET(ifplugd, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_IFUPDOWN(APPLET_ODDNAME(ifup, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifup)) IF_INETD(APPLET(inetd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_INOTIFYD(APPLET(inotifyd, BB_DIR_SBIN, BB_SUID_DROP)) IF_INSTALL(APPLET(install, BB_DIR_USR_BIN, BB_SUID_DROP)) diff --git a/networking/Config.src b/networking/Config.src index 398a5ee25..43667fe6a 100644 --- a/networking/Config.src +++ b/networking/Config.src @@ -342,111 +342,6 @@ config IFPLUGD help Network interface plug detection daemon. -config IFUPDOWN - bool "ifupdown" - default y - help - Activate or deactivate the specified interfaces. This applet makes - use of either "ifconfig" and "route" or the "ip" command to actually - configure network interfaces. Therefore, you will probably also want - to enable either IFCONFIG and ROUTE, or enable - FEATURE_IFUPDOWN_IP and the various IP options. Of - course you could use non-busybox versions of these programs, so - against my better judgement (since this will surely result in plenty - of support questions on the mailing list), I do not force you to - enable these additional options. It is up to you to supply either - "ifconfig", "route" and "run-parts" or the "ip" command, either - via busybox or via standalone utilities. - -config IFUPDOWN_IFSTATE_PATH - string "Absolute path to ifstate file" - default "/var/run/ifstate" - depends on IFUPDOWN - help - ifupdown keeps state information in a file called ifstate. - Typically it is located in /var/run/ifstate, however - some distributions tend to put it in other places - (debian, for example, uses /etc/network/run/ifstate). - This config option defines location of ifstate. - -config FEATURE_IFUPDOWN_IP - bool "Use ip applet" - default y - depends on IFUPDOWN - help - Use the iproute "ip" command to implement "ifup" and "ifdown", rather - than the default of using the older 'ifconfig' and 'route' utilities. - -config FEATURE_IFUPDOWN_IP_BUILTIN - bool "Use busybox ip applet" - default y - depends on FEATURE_IFUPDOWN_IP - select PLATFORM_LINUX - select IP - select FEATURE_IP_ADDRESS - select FEATURE_IP_LINK - select FEATURE_IP_ROUTE - help - Use the busybox iproute "ip" applet to implement "ifupdown". - - If left disabled, you must install the full-blown iproute2 - utility or the "ifup" and "ifdown" applets will not work. - -config FEATURE_IFUPDOWN_IFCONFIG_BUILTIN - bool "Use busybox ifconfig and route applets" - default n - depends on IFUPDOWN && !FEATURE_IFUPDOWN_IP - select IFCONFIG - select ROUTE - help - Use the busybox iproute "ifconfig" and "route" applets to - implement the "ifup" and "ifdown" utilities. - - If left disabled, you must install the full-blown ifconfig - and route utilities, or the "ifup" and "ifdown" applets will not - work. - -config FEATURE_IFUPDOWN_IPV4 - bool "Support for IPv4" - default y - depends on IFUPDOWN - help - If you want ifup/ifdown to talk IPv4, leave this on. - -config FEATURE_IFUPDOWN_IPV6 - bool "Support for IPv6" - default y - depends on IFUPDOWN && FEATURE_IPV6 - help - If you need support for IPv6, turn this option on. - -### UNUSED -###config FEATURE_IFUPDOWN_IPX -### bool "Support for IPX" -### default y -### depends on IFUPDOWN -### help -### If this option is selected you can use busybox to work with IPX -### networks. - -config FEATURE_IFUPDOWN_MAPPING - bool "Enable mapping support" - default y - depends on IFUPDOWN - help - This enables support for the "mapping" stanza, unless you have - a weird network setup you don't need it. - -config FEATURE_IFUPDOWN_EXTERNAL_DHCP - bool "Support for external dhcp clients" - default n - depends on IFUPDOWN - help - This enables support for the external dhcp clients. Clients are - tried in the following order: dhcpcd, dhclient, pump and udhcpc. - Otherwise, if udhcpc applet is enabled, it is used. - Otherwise, ifup/ifdown will have no support for DHCP. - config INETD bool "inetd" default y diff --git a/networking/Kbuild.src b/networking/Kbuild.src index e14070647..4ad750283 100644 --- a/networking/Kbuild.src +++ b/networking/Kbuild.src @@ -20,7 +20,6 @@ lib-$(CONFIG_HTTPD) += httpd.o lib-$(CONFIG_IFCONFIG) += ifconfig.o interface.o lib-$(CONFIG_IFENSLAVE) += ifenslave.o interface.o lib-$(CONFIG_IFPLUGD) += ifplugd.o -lib-$(CONFIG_IFUPDOWN) += ifupdown.o lib-$(CONFIG_INETD) += inetd.o lib-$(CONFIG_IP) += ip.o lib-$(CONFIG_IPCALC) += ipcalc.o diff --git a/networking/ifupdown.c b/networking/ifupdown.c index 1d0fc53cf..7ac517afd 100644 --- a/networking/ifupdown.c +++ b/networking/ifupdown.c @@ -1,6 +1,6 @@ /* vi: set sw=4 ts=4: */ /* - * ifupdown for busybox + * ifup/ifdown for busybox * Copyright (c) 2002 Glenn McGrath * Copyright (c) 2003-2004 Erik Andersen * @@ -17,10 +17,127 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config IFUP +//config: bool "ifup" +//config: default y +//config: help +//config: Activate the specified interfaces. This applet makes use +//config: of either "ifconfig" and "route" or the "ip" command to actually +//config: configure network interfaces. Therefore, you will probably also want +//config: to enable either IFCONFIG and ROUTE, or enable +//config: FEATURE_IFUPDOWN_IP and the various IP options. Of +//config: course you could use non-busybox versions of these programs, so +//config: against my better judgement (since this will surely result in plenty +//config: of support questions on the mailing list), I do not force you to +//config: enable these additional options. It is up to you to supply either +//config: "ifconfig", "route" and "run-parts" or the "ip" command, either +//config: via busybox or via standalone utilities. +//config: +//config:config IFDOWN +//config: bool "ifdown" +//config: default y +//config: help +//config: Deactivate the specified interfaces. +//config: +//config:config IFUPDOWN_IFSTATE_PATH +//config: string "Absolute path to ifstate file" +//config: default "/var/run/ifstate" +//config: depends on IFUP || IFDOWN +//config: help +//config: ifupdown keeps state information in a file called ifstate. +//config: Typically it is located in /var/run/ifstate, however +//config: some distributions tend to put it in other places +//config: (debian, for example, uses /etc/network/run/ifstate). +//config: This config option defines location of ifstate. +//config: +//config:config FEATURE_IFUPDOWN_IP +//config: bool "Use ip applet" +//config: default y +//config: depends on IFUP || IFDOWN +//config: help +//config: Use the iproute "ip" command to implement "ifup" and "ifdown", rather +//config: than the default of using the older 'ifconfig' and 'route' utilities. +//config: +//config:config FEATURE_IFUPDOWN_IP_BUILTIN +//config: bool "Use busybox ip applet" +//config: default y +//config: depends on FEATURE_IFUPDOWN_IP +//config: select PLATFORM_LINUX +//config: select IP +//config: select FEATURE_IP_ADDRESS +//config: select FEATURE_IP_LINK +//config: select FEATURE_IP_ROUTE +//config: help +//config: Use the busybox iproute "ip" applet to implement "ifupdown". +//config: +//config: If left disabled, you must install the full-blown iproute2 +//config: utility or the "ifup" and "ifdown" applets will not work. +//config: +//config:config FEATURE_IFUPDOWN_IFCONFIG_BUILTIN +//config: bool "Use busybox ifconfig and route applets" +//config: default n +//config: depends on (IFUP || IFDOWN) && !FEATURE_IFUPDOWN_IP +//config: select IFCONFIG +//config: select ROUTE +//config: help +//config: Use the busybox iproute "ifconfig" and "route" applets to +//config: implement the "ifup" and "ifdown" utilities. +//config: +//config: If left disabled, you must install the full-blown ifconfig +//config: and route utilities, or the "ifup" and "ifdown" applets will not +//config: work. +//config: +//config:config FEATURE_IFUPDOWN_IPV4 +//config: bool "Support for IPv4" +//config: default y +//config: depends on IFUP || IFDOWN +//config: help +//config: If you want ifup/ifdown to talk IPv4, leave this on. +//config: +//config:config FEATURE_IFUPDOWN_IPV6 +//config: bool "Support for IPv6" +//config: default y +//config: depends on (IFUP || IFDOWN) && FEATURE_IPV6 +//config: help +//config: If you need support for IPv6, turn this option on. +//config: +//UNUSED: +////////:config FEATURE_IFUPDOWN_IPX +////////: bool "Support for IPX" +////////: default y +////////: depends on IFUP || IFDOWN +////////: help +////////: If this option is selected you can use busybox to work with IPX +////////: networks. +//config: +//config:config FEATURE_IFUPDOWN_MAPPING +//config: bool "Enable mapping support" +//config: default y +//config: depends on IFUP || IFDOWN +//config: help +//config: This enables support for the "mapping" stanza, unless you have +//config: a weird network setup you don't need it. +//config: +//config:config FEATURE_IFUPDOWN_EXTERNAL_DHCP +//config: bool "Support for external dhcp clients" +//config: default n +//config: depends on IFUP || IFDOWN +//config: help +//config: This enables support for the external dhcp clients. Clients are +//config: tried in the following order: dhcpcd, dhclient, pump and udhcpc. +//config: Otherwise, if udhcpc applet is enabled, it is used. +//config: Otherwise, ifup/ifdown will have no support for DHCP. + +//applet:IF_IFUP(APPLET_ODDNAME(ifup, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifup)) +//applet:IF_IFDOWN(APPLET_ODDNAME(ifdown, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifdown)) + +//kbuild:lib-$(CONFIG_IFUP) += ifupdown.o +//kbuild:lib-$(CONFIG_IFDOWN) += ifupdown.o + //usage:#define ifup_trivial_usage //usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." //usage:#define ifup_full_usage "\n\n" -//usage: " -a De/configure all interfaces automatically" +//usage: " -a Configure all interfaces" //usage: "\n -i FILE Use FILE instead of /etc/network/interfaces" //usage: "\n -n Print out what would happen, but don't do it" //usage: IF_FEATURE_IFUPDOWN_MAPPING( @@ -28,12 +145,12 @@ //usage: "\n -m Don't run any mappings" //usage: ) //usage: "\n -v Print out what would happen before doing it" -//usage: "\n -f Force de/configuration" +//usage: "\n -f Force configuration" //usage: //usage:#define ifdown_trivial_usage //usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." //usage:#define ifdown_full_usage "\n\n" -//usage: " -a De/configure all interfaces automatically" +//usage: " -a Deconfigure all interfaces" //usage: "\n -i FILE Use FILE for interface definitions" //usage: "\n -n Print out what would happen, but don't do it" //usage: IF_FEATURE_IFUPDOWN_MAPPING( @@ -41,7 +158,7 @@ //usage: "\n -m Don't run any mappings" //usage: ) //usage: "\n -v Print out what would happen before doing it" -//usage: "\n -f Force de/configuration" +//usage: "\n -f Force deconfiguration" #include "libbb.h" #include "common_bufsiz.h" @@ -1248,7 +1365,6 @@ static FILE *open_new_state_file(void) return xfdopen_for_write(fd); } - int ifupdown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int ifupdown_main(int argc UNUSED_PARAM, char **argv) { @@ -1263,10 +1379,13 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv) G.startup_PATH = getenv("PATH"); G.shell = xstrdup(get_shell_name()); - cmds = iface_down; - if (applet_name[2] == 'u') { + if (ENABLE_IFUP + && (!ENABLE_IFDOWN || applet_name[2] == 'u') + ) { /* ifup command */ cmds = iface_up; + } else { + cmds = iface_down; } getopt32(argv, OPTION_STR, &interfaces); -- cgit v1.2.3-55-g6feb From eb3fdc843e4a56740f2de41a0a7e37c25bde246c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 16 Nov 2016 15:45:05 +0100 Subject: Make bzcat, lzcat, xzcat, zcat, lzopcat, unlzop individually selectable Signed-off-by: Denys Vlasenko --- archival/Config.src | 2 +- archival/bbunzip.c | 82 +++++++++++++++++++++++++++++++++++++---------------- archival/lzop.c | 32 +++++++++++++++------ 3 files changed, 81 insertions(+), 35 deletions(-) diff --git a/archival/Config.src b/archival/Config.src index a9afaea5b..5e7cfc0a4 100644 --- a/archival/Config.src +++ b/archival/Config.src @@ -30,7 +30,7 @@ config FEATURE_SEAMLESS_GZ Make tar, rpm, modprobe etc understand .gz data. config FEATURE_SEAMLESS_Z - bool "tar, rpm, modprobe etc understand .Z data" + bool "Make tar, rpm, modprobe etc understand .Z data" default n # it is ancient help Make tar, rpm, modprobe etc understand .Z data. diff --git a/archival/bbunzip.c b/archival/bbunzip.c index 07ef8617e..7d5402e8d 100644 --- a/archival/bbunzip.c +++ b/archival/bbunzip.c @@ -291,18 +291,24 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv) //config: You can use the `-t' option to test the integrity of //config: an archive, without decompressing it. //config: +//config:config ZCAT +//config: bool "zcat" +//config: default y +//config: help +//config: Alias to "gunzip -c". +//config: //config:config FEATURE_GUNZIP_LONG_OPTIONS //config: bool "Enable long options" //config: default y -//config: depends on GUNZIP && LONG_OPTS +//config: depends on (GUNZIP || ZCAT) && LONG_OPTS //config: help //config: Enable use of long options. //applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP)) -//applet:IF_GUNZIP(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat)) -//kbuild:lib-$(CONFIG_GZIP) += bbunzip.o +//applet:IF_ZCAT(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat)) //kbuild:lib-$(CONFIG_GUNZIP) += bbunzip.o -#if ENABLE_GUNZIP +//kbuild:lib-$(CONFIG_ZCAT) += bbunzip.o +#if ENABLE_GUNZIP || ENABLE_ZCAT static char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM) { @@ -365,7 +371,7 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv) * Normally, "zcat" is just "gunzip -c". * But if seamless magic is enabled, then we are much more clever. */ - if (applet_name[1] == 'c') + if (ENABLE_ZCAT && applet_name[1] == 'c') option_mask32 |= OPT_STDOUT | SEAMLESS_MAGIC; return bbunpack(argv, unpack_gz_stream, make_new_name_gunzip, /*unused:*/ NULL); @@ -402,18 +408,24 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv) //config: //config: Unless you have a specific application which requires bunzip2, you //config: should probably say N here. +//config: +//config:config BZCAT +//config: bool "bzcat" +//config: default y +//config: help +//config: Alias to "bunzip2 -c". //applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) -//applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) -//kbuild:lib-$(CONFIG_BZIP2) += bbunzip.o +//applet:IF_BZCAT(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) //kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o -#if ENABLE_BUNZIP2 +//kbuild:lib-$(CONFIG_BZCAT) += bbunzip.o +#if ENABLE_BUNZIP2 || ENABLE_BZCAT int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int bunzip2_main(int argc UNUSED_PARAM, char **argv) { getopt32(argv, "cfvqdt"); argv += optind; - if (applet_name[2] == 'c') /* bzcat */ + if (ENABLE_BZCAT && applet_name[2] == 'c') /* bzcat */ option_mask32 |= OPT_STDOUT; return bbunpack(argv, unpack_bz2_stream, make_new_name_generic, "bz2"); @@ -481,27 +493,40 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv) //config: The BusyBox unlzma applet is limited to decompression only. //config: On an x86 system, this applet adds about 4K. //config: -//config:config FEATURE_LZMA_FAST -//config: bool "Optimize unlzma for speed" -//config: default n -//config: depends on UNLZMA +//config:config LZCAT +//config: bool "lzcat" +//config: default y //config: help -//config: This option reduces decompression time by about 25% at the cost of -//config: a 1K bigger binary. +//config: unlzma is a compression utility using the Lempel-Ziv-Markov chain +//config: compression algorithm, and range coding. Compression +//config: is generally considerably better than that achieved by the bzip2 +//config: compressors. +//config: +//config: The BusyBox unlzma applet is limited to decompression only. +//config: On an x86 system, this applet adds about 4K. //config: //config:config LZMA -//config: bool "Provide lzma alias which supports only unpacking" +//config: bool "lzma -d" //config: default y -//config: depends on UNLZMA //config: help //config: Enable this option if you want commands like "lzma -d" to work. //config: IOW: you'll get lzma applet, but it will always require -d option. +//config: +//config:config FEATURE_LZMA_FAST +//config: bool "Optimize unlzma for speed" +//config: default n +//config: depends on UNLZMA || LZCAT || LZMA +//config: help +//config: This option reduces decompression time by about 25% at the cost of +//config: a 1K bigger binary. //applet:IF_UNLZMA(APPLET(unlzma, BB_DIR_USR_BIN, BB_SUID_DROP)) -//applet:IF_UNLZMA(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat)) +//applet:IF_LZCAT(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat)) //applet:IF_LZMA(APPLET_ODDNAME(lzma, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzma)) //kbuild:lib-$(CONFIG_UNLZMA) += bbunzip.o -#if ENABLE_UNLZMA +//kbuild:lib-$(CONFIG_LZCAT) += bbunzip.o +//kbuild:lib-$(CONFIG_LZMA) += bbunzip.o +#if ENABLE_UNLZMA || ENABLE_LZCAT || ENABLE_LZMA int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int unlzma_main(int argc UNUSED_PARAM, char **argv) { @@ -512,7 +537,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) bb_show_usage(); # endif /* lzcat? */ - if (applet_name[2] == 'c') + if (ENABLE_LZCAT && applet_name[2] == 'c') option_mask32 |= OPT_STDOUT; argv += optind; @@ -527,19 +552,26 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv) //config: help //config: unxz is a unlzma successor. //config: +//config:config XZCAT +//config: bool "xzcat" +//config: default y +//config: help +//config: Alias to "unxz -c". +//config: //config:config XZ -//config: bool "Provide xz alias which supports only unpacking" +//config: bool "xz -d" //config: default y -//config: depends on UNXZ //config: help //config: Enable this option if you want commands like "xz -d" to work. //config: IOW: you'll get xz applet, but it will always require -d option. //applet:IF_UNXZ(APPLET(unxz, BB_DIR_USR_BIN, BB_SUID_DROP)) -//applet:IF_UNXZ(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat)) +//applet:IF_XZCAT(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat)) //applet:IF_XZ(APPLET_ODDNAME(xz, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xz)) //kbuild:lib-$(CONFIG_UNXZ) += bbunzip.o -#if ENABLE_UNXZ +//kbuild:lib-$(CONFIG_XZCAT) += bbunzip.o +//kbuild:lib-$(CONFIG_XZ) += bbunzip.o +#if ENABLE_UNXZ || ENABLE_XZCAT || ENABLE_XZ int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int unxz_main(int argc UNUSED_PARAM, char **argv) { @@ -550,7 +582,7 @@ int unxz_main(int argc UNUSED_PARAM, char **argv) bb_show_usage(); # endif /* xzcat? */ - if (applet_name[2] == 'c') + if (ENABLE_XZCAT && applet_name[2] == 'c') option_mask32 |= OPT_STDOUT; argv += optind; diff --git a/archival/lzop.c b/archival/lzop.c index 202de4d03..e0e90ac6c 100644 --- a/archival/lzop.c +++ b/archival/lzop.c @@ -31,19 +31,33 @@ //config: help //config: Lzop compression/decompresion. //config: +//config:config UNLZOP +//config: bool "unlzop" +//config: default y +//config: help +//config: Lzop decompresion. +//config: +//config:config LZOPCAT +//config: bool "lzopcat" +//config: default y +//config: help +//config: Alias to "unlzop -c". +//config: //config:config LZOP_COMPR_HIGH //config: bool "lzop compression levels 7,8,9 (not very useful)" //config: default n -//config: depends on LZOP +//config: depends on LZOP || UNLZOP || LZOPCAT //config: help //config: High levels (7,8,9) of lzop compression. These levels //config: are actually slower than gzip at equivalent compression ratios //config: and take up 3.2K of code. //applet:IF_LZOP(APPLET(lzop, BB_DIR_BIN, BB_SUID_DROP)) -//applet:IF_LZOP(APPLET_ODDNAME(lzopcat, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, lzopcat)) -//applet:IF_LZOP(APPLET_ODDNAME(unlzop, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, unlzop)) +//applet:IF_UNLZOP(APPLET_ODDNAME(unlzop, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, unlzop)) +//applet:IF_LZOPCAT(APPLET_ODDNAME(lzopcat, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, lzopcat)) //kbuild:lib-$(CONFIG_LZOP) += lzop.o +//kbuild:lib-$(CONFIG_UNLZOP) += lzop.o +//kbuild:lib-$(CONFIG_LZOPCAT) += lzop.o //usage:#define lzop_trivial_usage //usage: "[-cfvd123456789CF] [FILE]..." @@ -57,18 +71,18 @@ //usage: "\n -C Also write checksum of compressed block" //usage: //usage:#define lzopcat_trivial_usage -//usage: "[-vCF] [FILE]..." +//usage: "[-vF] [FILE]..." //usage:#define lzopcat_full_usage "\n\n" //usage: " -v Verbose" -//usage: "\n -F Don't store or verify checksum" +//usage: "\n -F Don't verify checksum" //usage: //usage:#define unlzop_trivial_usage -//usage: "[-cfvCF] [FILE]..." +//usage: "[-cfvF] [FILE]..." //usage:#define unlzop_full_usage "\n\n" //usage: " -c Write to stdout" //usage: "\n -f Force" //usage: "\n -v Verbose" -//usage: "\n -F Don't store or verify checksum" +//usage: "\n -F Don't verify checksum" #include "libbb.h" #include "common_bufsiz.h" @@ -1111,10 +1125,10 @@ int lzop_main(int argc UNUSED_PARAM, char **argv) getopt32(argv, OPTION_STRING); argv += optind; /* lzopcat? */ - if (applet_name[4] == 'c') + if (ENABLE_LZOPCAT && applet_name[4] == 'c') option_mask32 |= (OPT_STDOUT | OPT_DECOMPRESS); /* unlzop? */ - if (applet_name[4] == 'o') + if (ENABLE_UNLZOP && applet_name[4] == 'o') option_mask32 |= OPT_DECOMPRESS; global_crc32_table = crc32_filltable(NULL, 0); -- cgit v1.2.3-55-g6feb From 0581a2f3041184db1af997305908e211d3e4e34f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 16 Nov 2016 16:12:11 +0100 Subject: Make mke2fs and mkfs.ext2 individually selectable Signed-off-by: Denys Vlasenko --- include/applets.src.h | 3 --- util-linux/Config.src | 7 ------- util-linux/Kbuild.src | 1 - util-linux/mkfs_ext2.c | 20 ++++++++++++++++++++ 4 files changed, 20 insertions(+), 11 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index 36e1f0266..0293952ef 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -204,10 +204,7 @@ IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_MICROCOM(APPLET(microcom, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir)) IF_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat)) -IF_MKFS_EXT2(APPLET_ODDNAME(mke2fs, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2)) IF_MKFIFO(APPLET_NOEXEC(mkfifo, mkfifo, BB_DIR_USR_BIN, BB_SUID_DROP, mkfifo)) -IF_MKFS_EXT2(APPLET_ODDNAME(mkfs.ext2, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2)) -//IF_MKE2FS(APPLET_ODDNAME(mkfs.ext3, mke2fs, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext3)) IF_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, BB_DIR_SBIN, BB_SUID_DROP, mkfs_minix)) IF_MKFS_REISER(APPLET_ODDNAME(mkfs.reiser, mkfs_reiser, BB_DIR_SBIN, BB_SUID_DROP, mkfs_reiser)) IF_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat)) diff --git a/util-linux/Config.src b/util-linux/Config.src index ee0d8a632..72d3be1f8 100644 --- a/util-linux/Config.src +++ b/util-linux/Config.src @@ -246,13 +246,6 @@ config FSCK_MINIX check for and attempt to repair any corruption that occurs to a minix filesystem. -config MKFS_EXT2 - bool "mkfs_ext2" - default y - select PLATFORM_LINUX - help - Utility to create EXT2 filesystems. - config MKFS_MINIX bool "mkfs_minix" default y diff --git a/util-linux/Kbuild.src b/util-linux/Kbuild.src index 5ee5cf7ff..41cf77809 100644 --- a/util-linux/Kbuild.src +++ b/util-linux/Kbuild.src @@ -26,7 +26,6 @@ lib-$(CONFIG_IPCS) += ipcs.o lib-$(CONFIG_LOSETUP) += losetup.o lib-$(CONFIG_LSPCI) += lspci.o lib-$(CONFIG_LSUSB) += lsusb.o -lib-$(CONFIG_MKFS_EXT2) += mkfs_ext2.o lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o lib-$(CONFIG_MKFS_VFAT) += mkfs_vfat.o diff --git a/util-linux/mkfs_ext2.c b/util-linux/mkfs_ext2.c index 413e7aa15..5816a208e 100644 --- a/util-linux/mkfs_ext2.c +++ b/util-linux/mkfs_ext2.c @@ -7,6 +7,26 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config MKE2FS +//config: bool "mke2fs" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Utility to create EXT2 filesystems. +//config: +//config:config MKFS_EXT2 +//config: bool "mkfs.ext2" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Alias to "mke2fs". + +//applet:IF_MKE2FS(APPLET_ODDNAME(mke2fs, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2)) +//applet:IF_MKFS_EXT2(APPLET_ODDNAME(mkfs.ext2, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2)) +////////:IF_MKFS_EXT3(APPLET_ODDNAME(mkfs.ext3, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2)) + +//kbuild:lib-$(CONFIG_MKE2FS) += mkfs_ext2.o +//kbuild:lib-$(CONFIG_MKFS_EXT2) += mkfs_ext2.o //usage:#define mkfs_ext2_trivial_usage //usage: "[-Fn] " -- cgit v1.2.3-55-g6feb From 10880cc20ff424c5443a8fc6b6afa5c59c5ef602 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 16 Nov 2016 16:18:50 +0100 Subject: Make mkfs.vfat and mkdosfs individually selectable Signed-off-by: Denys Vlasenko --- include/applets.src.h | 2 -- util-linux/Config.src | 7 ------- util-linux/Kbuild.src | 1 - util-linux/mkfs_vfat.c | 19 +++++++++++++++++++ 4 files changed, 19 insertions(+), 10 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index 0293952ef..f834d9040 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -203,11 +203,9 @@ IF_MAN(APPLET(man, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_MICROCOM(APPLET(microcom, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir)) -IF_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat)) IF_MKFIFO(APPLET_NOEXEC(mkfifo, mkfifo, BB_DIR_USR_BIN, BB_SUID_DROP, mkfifo)) IF_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, BB_DIR_SBIN, BB_SUID_DROP, mkfs_minix)) IF_MKFS_REISER(APPLET_ODDNAME(mkfs.reiser, mkfs_reiser, BB_DIR_SBIN, BB_SUID_DROP, mkfs_reiser)) -IF_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat)) IF_MKNOD(APPLET_NOEXEC(mknod, mknod, BB_DIR_BIN, BB_SUID_DROP, mknod)) IF_MKSWAP(APPLET(mkswap, BB_DIR_SBIN, BB_SUID_DROP)) IF_MORE(APPLET(more, BB_DIR_BIN, BB_SUID_DROP)) diff --git a/util-linux/Config.src b/util-linux/Config.src index 72d3be1f8..9bef0d532 100644 --- a/util-linux/Config.src +++ b/util-linux/Config.src @@ -272,13 +272,6 @@ config MKFS_REISER Utility to create ReiserFS filesystems. Note: this applet needs a lot of testing and polishing. -config MKFS_VFAT - bool "mkfs_vfat" - default y - select PLATFORM_LINUX - help - Utility to create FAT32 filesystems. - config GETOPT bool "getopt" default y diff --git a/util-linux/Kbuild.src b/util-linux/Kbuild.src index 41cf77809..dfd50afa2 100644 --- a/util-linux/Kbuild.src +++ b/util-linux/Kbuild.src @@ -28,7 +28,6 @@ lib-$(CONFIG_LSPCI) += lspci.o lib-$(CONFIG_LSUSB) += lsusb.o lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o -lib-$(CONFIG_MKFS_VFAT) += mkfs_vfat.o lib-$(CONFIG_MKSWAP) += mkswap.o lib-$(CONFIG_MORE) += more.o lib-$(CONFIG_MOUNT) += mount.o diff --git a/util-linux/mkfs_vfat.c b/util-linux/mkfs_vfat.c index d53c751eb..ab70853a1 100644 --- a/util-linux/mkfs_vfat.c +++ b/util-linux/mkfs_vfat.c @@ -7,6 +7,25 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config MKDOSFS +//config: bool "mkdosfs" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Utility to create FAT32 filesystems. +//config: +//config:config MKFS_VFAT +//config: bool "mkfs.vfat" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Alias to "mkdosfs". + +//applet:IF_MKDOSFS(APPLET_ODDNAME(mkdosfs, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat)) +//applet:IF_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat)) + +//kbuild:lib-$(CONFIG_MKDOSFS) += mkfs_vfat.o +//kbuild:lib-$(CONFIG_MKFS_VFAT) += mkfs_vfat.o //usage:#define mkfs_vfat_trivial_usage //usage: "[-v] [-n LABEL] BLOCKDEV [KBYTES]" -- cgit v1.2.3-55-g6feb From f4d0f4e7a9715375bfa4bcfb7ce26a967c78ca9e Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 17 Nov 2016 15:34:16 +0100 Subject: applets.h.sh: a script to check applet names against config options Signed-off-by: Denys Vlasenko --- include/applets.h.sh | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100755 include/applets.h.sh diff --git a/include/applets.h.sh b/include/applets.h.sh new file mode 100755 index 000000000..6b8046c4b --- /dev/null +++ b/include/applets.h.sh @@ -0,0 +1,20 @@ +#!/bin/sh +# +# This script allows to check whether every applet has a separate option +# enabling it. Run it after applets.h is generated. + +# CONFIG_applet names +grep ^IF_ applets.h | grep -v IF_FEATURE_ | sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \ +| grep -v MODPROBE_SMALL | sed 's/BB_SYSCTL/SYSCTL/' \ +| sort | uniq \ +>applets_APP1 + +# command line applet names +grep ^IF_ applets.h | sed -e's/ //g' -e's/.*(\([a-z[][^,]*\),.*/\1/' \ +| grep -v '^bash$' | grep -v '^sh$' \ +| tr a-z A-Z \ +| sort | uniq \ +>applets_APP2 + +diff -u applets_APP1 applets_APP2 >applets_APP.diff +rm applets_APP1 applets_APP2 -- cgit v1.2.3-55-g6feb From 7e8218f9b26946ec3b411bc25a62b6b4278f2386 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 18 Nov 2016 21:42:44 +0100 Subject: Fix allnoconfig warnings Signed-off-by: Denys Vlasenko --- libbb/appletlib.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/libbb/appletlib.c b/libbb/appletlib.c index 2d01a3ae7..bb7e905db 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -883,20 +883,21 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv) } # endif /* NUM_APPLETS > 0 */ +# if ENABLE_BUSYBOX || NUM_APPLETS > 0 static NORETURN void run_applet_and_exit(const char *name, char **argv) { -# if ENABLE_BUSYBOX +# if ENABLE_BUSYBOX if (is_prefixed_with(name, "busybox")) exit(busybox_main(argv)); -# endif -# if NUM_APPLETS > 0 +# endif +# if NUM_APPLETS > 0 /* find_applet_by_name() search is more expensive, so goes second */ { int applet = find_applet_by_name(name); if (applet >= 0) run_applet_no_and_exit(applet, argv); } -# endif +# endif /*bb_error_msg_and_die("applet not found"); - links in printf */ full_write2_str(applet_name); @@ -904,11 +905,11 @@ static NORETURN void run_applet_and_exit(const char *name, char **argv) /* POSIX: "If a command is not found, the exit status shall be 127" */ exit(127); } +# endif #endif /* !defined(SINGLE_APPLET_MAIN) */ - #if ENABLE_BUILD_LIBBUSYBOX int lbb_main(char **argv) #else @@ -960,6 +961,7 @@ int main(int argc UNUSED_PARAM, char **argv) #endif #if defined(SINGLE_APPLET_MAIN) + /* Only one applet is selected in .config */ if (argv[1] && is_prefixed_with(argv[0], "busybox")) { /* "busybox " should still work as expected */ @@ -968,9 +970,16 @@ int main(int argc UNUSED_PARAM, char **argv) /* applet_names in this case is just "applet\0\0" */ lbb_prepare(applet_names IF_FEATURE_INDIVIDUAL(, argv)); return SINGLE_APPLET_MAIN(argc, argv); + +#elif !ENABLE_BUSYBOX && NUM_APPLETS == 0 + + full_write2_str(bb_basename(argv[0])); + full_write2_str(": no applets enabled\n"); + exit(127); + #else - lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv)); + lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv)); # if !ENABLE_BUSYBOX if (argv[1] && is_prefixed_with(bb_basename(argv[0]), "busybox")) argv++; @@ -979,9 +988,8 @@ int main(int argc UNUSED_PARAM, char **argv) if (applet_name[0] == '-') applet_name++; applet_name = bb_basename(applet_name); - parse_config_file(); /* ...maybe, if FEATURE_SUID_CONFIG */ - run_applet_and_exit(applet_name, argv); + #endif } -- cgit v1.2.3-55-g6feb From 9f8eb1ee7620020e01b3596ac7259d51ebca7a7b Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 22 Nov 2016 02:23:35 +0100 Subject: httpd: explain why we use sprintf and why it should be fine While at it, fix a pathological case where it is not fine: -r REALM with some 8-kbyte long REALM would overflow the buffer. Signed-off-by: Denys Vlasenko --- networking/httpd.c | 56 +++++++++++++++++++++++++++++++++++------------------- 1 file changed, 36 insertions(+), 20 deletions(-) diff --git a/networking/httpd.c b/networking/httpd.c index abe83a458..c20642e11 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -926,16 +926,16 @@ static void log_and_exit(void) static void send_headers(int responseNum) { static const char RFC1123FMT[] ALIGN1 = "%a, %d %b %Y %H:%M:%S GMT"; + /* Fixed size 29-byte string. Example: Sun, 06 Nov 1994 08:49:37 GMT */ + char date_str[40]; /* using a bit larger buffer to paranoia reasons */ const char *responseString = ""; const char *infoString = NULL; - const char *mime_type; #if ENABLE_FEATURE_HTTPD_ERROR_PAGES const char *error_page = NULL; #endif unsigned i; time_t timer = time(NULL); - char tmp_str[80]; int len; for (i = 0; i < ARRAY_SIZE(http_response_type); i++) { @@ -948,25 +948,33 @@ static void send_headers(int responseNum) break; } } - /* error message is HTML */ - mime_type = responseNum == HTTP_OK ? - found_mime_type : "text/html"; if (verbose) bb_error_msg("response:%u", responseNum); - /* emit the current date */ - strftime(tmp_str, sizeof(tmp_str), RFC1123FMT, gmtime(&timer)); + /* We use sprintf, not snprintf (it's less code). + * iobuf[] is several kbytes long and all headers we generate + * always fit into those kbytes. + */ + + strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime(&timer)); len = sprintf(iobuf, - "HTTP/1.0 %d %s\r\nContent-type: %s\r\n" - "Date: %s\r\nConnection: close\r\n", - responseNum, responseString, mime_type, tmp_str); + "HTTP/1.0 %d %s\r\n" + "Content-type: %s\r\n" + "Date: %s\r\n" + "Connection: close\r\n", + responseNum, responseString, + /* if it's error message, then it's HTML */ + (responseNum == HTTP_OK ? found_mime_type : "text/html"), + date_str + ); #if ENABLE_FEATURE_HTTPD_BASIC_AUTH if (responseNum == HTTP_UNAUTHORIZED) { len += sprintf(iobuf + len, - "WWW-Authenticate: Basic realm=\"%s\"\r\n", - g_realm); + "WWW-Authenticate: Basic realm=\"%.999s\"\r\n", + g_realm /* %.999s protects from overflowing iobuf[] */ + ); } #endif if (responseNum == HTTP_MOVED_TEMPORARILY) { @@ -981,7 +989,8 @@ static void send_headers(int responseNum) "Location: %s/%s%s\r\n", found_moved_temporarily, (g_query ? "?" : ""), - (g_query ? g_query : "")); + (g_query ? g_query : "") + ); if (len > IOBUF_SIZE-3) len = IOBUF_SIZE-3; } @@ -1002,13 +1011,15 @@ static void send_headers(int responseNum) #endif if (file_size != -1) { /* file */ - strftime(tmp_str, sizeof(tmp_str), RFC1123FMT, gmtime(&last_mod)); + strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime(&last_mod)); #if ENABLE_FEATURE_HTTPD_RANGES if (responseNum == HTTP_PARTIAL_CONTENT) { - len += sprintf(iobuf + len, "Content-Range: bytes %"OFF_FMT"u-%"OFF_FMT"u/%"OFF_FMT"u\r\n", + len += sprintf(iobuf + len, + "Content-Range: bytes %"OFF_FMT"u-%"OFF_FMT"u/%"OFF_FMT"u\r\n", range_start, range_end, - file_size); + file_size + ); file_size = range_end - range_start + 1; } #endif @@ -1016,8 +1027,9 @@ static void send_headers(int responseNum) #if ENABLE_FEATURE_HTTPD_RANGES "Accept-Ranges: bytes\r\n" #endif - "Last-Modified: %s\r\n%s %"OFF_FMT"u\r\n", - tmp_str, + "Last-Modified: %s\r\n" + "%s %"OFF_FMT"u\r\n", + date_str, content_gzip ? "Transfer-length:" : "Content-length:", file_size ); @@ -1031,9 +1043,13 @@ static void send_headers(int responseNum) if (infoString) { len += sprintf(iobuf + len, "%d %s\n" - "

%d %s

\n%s\n\n", + "

%d %s

\n" + "%s\n" + "\n", responseNum, responseString, - responseNum, responseString, infoString); + responseNum, responseString, + infoString + ); } if (DEBUG) { iobuf[len] = '\0'; -- cgit v1.2.3-55-g6feb From fb4da167114e96d7f20ef97474f976f8ffa604e7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 22 Nov 2016 23:14:24 +0100 Subject: Split miscutils/Config.src items into miscutils/*.c files Signed-off-by: Denys Vlasenko --- miscutils/Config.src | 524 ------------------------------------------ miscutils/adjtimex.c | 7 + miscutils/bbconfig.c | 20 ++ miscutils/beep.c | 22 ++ miscutils/chat.c | 66 ++++++ miscutils/chrt.c | 6 + miscutils/conspy.c | 9 +- miscutils/crontab.c | 8 + miscutils/dc.c | 22 +- miscutils/devfsd.c | 56 +++++ miscutils/devmem.c | 6 + miscutils/eject.c | 14 ++ miscutils/fbsplash.c | 21 ++ miscutils/flash_eraseall.c | 6 + miscutils/flash_lock_unlock.c | 13 ++ miscutils/flashcp.c | 6 + miscutils/hdparm.c | 58 +++++ miscutils/inotifyd.c | 6 + miscutils/ionice.c | 7 + miscutils/last.c | 14 ++ miscutils/makedevs.c | 31 +++ miscutils/man.c | 5 + miscutils/microcom.c | 5 + miscutils/mountpoint.c | 5 + miscutils/mt.c | 7 + miscutils/raidautorun.c | 7 + miscutils/readahead.c | 17 ++ miscutils/runlevel.c | 9 + miscutils/rx.c | 6 + miscutils/setsid.c | 5 + miscutils/strings.c | 6 + miscutils/time.c | 7 + miscutils/timeout.c | 6 + miscutils/ttysize.c | 8 + miscutils/volname.c | 5 + miscutils/watchdog.c | 11 + 36 files changed, 498 insertions(+), 533 deletions(-) diff --git a/miscutils/Config.src b/miscutils/Config.src index 06f1c52ba..7325fb8fa 100644 --- a/miscutils/Config.src +++ b/miscutils/Config.src @@ -7,528 +7,4 @@ menu "Miscellaneous Utilities" INSERT -config ADJTIMEX - bool "adjtimex" - default y - select PLATFORM_LINUX - help - Adjtimex reads and optionally sets adjustment parameters for - the Linux clock adjustment algorithm. - -config BBCONFIG - bool "bbconfig" - default n - help - The bbconfig applet will print the config file with which - busybox was built. - -config FEATURE_COMPRESS_BBCONFIG - bool "Compress bbconfig data" - default y - depends on BBCONFIG - help - Store bbconfig data in compressed form, uncompress them on-the-fly - before output. - - If you have a really tiny busybox with few applets enabled (and - bunzip2 isn't one of them), the overhead of the decompressor might - be noticeable. Also, if you run executables directly from ROM - and have very little memory, this might not be a win. Otherwise, - you probably want this. - -config BEEP - bool "beep" - default y - select PLATFORM_LINUX - help - The beep applets beeps in a given freq/Hz. - -config FEATURE_BEEP_FREQ - int "default frequency" - range 0 2147483647 - default 4000 - depends on BEEP - help - Frequency for default beep. - -config FEATURE_BEEP_LENGTH_MS - int "default length" - range 0 2147483647 - default 30 - depends on BEEP - help - Length in ms for default beep. - -config CHAT - bool "chat" - default y - help - Simple chat utility. - -config FEATURE_CHAT_NOFAIL - bool "Enable NOFAIL expect strings" - depends on CHAT - default y - help - When enabled expect strings which are started with a dash trigger - no-fail mode. That is when expectation is not met within timeout - the script is not terminated but sends next SEND string and waits - for next EXPECT string. This allows to compose far more flexible - scripts. - -config FEATURE_CHAT_TTY_HIFI - bool "Force STDIN to be a TTY" - depends on CHAT - default n - help - Original chat always treats STDIN as a TTY device and sets for it - so-called raw mode. This option turns on such behaviour. - -config FEATURE_CHAT_IMPLICIT_CR - bool "Enable implicit Carriage Return" - depends on CHAT - default y - help - When enabled make chat to terminate all SEND strings with a "\r" - unless "\c" is met anywhere in the string. - -config FEATURE_CHAT_SWALLOW_OPTS - bool "Swallow options" - depends on CHAT - default y - help - Busybox chat require no options. To make it not fail when used - in place of original chat (which has a bunch of options) turn - this on. - -config FEATURE_CHAT_SEND_ESCAPES - bool "Support weird SEND escapes" - depends on CHAT - default y - help - Original chat uses some escape sequences in SEND arguments which - are not sent to device but rather performs special actions. - E.g. "\K" means to send a break sequence to device. - "\d" delays execution for a second, "\p" -- for a 1/100 of second. - Before turning this option on think twice: do you really need them? - -config FEATURE_CHAT_VAR_ABORT_LEN - bool "Support variable-length ABORT conditions" - depends on CHAT - default y - help - Original chat uses fixed 50-bytes length ABORT conditions. Say N here. - -config FEATURE_CHAT_CLR_ABORT - bool "Support revoking of ABORT conditions" - depends on CHAT - default y - help - Support CLR_ABORT directive. - -config CHRT - bool "chrt" - default y - help - manipulate real-time attributes of a process. - This requires sched_{g,s}etparam support in your libc. - -config CRONTAB - bool "crontab" - default y - help - Crontab manipulates the crontab for a particular user. Only - the superuser may specify a different user and/or crontab directory. - Note that Busybox binary must be setuid root for this applet to - work properly. - -config DC - bool "dc" - default y - help - Dc is a reverse-polish desk calculator which supports unlimited - precision arithmetic. - -config FEATURE_DC_LIBM - bool "Enable power and exp functions (requires libm)" - default y - depends on DC - help - Enable power and exp functions. - NOTE: This will require libm to be present for linking. - -config DEVFSD - bool "devfsd (obsolete)" - default n - select PLATFORM_LINUX - select FEATURE_SYSLOG - help - This is deprecated and should NOT be used anymore. - Use linux >= 2.6 (optionally with hotplug) and mdev instead! - See docs/mdev.txt for detailed instructions on how to use mdev - instead. - - Provides compatibility with old device names on a devfs systems. - You should set it to true if you have devfs enabled. - The following keywords in devsfd.conf are supported: - "CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE", "RESTORE", - "PERMISSIONS", "EXECUTE", "COPY", "IGNORE", - "MKOLDCOMPAT", "MKNEWCOMPAT","RMOLDCOMPAT", "RMNEWCOMPAT". - - But only if they are written UPPERCASE!!!!!!!! - -config DEVFSD_MODLOAD - bool "Adds support for MODLOAD keyword in devsfd.conf" - default y - depends on DEVFSD - help - This actually doesn't work with busybox modutils but needs - the external modutils. - -config DEVFSD_FG_NP - bool "Enables the -fg and -np options" - default y - depends on DEVFSD - help - -fg Run the daemon in the foreground. - -np Exit after parsing the configuration file. - Do not poll for events. - -config DEVFSD_VERBOSE - bool "Increases logging (and size)" - default y - depends on DEVFSD - help - Increases logging to stderr or syslog. - -config FEATURE_DEVFS - bool "Use devfs names for all devices (obsolete)" - default n - select PLATFORM_LINUX - help - This is obsolete and should NOT be used anymore. - Use linux >= 2.6 (optionally with hotplug) and mdev instead! - - For legacy systems -- if there is no way around devfsd -- this - tells busybox to look for names like /dev/loop/0 instead of - /dev/loop0. If your /dev directory has normal names instead of - devfs names, you don't want this. - -config DEVMEM - bool "devmem" - default y - help - devmem is a small program that reads and writes from physical - memory using /dev/mem. - -config EJECT - bool "eject" - default y - select PLATFORM_LINUX - help - Used to eject cdroms. (defaults to /dev/cdrom) - -config FEATURE_EJECT_SCSI - bool "SCSI support" - default y - depends on EJECT - help - Add the -s option to eject, this allows to eject SCSI-Devices and - usb-storage devices. - -config FBSPLASH - bool "fbsplash" - default y - select PLATFORM_LINUX - help - Shows splash image and progress bar on framebuffer device. - Can be used during boot phase of an embedded device. ~2kb. - Usage: - - use kernel option 'vga=xxx' or otherwise enable fb device. - - put somewhere fbsplash.cfg file and an image in .ppm format. - - $ setsid fbsplash [params] & - -c: hide cursor - -d /dev/fbN: framebuffer device (if not /dev/fb0) - -s path_to_image_file (can be "-" for stdin) - -i path_to_cfg_file (can be "-" for stdin) - -f path_to_fifo (can be "-" for stdin) - - if you want to run it only in presence of kernel parameter: - grep -q "fbsplash=on" = 2.6.13 - -config INOTIFYD - bool "inotifyd" - default n # doesn't build on Knoppix 5 - help - Simple inotify daemon. Reports filesystem changes. Requires - kernel >= 2.6.13 - -config LAST - bool "last" - default y - depends on FEATURE_WTMP - help - 'last' displays a list of the last users that logged into the system. - -config FEATURE_LAST_FANCY - bool "Turn on output of extra information" - default y - depends on LAST - help - 'last' displays detailed information about the last users that - logged into the system (mimics sysvinit last). +900 bytes. - -config HDPARM - bool "hdparm" - default y - select PLATFORM_LINUX - help - Get/Set hard drive parameters. Primarily intended for ATA - drives. Adds about 13k (or around 30k if you enable the - FEATURE_HDPARM_GET_IDENTITY option).... - -config FEATURE_HDPARM_GET_IDENTITY - bool "Support obtaining detailed information directly from drives" - default y - depends on HDPARM - help - Enables the -I and -i options to obtain detailed information - directly from drives about their capabilities and supported ATA - feature set. If no device name is specified, hdparm will read - identify data from stdin. Enabling this option will add about 16k... - -config FEATURE_HDPARM_HDIO_SCAN_HWIF - bool "Register an IDE interface (DANGEROUS)" - default y - depends on HDPARM - help - Enables the 'hdparm -R' option to register an IDE interface. - This is dangerous stuff, so you should probably say N. - -config FEATURE_HDPARM_HDIO_UNREGISTER_HWIF - bool "Un-register an IDE interface (DANGEROUS)" - default y - depends on HDPARM - help - Enables the 'hdparm -U' option to un-register an IDE interface. - This is dangerous stuff, so you should probably say N. - -config FEATURE_HDPARM_HDIO_DRIVE_RESET - bool "Perform device reset (DANGEROUS)" - default y - depends on HDPARM - help - Enables the 'hdparm -w' option to perform a device reset. - This is dangerous stuff, so you should probably say N. - -config FEATURE_HDPARM_HDIO_TRISTATE_HWIF - bool "Tristate device for hotswap (DANGEROUS)" - default y - depends on HDPARM - help - Enables the 'hdparm -x' option to tristate device for hotswap, - and the '-b' option to get/set bus state. This is dangerous - stuff, so you should probably say N. - -config FEATURE_HDPARM_HDIO_GETSET_DMA - bool "Get/set using_dma flag" - default y - depends on HDPARM - help - Enables the 'hdparm -d' option to get/set using_dma flag. - -config MAKEDEVS - bool "makedevs" - default y - help - 'makedevs' is a utility used to create a batch of devices with - one command. - - There are two choices for command line behaviour, the interface - as used by LEAF/Linux Router Project, or a device table file. - - 'leaf' is traditionally what busybox follows, it allows multiple - devices of a particluar type to be created per command. - e.g. /dev/hda[0-9] - Device properties are passed as command line arguments. - - 'table' reads device properties from a file or stdin, allowing - a batch of unrelated devices to be made with one command. - User/group names are allowed as an alternative to uid/gid. - -choice - prompt "Choose makedevs behaviour" - depends on MAKEDEVS - default FEATURE_MAKEDEVS_TABLE - -config FEATURE_MAKEDEVS_LEAF - bool "leaf" - -config FEATURE_MAKEDEVS_TABLE - bool "table" - -endchoice - -config MAN - bool "man" - default y - help - Format and display manual pages. - -config MICROCOM - bool "microcom" - default y - help - The poor man's minicom utility for chatting with serial port devices. - -config MOUNTPOINT - bool "mountpoint" - default y - help - mountpoint checks if the directory is a mountpoint. - -config MT - bool "mt" - default y - help - mt is used to control tape devices. You can use the mt utility - to advance or rewind a tape past a specified number of archive - files on the tape. - -config RAIDAUTORUN - bool "raidautorun" - default y - select PLATFORM_LINUX - help - raidautorun tells the kernel md driver to - search and start RAID arrays. - -config READAHEAD - bool "readahead" - default y - depends on LFS - select PLATFORM_LINUX - help - Preload the files listed on the command line into RAM cache so that - subsequent reads on these files will not block on disk I/O. - - This applet just calls the readahead(2) system call on each file. - It is mainly useful in system startup scripts to preload files - or executables before they are used. When used at the right time - (in particular when a CPU bound process is running) it can - significantly speed up system startup. - - As readahead(2) blocks until each file has been read, it is best to - run this applet as a background job. - -config RUNLEVEL - bool "runlevel" - default y - depends on FEATURE_UTMP - help - find the current and previous system runlevel. - - This applet uses utmp but does not rely on busybox supporing - utmp on purpose. It is used by e.g. emdebian via /etc/init.d/rc. - -config RX - bool "rx" - default y - select PLATFORM_LINUX - help - Receive files using the Xmodem protocol. - -config SETSID - bool "setsid" - default y - help - setsid runs a program in a new session - -config STRINGS - bool "strings" - default y - help - strings prints the printable character sequences for each file - specified. - -config TIME - bool "time" - default y - help - The time command runs the specified program with the given arguments. - When the command finishes, time writes a message to standard output - giving timing statistics about this program run. - -config TIMEOUT - bool "timeout" - default y - help - Runs a program and watches it. If it does not terminate in - specified number of seconds, it is sent a signal. - -config TTYSIZE - bool "ttysize" - default y - help - A replacement for "stty size". Unlike stty, can report only width, - only height, or both, in any order. It also does not complain on - error, but returns default 80x24. - Usage in shell scripts: width=`ttysize w`. - -config VOLNAME - bool "volname" - default y - help - Prints a CD-ROM volume name. - -config WATCHDOG - bool "watchdog" - default y - select PLATFORM_LINUX - help - The watchdog utility is used with hardware or software watchdog - device drivers. It opens the specified watchdog device special file - and periodically writes a magic character to the device. If the - watchdog applet ever fails to write the magic character within a - certain amount of time, the watchdog device assumes the system has - hung, and will cause the hardware to reboot. - endmenu diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c index 058aa9a5c..f9d7c949d 100644 --- a/miscutils/adjtimex.c +++ b/miscutils/adjtimex.c @@ -10,6 +10,13 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config ADJTIMEX +//config: bool "adjtimex" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Adjtimex reads and optionally sets adjustment parameters for +//config: the Linux clock adjustment algorithm. //usage:#define adjtimex_trivial_usage //usage: "[-q] [-o OFF] [-f FREQ] [-p TCONST] [-t TICK]" diff --git a/miscutils/bbconfig.c b/miscutils/bbconfig.c index e5f4eb379..8a709f9d3 100644 --- a/miscutils/bbconfig.c +++ b/miscutils/bbconfig.c @@ -1,6 +1,26 @@ /* vi: set sw=4 ts=4: */ /* This file was released into the public domain by Paul Fox. */ +//config:config BBCONFIG +//config: bool "bbconfig" +//config: default n +//config: help +//config: The bbconfig applet will print the config file with which +//config: busybox was built. +//config: +//config:config FEATURE_COMPRESS_BBCONFIG +//config: bool "Compress bbconfig data" +//config: default y +//config: depends on BBCONFIG +//config: help +//config: Store bbconfig data in compressed form, uncompress them on-the-fly +//config: before output. +//config: +//config: If you have a really tiny busybox with few applets enabled (and +//config: bunzip2 isn't one of them), the overhead of the decompressor might +//config: be noticeable. Also, if you run executables directly from ROM +//config: and have very little memory, this might not be a win. Otherwise, +//config: you probably want this. //usage:#define bbconfig_trivial_usage //usage: "" diff --git a/miscutils/beep.c b/miscutils/beep.c index 18b160cc4..f6fa8348d 100644 --- a/miscutils/beep.c +++ b/miscutils/beep.c @@ -7,6 +7,28 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. * */ +//config:config BEEP +//config: bool "beep" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: The beep applets beeps in a given freq/Hz. +//config: +//config:config FEATURE_BEEP_FREQ +//config: int "default frequency" +//config: range 0 2147483647 +//config: default 4000 +//config: depends on BEEP +//config: help +//config: Frequency for default beep. +//config: +//config:config FEATURE_BEEP_LENGTH_MS +//config: int "default length" +//config: range 0 2147483647 +//config: default 30 +//config: depends on BEEP +//config: help +//config: Length in ms for default beep. //usage:#define beep_trivial_usage //usage: "-f FREQ -l LEN -d DELAY -r COUNT -n" diff --git a/miscutils/chat.c b/miscutils/chat.c index 6b429f2a6..92a23441c 100644 --- a/miscutils/chat.c +++ b/miscutils/chat.c @@ -7,6 +7,72 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config CHAT +//config: bool "chat" +//config: default y +//config: help +//config: Simple chat utility. +//config: +//config:config FEATURE_CHAT_NOFAIL +//config: bool "Enable NOFAIL expect strings" +//config: depends on CHAT +//config: default y +//config: help +//config: When enabled expect strings which are started with a dash trigger +//config: no-fail mode. That is when expectation is not met within timeout +//config: the script is not terminated but sends next SEND string and waits +//config: for next EXPECT string. This allows to compose far more flexible +//config: scripts. +//config: +//config:config FEATURE_CHAT_TTY_HIFI +//config: bool "Force STDIN to be a TTY" +//config: depends on CHAT +//config: default n +//config: help +//config: Original chat always treats STDIN as a TTY device and sets for it +//config: so-called raw mode. This option turns on such behaviour. +//config: +//config:config FEATURE_CHAT_IMPLICIT_CR +//config: bool "Enable implicit Carriage Return" +//config: depends on CHAT +//config: default y +//config: help +//config: When enabled make chat to terminate all SEND strings with a "\r" +//config: unless "\c" is met anywhere in the string. +//config: +//config:config FEATURE_CHAT_SWALLOW_OPTS +//config: bool "Swallow options" +//config: depends on CHAT +//config: default y +//config: help +//config: Busybox chat require no options. To make it not fail when used +//config: in place of original chat (which has a bunch of options) turn +//config: this on. +//config: +//config:config FEATURE_CHAT_SEND_ESCAPES +//config: bool "Support weird SEND escapes" +//config: depends on CHAT +//config: default y +//config: help +//config: Original chat uses some escape sequences in SEND arguments which +//config: are not sent to device but rather performs special actions. +//config: E.g. "\K" means to send a break sequence to device. +//config: "\d" delays execution for a second, "\p" -- for a 1/100 of second. +//config: Before turning this option on think twice: do you really need them? +//config: +//config:config FEATURE_CHAT_VAR_ABORT_LEN +//config: bool "Support variable-length ABORT conditions" +//config: depends on CHAT +//config: default y +//config: help +//config: Original chat uses fixed 50-bytes length ABORT conditions. Say N here. +//config: +//config:config FEATURE_CHAT_CLR_ABORT +//config: bool "Support revoking of ABORT conditions" +//config: depends on CHAT +//config: default y +//config: help +//config: Support CLR_ABORT directive. //usage:#define chat_trivial_usage //usage: "EXPECT [SEND [EXPECT [SEND...]]]" diff --git a/miscutils/chrt.c b/miscutils/chrt.c index f2f559fd7..d76c0d152 100644 --- a/miscutils/chrt.c +++ b/miscutils/chrt.c @@ -5,6 +5,12 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config CHRT +//config: bool "chrt" +//config: default y +//config: help +//config: manipulate real-time attributes of a process. +//config: This requires sched_{g,s}etparam support in your libc. //usage:#define chrt_trivial_usage //usage: "[-prfom] [PRIO] [PID | PROG ARGS]" diff --git a/miscutils/conspy.c b/miscutils/conspy.c index e80158e39..d9d09d482 100644 --- a/miscutils/conspy.c +++ b/miscutils/conspy.c @@ -9,11 +9,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - -//applet:IF_CONSPY(APPLET(conspy, BB_DIR_BIN, BB_SUID_DROP)) - -//kbuild:lib-$(CONFIG_CONSPY) += conspy.o - //config:config CONSPY //config: bool "conspy" //config: default y @@ -24,6 +19,10 @@ //config: or conspy -nd NUM screenshot of console num //config: or conspy -cs NUM poor man's GNU screen like +//applet:IF_CONSPY(APPLET(conspy, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_CONSPY) += conspy.o + //usage:#define conspy_trivial_usage //usage: "[-vcsndfFQ] [-x COL] [-y LINE] [CONSOLE_NO]" //usage:#define conspy_full_usage "\n\n" diff --git a/miscutils/crontab.c b/miscutils/crontab.c index 85c6623b2..bcd2eab33 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c @@ -9,6 +9,14 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config CRONTAB +//config: bool "crontab" +//config: default y +//config: help +//config: Crontab manipulates the crontab for a particular user. Only +//config: the superuser may specify a different user and/or crontab directory. +//config: Note that Busybox binary must be setuid root for this applet to +//config: work properly. //usage:#define crontab_trivial_usage //usage: "[-c DIR] [-u USER] [-ler]|[FILE]" diff --git a/miscutils/dc.c b/miscutils/dc.c index 4d92bc3d0..2b77cd614 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c @@ -2,10 +2,20 @@ /* * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - -#include "libbb.h" -#include "common_bufsiz.h" -#include +//config:config DC +//config: bool "dc" +//config: default y +//config: help +//config: Dc is a reverse-polish desk calculator which supports unlimited +//config: precision arithmetic. +//config: +//config:config FEATURE_DC_LIBM +//config: bool "Enable power and exp functions (requires libm)" +//config: default y +//config: depends on DC +//config: help +//config: Enable power and exp functions. +//config: NOTE: This will require libm to be present for linking. //usage:#define dc_trivial_usage //usage: "EXPRESSION..." @@ -30,6 +40,10 @@ //usage: "$ echo 72 9 div 8 mul p | dc\n" //usage: "64\n" +#include "libbb.h" +#include "common_bufsiz.h" +#include + #if 0 typedef unsigned data_t; #define DATA_FMT "" diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 6217918da..361f3666f 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c @@ -53,6 +53,62 @@ The postal address is: Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. */ +//config:config DEVFSD +//config: bool "devfsd (obsolete)" +//config: default n +//config: select PLATFORM_LINUX +//config: select FEATURE_SYSLOG +//config: help +//config: This is deprecated and should NOT be used anymore. +//config: Use linux >= 2.6 (optionally with hotplug) and mdev instead! +//config: See docs/mdev.txt for detailed instructions on how to use mdev +//config: instead. +//config: +//config: Provides compatibility with old device names on a devfs systems. +//config: You should set it to true if you have devfs enabled. +//config: The following keywords in devsfd.conf are supported: +//config: "CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE", "RESTORE", +//config: "PERMISSIONS", "EXECUTE", "COPY", "IGNORE", +//config: "MKOLDCOMPAT", "MKNEWCOMPAT","RMOLDCOMPAT", "RMNEWCOMPAT". +//config: +//config: But only if they are written UPPERCASE!!!!!!!! +//config: +//config:config DEVFSD_MODLOAD +//config: bool "Adds support for MODLOAD keyword in devsfd.conf" +//config: default y +//config: depends on DEVFSD +//config: help +//config: This actually doesn't work with busybox modutils but needs +//config: the external modutils. +//config: +//config:config DEVFSD_FG_NP +//config: bool "Enables the -fg and -np options" +//config: default y +//config: depends on DEVFSD +//config: help +//config: -fg Run the daemon in the foreground. +//config: -np Exit after parsing the configuration file. +//config: Do not poll for events. +//config: +//config:config DEVFSD_VERBOSE +//config: bool "Increases logging (and size)" +//config: default y +//config: depends on DEVFSD +//config: help +//config: Increases logging to stderr or syslog. +//config: +//config:config FEATURE_DEVFS +//config: bool "Use devfs names for all devices (obsolete)" +//config: default n +//config: select PLATFORM_LINUX +//config: help +//config: This is obsolete and should NOT be used anymore. +//config: Use linux >= 2.6 (optionally with hotplug) and mdev instead! +//config: +//config: For legacy systems -- if there is no way around devfsd -- this +//config: tells busybox to look for names like /dev/loop/0 instead of +//config: /dev/loop0. If your /dev directory has normal names instead of +//config: devfs names, you don't want this. //usage:#define devfsd_trivial_usage //usage: "mntpnt [-v]" IF_DEVFSD_FG_NP("[-fg][-np]") diff --git a/miscutils/devmem.c b/miscutils/devmem.c index 786a21bee..dd6574e93 100644 --- a/miscutils/devmem.c +++ b/miscutils/devmem.c @@ -3,6 +3,12 @@ * Copyright (C) 2000, Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl) * Copyright (C) 2008, BusyBox Team. -solar 4/26/08 */ +//config:config DEVMEM +//config: bool "devmem" +//config: default y +//config: help +//config: devmem is a small program that reads and writes from physical +//config: memory using /dev/mem. //usage:#define devmem_trivial_usage //usage: "ADDRESS [WIDTH [VALUE]]" diff --git a/miscutils/eject.c b/miscutils/eject.c index 16ae250ff..d271066ad 100644 --- a/miscutils/eject.c +++ b/miscutils/eject.c @@ -12,6 +12,20 @@ * This is a simple hack of eject based on something Erik posted in #uclibc. * Most of the dirty work blatantly ripped off from cat.c =) */ +//config:config EJECT +//config: bool "eject" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Used to eject cdroms. (defaults to /dev/cdrom) +//config: +//config:config FEATURE_EJECT_SCSI +//config: bool "SCSI support" +//config: default y +//config: depends on EJECT +//config: help +//config: Add the -s option to eject, this allows to eject SCSI-Devices and +//config: usb-storage devices. //usage:#define eject_trivial_usage //usage: "[-t] [-T] [DEVICE]" diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c index 3ddf8a242..93fd9412b 100644 --- a/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c @@ -20,6 +20,27 @@ * "NN" (ASCII decimal number) - percentage to show on progress bar. * "exit" (or just close fifo) - well you guessed it. */ +//config:config FBSPLASH +//config: bool "fbsplash" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Shows splash image and progress bar on framebuffer device. +//config: Can be used during boot phase of an embedded device. ~2kb. +//config: Usage: +//config: - use kernel option 'vga=xxx' or otherwise enable fb device. +//config: - put somewhere fbsplash.cfg file and an image in .ppm format. +//config: - $ setsid fbsplash [params] & +//config: -c: hide cursor +//config: -d /dev/fbN: framebuffer device (if not /dev/fb0) +//config: -s path_to_image_file (can be "-" for stdin) +//config: -i path_to_cfg_file (can be "-" for stdin) +//config: -f path_to_fifo (can be "-" for stdin) +//config: - if you want to run it only in presence of kernel parameter: +//config: grep -q "fbsplash=on" = 2.6.13 //usage:#define inotifyd_trivial_usage //usage: "PROG FILE1[:MASK]..." diff --git a/miscutils/ionice.c b/miscutils/ionice.c index 5fcb653a8..1e1a5861c 100644 --- a/miscutils/ionice.c +++ b/miscutils/ionice.c @@ -6,6 +6,13 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config IONICE +//config: bool "ionice" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Set/set program io scheduling class and priority +//config: Requires kernel >= 2.6.13 //usage:#define ionice_trivial_usage //usage: "[-c 1-3] [-n 0-7] [-p PID] [PROG]" diff --git a/miscutils/last.c b/miscutils/last.c index f8f34371a..2b7060c53 100644 --- a/miscutils/last.c +++ b/miscutils/last.c @@ -6,6 +6,20 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config LAST +//config: bool "last" +//config: default y +//config: depends on FEATURE_WTMP +//config: help +//config: 'last' displays a list of the last users that logged into the system. +//config: +//config:config FEATURE_LAST_FANCY +//config: bool "Turn on output of extra information" +//config: default y +//config: depends on LAST +//config: help +//config: 'last' displays detailed information about the last users that +//config: logged into the system (mimics sysvinit last). +900 bytes. //usage:#define last_trivial_usage //usage: ""IF_FEATURE_LAST_FANCY("[-HW] [-f FILE]") diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index c945a1352..cbdb0e3a1 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c @@ -6,6 +6,37 @@ * Make ranges of device files quickly. * known bugs: can't deal with alpha ranges */ +//config:config MAKEDEVS +//config: bool "makedevs" +//config: default y +//config: help +//config: 'makedevs' is a utility used to create a batch of devices with +//config: one command. +//config: +//config: There are two choices for command line behaviour, the interface +//config: as used by LEAF/Linux Router Project, or a device table file. +//config: +//config: 'leaf' is traditionally what busybox follows, it allows multiple +//config: devices of a particluar type to be created per command. +//config: e.g. /dev/hda[0-9] +//config: Device properties are passed as command line arguments. +//config: +//config: 'table' reads device properties from a file or stdin, allowing +//config: a batch of unrelated devices to be made with one command. +//config: User/group names are allowed as an alternative to uid/gid. +//config: +//config:choice +//config: prompt "Choose makedevs behaviour" +//config: depends on MAKEDEVS +//config: default FEATURE_MAKEDEVS_TABLE +//config: +//config:config FEATURE_MAKEDEVS_LEAF +//config: bool "leaf" +//config: +//config:config FEATURE_MAKEDEVS_TABLE +//config: bool "table" +//config: +//config:endchoice //usage:#if ENABLE_FEATURE_MAKEDEVS_LEAF //usage:#define makedevs_trivial_usage diff --git a/miscutils/man.c b/miscutils/man.c index 932f0b794..cded6ebee 100644 --- a/miscutils/man.c +++ b/miscutils/man.c @@ -2,6 +2,11 @@ * Copyright (C) 2008 Denys Vlasenko * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config MAN +//config: bool "man" +//config: default y +//config: help +//config: Format and display manual pages. //usage:#define man_trivial_usage //usage: "[-aw] [MANPAGE]..." diff --git a/miscutils/microcom.c b/miscutils/microcom.c index dfc9771d8..c6ba476db 100644 --- a/miscutils/microcom.c +++ b/miscutils/microcom.c @@ -7,6 +7,11 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config MICROCOM +//config: bool "microcom" +//config: default y +//config: help +//config: The poor man's minicom utility for chatting with serial port devices. //usage:#define microcom_trivial_usage //usage: "[-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY" diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c index 7041f7c59..12af2ca9a 100644 --- a/miscutils/mountpoint.c +++ b/miscutils/mountpoint.c @@ -8,6 +8,11 @@ * * Based on sysvinit's mountpoint */ +//config:config MOUNTPOINT +//config: bool "mountpoint" +//config: default y +//config: help +//config: mountpoint checks if the directory is a mountpoint. //usage:#define mountpoint_trivial_usage //usage: "[-q] <[-dn] DIR | -x DEVICE>" diff --git a/miscutils/mt.c b/miscutils/mt.c index 20afd3a50..75a09b662 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c @@ -2,6 +2,13 @@ /* * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config MT +//config: bool "mt" +//config: default y +//config: help +//config: mt is used to control tape devices. You can use the mt utility +//config: to advance or rewind a tape past a specified number of archive +//config: files on the tape. //usage:#define mt_trivial_usage //usage: "[-f device] opcode value" diff --git a/miscutils/raidautorun.c b/miscutils/raidautorun.c index b72d89058..578b2cf52 100644 --- a/miscutils/raidautorun.c +++ b/miscutils/raidautorun.c @@ -7,6 +7,13 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. * */ +//config:config RAIDAUTORUN +//config: bool "raidautorun" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: raidautorun tells the kernel md driver to +//config: search and start RAID arrays. //usage:#define raidautorun_trivial_usage //usage: "DEVICE" diff --git a/miscutils/readahead.c b/miscutils/readahead.c index e22aaa468..0b502f88c 100644 --- a/miscutils/readahead.c +++ b/miscutils/readahead.c @@ -9,6 +9,23 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config READAHEAD +//config: bool "readahead" +//config: default y +//config: depends on LFS +//config: select PLATFORM_LINUX +//config: help +//config: Preload the files listed on the command line into RAM cache so that +//config: subsequent reads on these files will not block on disk I/O. +//config: +//config: This applet just calls the readahead(2) system call on each file. +//config: It is mainly useful in system startup scripts to preload files +//config: or executables before they are used. When used at the right time +//config: (in particular when a CPU bound process is running) it can +//config: significantly speed up system startup. +//config: +//config: As readahead(2) blocks until each file has been read, it is best to +//config: run this applet as a background job. //usage:#define readahead_trivial_usage //usage: "[FILE]..." diff --git a/miscutils/runlevel.c b/miscutils/runlevel.c index 8558db862..7c07a72e2 100644 --- a/miscutils/runlevel.c +++ b/miscutils/runlevel.c @@ -11,6 +11,15 @@ * * initially busyboxified by Bernhard Reutner-Fischer */ +//config:config RUNLEVEL +//config: bool "runlevel" +//config: default y +//config: depends on FEATURE_UTMP +//config: help +//config: find the current and previous system runlevel. +//config: +//config: This applet uses utmp but does not rely on busybox supporing +//config: utmp on purpose. It is used by e.g. emdebian via /etc/init.d/rc. //usage:#define runlevel_trivial_usage //usage: "[FILE]" diff --git a/miscutils/rx.c b/miscutils/rx.c index 1dffb593a..359ad5046 100644 --- a/miscutils/rx.c +++ b/miscutils/rx.c @@ -14,6 +14,12 @@ * * This was originally written for blob and then adapted for busybox. */ +//config:config RX +//config: bool "rx" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Receive files using the Xmodem protocol. //usage:#define rx_trivial_usage //usage: "FILE" diff --git a/miscutils/setsid.c b/miscutils/setsid.c index 9bddc2fcf..f0ec04a0b 100644 --- a/miscutils/setsid.c +++ b/miscutils/setsid.c @@ -13,6 +13,11 @@ * 2004-11-12 Paul Fox * - busyboxed */ +//config:config SETSID +//config: bool "setsid" +//config: default y +//config: help +//config: setsid runs a program in a new session //usage:#define setsid_trivial_usage //usage: "[-c] PROG ARGS" diff --git a/miscutils/strings.c b/miscutils/strings.c index ee6649625..d0e637987 100644 --- a/miscutils/strings.c +++ b/miscutils/strings.c @@ -6,6 +6,12 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config STRINGS +//config: bool "strings" +//config: default y +//config: help +//config: strings prints the printable character sequences for each file +//config: specified. //usage:#define strings_trivial_usage //usage: "[-fo] [-t o/d/x] [-n LEN] [FILE]..." diff --git a/miscutils/time.c b/miscutils/time.c index 19b0b44c9..90d2ab67c 100644 --- a/miscutils/time.c +++ b/miscutils/time.c @@ -8,6 +8,13 @@ Heavily modified by David MacKenzie . Heavily modified for busybox by Erik Andersen */ +//config:config TIME +//config: bool "time" +//config: default y +//config: help +//config: The time command runs the specified program with the given arguments. +//config: When the command finishes, time writes a message to standard output +//config: giving timing statistics about this program run. //usage:#define time_trivial_usage //usage: "[-v] PROG ARGS" diff --git a/miscutils/timeout.c b/miscutils/timeout.c index 8df9ff0fd..4d598ead2 100644 --- a/miscutils/timeout.c +++ b/miscutils/timeout.c @@ -27,6 +27,12 @@ * splitszf 12-05-2006 by Roberto A. Foglietta * rewrite 14-11-2008 vda */ +//config:config TIMEOUT +//config: bool "timeout" +//config: default y +//config: help +//config: Runs a program and watches it. If it does not terminate in +//config: specified number of seconds, it is sent a signal. //usage:#define timeout_trivial_usage //usage: "[-t SECS] [-s SIG] PROG ARGS" diff --git a/miscutils/ttysize.c b/miscutils/ttysize.c index d2d48d0a9..a63b731d2 100644 --- a/miscutils/ttysize.c +++ b/miscutils/ttysize.c @@ -9,6 +9,14 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config TTYSIZE +//config: bool "ttysize" +//config: default y +//config: help +//config: A replacement for "stty size". Unlike stty, can report only width, +//config: only height, or both, in any order. It also does not complain on +//config: error, but returns default 80x24. +//config: Usage in shell scripts: width=`ttysize w`. //usage:#define ttysize_trivial_usage //usage: "[w] [h]" diff --git a/miscutils/volname.c b/miscutils/volname.c index b50e79573..855f2206a 100644 --- a/miscutils/volname.c +++ b/miscutils/volname.c @@ -27,6 +27,11 @@ * mods from distributed source (eject-2.0.13) are by * Matthew Stoltenberg */ +//config:config VOLNAME +//config: bool "volname" +//config: default y +//config: help +//config: Prints a CD-ROM volume name. //usage:#define volname_trivial_usage //usage: "[DEVICE]" diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index d3a76edf0..7a743ef1b 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c @@ -8,6 +8,17 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config WATCHDOG +//config: bool "watchdog" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: The watchdog utility is used with hardware or software watchdog +//config: device drivers. It opens the specified watchdog device special file +//config: and periodically writes a magic character to the device. If the +//config: watchdog applet ever fails to write the magic character within a +//config: certain amount of time, the watchdog device assumes the system has +//config: hung, and will cause the hardware to reboot. //usage:#define watchdog_trivial_usage //usage: "[-t N[ms]] [-T N[ms]] [-F] DEV" -- cgit v1.2.3-55-g6feb From f88e3bfa8ded4f1c7e7d2143a1cfcbbdfe5e8541 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Tue, 22 Nov 2016 23:54:17 +0100 Subject: Convert all miscutils/* applets to "new style" applet definitions Signed-off-by: Denys Vlasenko --- include/applets.src.h | 37 ------------------------------------- miscutils/Kbuild.src | 40 ---------------------------------------- miscutils/adjtimex.c | 4 ++++ miscutils/bbconfig.c | 4 ++++ miscutils/beep.c | 4 ++++ miscutils/chat.c | 4 ++++ miscutils/chrt.c | 4 ++++ miscutils/crontab.c | 5 +++++ miscutils/dc.c | 4 ++++ miscutils/devfsd.c | 4 ++++ miscutils/devmem.c | 4 ++++ miscutils/eject.c | 4 ++++ miscutils/fbsplash.c | 4 ++++ miscutils/flash_eraseall.c | 4 ++++ miscutils/flash_lock_unlock.c | 6 ++++++ miscutils/flashcp.c | 4 ++++ miscutils/hdparm.c | 4 ++++ miscutils/inotifyd.c | 4 ++++ miscutils/ionice.c | 4 ++++ miscutils/last.c | 8 ++++++++ miscutils/less.c | 4 ++++ miscutils/makedevs.c | 4 ++++ miscutils/man.c | 4 ++++ miscutils/microcom.c | 4 ++++ miscutils/mountpoint.c | 4 ++++ miscutils/mt.c | 4 ++++ miscutils/raidautorun.c | 4 ++++ miscutils/readahead.c | 4 ++++ miscutils/runlevel.c | 4 ++++ miscutils/rx.c | 4 ++++ miscutils/setsid.c | 4 ++++ miscutils/strings.c | 4 ++++ miscutils/time.c | 4 ++++ miscutils/timeout.c | 4 ++++ miscutils/ttysize.c | 4 ++++ miscutils/volname.c | 4 ++++ miscutils/watchdog.c | 4 ++++ 37 files changed, 147 insertions(+), 77 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index f834d9040..5eaa5cbb8 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -76,37 +76,27 @@ 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_ACPID(APPLET(acpid, BB_DIR_SBIN, BB_SUID_DROP)) -IF_ADJTIMEX(APPLET(adjtimex, BB_DIR_SBIN, BB_SUID_DROP)) IF_ARP(APPLET(arp, BB_DIR_SBIN, BB_SUID_DROP)) IF_ARPING(APPLET(arping, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename)) -IF_BBCONFIG(APPLET(bbconfig, BB_DIR_BIN, BB_SUID_DROP)) -IF_BEEP(APPLET(beep, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_BLKID(APPLET(blkid, BB_DIR_SBIN, BB_SUID_DROP)) IF_BRCTL(APPLET(brctl, BB_DIR_USR_SBIN, BB_SUID_DROP)) 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_CHAT(APPLET(chat, BB_DIR_USR_SBIN, 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_CHRT(APPLET(chrt, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_CHVT(APPLET(chvt, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_CKSUM(APPLET_NOEXEC(cksum, cksum, BB_DIR_USR_BIN, BB_SUID_DROP, cksum)) IF_CLEAR(APPLET(clear, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_COMM(APPLET(comm, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_CP(APPLET_NOEXEC(cp, cp, BB_DIR_BIN, BB_SUID_DROP, cp)) -/* Needs to be run by root or be suid root - needs to change /var/spool/cron* files: */ -IF_CRONTAB(APPLET(crontab, BB_DIR_USR_BIN, BB_SUID_REQUIRE)) IF_CUT(APPLET_NOEXEC(cut, cut, BB_DIR_USR_BIN, BB_SUID_DROP, cut)) -IF_DC(APPLET(dc, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_DD(APPLET_NOEXEC(dd, dd, BB_DIR_BIN, BB_SUID_DROP, dd)) IF_DEALLOCVT(APPLET(deallocvt, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_DEVFSD(APPLET(devfsd, BB_DIR_SBIN, BB_SUID_DROP)) -IF_DEVMEM(APPLET(devmem, BB_DIR_SBIN, BB_SUID_DROP)) 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)) @@ -119,7 +109,6 @@ 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_EJECT(APPLET(eject, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env)) IF_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, BB_DIR_USR_SBIN, BB_SUID_DROP, ether_wake)) IF_EXPAND(APPLET(expand, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -127,17 +116,12 @@ IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_FAKEIDENTD(APPLET(fakeidentd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_FALSE(APPLET_NOFORK(false, false, BB_DIR_BIN, BB_SUID_DROP, false)) IF_FBSET(APPLET(fbset, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_FBSPLASH(APPLET(fbsplash, BB_DIR_SBIN, BB_SUID_DROP)) IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, BB_DIR_BIN, BB_SUID_DROP, fdflush)) IF_FDFORMAT(APPLET(fdformat, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_FDISK(APPLET(fdisk, BB_DIR_SBIN, BB_SUID_DROP)) IF_FGCONSOLE(APPLET(fgconsole, BB_DIR_USR_BIN, BB_SUID_DROP)) /* Benefits from suid root: better access to /dev/BLOCKDEVs: */ IF_FINDFS(APPLET(findfs, BB_DIR_SBIN, BB_SUID_MAYBE)) -IF_FLASH_ERASEALL(APPLET(flash_eraseall, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_FLASH_LOCK(APPLET_ODDNAME(flash_lock, flash_lock_unlock, BB_DIR_USR_SBIN, BB_SUID_DROP, flash_lock)) -IF_FLASH_UNLOCK(APPLET_ODDNAME(flash_unlock, flash_lock_unlock, BB_DIR_USR_SBIN, BB_SUID_DROP, flash_unlock)) -IF_FLASHCP(APPLET(flashcp, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_FLOCK(APPLET(flock, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_FOLD(APPLET_NOEXEC(fold, fold, BB_DIR_USR_BIN, BB_SUID_DROP, fold)) IF_FREE(APPLET(free, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -154,7 +138,6 @@ IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP)) IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd)) -IF_HDPARM(APPLET(hdparm, BB_DIR_SBIN, BB_SUID_DROP)) IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head)) IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump)) IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) @@ -163,9 +146,7 @@ IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP)) IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP)) IF_IFPLUGD(APPLET(ifplugd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_INETD(APPLET(inetd, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_INOTIFYD(APPLET(inotifyd, BB_DIR_SBIN, BB_SUID_DROP)) IF_INSTALL(APPLET(install, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_IONICE(APPLET(ionice, BB_DIR_BIN, BB_SUID_DROP)) #if ENABLE_FEATURE_IP_ADDRESS \ || ENABLE_FEATURE_IP_ROUTE \ || ENABLE_FEATURE_IP_LINK \ @@ -185,9 +166,7 @@ IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_BIN, BB_SUID_DROP)) IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP)) IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall)) IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5)) -IF_LAST(APPLET(last, BB_DIR_USR_BIN, BB_SUID_DROP)) //IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length)) -IF_LESS(APPLET(less, BB_DIR_USR_BIN, BB_SUID_DROP)) 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_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP)) @@ -197,11 +176,8 @@ IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP)) IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls)) IF_LSPCI(APPLET(lspci, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_LSUSB(APPLET(lsusb, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_MAKEDEVS(APPLET(makedevs, BB_DIR_SBIN, BB_SUID_DROP)) IF_MAKEMIME(APPLET(makemime, BB_DIR_BIN, BB_SUID_DROP)) -IF_MAN(APPLET(man, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_MICROCOM(APPLET(microcom, BB_DIR_USR_BIN, 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_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, BB_DIR_SBIN, BB_SUID_DROP, mkfs_minix)) @@ -214,8 +190,6 @@ IF_MORE(APPLET(more, BB_DIR_BIN, BB_SUID_DROP)) * for viewing mount table. * Therefore we use BB_SUID_MAYBE instead of BB_SUID_REQUIRE: */ IF_MOUNT(APPLET(mount, BB_DIR_BIN, IF_DESKTOP(BB_SUID_MAYBE) IF_NOT_DESKTOP(BB_SUID_DROP))) -IF_MOUNTPOINT(APPLET(mountpoint, BB_DIR_BIN, BB_SUID_DROP)) -IF_MT(APPLET(mt, BB_DIR_BIN, BB_SUID_DROP)) IF_MV(APPLET(mv, BB_DIR_BIN, BB_SUID_DROP)) IF_NAMEIF(APPLET(nameif, BB_DIR_SBIN, BB_SUID_DROP)) IF_NC(APPLET(nc, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -237,10 +211,8 @@ IF_PRINTF(APPLET_NOFORK(printf, printf, BB_DIR_USR_BIN, BB_SUID_DROP, printf)) IF_PS(APPLET(ps, BB_DIR_BIN, BB_SUID_DROP)) IF_PSCAN(APPLET(pscan, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_PWD(APPLET_NOFORK(pwd, pwd, BB_DIR_BIN, BB_SUID_DROP, pwd)) -IF_RAIDAUTORUN(APPLET(raidautorun, BB_DIR_SBIN, BB_SUID_DROP)) IF_RDATE(APPLET(rdate, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_RDEV(APPLET(rdev, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_READAHEAD(APPLET(readahead, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -254,8 +226,6 @@ IF_RMDIR(APPLET_NOFORK(rmdir, rmdir, BB_DIR_BIN, BB_SUID_DROP, rmdir)) IF_ROUTE(APPLET(route, BB_DIR_SBIN, BB_SUID_DROP)) IF_RTCWAKE(APPLET(rtcwake, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_RUNLEVEL(APPLET(runlevel, BB_DIR_SBIN, BB_SUID_DROP)) -IF_RX(APPLET(rx, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SCRIPT(APPLET(script, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SCRIPTREPLAY(APPLET(scriptreplay, BB_DIR_BIN, BB_SUID_DROP)) IF_SELINUXENABLED(APPLET(selinuxenabled, BB_DIR_USR_SBIN, BB_SUID_DROP)) @@ -269,7 +239,6 @@ IF_SETFONT(APPLET(setfont, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_SETKEYCODES(APPLET(setkeycodes, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SETLOGCONS(APPLET(setlogcons, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_SETSID(APPLET(setsid, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SHOWKEY(APPLET(showkey, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SLATTACH(APPLET(slattach, BB_DIR_SBIN, BB_SUID_DROP)) /* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells: */ @@ -277,7 +246,6 @@ 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_STRINGS(APPLET(strings, BB_DIR_USR_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_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP)) @@ -294,8 +262,6 @@ IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) IF_TFTP(APPLET(tftp, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_TFTPD(APPLET(tftpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) #endif -IF_TIME(APPLET(time, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_TIMEOUT(APPLET(timeout, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_TOP(APPLET(top, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_TR(APPLET(tr, BB_DIR_USR_BIN, BB_SUID_DROP)) /* Needs socket(AF_INET, SOCK_RAW, IPPROTO_ICMP), therefore BB_SUID_MAYBE: */ @@ -303,7 +269,6 @@ IF_TRACEROUTE(APPLET(traceroute, BB_DIR_USR_BIN, BB_SUID_MAYBE)) IF_TRACEROUTE6(APPLET(traceroute6, BB_DIR_USR_BIN, BB_SUID_MAYBE)) 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_TTYSIZE(APPLET(ttysize, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_TUNCTL(APPLET(tunctl, BB_DIR_SBIN, BB_SUID_DROP)) IF_UDHCPC(APPLET(udhcpc, BB_DIR_SBIN, BB_SUID_DROP)) IF_UDHCPD(APPLET(udhcpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) @@ -318,9 +283,7 @@ 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_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP)) -IF_VOLNAME(APPLET(volname, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_WATCH(APPLET(watch, BB_DIR_BIN, BB_SUID_DROP)) -IF_WATCHDOG(APPLET(watchdog, BB_DIR_SBIN, 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)) diff --git a/miscutils/Kbuild.src b/miscutils/Kbuild.src index 503f54904..60848ffc1 100644 --- a/miscutils/Kbuild.src +++ b/miscutils/Kbuild.src @@ -7,45 +7,5 @@ lib-y:= INSERT -lib-$(CONFIG_ADJTIMEX) += adjtimex.o -lib-$(CONFIG_BBCONFIG) += bbconfig.o -lib-$(CONFIG_BEEP) += beep.o -lib-$(CONFIG_CHAT) += chat.o -lib-$(CONFIG_CHRT) += chrt.o -lib-$(CONFIG_CRONTAB) += crontab.o -lib-$(CONFIG_DC) += dc.o -lib-$(CONFIG_DEVFSD) += devfsd.o -lib-$(CONFIG_DEVMEM) += devmem.o -lib-$(CONFIG_EJECT) += eject.o -lib-$(CONFIG_FBSPLASH) += fbsplash.o -lib-$(CONFIG_FLASHCP) += flashcp.o -lib-$(CONFIG_FLASH_ERASEALL) += flash_eraseall.o -lib-$(CONFIG_FLASH_LOCK) += flash_lock_unlock.o -lib-$(CONFIG_FLASH_UNLOCK) += flash_lock_unlock.o -lib-$(CONFIG_IONICE) += ionice.o -lib-$(CONFIG_HDPARM) += hdparm.o -lib-$(CONFIG_INOTIFYD) += inotifyd.o -ifeq ($(CONFIG_FEATURE_LAST_FANCY),y) -lib-$(CONFIG_FEATURE_LAST_FANCY) += last_fancy.o -else -lib-$(CONFIG_LAST) += last.o -endif -lib-$(CONFIG_LESS) += less.o -lib-$(CONFIG_MAKEDEVS) += makedevs.o -lib-$(CONFIG_MAN) += man.o -lib-$(CONFIG_MICROCOM) += microcom.o -lib-$(CONFIG_MOUNTPOINT) += mountpoint.o -lib-$(CONFIG_MT) += mt.o -lib-$(CONFIG_RAIDAUTORUN) += raidautorun.o -lib-$(CONFIG_READAHEAD) += readahead.o -lib-$(CONFIG_RUNLEVEL) += runlevel.o -lib-$(CONFIG_RX) += rx.o -lib-$(CONFIG_SETSID) += setsid.o -lib-$(CONFIG_STRINGS) += strings.o -lib-$(CONFIG_TIME) += time.o -lib-$(CONFIG_TIMEOUT) += timeout.o -lib-$(CONFIG_TTYSIZE) += ttysize.o -lib-$(CONFIG_VOLNAME) += volname.o -lib-$(CONFIG_WATCHDOG) += watchdog.o diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c index f9d7c949d..6355cc1ef 100644 --- a/miscutils/adjtimex.c +++ b/miscutils/adjtimex.c @@ -18,6 +18,10 @@ //config: Adjtimex reads and optionally sets adjustment parameters for //config: the Linux clock adjustment algorithm. +//applet:IF_ADJTIMEX(APPLET(adjtimex, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_ADJTIMEX) += adjtimex.o + //usage:#define adjtimex_trivial_usage //usage: "[-q] [-o OFF] [-f FREQ] [-p TCONST] [-t TICK]" //usage:#define adjtimex_full_usage "\n\n" diff --git a/miscutils/bbconfig.c b/miscutils/bbconfig.c index 8a709f9d3..4781a4276 100644 --- a/miscutils/bbconfig.c +++ b/miscutils/bbconfig.c @@ -22,6 +22,10 @@ //config: and have very little memory, this might not be a win. Otherwise, //config: you probably want this. +//applet:IF_BBCONFIG(APPLET(bbconfig, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_BBCONFIG) += bbconfig.o + //usage:#define bbconfig_trivial_usage //usage: "" //usage:#define bbconfig_full_usage "\n\n" diff --git a/miscutils/beep.c b/miscutils/beep.c index f6fa8348d..14802b543 100644 --- a/miscutils/beep.c +++ b/miscutils/beep.c @@ -30,6 +30,10 @@ //config: help //config: Length in ms for default beep. +//applet:IF_BEEP(APPLET(beep, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_BEEP) += beep.o + //usage:#define beep_trivial_usage //usage: "-f FREQ -l LEN -d DELAY -r COUNT -n" //usage:#define beep_full_usage "\n\n" diff --git a/miscutils/chat.c b/miscutils/chat.c index 92a23441c..dc85f82fb 100644 --- a/miscutils/chat.c +++ b/miscutils/chat.c @@ -74,6 +74,10 @@ //config: help //config: Support CLR_ABORT directive. +//applet:IF_CHAT(APPLET(chat, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_CHAT) += chat.o + //usage:#define chat_trivial_usage //usage: "EXPECT [SEND [EXPECT [SEND...]]]" //usage:#define chat_full_usage "\n\n" diff --git a/miscutils/chrt.c b/miscutils/chrt.c index d76c0d152..1604a6890 100644 --- a/miscutils/chrt.c +++ b/miscutils/chrt.c @@ -12,6 +12,10 @@ //config: manipulate real-time attributes of a process. //config: This requires sched_{g,s}etparam support in your libc. +//applet:IF_CHRT(APPLET(chrt, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_CHRT) += chrt.o + //usage:#define chrt_trivial_usage //usage: "[-prfom] [PRIO] [PID | PROG ARGS]" //usage:#define chrt_full_usage "\n\n" diff --git a/miscutils/crontab.c b/miscutils/crontab.c index bcd2eab33..bcd424578 100644 --- a/miscutils/crontab.c +++ b/miscutils/crontab.c @@ -18,6 +18,11 @@ //config: Note that Busybox binary must be setuid root for this applet to //config: work properly. +/* Needs to be run by root or be suid root - needs to change /var/spool/cron* files: */ +//applet:IF_CRONTAB(APPLET(crontab, BB_DIR_USR_BIN, BB_SUID_REQUIRE)) + +//kbuild:lib-$(CONFIG_CRONTAB) += crontab.o + //usage:#define crontab_trivial_usage //usage: "[-c DIR] [-u USER] [-ler]|[FILE]" //usage:#define crontab_full_usage "\n\n" diff --git a/miscutils/dc.c b/miscutils/dc.c index 2b77cd614..7986fef5f 100644 --- a/miscutils/dc.c +++ b/miscutils/dc.c @@ -17,6 +17,10 @@ //config: Enable power and exp functions. //config: NOTE: This will require libm to be present for linking. +//applet:IF_DC(APPLET(dc, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_DC) += dc.o + //usage:#define dc_trivial_usage //usage: "EXPRESSION..." //usage: diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c index 361f3666f..99bdc72b8 100644 --- a/miscutils/devfsd.c +++ b/miscutils/devfsd.c @@ -110,6 +110,10 @@ //config: /dev/loop0. If your /dev directory has normal names instead of //config: devfs names, you don't want this. +//applet:IF_DEVFSD(APPLET(devfsd, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_DEVFSD) += devfsd.o + //usage:#define devfsd_trivial_usage //usage: "mntpnt [-v]" IF_DEVFSD_FG_NP("[-fg][-np]") //usage:#define devfsd_full_usage "\n\n" diff --git a/miscutils/devmem.c b/miscutils/devmem.c index dd6574e93..aeb32b13a 100644 --- a/miscutils/devmem.c +++ b/miscutils/devmem.c @@ -10,6 +10,10 @@ //config: devmem is a small program that reads and writes from physical //config: memory using /dev/mem. +//applet:IF_DEVMEM(APPLET(devmem, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_DEVMEM) += devmem.o + //usage:#define devmem_trivial_usage //usage: "ADDRESS [WIDTH [VALUE]]" //usage:#define devmem_full_usage "\n\n" diff --git a/miscutils/eject.c b/miscutils/eject.c index d271066ad..667932f6c 100644 --- a/miscutils/eject.c +++ b/miscutils/eject.c @@ -27,6 +27,10 @@ //config: Add the -s option to eject, this allows to eject SCSI-Devices and //config: usb-storage devices. +//applet:IF_EJECT(APPLET(eject, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_EJECT) += eject.o + //usage:#define eject_trivial_usage //usage: "[-t] [-T] [DEVICE]" //usage:#define eject_full_usage "\n\n" diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c index 93fd9412b..fc6c9b953 100644 --- a/miscutils/fbsplash.c +++ b/miscutils/fbsplash.c @@ -42,6 +42,10 @@ //config: "NN" (ASCII decimal number) - percentage to show on progress bar //config: "exit" - well you guessed it +//applet:IF_FBSPLASH(APPLET(fbsplash, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FBSPLASH) += fbsplash.o + //usage:#define fbsplash_trivial_usage //usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" //usage:#define fbsplash_full_usage "\n\n" diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c index 08ec44e0c..2a9bd6cfe 100644 --- a/miscutils/flash_eraseall.c +++ b/miscutils/flash_eraseall.c @@ -16,6 +16,10 @@ //config: The flash_eraseall binary from mtd-utils as of git head c4c6a59eb. //config: This utility is used to erase the whole MTD device. +//applet:IF_FLASH_ERASEALL(APPLET(flash_eraseall, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FLASH_ERASEALL) += flash_eraseall.o + //usage:#define flash_eraseall_trivial_usage //usage: "[-jNq] MTD_DEVICE" //usage:#define flash_eraseall_full_usage "\n\n" diff --git a/miscutils/flash_lock_unlock.c b/miscutils/flash_lock_unlock.c index 287abaafd..2f698641f 100644 --- a/miscutils/flash_lock_unlock.c +++ b/miscutils/flash_lock_unlock.c @@ -17,6 +17,12 @@ //config: The flash_unlock binary from mtd-utils as of git head 5ec0c10d0. This //config: utility unlocks part or all of the flash device. +//applet:IF_FLASH_LOCK(APPLET_ODDNAME(flash_lock, flash_lock_unlock, BB_DIR_USR_SBIN, BB_SUID_DROP, flash_lock)) +//applet:IF_FLASH_UNLOCK(APPLET_ODDNAME(flash_unlock, flash_lock_unlock, BB_DIR_USR_SBIN, BB_SUID_DROP, flash_unlock)) + +//kbuild:lib-$(CONFIG_FLASH_LOCK) += flash_lock_unlock.o +//kbuild:lib-$(CONFIG_FLASH_UNLOCK) += flash_lock_unlock.o + //usage:#define flash_lock_trivial_usage //usage: "MTD_DEVICE OFFSET SECTORS" //usage:#define flash_lock_full_usage "\n\n" diff --git a/miscutils/flashcp.c b/miscutils/flashcp.c index 6cbf455ff..4bbc67727 100644 --- a/miscutils/flashcp.c +++ b/miscutils/flashcp.c @@ -13,6 +13,10 @@ //config: The flashcp binary, inspired by mtd-utils as of git head 5eceb74f7. //config: This utility is used to copy images into a MTD device. +//applet:IF_FLASHCP(APPLET(flashcp, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FLASHCP) += flashcp.o + //usage:#define flashcp_trivial_usage //usage: "-v FILE MTD_DEVICE" //usage:#define flashcp_full_usage "\n\n" diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c index 06311ccf7..e43a0dec2 100644 --- a/miscutils/hdparm.c +++ b/miscutils/hdparm.c @@ -70,6 +70,10 @@ //config: help //config: Enables the 'hdparm -d' option to get/set using_dma flag. +//applet:IF_HDPARM(APPLET(hdparm, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_HDPARM) += hdparm.o + //usage:#define hdparm_trivial_usage //usage: "[OPTIONS] [DEVICE]" //usage:#define hdparm_full_usage "\n\n" diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c index ffac8b958..601df6465 100644 --- a/miscutils/inotifyd.c +++ b/miscutils/inotifyd.c @@ -33,6 +33,10 @@ //config: Simple inotify daemon. Reports filesystem changes. Requires //config: kernel >= 2.6.13 +//applet:IF_INOTIFYD(APPLET(inotifyd, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_INOTIFYD) += inotifyd.o + //usage:#define inotifyd_trivial_usage //usage: "PROG FILE1[:MASK]..." //usage:#define inotifyd_full_usage "\n\n" diff --git a/miscutils/ionice.c b/miscutils/ionice.c index 1e1a5861c..c54b3a6e1 100644 --- a/miscutils/ionice.c +++ b/miscutils/ionice.c @@ -14,6 +14,10 @@ //config: Set/set program io scheduling class and priority //config: Requires kernel >= 2.6.13 +//applet:IF_IONICE(APPLET(ionice, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_IONICE) += ionice.o + //usage:#define ionice_trivial_usage //usage: "[-c 1-3] [-n 0-7] [-p PID] [PROG]" //usage:#define ionice_full_usage "\n\n" diff --git a/miscutils/last.c b/miscutils/last.c index 2b7060c53..67c1343f1 100644 --- a/miscutils/last.c +++ b/miscutils/last.c @@ -21,6 +21,14 @@ //config: 'last' displays detailed information about the last users that //config: logged into the system (mimics sysvinit last). +900 bytes. +//applet:IF_LAST(APPLET(last, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:ifeq ($(CONFIG_FEATURE_LAST_FANCY),y) +//kbuild:lib-$(CONFIG_FEATURE_LAST_FANCY) += last_fancy.o +//kbuild:else +//kbuild:lib-$(CONFIG_LAST) += last.o +//kbuild:endif + //usage:#define last_trivial_usage //usage: ""IF_FEATURE_LAST_FANCY("[-HW] [-f FILE]") //usage:#define last_full_usage "\n\n" diff --git a/miscutils/less.c b/miscutils/less.c index 61acfdcb5..e90691b49 100644 --- a/miscutils/less.c +++ b/miscutils/less.c @@ -105,6 +105,10 @@ //config: help //config: Enables "-N" command. +//applet:IF_LESS(APPLET(less, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_LESS) += less.o + //usage:#define less_trivial_usage //usage: "[-E" IF_FEATURE_LESS_REGEXP("I")IF_FEATURE_LESS_FLAGS("Mm") //usage: "N" IF_FEATURE_LESS_TRUNCATE("S") "h~] [FILE]..." diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index cbdb0e3a1..6278ee77c 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c @@ -38,6 +38,10 @@ //config: //config:endchoice +//applet:IF_MAKEDEVS(APPLET(makedevs, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_MAKEDEVS) += makedevs.o + //usage:#if ENABLE_FEATURE_MAKEDEVS_LEAF //usage:#define makedevs_trivial_usage //usage: "NAME TYPE MAJOR MINOR FIRST LAST [s]" diff --git a/miscutils/man.c b/miscutils/man.c index cded6ebee..6a636f1ec 100644 --- a/miscutils/man.c +++ b/miscutils/man.c @@ -8,6 +8,10 @@ //config: help //config: Format and display manual pages. +//applet:IF_MAN(APPLET(man, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_MAN) += man.o + //usage:#define man_trivial_usage //usage: "[-aw] [MANPAGE]..." //usage:#define man_full_usage "\n\n" diff --git a/miscutils/microcom.c b/miscutils/microcom.c index c6ba476db..04605d883 100644 --- a/miscutils/microcom.c +++ b/miscutils/microcom.c @@ -13,6 +13,10 @@ //config: help //config: The poor man's minicom utility for chatting with serial port devices. +//applet:IF_MICROCOM(APPLET(microcom, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_MICROCOM) += microcom.o + //usage:#define microcom_trivial_usage //usage: "[-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY" //usage:#define microcom_full_usage "\n\n" diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c index 12af2ca9a..8b9e1d779 100644 --- a/miscutils/mountpoint.c +++ b/miscutils/mountpoint.c @@ -14,6 +14,10 @@ //config: help //config: mountpoint checks if the directory is a mountpoint. +//applet:IF_MOUNTPOINT(APPLET(mountpoint, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_MOUNTPOINT) += mountpoint.o + //usage:#define mountpoint_trivial_usage //usage: "[-q] <[-dn] DIR | -x DEVICE>" //usage:#define mountpoint_full_usage "\n\n" diff --git a/miscutils/mt.c b/miscutils/mt.c index 75a09b662..6b3169675 100644 --- a/miscutils/mt.c +++ b/miscutils/mt.c @@ -10,6 +10,10 @@ //config: to advance or rewind a tape past a specified number of archive //config: files on the tape. +//applet:IF_MT(APPLET(mt, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_MT) += mt.o + //usage:#define mt_trivial_usage //usage: "[-f device] opcode value" //usage:#define mt_full_usage "\n\n" diff --git a/miscutils/raidautorun.c b/miscutils/raidautorun.c index 578b2cf52..c6d8e6235 100644 --- a/miscutils/raidautorun.c +++ b/miscutils/raidautorun.c @@ -15,6 +15,10 @@ //config: raidautorun tells the kernel md driver to //config: search and start RAID arrays. +//applet:IF_RAIDAUTORUN(APPLET(raidautorun, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RAIDAUTORUN) += raidautorun.o + //usage:#define raidautorun_trivial_usage //usage: "DEVICE" //usage:#define raidautorun_full_usage "\n\n" diff --git a/miscutils/readahead.c b/miscutils/readahead.c index 0b502f88c..b8e9b257f 100644 --- a/miscutils/readahead.c +++ b/miscutils/readahead.c @@ -27,6 +27,10 @@ //config: As readahead(2) blocks until each file has been read, it is best to //config: run this applet as a background job. +//applet:IF_READAHEAD(APPLET(readahead, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_READAHEAD) += readahead.o + //usage:#define readahead_trivial_usage //usage: "[FILE]..." //usage:#define readahead_full_usage "\n\n" diff --git a/miscutils/runlevel.c b/miscutils/runlevel.c index 7c07a72e2..b6412a6ea 100644 --- a/miscutils/runlevel.c +++ b/miscutils/runlevel.c @@ -21,6 +21,10 @@ //config: This applet uses utmp but does not rely on busybox supporing //config: utmp on purpose. It is used by e.g. emdebian via /etc/init.d/rc. +//applet:IF_RUNLEVEL(APPLET(runlevel, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RUNLEVEL) += runlevel.o + //usage:#define runlevel_trivial_usage //usage: "[FILE]" //usage:#define runlevel_full_usage "\n\n" diff --git a/miscutils/rx.c b/miscutils/rx.c index 359ad5046..7fca8e36b 100644 --- a/miscutils/rx.c +++ b/miscutils/rx.c @@ -21,6 +21,10 @@ //config: help //config: Receive files using the Xmodem protocol. +//applet:IF_RX(APPLET(rx, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RX) += rx.o + //usage:#define rx_trivial_usage //usage: "FILE" //usage:#define rx_full_usage "\n\n" diff --git a/miscutils/setsid.c b/miscutils/setsid.c index f0ec04a0b..143a8f8fa 100644 --- a/miscutils/setsid.c +++ b/miscutils/setsid.c @@ -19,6 +19,10 @@ //config: help //config: setsid runs a program in a new session +//applet:IF_SETSID(APPLET(setsid, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SETSID) += setsid.o + //usage:#define setsid_trivial_usage //usage: "[-c] PROG ARGS" //usage:#define setsid_full_usage "\n\n" diff --git a/miscutils/strings.c b/miscutils/strings.c index d0e637987..4d9bfe690 100644 --- a/miscutils/strings.c +++ b/miscutils/strings.c @@ -13,6 +13,10 @@ //config: strings prints the printable character sequences for each file //config: specified. +//applet:IF_STRINGS(APPLET(strings, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_STRINGS) += strings.o + //usage:#define strings_trivial_usage //usage: "[-fo] [-t o/d/x] [-n LEN] [FILE]..." //usage:#define strings_full_usage "\n\n" diff --git a/miscutils/time.c b/miscutils/time.c index 90d2ab67c..a73a837d8 100644 --- a/miscutils/time.c +++ b/miscutils/time.c @@ -16,6 +16,10 @@ //config: When the command finishes, time writes a message to standard output //config: giving timing statistics about this program run. +//applet:IF_TIME(APPLET(time, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_TIME) += time.o + //usage:#define time_trivial_usage //usage: "[-v] PROG ARGS" //usage:#define time_full_usage "\n\n" diff --git a/miscutils/timeout.c b/miscutils/timeout.c index 4d598ead2..f29dc8a9c 100644 --- a/miscutils/timeout.c +++ b/miscutils/timeout.c @@ -34,6 +34,10 @@ //config: Runs a program and watches it. If it does not terminate in //config: specified number of seconds, it is sent a signal. +//applet:IF_TIMEOUT(APPLET(timeout, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_TIMEOUT) += timeout.o + //usage:#define timeout_trivial_usage //usage: "[-t SECS] [-s SIG] PROG ARGS" //usage:#define timeout_full_usage "\n\n" diff --git a/miscutils/ttysize.c b/miscutils/ttysize.c index a63b731d2..135ce8535 100644 --- a/miscutils/ttysize.c +++ b/miscutils/ttysize.c @@ -18,6 +18,10 @@ //config: error, but returns default 80x24. //config: Usage in shell scripts: width=`ttysize w`. +//applet:IF_TTYSIZE(APPLET(ttysize, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_TTYSIZE) += ttysize.o + //usage:#define ttysize_trivial_usage //usage: "[w] [h]" //usage:#define ttysize_full_usage "\n\n" diff --git a/miscutils/volname.c b/miscutils/volname.c index 855f2206a..6d1addbb5 100644 --- a/miscutils/volname.c +++ b/miscutils/volname.c @@ -33,6 +33,10 @@ //config: help //config: Prints a CD-ROM volume name. +//applet:IF_VOLNAME(APPLET(volname, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_VOLNAME) += volname.o + //usage:#define volname_trivial_usage //usage: "[DEVICE]" //usage:#define volname_full_usage "\n\n" diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c index 7a743ef1b..07ae64e52 100644 --- a/miscutils/watchdog.c +++ b/miscutils/watchdog.c @@ -20,6 +20,10 @@ //config: certain amount of time, the watchdog device assumes the system has //config: hung, and will cause the hardware to reboot. +//applet:IF_WATCHDOG(APPLET(watchdog, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_WATCHDOG) += watchdog.o + //usage:#define watchdog_trivial_usage //usage: "[-t N[ms]] [-T N[ms]] [-F] DEV" //usage:#define watchdog_full_usage "\n\n" -- cgit v1.2.3-55-g6feb From f8f81ed7aaf90897fa9a4687dac75152740a71e2 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 06:23:44 +0100 Subject: Convert all procps/* applets to "new style" applet definitions Signed-off-by: Denys Vlasenko --- include/applets.src.h | 14 ----- procps/Config.src | 140 -------------------------------------------------- procps/Kbuild.src | 15 +----- procps/free.c | 12 ++++- procps/fuser.c | 11 ++++ procps/kill.c | 30 +++++++++++ procps/pgrep.c | 17 ++++++ procps/pidof.c | 26 ++++++++++ procps/ps.c | 49 ++++++++++++++++++ procps/renice.c | 10 ++++ procps/sysctl.c | 9 ++++ procps/top.c | 5 +- procps/uptime.c | 7 +-- procps/watch.c | 11 ++++ 14 files changed, 184 insertions(+), 172 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index 5eaa5cbb8..1d2d9c8ed 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -124,7 +124,6 @@ IF_FGCONSOLE(APPLET(fgconsole, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_FINDFS(APPLET(findfs, BB_DIR_SBIN, BB_SUID_MAYBE)) IF_FLOCK(APPLET(flock, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_FOLD(APPLET_NOEXEC(fold, fold, BB_DIR_USR_BIN, BB_SUID_DROP, fold)) -IF_FREE(APPLET(free, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_FREERAMDISK(APPLET(freeramdisk, BB_DIR_SBIN, BB_SUID_DROP)) //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)) @@ -133,7 +132,6 @@ IF_FSYNC(APPLET_NOFORK(fsync, fsync, BB_DIR_BIN, BB_SUID_DROP, fsync)) IF_FTPD(APPLET(ftpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpget)) IF_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpput)) -IF_FUSER(APPLET(fuser, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP)) IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) @@ -163,9 +161,6 @@ IF_IPROUTE(APPLET(iproute, BB_DIR_SBIN, BB_SUID_DROP)) IF_IPRULE(APPLET(iprule, BB_DIR_SBIN, BB_SUID_DROP)) IF_IPTUNNEL(APPLET(iptunnel, BB_DIR_SBIN, BB_SUID_DROP)) IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_BIN, BB_SUID_DROP)) -IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP)) -IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall)) -IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5)) //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)) @@ -201,14 +196,10 @@ IF_NTPD(APPLET(ntpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_OD(APPLET(od, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_OPENVT(APPLET(openvt, BB_DIR_USR_BIN, BB_SUID_DROP)) //IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_PGREP(APPLET(pgrep, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_PIDOF(APPLET(pidof, BB_DIR_BIN, BB_SUID_DROP)) IF_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, BB_SUID_DROP)) -IF_PKILL(APPLET_ODDNAME(pkill, pgrep, BB_DIR_USR_BIN, BB_SUID_DROP, pkill)) IF_POPMAILDIR(APPLET(popmaildir, BB_DIR_USR_SBIN, 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_PS(APPLET(ps, BB_DIR_BIN, BB_SUID_DROP)) IF_PSCAN(APPLET(pscan, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_PWD(APPLET_NOFORK(pwd, pwd, BB_DIR_BIN, BB_SUID_DROP, pwd)) IF_RDATE(APPLET(rdate, BB_DIR_USR_SBIN, BB_SUID_DROP)) @@ -217,7 +208,6 @@ IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_REFORMIME(APPLET(reformime, BB_DIR_BIN, BB_SUID_DROP)) -IF_RENICE(APPLET(renice, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_RESET(APPLET(reset, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_RESIZE(APPLET(resize, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon)) @@ -249,7 +239,6 @@ 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_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP)) -IF_BB_SYSCTL(APPLET(sysctl, BB_DIR_SBIN, 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_TC(APPLET(tc, BB_DIR_SBIN, BB_SUID_DROP)) */ @@ -262,7 +251,6 @@ IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) IF_TFTP(APPLET(tftp, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_TFTPD(APPLET(tftpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) #endif -IF_TOP(APPLET(top, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_TR(APPLET(tr, BB_DIR_USR_BIN, BB_SUID_DROP)) /* Needs socket(AF_INET, SOCK_RAW, IPPROTO_ICMP), therefore BB_SUID_MAYBE: */ IF_TRACEROUTE(APPLET(traceroute, BB_DIR_USR_BIN, BB_SUID_MAYBE)) @@ -278,12 +266,10 @@ 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_UPTIME(APPLET(uptime, BB_DIR_USR_BIN, BB_SUID_DROP)) 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_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP)) -IF_WATCH(APPLET(watch, BB_DIR_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)) diff --git a/procps/Config.src b/procps/Config.src index 527d9ee0c..eb4760752 100644 --- a/procps/Config.src +++ b/procps/Config.src @@ -7,139 +7,6 @@ menu "Process Utilities" INSERT -config FREE - bool "free" - default y - select PLATFORM_LINUX #sysinfo() - help - free displays the total amount of free and used physical and swap - memory in the system, as well as the buffers used by the kernel. - The shared memory column should be ignored; it is obsolete. - -config FUSER - bool "fuser" - default y - help - fuser lists all PIDs (Process IDs) that currently have a given - file open. fuser can also list all PIDs that have a given network - (TCP or UDP) port open. - -config KILL - bool "kill" - default y - help - The command kill sends the specified signal to the specified - process or process group. If no signal is specified, the TERM - signal is sent. - -config KILLALL - bool "killall" - default y - depends on KILL - help - killall sends a signal to all processes running any of the - specified commands. If no signal name is specified, SIGTERM is - sent. - -config KILLALL5 - bool "killall5" - default y - depends on KILL - -config PGREP - bool "pgrep" - default y - help - Look for processes by name. - -config PIDOF - bool "pidof" - default y - help - Pidof finds the process id's (pids) of the named programs. It prints - those id's on the standard output. - -config FEATURE_PIDOF_SINGLE - bool "Enable argument for single shot (-s)" - default y - depends on PIDOF - help - Support argument '-s' for returning only the first pid found. - -config FEATURE_PIDOF_OMIT - bool "Enable argument for omitting pids (-o)" - default y - depends on PIDOF - help - Support argument '-o' for omitting the given pids in output. - The special pid %PPID can be used to name the parent process - of the pidof, in other words the calling shell or shell script. - -config PKILL - bool "pkill" - default y - help - Send signals to processes by name. - -config PS - bool "ps" - default y - help - ps gives a snapshot of the current processes. - -config FEATURE_PS_WIDE - bool "Enable wide output option (-w)" - default y - depends on PS && !DESKTOP - help - Support argument 'w' for wide output. - If given once, 132 chars are printed, and if given more - than once, the length is unlimited. - -config FEATURE_PS_LONG - bool "Enable long output option (-l)" - default y - depends on PS && !DESKTOP - help - Support argument 'l' for long output. - Adds fields PPID, RSS, START, TIME & TTY - -config FEATURE_PS_TIME - bool "Enable time and elapsed time output" - default y - depends on PS && DESKTOP - select PLATFORM_LINUX - help - Support -o time and -o etime output specifiers. - -config FEATURE_PS_ADDITIONAL_COLUMNS - bool "Enable additional ps columns" - default y - depends on PS && DESKTOP - help - Support -o rgroup, -o ruser, -o nice output specifiers. - -config FEATURE_PS_UNUSUAL_SYSTEMS - bool "Support Linux prior to 2.4.0 and non-ELF systems" - default n - depends on FEATURE_PS_TIME - help - Include support for measuring HZ on old kernels and non-ELF systems - (if you are on Linux 2.4.0+ and use ELF, you don't need this) - -config RENICE - bool "renice" - default y - help - Renice alters the scheduling priority of one or more running - processes. - -config BB_SYSCTL - bool "sysctl" - default y - help - Configure kernel parameters at runtime. - config FEATURE_SHOW_THREADS bool "Support for showing threads in ps/pstree/top" default y @@ -148,11 +15,4 @@ config FEATURE_SHOW_THREADS Enables the ps -T option, showing of threads in pstree, and 'h' command in top. -config WATCH - bool "watch" - default y - help - watch is used to execute a program periodically, showing - output to the screen. - endmenu diff --git a/procps/Kbuild.src b/procps/Kbuild.src index 89b1cc094..83af05a05 100644 --- a/procps/Kbuild.src +++ b/procps/Kbuild.src @@ -7,16 +7,5 @@ lib-y:= INSERT -lib-$(CONFIG_FREE) += free.o -lib-$(CONFIG_FUSER) += fuser.o -lib-$(CONFIG_KILL) += kill.o -lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash -lib-$(CONFIG_PGREP) += pgrep.o -lib-$(CONFIG_PKILL) += pgrep.o -lib-$(CONFIG_PIDOF) += pidof.o -lib-$(CONFIG_PS) += ps.o -lib-$(CONFIG_RENICE) += renice.o -lib-$(CONFIG_BB_SYSCTL) += sysctl.o -lib-$(CONFIG_TOP) += top.o -lib-$(CONFIG_UPTIME) += uptime.o -lib-$(CONFIG_WATCH) += watch.o + +lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash diff --git a/procps/free.c b/procps/free.c index fca9a2242..f3a2c3c0c 100644 --- a/procps/free.c +++ b/procps/free.c @@ -6,8 +6,18 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config FREE +//config: bool "free" +//config: default y +//config: select PLATFORM_LINUX #sysinfo() +//config: help +//config: free displays the total amount of free and used physical and swap +//config: memory in the system, as well as the buffers used by the kernel. +//config: The shared memory column should be ignored; it is obsolete. -/* getopt not needed */ +//applet:IF_FREE(APPLET(free, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FREE) += free.o //usage:#define free_trivial_usage //usage: "" IF_DESKTOP("[-b/k/m/g]") diff --git a/procps/fuser.c b/procps/fuser.c index 6dac852ed..db28cca79 100644 --- a/procps/fuser.c +++ b/procps/fuser.c @@ -6,6 +6,17 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config FUSER +//config: bool "fuser" +//config: default y +//config: help +//config: fuser lists all PIDs (Process IDs) that currently have a given +//config: file open. fuser can also list all PIDs that have a given network +//config: (TCP or UDP) port open. + +//applet:IF_FUSER(APPLET(fuser, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FUSER) += fuser.o //usage:#define fuser_trivial_usage //usage: "[OPTIONS] FILE or PORT/PROTO" diff --git a/procps/kill.c b/procps/kill.c index c5c7a8d72..1ee79a051 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -7,6 +7,36 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config KILL +//config: bool "kill" +//config: default y +//config: help +//config: The command kill sends the specified signal to the specified +//config: process or process group. If no signal is specified, the TERM +//config: signal is sent. +//config: +//config:config KILLALL +//config: bool "killall" +//config: default y +//config: depends on KILL +//config: help +//config: killall sends a signal to all processes running any of the +//config: specified commands. If no signal name is specified, SIGTERM is +//config: sent. +//config: +//config:config KILLALL5 +//config: bool "killall5" +//config: default y +//config: depends on KILL +//config: + +//applet:IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP)) +//applet:IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall)) +//applet:IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5)) + +//kbuild:lib-$(CONFIG_KILL) += kill.o +//kbuild:lib-$(CONFIG_KILLALL) += kill.o +//kbuild:lib-$(CONFIG_KILLALL5) += kill.o //usage:#define kill_trivial_usage //usage: "[-l] [-SIG] PID..." diff --git a/procps/pgrep.c b/procps/pgrep.c index 1c594cf96..974d007f3 100644 --- a/procps/pgrep.c +++ b/procps/pgrep.c @@ -6,6 +6,23 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config PGREP +//config: bool "pgrep" +//config: default y +//config: help +//config: Look for processes by name. +//config: +//config:config PKILL +//config: bool "pkill" +//config: default y +//config: help +//config: Send signals to processes by name. + +//applet:IF_PGREP(APPLET(pgrep, BB_DIR_USR_BIN, BB_SUID_DROP)) +//applet:IF_PKILL(APPLET_ODDNAME(pkill, pgrep, BB_DIR_USR_BIN, BB_SUID_DROP, pkill)) + +//kbuild:lib-$(CONFIG_PGREP) += pgrep.o +//kbuild:lib-$(CONFIG_PKILL) += pgrep.o //usage:#define pgrep_trivial_usage //usage: "[-flnovx] [-s SID|-P PPID|PATTERN]" diff --git a/procps/pidof.c b/procps/pidof.c index 6d265667f..069adb7a4 100644 --- a/procps/pidof.c +++ b/procps/pidof.c @@ -6,6 +6,32 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config PIDOF +//config: bool "pidof" +//config: default y +//config: help +//config: Pidof finds the process id's (pids) of the named programs. It prints +//config: those id's on the standard output. +//config: +//config:config FEATURE_PIDOF_SINGLE +//config: bool "Enable argument for single shot (-s)" +//config: default y +//config: depends on PIDOF +//config: help +//config: Support argument '-s' for returning only the first pid found. +//config: +//config:config FEATURE_PIDOF_OMIT +//config: bool "Enable argument for omitting pids (-o)" +//config: default y +//config: depends on PIDOF +//config: help +//config: Support argument '-o' for omitting the given pids in output. +//config: The special pid %PPID can be used to name the parent process +//config: of the pidof, in other words the calling shell or shell script. + +//applet:IF_PIDOF(APPLET(pidof, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_PIDOF) += pidof.o //usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT) //usage:#define pidof_trivial_usage diff --git a/procps/ps.c b/procps/ps.c index ce638261a..e291ecd7e 100644 --- a/procps/ps.c +++ b/procps/ps.c @@ -8,6 +8,55 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config PS +//config: bool "ps" +//config: default y +//config: help +//config: ps gives a snapshot of the current processes. +//config: +//config:config FEATURE_PS_WIDE +//config: bool "Enable wide output option (-w)" +//config: default y +//config: depends on PS && !DESKTOP +//config: help +//config: Support argument 'w' for wide output. +//config: If given once, 132 chars are printed, and if given more +//config: than once, the length is unlimited. +//config: +//config:config FEATURE_PS_LONG +//config: bool "Enable long output option (-l)" +//config: default y +//config: depends on PS && !DESKTOP +//config: help +//config: Support argument 'l' for long output. +//config: Adds fields PPID, RSS, START, TIME & TTY +//config: +//config:config FEATURE_PS_TIME +//config: bool "Enable time and elapsed time output" +//config: default y +//config: depends on PS && DESKTOP +//config: select PLATFORM_LINUX +//config: help +//config: Support -o time and -o etime output specifiers. +//config: +//config:config FEATURE_PS_ADDITIONAL_COLUMNS +//config: bool "Enable additional ps columns" +//config: default y +//config: depends on PS && DESKTOP +//config: help +//config: Support -o rgroup, -o ruser, -o nice output specifiers. +//config: +//config:config FEATURE_PS_UNUSUAL_SYSTEMS +//config: bool "Support Linux prior to 2.4.0 and non-ELF systems" +//config: default n +//config: depends on FEATURE_PS_TIME +//config: help +//config: Include support for measuring HZ on old kernels and non-ELF systems +//config: (if you are on Linux 2.4.0+ and use ELF, you don't need this) + +//applet:IF_PS(APPLET(ps, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_PS) += ps.o //usage:#if ENABLE_DESKTOP //usage: diff --git a/procps/renice.c b/procps/renice.c index 2b690e0ed..64213c680 100644 --- a/procps/renice.c +++ b/procps/renice.c @@ -18,6 +18,16 @@ * options -p, -g, and -u are treated as mode switches for the * following IDs (if any). Multiple switches are allowed. */ +//config:config RENICE +//config: bool "renice" +//config: default y +//config: help +//config: Renice alters the scheduling priority of one or more running +//config: processes. + +//applet:IF_RENICE(APPLET(renice, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RENICE) += renice.o //usage:#define renice_trivial_usage //usage: "[-n] PRIORITY [[-p | -g | -u] ID...]..." diff --git a/procps/sysctl.c b/procps/sysctl.c index f0883f054..93d7c3418 100644 --- a/procps/sysctl.c +++ b/procps/sysctl.c @@ -10,6 +10,15 @@ * v1.01 - added -p to preload values from a file * v1.01.1 - busybox applet aware by */ +//config:config BB_SYSCTL +//config: bool "sysctl" +//config: default y +//config: help +//config: Configure kernel parameters at runtime. + +//applet:IF_BB_SYSCTL(APPLET(sysctl, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_BB_SYSCTL) += sysctl.o //usage:#define sysctl_trivial_usage //usage: "[OPTIONS] [KEY[=VALUE]]..." diff --git a/procps/top.c b/procps/top.c index 6f7f7d382..c66cdb764 100644 --- a/procps/top.c +++ b/procps/top.c @@ -49,7 +49,6 @@ * cp stat meminfo loadavg proc * chroot . ./top -bn1 >top1.out */ - //config:config TOP //config: bool "top" //config: default y @@ -104,6 +103,10 @@ //config: help //config: Enable 's' in top (gives lots of memory info). +//applet:IF_TOP(APPLET(top, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_TOP) += top.o + #include "libbb.h" #include "common_bufsiz.h" diff --git a/procps/uptime.c b/procps/uptime.c index 149bae6e5..436193925 100644 --- a/procps/uptime.c +++ b/procps/uptime.c @@ -11,9 +11,6 @@ * * Added FEATURE_UPTIME_UTMP_SUPPORT flag. */ - -/* getopt not needed */ - //config:config UPTIME //config: bool "uptime" //config: default y @@ -30,6 +27,10 @@ //config: help //config: Makes uptime display the number of users currently logged on. +//applet:IF_UPTIME(APPLET(uptime, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_UPTIME) += uptime.o + //usage:#define uptime_trivial_usage //usage: "" //usage:#define uptime_full_usage "\n\n" diff --git a/procps/watch.c b/procps/watch.c index 20859c3cd..bb34124c0 100644 --- a/procps/watch.c +++ b/procps/watch.c @@ -11,6 +11,17 @@ /* BB_AUDIT SUSv3 N/A */ /* BB_AUDIT GNU defects -- only option -n is supported. */ +//config:config WATCH +//config: bool "watch" +//config: default y +//config: help +//config: watch is used to execute a program periodically, showing +//config: output to the screen. + +//applet:IF_WATCH(APPLET(watch, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_WATCH) += watch.o + //usage:#define watch_trivial_usage //usage: "[-n SEC] [-t] PROG ARGS" //usage:#define watch_full_usage "\n\n" -- cgit v1.2.3-55-g6feb From 5467d268f09ddddd200ab14fd402831708be5dfd Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 06:43:46 +0100 Subject: Make killall and killall5 selecatable independent from kill Signed-off-by: Denys Vlasenko --- procps/kill.c | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/procps/kill.c b/procps/kill.c index 1ee79a051..57a33bcaa 100644 --- a/procps/kill.c +++ b/procps/kill.c @@ -18,7 +18,6 @@ //config:config KILLALL //config: bool "killall" //config: default y -//config: depends on KILL //config: help //config: killall sends a signal to all processes running any of the //config: specified commands. If no signal name is specified, SIGTERM is @@ -27,8 +26,11 @@ //config:config KILLALL5 //config: bool "killall5" //config: default y -//config: depends on KILL -//config: +//config: help +//config: The SystemV killall command. killall5 sends a signal +//config: to all processes except kernel threads and the processes +//config: in its own session, so it won't kill the shell that is running +//config: the script it was called from. //applet:IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP)) //applet:IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall)) @@ -95,17 +97,23 @@ int kill_main(int argc UNUSED_PARAM, char **argv) char *arg; pid_t pid; int signo = SIGTERM, errors = 0, quiet = 0; -#if !ENABLE_KILLALL && !ENABLE_KILLALL5 -#define killall 0 -#define killall5 0 +#if ENABLE_KILL && !ENABLE_KILLALL && !ENABLE_KILLALL5 +# define killall 0 +# define killall5 0 +#elif !ENABLE_KILL && ENABLE_KILLALL && !ENABLE_KILLALL5 +# define killall 1 +# define killall5 0 +#elif !ENABLE_KILL && !ENABLE_KILLALL && ENABLE_KILLALL5 +# define killall 0 +# define killall5 1 #else /* How to determine who we are? find 3rd char from the end: * kill, killall, killall5 * ^i ^a ^l - it's unique * (checking from the start is complicated by /bin/kill... case) */ const char char3 = argv[0][strlen(argv[0]) - 3]; -#define killall (ENABLE_KILLALL && char3 == 'a') -#define killall5 (ENABLE_KILLALL5 && char3 == 'l') +# define killall (ENABLE_KILLALL && char3 == 'a') +# define killall5 (ENABLE_KILLALL5 && char3 == 'l') #endif /* Parse any options */ -- cgit v1.2.3-55-g6feb From e32b64c4ec9272295df6852fb2a2888d7799d2f0 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 07:54:52 +0100 Subject: Convert all modutils/* applets to "new style" applet definitions Signed-off-by: Denys Vlasenko --- modutils/Config.src | 111 ---------------------------------------------- modutils/Kbuild.src | 7 --- modutils/depmod.c | 11 +++++ modutils/insmod.c | 9 ++++ modutils/lsmod.c | 19 ++++++++ modutils/modprobe-small.c | 47 ++++++++++++++++++++ modutils/modprobe.c | 22 +++++++++ modutils/modutils-24.c | 2 + modutils/rmmod.c | 9 ++++ 9 files changed, 119 insertions(+), 118 deletions(-) diff --git a/modutils/Config.src b/modutils/Config.src index 0b11832bc..4227f356a 100644 --- a/modutils/Config.src +++ b/modutils/Config.src @@ -7,117 +7,6 @@ menu "Linux Module Utilities" INSERT -config MODPROBE_SMALL - bool "Simplified modutils" - default y - select PLATFORM_LINUX - help - Simplified modutils. - - With this option modprobe does not require modules.dep file - and does not use /etc/modules.conf file. - It scans module files in /lib/modules/`uname -r` and - determines dependencies and module alias names on the fly. - This may make module loading slower, most notably - when one needs to load module by alias (this requires - scanning through module _bodies_). - - At the first attempt to load a module by alias modprobe - will try to generate modules.dep.bb file in order to speed up - future loads by alias. Failure to do so (read-only /lib/modules, - etc) is not reported, and future modprobes will be slow too. - - NB: modules.dep.bb file format is not compatible - with modules.dep file as created/used by standard module tools. - - Additional module parameters can be stored in - /etc/modules/$module_name files. - - Apart from modprobe, other utilities are also provided: - - insmod is an alias to modprobe - - rmmod is an alias to modprobe -r - - depmod generates modules.dep.bb - -config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE - bool "Accept module options on modprobe command line" - default y - depends on MODPROBE_SMALL - select PLATFORM_LINUX - help - Allow insmod and modprobe take module options from command line. - -config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED - bool "Skip loading of already loaded modules" - default y - depends on MODPROBE_SMALL - help - Check if the module is already loaded. - -config INSMOD - bool "insmod" - default n - depends on !MODPROBE_SMALL - select PLATFORM_LINUX - help - insmod is used to load specified modules in the running kernel. - -config RMMOD - bool "rmmod" - default n - depends on !MODPROBE_SMALL - select PLATFORM_LINUX - help - rmmod is used to unload specified modules from the kernel. - -config LSMOD - bool "lsmod" - default n - depends on !MODPROBE_SMALL - select PLATFORM_LINUX - help - lsmod is used to display a list of loaded modules. - -config FEATURE_LSMOD_PRETTY_2_6_OUTPUT - bool "Pretty output" - default n - depends on LSMOD - select PLATFORM_LINUX - help - This option makes output format of lsmod adjusted to - the format of module-init-tools for Linux kernel 2.6. - Increases size somewhat. - -config MODPROBE - bool "modprobe" - default n - depends on !MODPROBE_SMALL - select PLATFORM_LINUX - help - Handle the loading of modules, and their dependencies on a high - level. - -config FEATURE_MODPROBE_BLACKLIST - bool "Blacklist support" - default n - depends on MODPROBE - select PLATFORM_LINUX - help - Say 'y' here to enable support for the 'blacklist' command in - modprobe.conf. This prevents the alias resolver to resolve - blacklisted modules. This is useful if you want to prevent your - hardware autodetection scripts to load modules like evdev, frame - buffer drivers etc. - -config DEPMOD - bool "depmod" - default n - depends on !MODPROBE_SMALL - select PLATFORM_LINUX - help - depmod generates modules.dep (and potentially modules.alias - and modules.symbols) that contain dependency information - for modprobe. - comment "Options common to multiple modutils" config FEATURE_2_4_MODULES diff --git a/modutils/Kbuild.src b/modutils/Kbuild.src index 1a7ac8751..6b4fb7470 100644 --- a/modutils/Kbuild.src +++ b/modutils/Kbuild.src @@ -7,10 +7,3 @@ lib-y:= INSERT -lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o -lib-$(CONFIG_DEPMOD) += depmod.o modutils.o -lib-$(CONFIG_INSMOD) += insmod.o modutils.o -lib-$(CONFIG_LSMOD) += lsmod.o modutils.o -lib-$(CONFIG_MODPROBE) += modprobe.o modutils.o -lib-$(CONFIG_RMMOD) += rmmod.o modutils.o -lib-$(CONFIG_FEATURE_2_4_MODULES) += modutils-24.o diff --git a/modutils/depmod.c b/modutils/depmod.c index e5f0e3d2b..b9347027e 100644 --- a/modutils/depmod.c +++ b/modutils/depmod.c @@ -7,9 +7,20 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config DEPMOD +//config: bool "depmod" +//config: default n +//config: depends on !MODPROBE_SMALL +//config: select PLATFORM_LINUX +//config: help +//config: depmod generates modules.dep (and potentially modules.alias +//config: and modules.symbols) that contain dependency information +//config: for modprobe. //applet:IF_DEPMOD(APPLET(depmod, BB_DIR_SBIN, BB_SUID_DROP)) +//kbuild:lib-$(CONFIG_DEPMOD) += depmod.o modutils.o + #include "libbb.h" #include "modutils.h" #include /* uname() */ diff --git a/modutils/insmod.c b/modutils/insmod.c index 9c3c992a5..2ebf4beb9 100644 --- a/modutils/insmod.c +++ b/modutils/insmod.c @@ -6,9 +6,18 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config INSMOD +//config: bool "insmod" +//config: default n +//config: depends on !MODPROBE_SMALL +//config: select PLATFORM_LINUX +//config: help +//config: insmod is used to load specified modules in the running kernel. //applet:IF_INSMOD(APPLET(insmod, BB_DIR_SBIN, BB_SUID_DROP)) +//kbuild:lib-$(CONFIG_INSMOD) += insmod.o modutils.o + #include "libbb.h" #include "modutils.h" diff --git a/modutils/lsmod.c b/modutils/lsmod.c index 3b3c166b9..ee85fb0fb 100644 --- a/modutils/lsmod.c +++ b/modutils/lsmod.c @@ -7,9 +7,28 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config LSMOD +//config: bool "lsmod" +//config: default n +//config: depends on !MODPROBE_SMALL +//config: select PLATFORM_LINUX +//config: help +//config: lsmod is used to display a list of loaded modules. +//config: +//config:config FEATURE_LSMOD_PRETTY_2_6_OUTPUT +//config: bool "Pretty output" +//config: default n +//config: depends on LSMOD +//config: select PLATFORM_LINUX +//config: help +//config: This option makes output format of lsmod adjusted to +//config: the format of module-init-tools for Linux kernel 2.6. +//config: Increases size somewhat. //applet:IF_LSMOD(APPLET(lsmod, BB_DIR_SBIN, BB_SUID_DROP)) +//kbuild:lib-$(CONFIG_LSMOD) += lsmod.o modutils.o + //usage:#if !ENABLE_MODPROBE_SMALL //usage:#define lsmod_trivial_usage //usage: "" diff --git a/modutils/modprobe-small.c b/modutils/modprobe-small.c index a47e52234..51ba42f7a 100644 --- a/modutils/modprobe-small.c +++ b/modutils/modprobe-small.c @@ -7,6 +7,51 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config MODPROBE_SMALL +//config: bool "Simplified modutils" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Simplified modutils. +//config: +//config: With this option modprobe does not require modules.dep file +//config: and does not use /etc/modules.conf file. +//config: It scans module files in /lib/modules/`uname -r` and +//config: determines dependencies and module alias names on the fly. +//config: This may make module loading slower, most notably +//config: when one needs to load module by alias (this requires +//config: scanning through module _bodies_). +//config: +//config: At the first attempt to load a module by alias modprobe +//config: will try to generate modules.dep.bb file in order to speed up +//config: future loads by alias. Failure to do so (read-only /lib/modules, +//config: etc) is not reported, and future modprobes will be slow too. +//config: +//config: NB: modules.dep.bb file format is not compatible +//config: with modules.dep file as created/used by standard module tools. +//config: +//config: Additional module parameters can be stored in +//config: /etc/modules/$module_name files. +//config: +//config: Apart from modprobe, other utilities are also provided: +//config: - insmod is an alias to modprobe +//config: - rmmod is an alias to modprobe -r +//config: - depmod generates modules.dep.bb +//config: +//config:config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE +//config: bool "Accept module options on modprobe command line" +//config: default y +//config: depends on MODPROBE_SMALL +//config: select PLATFORM_LINUX +//config: help +//config: Allow insmod and modprobe take module options from command line. +//config: +//config:config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED +//config: bool "Skip loading of already loaded modules" +//config: default y +//config: depends on MODPROBE_SMALL +//config: help +//config: Check if the module is already loaded. //applet:IF_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP)) //applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, depmod)) @@ -14,6 +59,8 @@ //applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, lsmod)) //applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, rmmod)) +//kbuild:lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o + #include "libbb.h" /* After libbb.h, since it needs sys/types.h on some systems */ #include /* uname() */ diff --git a/modutils/modprobe.c b/modutils/modprobe.c index 8130c40b7..d404ef92f 100644 --- a/modutils/modprobe.c +++ b/modutils/modprobe.c @@ -7,9 +7,31 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config MODPROBE +//config: bool "modprobe" +//config: default n +//config: depends on !MODPROBE_SMALL +//config: select PLATFORM_LINUX +//config: help +//config: Handle the loading of modules, and their dependencies on a high +//config: level. +//config: +//config:config FEATURE_MODPROBE_BLACKLIST +//config: bool "Blacklist support" +//config: default n +//config: depends on MODPROBE +//config: select PLATFORM_LINUX +//config: help +//config: Say 'y' here to enable support for the 'blacklist' command in +//config: modprobe.conf. This prevents the alias resolver to resolve +//config: blacklisted modules. This is useful if you want to prevent your +//config: hardware autodetection scripts to load modules like evdev, frame +//config: buffer drivers etc. //applet:IF_MODPROBE(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP)) +//kbuild:lib-$(CONFIG_MODPROBE) += modprobe.o modutils.o + #include "libbb.h" #include "modutils.h" #include diff --git a/modutils/modutils-24.c b/modutils/modutils-24.c index fe46fc3fd..9ce91351d 100644 --- a/modutils/modutils-24.c +++ b/modutils/modutils-24.c @@ -58,6 +58,8 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//kbuild:lib-$(CONFIG_FEATURE_2_4_MODULES) += modutils-24.o + #include "libbb.h" #include "modutils.h" #include diff --git a/modutils/rmmod.c b/modutils/rmmod.c index 5c353ef95..e0358838a 100644 --- a/modutils/rmmod.c +++ b/modutils/rmmod.c @@ -7,9 +7,18 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config RMMOD +//config: bool "rmmod" +//config: default n +//config: depends on !MODPROBE_SMALL +//config: select PLATFORM_LINUX +//config: help +//config: rmmod is used to unload specified modules from the kernel. //applet:IF_RMMOD(APPLET(rmmod, BB_DIR_SBIN, BB_SUID_DROP)) +//kbuild:lib-$(CONFIG_RMMOD) += rmmod.o modutils.o + //usage:#if !ENABLE_MODPROBE_SMALL //usage:#define rmmod_trivial_usage //usage: "[-wfa] [MODULE]..." -- cgit v1.2.3-55-g6feb From 47367e1d50b81501e8a6ce215f8be4eeacdda693 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 09:05:14 +0100 Subject: Convert all networking/* applets to "new style" applet definitions Signed-off-by: Denys Vlasenko --- include/applets.src.h | 49 --- networking/Config.src | 794 +---------------------------------------------- networking/Kbuild.src | 36 --- networking/arp.c | 10 + networking/arping.c | 11 + networking/brctl.c | 30 ++ networking/dnsd.c | 9 + networking/ether-wake.c | 10 + networking/ftpd.c | 34 ++ networking/ftpgetput.c | 24 ++ networking/httpd.c | 122 ++++++++ networking/ifconfig.c | 51 +++ networking/ifenslave.c | 11 + networking/ifplugd.c | 10 + networking/inetd.c | 53 ++++ networking/ip.c | 124 ++++++++ networking/ipcalc.c | 25 ++ networking/isrv_identd.c | 11 + networking/nameif.c | 4 + networking/nc.c | 10 +- networking/netstat.c | 26 ++ networking/nslookup.c | 9 + networking/ntpd.c | 26 ++ networking/pscan.c | 9 + networking/route.c | 10 + networking/slattach.c | 11 + networking/tc.c | 1 + networking/tcpudp.c | 19 ++ networking/telnet.c | 29 ++ networking/telnetd.c | 72 +++++ networking/tftp.c | 72 +++++ networking/traceroute.c | 34 ++ networking/tunctl.c | 18 ++ networking/vconfig.c | 11 + networking/zcip.c | 16 + 35 files changed, 909 insertions(+), 882 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index 1d2d9c8ed..3fd9ba06e 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -76,11 +76,8 @@ 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_ACPID(APPLET(acpid, BB_DIR_SBIN, BB_SUID_DROP)) -IF_ARP(APPLET(arp, BB_DIR_SBIN, BB_SUID_DROP)) -IF_ARPING(APPLET(arping, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename)) IF_BLKID(APPLET(blkid, BB_DIR_SBIN, BB_SUID_DROP)) -IF_BRCTL(APPLET(brctl, BB_DIR_USR_SBIN, BB_SUID_DROP)) 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)) @@ -101,7 +98,6 @@ 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_DMESG(APPLET(dmesg, BB_DIR_BIN, BB_SUID_DROP)) -IF_DNSD(APPLET(dnsd, BB_DIR_USR_SBIN, BB_SUID_DROP)) 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_DUMPKMAP(APPLET(dumpkmap, BB_DIR_BIN, BB_SUID_DROP)) @@ -110,10 +106,8 @@ IF_DUMPLEASES(APPLET(dumpleases, BB_DIR_USR_BIN, 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_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, BB_DIR_USR_SBIN, BB_SUID_DROP, ether_wake)) IF_EXPAND(APPLET(expand, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_FAKEIDENTD(APPLET(fakeidentd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_FALSE(APPLET_NOFORK(false, false, BB_DIR_BIN, BB_SUID_DROP, false)) IF_FBSET(APPLET(fbset, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, BB_DIR_BIN, BB_SUID_DROP, fdflush)) @@ -129,37 +123,16 @@ IF_FREERAMDISK(APPLET(freeramdisk, BB_DIR_SBIN, BB_SUID_DROP)) //IF_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext3)) IF_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, BB_DIR_SBIN, BB_SUID_DROP, fsck_minix)) IF_FSYNC(APPLET_NOFORK(fsync, fsync, BB_DIR_BIN, BB_SUID_DROP, fsync)) -IF_FTPD(APPLET(ftpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpget)) -IF_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpput)) IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP)) IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd)) IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head)) IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump)) -IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP)) -IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP)) -IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP)) -IF_IFPLUGD(APPLET(ifplugd, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_INETD(APPLET(inetd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_INSTALL(APPLET(install, BB_DIR_USR_BIN, BB_SUID_DROP)) -#if ENABLE_FEATURE_IP_ADDRESS \ - || ENABLE_FEATURE_IP_ROUTE \ - || ENABLE_FEATURE_IP_LINK \ - || ENABLE_FEATURE_IP_TUNNEL \ - || ENABLE_FEATURE_IP_RULE -IF_IP(APPLET(ip, BB_DIR_SBIN, BB_SUID_DROP)) -#endif -IF_IPADDR(APPLET(ipaddr, BB_DIR_SBIN, BB_SUID_DROP)) -IF_IPCALC(APPLET(ipcalc, BB_DIR_BIN, BB_SUID_DROP)) IF_IPCRM(APPLET(ipcrm, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_IPCS(APPLET(ipcs, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_IPLINK(APPLET(iplink, BB_DIR_SBIN, BB_SUID_DROP)) -IF_IPROUTE(APPLET(iproute, BB_DIR_SBIN, BB_SUID_DROP)) -IF_IPRULE(APPLET(iprule, BB_DIR_SBIN, BB_SUID_DROP)) -IF_IPTUNNEL(APPLET(iptunnel, BB_DIR_SBIN, BB_SUID_DROP)) IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_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)) @@ -186,13 +159,8 @@ IF_MORE(APPLET(more, BB_DIR_BIN, BB_SUID_DROP)) * Therefore we use BB_SUID_MAYBE instead of BB_SUID_REQUIRE: */ IF_MOUNT(APPLET(mount, BB_DIR_BIN, IF_DESKTOP(BB_SUID_MAYBE) IF_NOT_DESKTOP(BB_SUID_DROP))) IF_MV(APPLET(mv, BB_DIR_BIN, BB_SUID_DROP)) -IF_NAMEIF(APPLET(nameif, BB_DIR_SBIN, BB_SUID_DROP)) -IF_NC(APPLET(nc, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_NETSTAT(APPLET(netstat, 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_NSLOOKUP(APPLET(nslookup, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_NTPD(APPLET(ntpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_OD(APPLET(od, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_OPENVT(APPLET(openvt, BB_DIR_USR_BIN, BB_SUID_DROP)) //IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -200,7 +168,6 @@ IF_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, BB_SUID_DROP)) IF_POPMAILDIR(APPLET(popmaildir, BB_DIR_USR_SBIN, 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_PSCAN(APPLET(pscan, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_PWD(APPLET_NOFORK(pwd, pwd, BB_DIR_BIN, BB_SUID_DROP, pwd)) IF_RDATE(APPLET(rdate, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_RDEV(APPLET(rdev, BB_DIR_USR_SBIN, BB_SUID_DROP)) @@ -213,7 +180,6 @@ IF_RESIZE(APPLET(resize, 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_ROUTE(APPLET(route, BB_DIR_SBIN, BB_SUID_DROP)) IF_RTCWAKE(APPLET(rtcwake, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SCRIPT(APPLET(script, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -230,7 +196,6 @@ IF_SETKEYCODES(APPLET(setkeycodes, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SETLOGCONS(APPLET(setlogcons, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_SHOWKEY(APPLET(showkey, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_SLATTACH(APPLET(slattach, BB_DIR_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)) @@ -242,25 +207,13 @@ IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, 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_TC(APPLET(tc, BB_DIR_SBIN, BB_SUID_DROP)) */ -IF_TCPSVD(APPLET_ODDNAME(tcpsvd, tcpudpsvd, BB_DIR_USR_BIN, BB_SUID_DROP, tcpsvd)) IF_TEE(APPLET(tee, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_TELNET(APPLET(telnet, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_TELNETD(APPLET(telnetd, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) -#if ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT -IF_TFTP(APPLET(tftp, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_TFTPD(APPLET(tftpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) -#endif IF_TR(APPLET(tr, BB_DIR_USR_BIN, BB_SUID_DROP)) -/* Needs socket(AF_INET, SOCK_RAW, IPPROTO_ICMP), therefore BB_SUID_MAYBE: */ -IF_TRACEROUTE(APPLET(traceroute, BB_DIR_USR_BIN, BB_SUID_MAYBE)) -IF_TRACEROUTE6(APPLET(traceroute6, BB_DIR_USR_BIN, BB_SUID_MAYBE)) 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_TUNCTL(APPLET(tunctl, BB_DIR_SBIN, 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_UDPSVD(APPLET_ODDNAME(udpsvd, tcpudpsvd, BB_DIR_USR_BIN, BB_SUID_DROP, udpsvd)) IF_UMOUNT(APPLET(umount, BB_DIR_BIN, 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)) @@ -269,11 +222,9 @@ IF_UNIX2DOS(APPLET_NOEXEC(unix2dos, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, unix 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_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, 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_ZCIP(APPLET(zcip, BB_DIR_SBIN, BB_SUID_DROP)) #if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \ && !defined(MAKE_LINKS) && !defined(MAKE_SUID) diff --git a/networking/Config.src b/networking/Config.src index 43667fe6a..4d921884f 100644 --- a/networking/Config.src +++ b/networking/Config.src @@ -5,8 +5,6 @@ menu "Networking Utilities" -INSERT - config FEATURE_IPV6 bool "Enable IPv6 support" default y @@ -48,558 +46,7 @@ config VERBOSE_RESOLUTION_ERRORS "can't resolve 'hostname.com'" and want to know more. This may increase size of your executable a bit. -config ARP - bool "arp" - default y - select PLATFORM_LINUX - help - Manipulate the system ARP cache. - -config ARPING - bool "arping" - default y - select PLATFORM_LINUX - help - Ping hosts by ARP packets. - -config BRCTL - bool "brctl" - default y - select PLATFORM_LINUX - help - Manage ethernet bridges. - Supports addbr/delbr and addif/delif. - -config FEATURE_BRCTL_FANCY - bool "Fancy options" - default y - depends on BRCTL - help - Add support for extended option like: - setageing, setfd, sethello, setmaxage, - setpathcost, setportprio, setbridgeprio, - stp - This adds about 600 bytes. - -config FEATURE_BRCTL_SHOW - bool "Support show" - default y - depends on BRCTL && FEATURE_BRCTL_FANCY - help - Add support for option which prints the current config: - show - -config DNSD - bool "dnsd" - default y - help - Small and static DNS server daemon. - -config ETHER_WAKE - bool "ether-wake" - default y - select PLATFORM_LINUX - help - Send a magic packet to wake up sleeping machines. - -config FAKEIDENTD - bool "fakeidentd" - default y - select FEATURE_SYSLOG - help - fakeidentd listens on the ident port and returns a predefined - fake value on any query. - -config FTPD - bool "ftpd" - default y - help - simple FTP daemon. You have to run it via inetd. - -config FEATURE_FTP_WRITE - bool "Enable upload commands" - default y - depends on FTPD - help - Enable all kinds of FTP upload commands (-w option) - -config FEATURE_FTPD_ACCEPT_BROKEN_LIST - bool "Enable workaround for RFC-violating clients" - default y - depends on FTPD - help - Some ftp clients (among them KDE's Konqueror) issue illegal - "LIST -l" requests. This option works around such problems. - It might prevent you from listing files starting with "-" and - it increases the code size by ~40 bytes. - Most other ftp servers seem to behave similar to this. - -config FEATURE_FTP_AUTHENTICATION - bool "Enable authentication" - default y - depends on FTPD - help - Enable basic system login as seen in telnet etc. - -config FTPGET - bool "ftpget" - default y - help - Retrieve a remote file via FTP. - -config FTPPUT - bool "ftpput" - default y - help - Store a remote file via FTP. - -config FEATURE_FTPGETPUT_LONG_OPTIONS - bool "Enable long options in ftpget/ftpput" - default y - depends on LONG_OPTS && (FTPGET || FTPPUT) - help - Support long options for the ftpget/ftpput applet. - -config HTTPD - bool "httpd" - default y - help - Serve web pages via an HTTP server. - -config FEATURE_HTTPD_RANGES - bool "Support 'Ranges:' header" - default y - depends on HTTPD - help - Makes httpd emit "Accept-Ranges: bytes" header and understand - "Range: bytes=NNN-[MMM]" header. Allows for resuming interrupted - downloads, seeking in multimedia players etc. - -config FEATURE_HTTPD_SETUID - bool "Enable -u option" - default y - depends on HTTPD - help - This option allows the server to run as a specific user - rather than defaulting to the user that starts the server. - Use of this option requires special privileges to change to a - different user. - -config FEATURE_HTTPD_BASIC_AUTH - bool "Enable Basic http Authentication" - default y - depends on HTTPD - help - Utilizes password settings from /etc/httpd.conf for basic - authentication on a per url basis. - Example for httpd.conf file: - /adm:toor:PaSsWd - -config FEATURE_HTTPD_AUTH_MD5 - bool "Support MD5 crypted passwords for http Authentication" - default y - depends on FEATURE_HTTPD_BASIC_AUTH - help - Enables encrypted passwords, and wildcard user/passwords - in httpd.conf file. - User '*' means 'any system user name is ok', - password of '*' means 'use system password for this user' - Examples: - /adm:toor:$1$P/eKnWXS$aI1aPGxT.dJD5SzqAKWrF0 - /adm:root:* - /wiki:*:* - -config FEATURE_HTTPD_CGI - bool "Support Common Gateway Interface (CGI)" - default y - depends on HTTPD - help - This option allows scripts and executables to be invoked - when specific URLs are requested. - -config FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR - bool "Support for running scripts through an interpreter" - default y - depends on FEATURE_HTTPD_CGI - help - This option enables support for running scripts through an - interpreter. Turn this on if you want PHP scripts to work - properly. You need to supply an additional line in your - httpd.conf file: - *.php:/path/to/your/php - -config FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV - bool "Set REMOTE_PORT environment variable for CGI" - default y - depends on FEATURE_HTTPD_CGI - help - Use of this option can assist scripts in generating - references that contain a unique port number. - -config FEATURE_HTTPD_ENCODE_URL_STR - bool "Enable -e option (useful for CGIs written as shell scripts)" - default y - depends on HTTPD - help - This option allows html encoding of arbitrary strings for display - by the browser. Output goes to stdout. - For example, httpd -e "" produces - "<Hello World>". - -config FEATURE_HTTPD_ERROR_PAGES - bool "Support for custom error pages" - default y - depends on HTTPD - help - This option allows you to define custom error pages in - the configuration file instead of the default HTTP status - error pages. For instance, if you add the line: - E404:/path/e404.html - in the config file, the server will respond the specified - '/path/e404.html' file instead of the terse '404 NOT FOUND' - message. - -config FEATURE_HTTPD_PROXY - bool "Support for reverse proxy" - default y - depends on HTTPD - help - This option allows you to define URLs that will be forwarded - to another HTTP server. To setup add the following line to the - configuration file - P:/url/:http://hostname[:port]/new/path/ - Then a request to /url/myfile will be forwarded to - http://hostname[:port]/new/path/myfile. - -config FEATURE_HTTPD_GZIP - bool "Support for GZIP content encoding" - default y - depends on HTTPD - help - Makes httpd send files using GZIP content encoding if the - client supports it and a pre-compressed .gz exists. - -config IFCONFIG - bool "ifconfig" - default y - select PLATFORM_LINUX - help - Ifconfig is used to configure the kernel-resident network interfaces. - -config FEATURE_IFCONFIG_STATUS - bool "Enable status reporting output (+7k)" - default y - depends on IFCONFIG - help - If ifconfig is called with no arguments it will display the status - of the currently active interfaces. - -config FEATURE_IFCONFIG_SLIP - bool "Enable slip-specific options \"keepalive\" and \"outfill\"" - default y - depends on IFCONFIG - help - Allow "keepalive" and "outfill" support for SLIP. If you're not - planning on using serial lines, leave this unchecked. - -config FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ - bool "Enable options \"mem_start\", \"io_addr\", and \"irq\"" - default y - depends on IFCONFIG - help - Allow the start address for shared memory, start address for I/O, - and/or the interrupt line used by the specified device. - -config FEATURE_IFCONFIG_HW - bool "Enable option \"hw\" (ether only)" - default y - depends on IFCONFIG - help - Set the hardware address of this interface, if the device driver - supports this operation. Currently, we only support the 'ether' - class. - -config FEATURE_IFCONFIG_BROADCAST_PLUS - bool "Set the broadcast automatically" - default y - depends on IFCONFIG - help - Setting this will make ifconfig attempt to find the broadcast - automatically if the value '+' is used. - -config IFENSLAVE - bool "ifenslave" - default y - select PLATFORM_LINUX - help - Userspace application to bind several interfaces - to a logical interface (use with kernel bonding driver). - -config IFPLUGD - bool "ifplugd" - default y - select PLATFORM_LINUX - help - Network interface plug detection daemon. - -config INETD - bool "inetd" - default y - select FEATURE_SYSLOG - help - Internet superserver daemon - -config FEATURE_INETD_SUPPORT_BUILTIN_ECHO - bool "Support echo service" - default y - depends on INETD - help - Echo received data internal inetd service - -config FEATURE_INETD_SUPPORT_BUILTIN_DISCARD - bool "Support discard service" - default y - depends on INETD - help - Internet /dev/null internal inetd service - -config FEATURE_INETD_SUPPORT_BUILTIN_TIME - bool "Support time service" - default y - depends on INETD - help - Return 32 bit time since 1900 internal inetd service - -config FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME - bool "Support daytime service" - default y - depends on INETD - help - Return human-readable time internal inetd service - -config FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN - bool "Support chargen service" - default y - depends on INETD - help - Familiar character generator internal inetd service - -config FEATURE_INETD_RPC - bool "Support RPC services" - default n # very rarely used, and needs Sun RPC support in libc - depends on INETD - select FEATURE_HAVE_RPC - help - Support Sun-RPC based services - -config IP - bool "ip" - default y - select PLATFORM_LINUX - help - The "ip" applet is a TCP/IP interface configuration and routing - utility. You generally don't need "ip" to use busybox with - TCP/IP. - -config FEATURE_IP_ADDRESS - bool "ip address" - default y - depends on IP - help - Address manipulation support for the "ip" applet. - -config FEATURE_IP_LINK - bool "ip link" - default y - depends on IP - help - Configure network devices with "ip". - -config FEATURE_IP_ROUTE - bool "ip route" - default y - depends on IP - help - Add support for routing table management to "ip". - -config FEATURE_IP_ROUTE_DIR - string "ip route configuration directory" - default "/etc/iproute2" - depends on FEATURE_IP_ROUTE - help - Location of the "ip" applet routing configuration. - -config FEATURE_IP_TUNNEL - bool "ip tunnel" - default y - depends on IP - help - Add support for tunneling commands to "ip". - -config FEATURE_IP_RULE - bool "ip rule" - default y - depends on IP - help - Add support for rule commands to "ip". - -config FEATURE_IP_NEIGH - bool "ip neighbor" - default y - depends on IP - help - Add support for neighbor commands to "ip". - -config FEATURE_IP_SHORT_FORMS - bool "Support short forms of ip commands" - default y - depends on IP - help - Also support short-form of ip commands: - ip addr -> ipaddr - ip link -> iplink - ip route -> iproute - ip tunnel -> iptunnel - ip rule -> iprule - ip neigh -> ipneigh - - Say N unless you desparately need the short form of the ip - object commands. - -config FEATURE_IP_RARE_PROTOCOLS - bool "Support displaying rarely used link types" - default n - depends on IP - help - If you are not going to use links of type "frad", "econet", - "bif" etc, you probably don't need to enable this. - Ethernet, wireless, infrared, ppp/slip, ip tunnelling - link types are supported without this option selected. - -config IPADDR - bool - default y - depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ADDRESS - -config IPLINK - bool - default y - depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_LINK - -config IPROUTE - bool - default y - depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ROUTE - -config IPTUNNEL - bool - default y - depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_TUNNEL - -config IPRULE - bool - default y - depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_RULE - -config IPNEIGH - bool - default y - depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_NEIGH - -config IPCALC - bool "ipcalc" - default y - help - ipcalc takes an IP address and netmask and calculates the - resulting broadcast, network, and host range. - -config FEATURE_IPCALC_FANCY - bool "Fancy IPCALC, more options, adds 1 kbyte" - default y - depends on IPCALC - help - Adds the options hostname, prefix and silent to the output of - "ipcalc". - -config FEATURE_IPCALC_LONG_OPTIONS - bool "Enable long options" - default y - depends on IPCALC && LONG_OPTS - help - Support long options for the ipcalc applet. - -config NETSTAT - bool "netstat" - default y - select PLATFORM_LINUX - help - netstat prints information about the Linux networking subsystem. - -config FEATURE_NETSTAT_WIDE - bool "Enable wide netstat output" - default y - depends on NETSTAT - help - Add support for wide columns. Useful when displaying IPv6 addresses - (-W option). - -config FEATURE_NETSTAT_PRG - bool "Enable PID/Program name output" - default y - depends on NETSTAT - help - Add support for -p flag to print out PID and program name. - +700 bytes of code. - -config NSLOOKUP - bool "nslookup" - default y - help - nslookup is a tool to query Internet name servers. - -config NTPD - bool "ntpd" - default y - select PLATFORM_LINUX - help - The NTP client/server daemon. - -config FEATURE_NTPD_SERVER - bool "Make ntpd usable as a NTP server" - default y - depends on NTPD - help - Make ntpd usable as a NTP server. If you disable this option - ntpd will be usable only as a NTP client. - -config FEATURE_NTPD_CONF - bool "Make ntpd understand /etc/ntp.conf" - default y - depends on NTPD - help - Make ntpd look in /etc/ntp.conf for peers. Only "server address" - is supported. - -config PSCAN - bool "pscan" - default y - help - Simple network port scanner. - -config ROUTE - bool "route" - default y - select PLATFORM_LINUX - help - Route displays or manipulates the kernel's IP routing tables. - -config SLATTACH - bool "slattach" - default y - select PLATFORM_LINUX - help - slattach is a small utility to attach network interfaces to serial - lines. +INSERT #config TC # bool "tc" @@ -611,218 +58,6 @@ config SLATTACH # def_bool n # depends on TC -config TCPSVD - bool "tcpsvd" - default y - help - tcpsvd listens on a TCP port and runs a program for each new - connection. - -config TELNET - bool "telnet" - default y - help - Telnet is an interface to the TELNET protocol, but is also commonly - used to test other simple protocols. - -config FEATURE_TELNET_TTYPE - bool "Pass TERM type to remote host" - default y - depends on TELNET - help - Setting this option will forward the TERM environment variable to the - remote host you are connecting to. This is useful to make sure that - things like ANSI colors and other control sequences behave. - -config FEATURE_TELNET_AUTOLOGIN - bool "Pass USER type to remote host" - default y - depends on TELNET - help - Setting this option will forward the USER environment variable to the - remote host you are connecting to. This is useful when you need to - log into a machine without telling the username (autologin). This - option enables `-a' and `-l USER' arguments. - -config TELNETD - bool "telnetd" - default y - select FEATURE_SYSLOG - help - A daemon for the TELNET protocol, allowing you to log onto the host - running the daemon. Please keep in mind that the TELNET protocol - sends passwords in plain text. If you can't afford the space for an - SSH daemon and you trust your network, you may say 'y' here. As a - more secure alternative, you should seriously consider installing the - very small Dropbear SSH daemon instead: - http://matt.ucc.asn.au/dropbear/dropbear.html - - Note that for busybox telnetd to work you need several things: - First of all, your kernel needs: - CONFIG_UNIX98_PTYS=y - - Next, you need a /dev/pts directory on your root filesystem: - - $ ls -ld /dev/pts - drwxr-xr-x 2 root root 0 Sep 23 13:21 /dev/pts/ - - Next you need the pseudo terminal master multiplexer /dev/ptmx: - - $ ls -la /dev/ptmx - crw-rw-rw- 1 root tty 5, 2 Sep 23 13:55 /dev/ptmx - - Any /dev/ttyp[0-9]* files you may have can be removed. - Next, you need to mount the devpts filesystem on /dev/pts using: - - mount -t devpts devpts /dev/pts - - You need to be sure that busybox has LOGIN and - FEATURE_SUID enabled. And finally, you should make - certain that Busybox has been installed setuid root: - - chown root.root /bin/busybox - chmod 4755 /bin/busybox - - with all that done, telnetd _should_ work.... - - -config FEATURE_TELNETD_STANDALONE - bool "Support standalone telnetd (not inetd only)" - default y - depends on TELNETD - help - Selecting this will make telnetd able to run standalone. - -config FEATURE_TELNETD_INETD_WAIT - bool "Support -w SEC option (inetd wait mode)" - default y - depends on FEATURE_TELNETD_STANDALONE - help - This option allows you to run telnetd in "inet wait" mode. - Example inetd.conf line (note "wait", not usual "nowait"): - - telnet stream tcp wait root /bin/telnetd telnetd -w10 - - In this example, inetd passes _listening_ socket_ as fd 0 - to telnetd when connection appears. - telnetd will wait for connections until all existing - connections are closed, and no new connections - appear during 10 seconds. Then it exits, and inetd continues - to listen for new connections. - - This option is rarely used. "tcp nowait" is much more usual - way of running tcp services, including telnetd. - You most probably want to say N here. - -config TFTP - bool "tftp" - default y - help - This enables the Trivial File Transfer Protocol client program. TFTP - is usually used for simple, small transfers such as a root image - for a network-enabled bootloader. - -config TFTPD - bool "tftpd" - default y - help - This enables the Trivial File Transfer Protocol server program. - It expects that stdin is a datagram socket and a packet - is already pending on it. It will exit after one transfer. - In other words: it should be run from inetd in nowait mode, - or from udpsvd. Example: "udpsvd -E 0 69 tftpd DIR" - -comment "Common options for tftp/tftpd" - depends on TFTP || TFTPD - -config FEATURE_TFTP_GET - bool "Enable 'tftp get' and/or tftpd upload code" - default y - depends on TFTP || TFTPD - help - Add support for the GET command within the TFTP client. This allows - a client to retrieve a file from a TFTP server. - Also enable upload support in tftpd, if tftpd is selected. - - Note: this option does _not_ make tftpd capable of download - (the usual operation people need from it)! - -config FEATURE_TFTP_PUT - bool "Enable 'tftp put' and/or tftpd download code" - default y - depends on TFTP || TFTPD - help - Add support for the PUT command within the TFTP client. This allows - a client to transfer a file to a TFTP server. - Also enable download support in tftpd, if tftpd is selected. - -config FEATURE_TFTP_BLOCKSIZE - bool "Enable 'blksize' and 'tsize' protocol options" - default y - depends on TFTP || TFTPD - help - Allow tftp to specify block size, and tftpd to understand - "blksize" and "tsize" options. - -config FEATURE_TFTP_PROGRESS_BAR - bool "Enable tftp progress meter" - default y - depends on TFTP && FEATURE_TFTP_BLOCKSIZE - help - Show progress bar. - -config TFTP_DEBUG - bool "Enable debug" - default n - depends on TFTP || TFTPD - help - Make tftp[d] print debugging messages on stderr. - This is useful if you are diagnosing a bug in tftp[d]. - -config TRACEROUTE - bool "traceroute" - default y - select PLATFORM_LINUX - help - Utility to trace the route of IP packets. - -config TRACEROUTE6 - bool "traceroute6" - default y - depends on FEATURE_IPV6 && TRACEROUTE - help - Utility to trace the route of IPv6 packets. - -config FEATURE_TRACEROUTE_VERBOSE - bool "Enable verbose output" - default y - depends on TRACEROUTE - help - Add some verbosity to traceroute. This includes among other things - hostnames and ICMP response types. - -config FEATURE_TRACEROUTE_USE_ICMP - bool "Enable -I option (use ICMP instead of UDP)" - default y - depends on TRACEROUTE - help - Add option -I to use ICMP ECHO instead of UDP datagrams. - -config TUNCTL - bool "tunctl" - default y - select PLATFORM_LINUX - help - tunctl creates or deletes tun devices. - -config FEATURE_TUNCTL_UG - bool "Support owner:group assignment" - default y - depends on TUNCTL - help - Allow to specify owner and group of newly created interface. - 340 bytes of pure bloat. Say no here. - source networking/udhcp/Config.in config IFUPDOWN_UDHCPC_CMD_OPTIONS @@ -834,31 +69,4 @@ config IFUPDOWN_UDHCPC_CMD_OPTIONS Intended to alter options not available in /etc/network/interfaces. (IE: --syslog --background etc...) -config UDPSVD - bool "udpsvd" - default y - help - udpsvd listens on an UDP port and runs a program for each new - connection. - -config VCONFIG - bool "vconfig" - default y - select PLATFORM_LINUX - help - Creates, removes, and configures VLAN interfaces - -config ZCIP - bool "zcip" - default y - select PLATFORM_LINUX - select FEATURE_SYSLOG - help - ZCIP provides ZeroConf IPv4 address selection, according to RFC 3927. - It's a daemon that allocates and defends a dynamically assigned - address on the 169.254/16 network, requiring no system administrator. - - See http://www.zeroconf.org for further details, and "zcip.script" - in the busybox examples. - endmenu diff --git a/networking/Kbuild.src b/networking/Kbuild.src index 4ad750283..6b4fb7470 100644 --- a/networking/Kbuild.src +++ b/networking/Kbuild.src @@ -7,39 +7,3 @@ lib-y:= INSERT -lib-$(CONFIG_ARP) += arp.o interface.o -lib-$(CONFIG_ARPING) += arping.o -lib-$(CONFIG_BRCTL) += brctl.o -lib-$(CONFIG_DNSD) += dnsd.o -lib-$(CONFIG_ETHER_WAKE) += ether-wake.o -lib-$(CONFIG_FAKEIDENTD) += isrv_identd.o isrv.o -lib-$(CONFIG_FTPD) += ftpd.o -lib-$(CONFIG_FTPGET) += ftpgetput.o -lib-$(CONFIG_FTPPUT) += ftpgetput.o -lib-$(CONFIG_HTTPD) += httpd.o -lib-$(CONFIG_IFCONFIG) += ifconfig.o interface.o -lib-$(CONFIG_IFENSLAVE) += ifenslave.o interface.o -lib-$(CONFIG_IFPLUGD) += ifplugd.o -lib-$(CONFIG_INETD) += inetd.o -lib-$(CONFIG_IP) += ip.o -lib-$(CONFIG_IPCALC) += ipcalc.o -lib-$(CONFIG_NAMEIF) += nameif.o -lib-$(CONFIG_NC) += nc.o -lib-$(CONFIG_NETSTAT) += netstat.o -lib-$(CONFIG_NSLOOKUP) += nslookup.o -lib-$(CONFIG_NTPD) += ntpd.o -lib-$(CONFIG_PSCAN) += pscan.o -lib-$(CONFIG_ROUTE) += route.o -lib-$(CONFIG_SLATTACH) += slattach.o -lib-$(CONFIG_TC) += tc.o -lib-$(CONFIG_TELNET) += telnet.o -lib-$(CONFIG_TELNETD) += telnetd.o -lib-$(CONFIG_TFTP) += tftp.o -lib-$(CONFIG_TFTPD) += tftp.o -lib-$(CONFIG_TRACEROUTE) += traceroute.o -lib-$(CONFIG_TUNCTL) += tunctl.o -lib-$(CONFIG_VCONFIG) += vconfig.o -lib-$(CONFIG_ZCIP) += zcip.o - -lib-$(CONFIG_TCPSVD) += tcpudp.o tcpudp_perhost.o -lib-$(CONFIG_UDPSVD) += tcpudp.o tcpudp_perhost.o diff --git a/networking/arp.c b/networking/arp.c index 69a5816eb..a62a3761c 100644 --- a/networking/arp.c +++ b/networking/arp.c @@ -12,6 +12,16 @@ * * modified for getopt32 by Arne Bernin */ +//config:config ARP +//config: bool "arp" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Manipulate the system ARP cache. + +//applet:IF_ARP(APPLET(arp, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_ARP) += arp.o interface.o //usage:#define arp_trivial_usage //usage: "\n[-vn] [-H HWTYPE] [-i IF] -a [HOSTNAME]" diff --git a/networking/arping.c b/networking/arping.c index 46bd65e36..5bfeb1b45 100644 --- a/networking/arping.c +++ b/networking/arping.c @@ -5,6 +5,17 @@ * Author: Alexey Kuznetsov * Busybox port: Nick Fedchik */ +//config:config ARPING +//config: bool "arping" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Ping hosts by ARP packets. +//config: + +//applet:IF_ARPING(APPLET(arping, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_ARPING) += arping.o //usage:#define arping_trivial_usage //usage: "[-fqbDUA] [-c CNT] [-w TIMEOUT] [-I IFACE] [-s SRC_IP] DST_IP" diff --git a/networking/brctl.c b/networking/brctl.c index b7320966a..35876896e 100644 --- a/networking/brctl.c +++ b/networking/brctl.c @@ -12,6 +12,36 @@ /* This applet currently uses only the ioctl interface and no sysfs at all. * At the time of this writing this was considered a feature. */ +//config:config BRCTL +//config: bool "brctl" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Manage ethernet bridges. +//config: Supports addbr/delbr and addif/delif. +//config: +//config:config FEATURE_BRCTL_FANCY +//config: bool "Fancy options" +//config: default y +//config: depends on BRCTL +//config: help +//config: Add support for extended option like: +//config: setageing, setfd, sethello, setmaxage, +//config: setpathcost, setportprio, setbridgeprio, +//config: stp +//config: This adds about 600 bytes. +//config: +//config:config FEATURE_BRCTL_SHOW +//config: bool "Support show" +//config: default y +//config: depends on BRCTL && FEATURE_BRCTL_FANCY +//config: help +//config: Add support for option which prints the current config: +//config: show + +//applet:IF_BRCTL(APPLET(brctl, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_BRCTL) += brctl.o //usage:#define brctl_trivial_usage //usage: "COMMAND [BRIDGE [INTERFACE]]" diff --git a/networking/dnsd.c b/networking/dnsd.c index 923ad6bc6..7be90018d 100644 --- a/networking/dnsd.c +++ b/networking/dnsd.c @@ -16,6 +16,15 @@ * Some bugfix and minor changes was applied by Roberto A. Foglietta who made * the first porting of oao' scdns to busybox also. */ +//config:config DNSD +//config: bool "dnsd" +//config: default y +//config: help +//config: Small and static DNS server daemon. + +//applet:IF_DNSD(APPLET(dnsd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_DNSD) += dnsd.o //usage:#define dnsd_trivial_usage //usage: "[-dvs] [-c CONFFILE] [-t TTL_SEC] [-p PORT] [-i ADDR]" diff --git a/networking/ether-wake.c b/networking/ether-wake.c index c38547dda..d7d691772 100644 --- a/networking/ether-wake.c +++ b/networking/ether-wake.c @@ -63,6 +63,16 @@ * doing so only works with adapters configured for unicast+broadcast Rx * filter. That configuration consumes more power. */ +//config:config ETHER_WAKE +//config: bool "ether-wake" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Send a magic packet to wake up sleeping machines. + +//applet:IF_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, BB_DIR_USR_SBIN, BB_SUID_DROP, ether_wake)) + +//kbuild:lib-$(CONFIG_ETHER_WAKE) += ether-wake.o //usage:#define ether_wake_trivial_usage //usage: "[-b] [-i IFACE] [-p aa:bb:cc:dd[:ee:ff]/a.b.c.d] MAC" diff --git a/networking/ftpd.c b/networking/ftpd.c index 4cbb9b6fe..d4e6c27ce 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c @@ -11,6 +11,40 @@ * * You have to run this daemon via inetd. */ +//config:config FTPD +//config: bool "ftpd" +//config: default y +//config: help +//config: simple FTP daemon. You have to run it via inetd. +//config: +//config:config FEATURE_FTP_WRITE +//config: bool "Enable upload commands" +//config: default y +//config: depends on FTPD +//config: help +//config: Enable all kinds of FTP upload commands (-w option) +//config: +//config:config FEATURE_FTPD_ACCEPT_BROKEN_LIST +//config: bool "Enable workaround for RFC-violating clients" +//config: default y +//config: depends on FTPD +//config: help +//config: Some ftp clients (among them KDE's Konqueror) issue illegal +//config: "LIST -l" requests. This option works around such problems. +//config: It might prevent you from listing files starting with "-" and +//config: it increases the code size by ~40 bytes. +//config: Most other ftp servers seem to behave similar to this. +//config: +//config:config FEATURE_FTP_AUTHENTICATION +//config: bool "Enable authentication" +//config: default y +//config: depends on FTPD +//config: help +//config: Enable basic system login as seen in telnet etc. + +//applet:IF_FTPD(APPLET(ftpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FTPD) += ftpd.o //usage:#define ftpd_trivial_usage //usage: "[-wvS] [-t N] [-T N] [DIR]" diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c index 91fb4569a..40a3271ab 100644 --- a/networking/ftpgetput.c +++ b/networking/ftpgetput.c @@ -12,6 +12,30 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config FTPGET +//config: bool "ftpget" +//config: default y +//config: help +//config: Retrieve a remote file via FTP. +//config: +//config:config FTPPUT +//config: bool "ftpput" +//config: default y +//config: help +//config: Store a remote file via FTP. +//config: +//config:config FEATURE_FTPGETPUT_LONG_OPTIONS +//config: bool "Enable long options in ftpget/ftpput" +//config: default y +//config: depends on LONG_OPTS && (FTPGET || FTPPUT) +//config: help +//config: Support long options for the ftpget/ftpput applet. + +//applet:IF_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpget)) +//applet:IF_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpput)) + +//kbuild:lib-$(CONFIG_FTPGET) += ftpgetput.o +//kbuild:lib-$(CONFIG_FTPPUT) += ftpgetput.o //usage:#define ftpget_trivial_usage //usage: "[OPTIONS] HOST [LOCAL_FILE] REMOTE_FILE" diff --git a/networking/httpd.c b/networking/httpd.c index c20642e11..d301d598d 100644 --- a/networking/httpd.c +++ b/networking/httpd.c @@ -98,6 +98,128 @@ * */ /* TODO: use TCP_CORK, parse_config() */ +//config:config HTTPD +//config: bool "httpd" +//config: default y +//config: help +//config: Serve web pages via an HTTP server. +//config: +//config:config FEATURE_HTTPD_RANGES +//config: bool "Support 'Ranges:' header" +//config: default y +//config: depends on HTTPD +//config: help +//config: Makes httpd emit "Accept-Ranges: bytes" header and understand +//config: "Range: bytes=NNN-[MMM]" header. Allows for resuming interrupted +//config: downloads, seeking in multimedia players etc. +//config: +//config:config FEATURE_HTTPD_SETUID +//config: bool "Enable -u option" +//config: default y +//config: depends on HTTPD +//config: help +//config: This option allows the server to run as a specific user +//config: rather than defaulting to the user that starts the server. +//config: Use of this option requires special privileges to change to a +//config: different user. +//config: +//config:config FEATURE_HTTPD_BASIC_AUTH +//config: bool "Enable Basic http Authentication" +//config: default y +//config: depends on HTTPD +//config: help +//config: Utilizes password settings from /etc/httpd.conf for basic +//config: authentication on a per url basis. +//config: Example for httpd.conf file: +//config: /adm:toor:PaSsWd +//config: +//config:config FEATURE_HTTPD_AUTH_MD5 +//config: bool "Support MD5 crypted passwords for http Authentication" +//config: default y +//config: depends on FEATURE_HTTPD_BASIC_AUTH +//config: help +//config: Enables encrypted passwords, and wildcard user/passwords +//config: in httpd.conf file. +//config: User '*' means 'any system user name is ok', +//config: password of '*' means 'use system password for this user' +//config: Examples: +//config: /adm:toor:$1$P/eKnWXS$aI1aPGxT.dJD5SzqAKWrF0 +//config: /adm:root:* +//config: /wiki:*:* +//config: +//config:config FEATURE_HTTPD_CGI +//config: bool "Support Common Gateway Interface (CGI)" +//config: default y +//config: depends on HTTPD +//config: help +//config: This option allows scripts and executables to be invoked +//config: when specific URLs are requested. +//config: +//config:config FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR +//config: bool "Support for running scripts through an interpreter" +//config: default y +//config: depends on FEATURE_HTTPD_CGI +//config: help +//config: This option enables support for running scripts through an +//config: interpreter. Turn this on if you want PHP scripts to work +//config: properly. You need to supply an additional line in your +//config: httpd.conf file: +//config: *.php:/path/to/your/php +//config: +//config:config FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV +//config: bool "Set REMOTE_PORT environment variable for CGI" +//config: default y +//config: depends on FEATURE_HTTPD_CGI +//config: help +//config: Use of this option can assist scripts in generating +//config: references that contain a unique port number. +//config: +//config:config FEATURE_HTTPD_ENCODE_URL_STR +//config: bool "Enable -e option (useful for CGIs written as shell scripts)" +//config: default y +//config: depends on HTTPD +//config: help +//config: This option allows html encoding of arbitrary strings for display +//config: by the browser. Output goes to stdout. +//config: For example, httpd -e "" produces +//config: "<Hello World>". +//config: +//config:config FEATURE_HTTPD_ERROR_PAGES +//config: bool "Support for custom error pages" +//config: default y +//config: depends on HTTPD +//config: help +//config: This option allows you to define custom error pages in +//config: the configuration file instead of the default HTTP status +//config: error pages. For instance, if you add the line: +//config: E404:/path/e404.html +//config: in the config file, the server will respond the specified +//config: '/path/e404.html' file instead of the terse '404 NOT FOUND' +//config: message. +//config: +//config:config FEATURE_HTTPD_PROXY +//config: bool "Support for reverse proxy" +//config: default y +//config: depends on HTTPD +//config: help +//config: This option allows you to define URLs that will be forwarded +//config: to another HTTP server. To setup add the following line to the +//config: configuration file +//config: P:/url/:http://hostname[:port]/new/path/ +//config: Then a request to /url/myfile will be forwarded to +//config: http://hostname[:port]/new/path/myfile. +//config: +//config:config FEATURE_HTTPD_GZIP +//config: bool "Support for GZIP content encoding" +//config: default y +//config: depends on HTTPD +//config: help +//config: Makes httpd send files using GZIP content encoding if the +//config: client supports it and a pre-compressed .gz exists. + +//applet:IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_HTTPD) += httpd.o //usage:#define httpd_trivial_usage //usage: "[-ifv[v]]" diff --git a/networking/ifconfig.c b/networking/ifconfig.c index 8984b0207..9e16936d8 100644 --- a/networking/ifconfig.c +++ b/networking/ifconfig.c @@ -25,6 +25,57 @@ * 2002-04-20 * IPV6 support added by Bart Visscher */ +//config:config IFCONFIG +//config: bool "ifconfig" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Ifconfig is used to configure the kernel-resident network interfaces. +//config: +//config:config FEATURE_IFCONFIG_STATUS +//config: bool "Enable status reporting output (+7k)" +//config: default y +//config: depends on IFCONFIG +//config: help +//config: If ifconfig is called with no arguments it will display the status +//config: of the currently active interfaces. +//config: +//config:config FEATURE_IFCONFIG_SLIP +//config: bool "Enable slip-specific options \"keepalive\" and \"outfill\"" +//config: default y +//config: depends on IFCONFIG +//config: help +//config: Allow "keepalive" and "outfill" support for SLIP. If you're not +//config: planning on using serial lines, leave this unchecked. +//config: +//config:config FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ +//config: bool "Enable options \"mem_start\", \"io_addr\", and \"irq\"" +//config: default y +//config: depends on IFCONFIG +//config: help +//config: Allow the start address for shared memory, start address for I/O, +//config: and/or the interrupt line used by the specified device. +//config: +//config:config FEATURE_IFCONFIG_HW +//config: bool "Enable option \"hw\" (ether only)" +//config: default y +//config: depends on IFCONFIG +//config: help +//config: Set the hardware address of this interface, if the device driver +//config: supports this operation. Currently, we only support the 'ether' +//config: class. +//config: +//config:config FEATURE_IFCONFIG_BROADCAST_PLUS +//config: bool "Set the broadcast automatically" +//config: default y +//config: depends on IFCONFIG +//config: help +//config: Setting this will make ifconfig attempt to find the broadcast +//config: automatically if the value '+' is used. + +//applet:IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_IFCONFIG) += ifconfig.o interface.o //usage:#define ifconfig_trivial_usage //usage: IF_FEATURE_IFCONFIG_STATUS("[-a]") " interface [address]" diff --git a/networking/ifenslave.c b/networking/ifenslave.c index 6b234adee..1cb765e23 100644 --- a/networking/ifenslave.c +++ b/networking/ifenslave.c @@ -97,6 +97,17 @@ * - Code cleanup and style changes * set version to 1.1.0 */ +//config:config IFENSLAVE +//config: bool "ifenslave" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Userspace application to bind several interfaces +//config: to a logical interface (use with kernel bonding driver). + +//applet:IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_IFENSLAVE) += ifenslave.o interface.o //usage:#define ifenslave_trivial_usage //usage: "[-cdf] MASTER_IFACE SLAVE_IFACE..." diff --git a/networking/ifplugd.c b/networking/ifplugd.c index 029cba147..4f8a274b0 100644 --- a/networking/ifplugd.c +++ b/networking/ifplugd.c @@ -6,6 +6,16 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config IFPLUGD +//config: bool "ifplugd" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Network interface plug detection daemon. + +//applet:IF_IFPLUGD(APPLET(ifplugd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_IFPLUGD) += ifplugd.o //usage:#define ifplugd_trivial_usage //usage: "[OPTIONS]" diff --git a/networking/inetd.c b/networking/inetd.c index f9295e38b..4d0ab2e0d 100644 --- a/networking/inetd.c +++ b/networking/inetd.c @@ -153,6 +153,59 @@ * setgid(specified group) * setuid() */ +//config:config INETD +//config: bool "inetd" +//config: default y +//config: select FEATURE_SYSLOG +//config: help +//config: Internet superserver daemon +//config: +//config:config FEATURE_INETD_SUPPORT_BUILTIN_ECHO +//config: bool "Support echo service" +//config: default y +//config: depends on INETD +//config: help +//config: Echo received data internal inetd service +//config: +//config:config FEATURE_INETD_SUPPORT_BUILTIN_DISCARD +//config: bool "Support discard service" +//config: default y +//config: depends on INETD +//config: help +//config: Internet /dev/null internal inetd service +//config: +//config:config FEATURE_INETD_SUPPORT_BUILTIN_TIME +//config: bool "Support time service" +//config: default y +//config: depends on INETD +//config: help +//config: Return 32 bit time since 1900 internal inetd service +//config: +//config:config FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME +//config: bool "Support daytime service" +//config: default y +//config: depends on INETD +//config: help +//config: Return human-readable time internal inetd service +//config: +//config:config FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN +//config: bool "Support chargen service" +//config: default y +//config: depends on INETD +//config: help +//config: Familiar character generator internal inetd service +//config: +//config:config FEATURE_INETD_RPC +//config: bool "Support RPC services" +//config: default n # very rarely used, and needs Sun RPC support in libc +//config: depends on INETD +//config: select FEATURE_HAVE_RPC +//config: help +//config: Support Sun-RPC based services + +//applet:IF_INETD(APPLET(inetd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_INETD) += inetd.o //usage:#define inetd_trivial_usage //usage: "[-fe] [-q N] [-R N] [CONFFILE]" diff --git a/networking/ip.c b/networking/ip.c index ddfe74e9c..99f150e61 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -8,6 +8,130 @@ * Rani Assaf 980929: resolve addresses * Bernhard Reutner-Fischer rewrote to use index_in_substr_array */ +//config:config IP +//config: bool "ip" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: The "ip" applet is a TCP/IP interface configuration and routing +//config: utility. You generally don't need "ip" to use busybox with +//config: TCP/IP. +//config: +//config:config FEATURE_IP_ADDRESS +//config: bool "ip address" +//config: default y +//config: depends on IP +//config: help +//config: Address manipulation support for the "ip" applet. +//config: +//config:config FEATURE_IP_LINK +//config: bool "ip link" +//config: default y +//config: depends on IP +//config: help +//config: Configure network devices with "ip". +//config: +//config:config FEATURE_IP_ROUTE +//config: bool "ip route" +//config: default y +//config: depends on IP +//config: help +//config: Add support for routing table management to "ip". +//config: +//config:config FEATURE_IP_ROUTE_DIR +//config: string "ip route configuration directory" +//config: default "/etc/iproute2" +//config: depends on FEATURE_IP_ROUTE +//config: help +//config: Location of the "ip" applet routing configuration. +//config: +//config:config FEATURE_IP_TUNNEL +//config: bool "ip tunnel" +//config: default y +//config: depends on IP +//config: help +//config: Add support for tunneling commands to "ip". +//config: +//config:config FEATURE_IP_RULE +//config: bool "ip rule" +//config: default y +//config: depends on IP +//config: help +//config: Add support for rule commands to "ip". +//config: +//config:config FEATURE_IP_NEIGH +//config: bool "ip neighbor" +//config: default y +//config: depends on IP +//config: help +//config: Add support for neighbor commands to "ip". +//config: +//config:config FEATURE_IP_SHORT_FORMS +//config: bool "Support short forms of ip commands" +//config: default y +//config: depends on IP +//config: help +//config: Also support short-form of ip commands: +//config: ip addr -> ipaddr +//config: ip link -> iplink +//config: ip route -> iproute +//config: ip tunnel -> iptunnel +//config: ip rule -> iprule +//config: ip neigh -> ipneigh +//config: +//config: Say N unless you desparately need the short form of the ip +//config: object commands. +//config: +//config:config FEATURE_IP_RARE_PROTOCOLS +//config: bool "Support displaying rarely used link types" +//config: default n +//config: depends on IP +//config: help +//config: If you are not going to use links of type "frad", "econet", +//config: "bif" etc, you probably don't need to enable this. +//config: Ethernet, wireless, infrared, ppp/slip, ip tunnelling +//config: link types are supported without this option selected. +//config: +//config:config IPADDR +//config: bool +//config: default y +//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ADDRESS +//config: +//config:config IPLINK +//config: bool +//config: default y +//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_LINK +//config: +//config:config IPROUTE +//config: bool +//config: default y +//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ROUTE +//config: +//config:config IPTUNNEL +//config: bool +//config: default y +//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_TUNNEL +//config: +//config:config IPRULE +//config: bool +//config: default y +//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_RULE +//config: +//config:config IPNEIGH +//config: bool +//config: default y +//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_NEIGH + +//applet:#if ENABLE_FEATURE_IP_ADDRESS || ENABLE_FEATURE_IP_ROUTE || ENABLE_FEATURE_IP_LINK || ENABLE_FEATURE_IP_TUNNEL || ENABLE_FEATURE_IP_RULE +//applet:IF_IP(APPLET(ip, BB_DIR_SBIN, BB_SUID_DROP)) +//applet:#endif +//applet:IF_IPADDR(APPLET(ipaddr, BB_DIR_SBIN, BB_SUID_DROP)) +//applet:IF_IPLINK(APPLET(iplink, BB_DIR_SBIN, BB_SUID_DROP)) +//applet:IF_IPROUTE(APPLET(iproute, BB_DIR_SBIN, BB_SUID_DROP)) +//applet:IF_IPRULE(APPLET(iprule, BB_DIR_SBIN, BB_SUID_DROP)) +//applet:IF_IPTUNNEL(APPLET(iptunnel, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_IP) += ip.o /* would need to make the " | " optional depending on more than one selected: */ //usage:#define ip_trivial_usage diff --git a/networking/ipcalc.c b/networking/ipcalc.c index f4bacd7dc..21219424f 100644 --- a/networking/ipcalc.c +++ b/networking/ipcalc.c @@ -11,6 +11,31 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config IPCALC +//config: bool "ipcalc" +//config: default y +//config: help +//config: ipcalc takes an IP address and netmask and calculates the +//config: resulting broadcast, network, and host range. +//config: +//config:config FEATURE_IPCALC_FANCY +//config: bool "Fancy IPCALC, more options, adds 1 kbyte" +//config: default y +//config: depends on IPCALC +//config: help +//config: Adds the options hostname, prefix and silent to the output of +//config: "ipcalc". +//config: +//config:config FEATURE_IPCALC_LONG_OPTIONS +//config: bool "Enable long options" +//config: default y +//config: depends on IPCALC && LONG_OPTS +//config: help +//config: Support long options for the ipcalc applet. + +//applet:IF_IPCALC(APPLET(ipcalc, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_IPCALC) += ipcalc.o //usage:#define ipcalc_trivial_usage //usage: "[OPTIONS] ADDRESS" diff --git a/networking/isrv_identd.c b/networking/isrv_identd.c index 8a15926e5..219c64b66 100644 --- a/networking/isrv_identd.c +++ b/networking/isrv_identd.c @@ -6,6 +6,17 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config FAKEIDENTD +//config: bool "fakeidentd" +//config: default y +//config: select FEATURE_SYSLOG +//config: help +//config: fakeidentd listens on the ident port and returns a predefined +//config: fake value on any query. + +//applet:IF_FAKEIDENTD(APPLET(fakeidentd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FAKEIDENTD) += isrv_identd.o isrv.o //usage:#define fakeidentd_trivial_usage //usage: "[-fiw] [-b ADDR] [STRING]" diff --git a/networking/nameif.c b/networking/nameif.c index 9b18a6d16..cffd5bfde 100644 --- a/networking/nameif.c +++ b/networking/nameif.c @@ -40,6 +40,10 @@ //config: new_interface_name mac=00:80:C8:38:91:B5 //config: new_interface_name 00:80:C8:38:91:B5 +//applet:IF_NAMEIF(APPLET(nameif, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_NAMEIF) += nameif.o + //usage:#define nameif_trivial_usage //usage: IF_NOT_FEATURE_NAMEIF_EXTENDED( //usage: "[-s] [-c FILE] [IFNAME HWADDR]..." diff --git a/networking/nc.c b/networking/nc.c index 13a9b48a8..1b70434ac 100644 --- a/networking/nc.c +++ b/networking/nc.c @@ -6,10 +6,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - -#include "libbb.h" -#include "common_bufsiz.h" - //config:config NC //config: bool "nc" //config: default y @@ -43,6 +39,12 @@ //config: -s ADDR, -n, -u, -v, -o FILE, -z options, but loses //config: busybox-specific extensions: -f FILE. +//applet:IF_NC(APPLET(nc, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_NC) += nc.o + +#include "libbb.h" +#include "common_bufsiz.h" #if ENABLE_NC_110_COMPAT # include "nc_bloaty.c" #else diff --git a/networking/netstat.c b/networking/netstat.c index 2196d42f7..90da6cdb8 100644 --- a/networking/netstat.c +++ b/networking/netstat.c @@ -13,6 +13,32 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config NETSTAT +//config: bool "netstat" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: netstat prints information about the Linux networking subsystem. +//config: +//config:config FEATURE_NETSTAT_WIDE +//config: bool "Enable wide netstat output" +//config: default y +//config: depends on NETSTAT +//config: help +//config: Add support for wide columns. Useful when displaying IPv6 addresses +//config: (-W option). +//config: +//config:config FEATURE_NETSTAT_PRG +//config: bool "Enable PID/Program name output" +//config: default y +//config: depends on NETSTAT +//config: help +//config: Add support for -p flag to print out PID and program name. +//config: +700 bytes of code. + +//applet:IF_NETSTAT(APPLET(netstat, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_NETSTAT) += netstat.o #include "libbb.h" #include "inet_common.h" diff --git a/networking/nslookup.c b/networking/nslookup.c index dd4b1ffed..8e3c8fed9 100644 --- a/networking/nslookup.c +++ b/networking/nslookup.c @@ -10,6 +10,15 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config NSLOOKUP +//config: bool "nslookup" +//config: default y +//config: help +//config: nslookup is a tool to query Internet name servers. + +//applet:IF_NSLOOKUP(APPLET(nslookup, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_NSLOOKUP) += nslookup.o //usage:#define nslookup_trivial_usage //usage: "[HOST] [SERVER]" diff --git a/networking/ntpd.c b/networking/ntpd.c index 8ca62cf1b..b7fa5dce9 100644 --- a/networking/ntpd.c +++ b/networking/ntpd.c @@ -40,6 +40,32 @@ * purpose. It is provided "as is" without express or implied warranty. *********************************************************************** */ +//config:config NTPD +//config: bool "ntpd" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: The NTP client/server daemon. +//config: +//config:config FEATURE_NTPD_SERVER +//config: bool "Make ntpd usable as a NTP server" +//config: default y +//config: depends on NTPD +//config: help +//config: Make ntpd usable as a NTP server. If you disable this option +//config: ntpd will be usable only as a NTP client. +//config: +//config:config FEATURE_NTPD_CONF +//config: bool "Make ntpd understand /etc/ntp.conf" +//config: default y +//config: depends on NTPD +//config: help +//config: Make ntpd look in /etc/ntp.conf for peers. Only "server address" +//config: is supported. + +//applet:IF_NTPD(APPLET(ntpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_NTPD) += ntpd.o //usage:#define ntpd_trivial_usage //usage: "[-dnqNw"IF_FEATURE_NTPD_SERVER("l -I IFACE")"] [-S PROG] [-p PEER]..." diff --git a/networking/pscan.c b/networking/pscan.c index 72ed8cdb5..0893c3577 100644 --- a/networking/pscan.c +++ b/networking/pscan.c @@ -5,6 +5,15 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config PSCAN +//config: bool "pscan" +//config: default y +//config: help +//config: Simple network port scanner. + +//applet:IF_PSCAN(APPLET(pscan, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_PSCAN) += pscan.o //usage:#define pscan_trivial_usage //usage: "[-cb] [-p MIN_PORT] [-P MAX_PORT] [-t TIMEOUT] [-T MIN_RTT] HOST" diff --git a/networking/route.c b/networking/route.c index 102a6ec67..7dc2b5a3d 100644 --- a/networking/route.c +++ b/networking/route.c @@ -24,6 +24,16 @@ * Rewritten to fix several bugs, add additional error checking, and * remove ridiculous amounts of bloat. */ +//config:config ROUTE +//config: bool "route" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Route displays or manipulates the kernel's IP routing tables. + +//applet:IF_ROUTE(APPLET(route, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_ROUTE) += route.o //usage:#define route_trivial_usage //usage: "[{add|del|delete}]" diff --git a/networking/slattach.c b/networking/slattach.c index 2d1305e32..9267eb1d0 100644 --- a/networking/slattach.c +++ b/networking/slattach.c @@ -12,6 +12,17 @@ * * - The -F options allows disabling of RTS/CTS flow control. */ +//config:config SLATTACH +//config: bool "slattach" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: slattach is a small utility to attach network interfaces to serial +//config: lines. + +//applet:IF_SLATTACH(APPLET(slattach, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SLATTACH) += slattach.o //usage:#define slattach_trivial_usage //usage: "[-cehmLF] [-s SPEED] [-p PROTOCOL] DEVICE" diff --git a/networking/tc.c b/networking/tc.c index d0bcbdeaa..e10200c1e 100644 --- a/networking/tc.c +++ b/networking/tc.c @@ -6,6 +6,7 @@ * * Bernhard Reutner-Fischer adjusted for busybox */ +//kbuild:lib-$(CONFIG_TC) += tc.o //usage:#define tc_trivial_usage /* //usage: "[OPTIONS] OBJECT CMD [dev STRING]" */ diff --git a/networking/tcpudp.c b/networking/tcpudp.c index b27cf3ea9..94c89b9ef 100644 --- a/networking/tcpudp.c +++ b/networking/tcpudp.c @@ -28,6 +28,25 @@ * with wrong source IP... * - don't know how to retrieve ORIGDST for udp. */ +//config:config TCPSVD +//config: bool "tcpsvd" +//config: default y +//config: help +//config: tcpsvd listens on a TCP port and runs a program for each new +//config: connection. +//config: +//config:config UDPSVD +//config: bool "udpsvd" +//config: default y +//config: help +//config: udpsvd listens on an UDP port and runs a program for each new +//config: connection. + +//applet:IF_TCPSVD(APPLET_ODDNAME(tcpsvd, tcpudpsvd, BB_DIR_USR_BIN, BB_SUID_DROP, tcpsvd)) +//applet:IF_UDPSVD(APPLET_ODDNAME(udpsvd, tcpudpsvd, BB_DIR_USR_BIN, BB_SUID_DROP, udpsvd)) + +//kbuild:lib-$(CONFIG_TCPSVD) += tcpudp.o tcpudp_perhost.o +//kbuild:lib-$(CONFIG_UDPSVD) += tcpudp.o tcpudp_perhost.o //usage:#define tcpsvd_trivial_usage //usage: "[-hEv] [-c N] [-C N[:MSG]] [-b N] [-u USER] [-l NAME] IP PORT PROG" diff --git a/networking/telnet.c b/networking/telnet.c index 1a6986b94..f520fe1dd 100644 --- a/networking/telnet.c +++ b/networking/telnet.c @@ -20,6 +20,35 @@ * by Fernando Silveira * */ +//config:config TELNET +//config: bool "telnet" +//config: default y +//config: help +//config: Telnet is an interface to the TELNET protocol, but is also commonly +//config: used to test other simple protocols. +//config: +//config:config FEATURE_TELNET_TTYPE +//config: bool "Pass TERM type to remote host" +//config: default y +//config: depends on TELNET +//config: help +//config: Setting this option will forward the TERM environment variable to the +//config: remote host you are connecting to. This is useful to make sure that +//config: things like ANSI colors and other control sequences behave. +//config: +//config:config FEATURE_TELNET_AUTOLOGIN +//config: bool "Pass USER type to remote host" +//config: default y +//config: depends on TELNET +//config: help +//config: Setting this option will forward the USER environment variable to the +//config: remote host you are connecting to. This is useful when you need to +//config: log into a machine without telling the username (autologin). This +//config: option enables `-a' and `-l USER' arguments. + +//applet:IF_TELNET(APPLET(telnet, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_TELNET) += telnet.o //usage:#if ENABLE_FEATURE_TELNET_AUTOLOGIN //usage:#define telnet_trivial_usage diff --git a/networking/telnetd.c b/networking/telnetd.c index 303ef1be7..f06e9583e 100644 --- a/networking/telnetd.c +++ b/networking/telnetd.c @@ -20,6 +20,78 @@ * Vladimir Oleynik 2001 * Set process group corrections, initial busybox port */ +//config:config TELNETD +//config: bool "telnetd" +//config: default y +//config: select FEATURE_SYSLOG +//config: help +//config: A daemon for the TELNET protocol, allowing you to log onto the host +//config: running the daemon. Please keep in mind that the TELNET protocol +//config: sends passwords in plain text. If you can't afford the space for an +//config: SSH daemon and you trust your network, you may say 'y' here. As a +//config: more secure alternative, you should seriously consider installing the +//config: very small Dropbear SSH daemon instead: +//config: http://matt.ucc.asn.au/dropbear/dropbear.html +//config: +//config: Note that for busybox telnetd to work you need several things: +//config: First of all, your kernel needs: +//config: CONFIG_UNIX98_PTYS=y +//config: +//config: Next, you need a /dev/pts directory on your root filesystem: +//config: +//config: $ ls -ld /dev/pts +//config: drwxr-xr-x 2 root root 0 Sep 23 13:21 /dev/pts/ +//config: +//config: Next you need the pseudo terminal master multiplexer /dev/ptmx: +//config: +//config: $ ls -la /dev/ptmx +//config: crw-rw-rw- 1 root tty 5, 2 Sep 23 13:55 /dev/ptmx +//config: +//config: Any /dev/ttyp[0-9]* files you may have can be removed. +//config: Next, you need to mount the devpts filesystem on /dev/pts using: +//config: +//config: mount -t devpts devpts /dev/pts +//config: +//config: You need to be sure that busybox has LOGIN and +//config: FEATURE_SUID enabled. And finally, you should make +//config: certain that Busybox has been installed setuid root: +//config: +//config: chown root.root /bin/busybox +//config: chmod 4755 /bin/busybox +//config: +//config: with all that done, telnetd _should_ work.... +//config: +//config:config FEATURE_TELNETD_STANDALONE +//config: bool "Support standalone telnetd (not inetd only)" +//config: default y +//config: depends on TELNETD +//config: help +//config: Selecting this will make telnetd able to run standalone. +//config: +//config:config FEATURE_TELNETD_INETD_WAIT +//config: bool "Support -w SEC option (inetd wait mode)" +//config: default y +//config: depends on FEATURE_TELNETD_STANDALONE +//config: help +//config: This option allows you to run telnetd in "inet wait" mode. +//config: Example inetd.conf line (note "wait", not usual "nowait"): +//config: +//config: telnet stream tcp wait root /bin/telnetd telnetd -w10 +//config: +//config: In this example, inetd passes _listening_ socket_ as fd 0 +//config: to telnetd when connection appears. +//config: telnetd will wait for connections until all existing +//config: connections are closed, and no new connections +//config: appear during 10 seconds. Then it exits, and inetd continues +//config: to listen for new connections. +//config: +//config: This option is rarely used. "tcp nowait" is much more usual +//config: way of running tcp services, including telnetd. +//config: You most probably want to say N here. + +//applet:IF_TELNETD(APPLET(telnetd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_TELNETD) += telnetd.o //usage:#define telnetd_trivial_usage //usage: "[OPTIONS]" diff --git a/networking/tftp.c b/networking/tftp.c index e879c4674..ed8672025 100644 --- a/networking/tftp.c +++ b/networking/tftp.c @@ -18,6 +18,78 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config TFTP +//config: bool "tftp" +//config: default y +//config: help +//config: This enables the Trivial File Transfer Protocol client program. TFTP +//config: is usually used for simple, small transfers such as a root image +//config: for a network-enabled bootloader. +//config: +//config:config TFTPD +//config: bool "tftpd" +//config: default y +//config: help +//config: This enables the Trivial File Transfer Protocol server program. +//config: It expects that stdin is a datagram socket and a packet +//config: is already pending on it. It will exit after one transfer. +//config: In other words: it should be run from inetd in nowait mode, +//config: or from udpsvd. Example: "udpsvd -E 0 69 tftpd DIR" +//config: +//config:comment "Common options for tftp/tftpd" +//config: depends on TFTP || TFTPD +//config: +//config:config FEATURE_TFTP_GET +//config: bool "Enable 'tftp get' and/or tftpd upload code" +//config: default y +//config: depends on TFTP || TFTPD +//config: help +//config: Add support for the GET command within the TFTP client. This allows +//config: a client to retrieve a file from a TFTP server. +//config: Also enable upload support in tftpd, if tftpd is selected. +//config: +//config: Note: this option does _not_ make tftpd capable of download +//config: (the usual operation people need from it)! +//config: +//config:config FEATURE_TFTP_PUT +//config: bool "Enable 'tftp put' and/or tftpd download code" +//config: default y +//config: depends on TFTP || TFTPD +//config: help +//config: Add support for the PUT command within the TFTP client. This allows +//config: a client to transfer a file to a TFTP server. +//config: Also enable download support in tftpd, if tftpd is selected. +//config: +//config:config FEATURE_TFTP_BLOCKSIZE +//config: bool "Enable 'blksize' and 'tsize' protocol options" +//config: default y +//config: depends on TFTP || TFTPD +//config: help +//config: Allow tftp to specify block size, and tftpd to understand +//config: "blksize" and "tsize" options. +//config: +//config:config FEATURE_TFTP_PROGRESS_BAR +//config: bool "Enable tftp progress meter" +//config: default y +//config: depends on TFTP && FEATURE_TFTP_BLOCKSIZE +//config: help +//config: Show progress bar. +//config: +//config:config TFTP_DEBUG +//config: bool "Enable debug" +//config: default n +//config: depends on TFTP || TFTPD +//config: help +//config: Make tftp[d] print debugging messages on stderr. +//config: This is useful if you are diagnosing a bug in tftp[d]. + +//applet:#if ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT +//applet:IF_TFTP(APPLET(tftp, BB_DIR_USR_BIN, BB_SUID_DROP)) +//applet:IF_TFTPD(APPLET(tftpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) +//applet:#endif + +//kbuild:lib-$(CONFIG_TFTP) += tftp.o +//kbuild:lib-$(CONFIG_TFTPD) += tftp.o //usage:#define tftp_trivial_usage //usage: "[OPTIONS] HOST [PORT]" diff --git a/networking/traceroute.c b/networking/traceroute.c index b9a9ca4bb..58a9b692a 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -209,6 +209,40 @@ * -- Van Jacobson (van@ee.lbl.gov) * Tue Dec 20 03:50:13 PST 1988 */ +//config:config TRACEROUTE +//config: bool "traceroute" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Utility to trace the route of IP packets. +//config: +//config:config TRACEROUTE6 +//config: bool "traceroute6" +//config: default y +//config: depends on FEATURE_IPV6 && TRACEROUTE +//config: help +//config: Utility to trace the route of IPv6 packets. +//config: +//config:config FEATURE_TRACEROUTE_VERBOSE +//config: bool "Enable verbose output" +//config: default y +//config: depends on TRACEROUTE +//config: help +//config: Add some verbosity to traceroute. This includes among other things +//config: hostnames and ICMP response types. +//config: +//config:config FEATURE_TRACEROUTE_USE_ICMP +//config: bool "Enable -I option (use ICMP instead of UDP)" +//config: default y +//config: depends on TRACEROUTE +//config: help +//config: Add option -I to use ICMP ECHO instead of UDP datagrams. + +/* Needs socket(AF_INET, SOCK_RAW, IPPROTO_ICMP), therefore BB_SUID_MAYBE: */ +//applet:IF_TRACEROUTE(APPLET(traceroute, BB_DIR_USR_BIN, BB_SUID_MAYBE)) +//applet:IF_TRACEROUTE6(APPLET(traceroute6, BB_DIR_USR_BIN, BB_SUID_MAYBE)) + +//kbuild:lib-$(CONFIG_TRACEROUTE) += traceroute.o //usage:#define traceroute_trivial_usage //usage: "[-"IF_TRACEROUTE6("46")"FIlnrv] [-f 1ST_TTL] [-m MAXTTL] [-q PROBES] [-p PORT]\n" diff --git a/networking/tunctl.c b/networking/tunctl.c index 941e8bbd3..fa904c2a9 100644 --- a/networking/tunctl.c +++ b/networking/tunctl.c @@ -9,6 +9,24 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config TUNCTL +//config: bool "tunctl" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: tunctl creates or deletes tun devices. +//config: +//config:config FEATURE_TUNCTL_UG +//config: bool "Support owner:group assignment" +//config: default y +//config: depends on TUNCTL +//config: help +//config: Allow to specify owner and group of newly created interface. +//config: 340 bytes of pure bloat. Say no here. + +//applet:IF_TUNCTL(APPLET(tunctl, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_TUNCTL) += tunctl.o //usage:#define tunctl_trivial_usage //usage: "[-f device] ([-t name] | -d name)" IF_FEATURE_TUNCTL_UG(" [-u owner] [-g group] [-b]") diff --git a/networking/vconfig.c b/networking/vconfig.c index 924b2f009..f3020409a 100644 --- a/networking/vconfig.c +++ b/networking/vconfig.c @@ -9,6 +9,17 @@ /* BB_AUDIT SUSv3 N/A */ +//config:config VCONFIG +//config: bool "vconfig" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Creates, removes, and configures VLAN interfaces + +//applet:IF_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_VCONFIG) += vconfig.o + //usage:#define vconfig_trivial_usage //usage: "COMMAND [OPTIONS]" //usage:#define vconfig_full_usage "\n\n" diff --git a/networking/zcip.c b/networking/zcip.c index 47f3216a0..9122bd681 100644 --- a/networking/zcip.c +++ b/networking/zcip.c @@ -14,6 +14,22 @@ * routed at the IP level, though various proxies or bridges can * certainly be used. Its naming is built over multicast DNS. */ +//config:config ZCIP +//config: bool "zcip" +//config: default y +//config: select PLATFORM_LINUX +//config: select FEATURE_SYSLOG +//config: help +//config: ZCIP provides ZeroConf IPv4 address selection, according to RFC 3927. +//config: It's a daemon that allocates and defends a dynamically assigned +//config: address on the 169.254/16 network, requiring no system administrator. +//config: +//config: See http://www.zeroconf.org for further details, and "zcip.script" +//config: in the busybox examples. + +//applet:IF_ZCIP(APPLET(zcip, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_ZCIP) += zcip.o //#define DEBUG -- cgit v1.2.3-55-g6feb From 3148e0c05be2e90def3fbe0da2ecc96094725e41 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 09:07:44 +0100 Subject: Rename FEATURE_FTP_WRITE and FEATURE_FTP_AUTHENTICATION to *_FTPD_* Signed-off-by: Denys Vlasenko --- networking/ftpd.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/networking/ftpd.c b/networking/ftpd.c index d4e6c27ce..bcd60a2ad 100644 --- a/networking/ftpd.c +++ b/networking/ftpd.c @@ -17,7 +17,7 @@ //config: help //config: simple FTP daemon. You have to run it via inetd. //config: -//config:config FEATURE_FTP_WRITE +//config:config FEATURE_FTPD_WRITE //config: bool "Enable upload commands" //config: default y //config: depends on FTPD @@ -35,7 +35,7 @@ //config: it increases the code size by ~40 bytes. //config: Most other ftp servers seem to behave similar to this. //config: -//config:config FEATURE_FTP_AUTHENTICATION +//config:config FEATURE_FTPD_AUTHENTICATION //config: bool "Enable authentication" //config: default y //config: depends on FTPD @@ -151,7 +151,7 @@ struct globals { len_and_sockaddr *port_addr; char *ftp_cmd; char *ftp_arg; -#if ENABLE_FEATURE_FTP_WRITE +#if ENABLE_FEATURE_FTPD_WRITE char *rnfr_filename; #endif /* We need these aligned to uint32_t */ @@ -865,7 +865,7 @@ handle_size_or_mdtm(int need_size) /* Upload commands */ -#if ENABLE_FEATURE_FTP_WRITE +#if ENABLE_FEATURE_FTPD_WRITE static void handle_mkd(void) { @@ -1008,7 +1008,7 @@ handle_stou(void) G.restart_pos = 0; handle_upload_common(0, 1); } -#endif /* ENABLE_FEATURE_FTP_WRITE */ +#endif /* ENABLE_FEATURE_FTPD_WRITE */ static uint32_t cmdio_get_cmd_and_arg(void) @@ -1142,7 +1142,7 @@ enum { #endif OPT_v = (1 << ((!BB_MMU) * 3 + 0)), OPT_S = (1 << ((!BB_MMU) * 3 + 1)), - OPT_w = (1 << ((!BB_MMU) * 3 + 2)) * ENABLE_FEATURE_FTP_WRITE, + OPT_w = (1 << ((!BB_MMU) * 3 + 2)) * ENABLE_FEATURE_FTPD_WRITE, }; int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; @@ -1152,7 +1152,7 @@ int ftpd_main(int argc, char **argv) int ftpd_main(int argc UNUSED_PARAM, char **argv) #endif { -#if ENABLE_FEATURE_FTP_AUTHENTICATION +#if ENABLE_FEATURE_FTPD_AUTHENTICATION struct passwd *pw = NULL; #endif unsigned abs_timeout; @@ -1166,9 +1166,9 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv) G.timeout = 2 * 60; opt_complementary = "vv:SS"; #if BB_MMU - opts = getopt32(argv, "vS" IF_FEATURE_FTP_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S); + opts = getopt32(argv, "vS" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S); #else - opts = getopt32(argv, "l1AvS" IF_FEATURE_FTP_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S); + opts = getopt32(argv, "l1AvS" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S); if (opts & (OPT_l|OPT_1)) { /* Our secret backdoor to ls */ /* TODO: pass --group-directories-first? would be nice, but ls doesn't do that yet */ @@ -1231,7 +1231,7 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv) WRITE_OK(FTP_GREET); signal(SIGALRM, timeout_handler); -#if ENABLE_FEATURE_FTP_AUTHENTICATION +#if ENABLE_FEATURE_FTPD_AUTHENTICATION while (1) { uint32_t cmdval = cmdio_get_cmd_and_arg(); if (cmdval == const_USER) { @@ -1281,7 +1281,7 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv) xchdir(basedir); } -#if ENABLE_FEATURE_FTP_AUTHENTICATION +#if ENABLE_FEATURE_FTPD_AUTHENTICATION change_identity(pw); #endif @@ -1388,7 +1388,7 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv) handle_port(); else if (cmdval == const_REST) handle_rest(); -#if ENABLE_FEATURE_FTP_WRITE +#if ENABLE_FEATURE_FTPD_WRITE else if (opts & OPT_w) { if (cmdval == const_STOR) handle_stor(); @@ -1428,7 +1428,7 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv) * (doesn't necessarily mean "we must support them") * foo 1.2.3: XXXX - comment */ -#if ENABLE_FEATURE_FTP_WRITE +#if ENABLE_FEATURE_FTPD_WRITE bad_cmd: #endif cmdio_write_raw(STR(FTP_BADCMD)" Unknown command\r\n"); -- cgit v1.2.3-55-g6feb From 6bfab0c49f45769920a380e2c7a5f42adeef0a12 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 09:18:05 +0100 Subject: ipneigh: add this shortcur similar to other "ip " shortcuts Signed-off-by: Denys Vlasenko --- networking/ip.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/networking/ip.c b/networking/ip.c index 99f150e61..c3607b74f 100644 --- a/networking/ip.c +++ b/networking/ip.c @@ -122,7 +122,7 @@ //config: default y //config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_NEIGH -//applet:#if ENABLE_FEATURE_IP_ADDRESS || ENABLE_FEATURE_IP_ROUTE || ENABLE_FEATURE_IP_LINK || ENABLE_FEATURE_IP_TUNNEL || ENABLE_FEATURE_IP_RULE +//applet:#if ENABLE_FEATURE_IP_ADDRESS || ENABLE_FEATURE_IP_ROUTE || ENABLE_FEATURE_IP_LINK || ENABLE_FEATURE_IP_TUNNEL || ENABLE_FEATURE_IP_RULE || ENABLE_FEATURE_IP_NEIGH //applet:IF_IP(APPLET(ip, BB_DIR_SBIN, BB_SUID_DROP)) //applet:#endif //applet:IF_IPADDR(APPLET(ipaddr, BB_DIR_SBIN, BB_SUID_DROP)) @@ -130,6 +130,7 @@ //applet:IF_IPROUTE(APPLET(iproute, BB_DIR_SBIN, BB_SUID_DROP)) //applet:IF_IPRULE(APPLET(iprule, BB_DIR_SBIN, BB_SUID_DROP)) //applet:IF_IPTUNNEL(APPLET(iptunnel, BB_DIR_SBIN, BB_SUID_DROP)) +//applet:IF_IPNEIGH(APPLET(ipneigh, BB_DIR_SBIN, BB_SUID_DROP)) //kbuild:lib-$(CONFIG_IP) += ip.o -- cgit v1.2.3-55-g6feb From 83423978014bce3ef4d09022d3eb1a4a32f7ba6d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 09:25:57 +0100 Subject: Make ping6 and traceroute6 selectable independently from ping/traceroute Signed-off-by: Denys Vlasenko --- networking/ping.c | 12 +++++++----- networking/traceroute.c | 9 ++++++--- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/networking/ping.c b/networking/ping.c index 82d5b7a85..d0ef7ba62 100644 --- a/networking/ping.c +++ b/networking/ping.c @@ -57,14 +57,14 @@ //config:config PING6 //config: bool "ping6" //config: default y -//config: depends on FEATURE_IPV6 && PING +//config: depends on FEATURE_IPV6 //config: help //config: This will give you a ping that can talk IPv6. //config: //config:config FEATURE_FANCY_PING //config: bool "Enable fancy ping output" //config: default y -//config: depends on PING +//config: depends on PING || PING6 //config: help //config: Make the output from the ping applet include statistics, and at the //config: same time provide full support for ICMP packets. @@ -907,15 +907,17 @@ static int common_ping_main(int opt, char **argv) #endif /* FEATURE_FANCY_PING */ +#if ENABLE_PING int ping_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int ping_main(int argc UNUSED_PARAM, char **argv) { -#if !ENABLE_FEATURE_FANCY_PING +# if !ENABLE_FEATURE_FANCY_PING return common_ping_main(AF_UNSPEC, argv); -#else +# else return common_ping_main(0, argv); -#endif +# endif } +#endif #if ENABLE_PING6 int ping6_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; diff --git a/networking/traceroute.c b/networking/traceroute.c index 58a9b692a..a463b0faa 100644 --- a/networking/traceroute.c +++ b/networking/traceroute.c @@ -219,14 +219,14 @@ //config:config TRACEROUTE6 //config: bool "traceroute6" //config: default y -//config: depends on FEATURE_IPV6 && TRACEROUTE +//config: depends on FEATURE_IPV6 //config: help //config: Utility to trace the route of IPv6 packets. //config: //config:config FEATURE_TRACEROUTE_VERBOSE //config: bool "Enable verbose output" //config: default y -//config: depends on TRACEROUTE +//config: depends on TRACEROUTE || TRACEROUTE6 //config: help //config: Add some verbosity to traceroute. This includes among other things //config: hostnames and ICMP response types. @@ -234,7 +234,7 @@ //config:config FEATURE_TRACEROUTE_USE_ICMP //config: bool "Enable -I option (use ICMP instead of UDP)" //config: default y -//config: depends on TRACEROUTE +//config: depends on TRACEROUTE || TRACEROUTE6 //config: help //config: Add option -I to use ICMP ECHO instead of UDP datagrams. @@ -243,6 +243,7 @@ //applet:IF_TRACEROUTE6(APPLET(traceroute6, BB_DIR_USR_BIN, BB_SUID_MAYBE)) //kbuild:lib-$(CONFIG_TRACEROUTE) += traceroute.o +//kbuild:lib-$(CONFIG_TRACEROUTE6) += traceroute.o //usage:#define traceroute_trivial_usage //usage: "[-"IF_TRACEROUTE6("46")"FIlnrv] [-f 1ST_TTL] [-m MAXTTL] [-q PROBES] [-p PORT]\n" @@ -1204,11 +1205,13 @@ common_traceroute_main(int op, char **argv) return 0; } +#if ENABLE_TRACEROUTE int traceroute_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; int traceroute_main(int argc UNUSED_PARAM, char **argv) { return common_traceroute_main(0, argv); } +#endif #if ENABLE_TRACEROUTE6 int traceroute6_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; -- cgit v1.2.3-55-g6feb From 29e2c45a5b317556a890a86ca7780e589072151c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 09:51:33 +0100 Subject: tc: consolidate its disabled bits Signed-off-by: Denys Vlasenko --- include/applets.src.h | 1 - networking/Config.src | 10 ---------- networking/tc.c | 17 ++++++++++++++++- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index 3fd9ba06e..18baee155 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -206,7 +206,6 @@ IF_SUM(APPLET(sum, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, 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_TC(APPLET(tc, BB_DIR_SBIN, 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)) diff --git a/networking/Config.src b/networking/Config.src index 4d921884f..527bdd15d 100644 --- a/networking/Config.src +++ b/networking/Config.src @@ -48,16 +48,6 @@ config VERBOSE_RESOLUTION_ERRORS INSERT -#config TC -# bool "tc" -# default y -# help -# show / manipulate traffic control settings -# -#config FEATURE_TC_INGRESS -# def_bool n -# depends on TC - source networking/udhcp/Config.in config IFUPDOWN_UDHCPC_CMD_OPTIONS diff --git a/networking/tc.c b/networking/tc.c index e10200c1e..271d569e4 100644 --- a/networking/tc.c +++ b/networking/tc.c @@ -6,7 +6,22 @@ * * Bernhard Reutner-Fischer adjusted for busybox */ -//kbuild:lib-$(CONFIG_TC) += tc.o + +/* Was disabled in 2008 by Bernhard, not known why. +--//config:#config TC +--//config:# bool "tc" +--//config:# default y +--//config:# help +--//config:# Show / manipulate traffic control settings +--//config:# +--//config:#config FEATURE_TC_INGRESS +--//config:# default y +--//config:# depends on TC +-- +--//applet:IF_TC(APPLET(tc, BB_DIR_SBIN, BB_SUID_DROP)) +-- +--//kbuild:lib-$(CONFIG_TC) += tc.o +*/ //usage:#define tc_trivial_usage /* //usage: "[OPTIONS] OBJECT CMD [dev STRING]" */ -- cgit v1.2.3-55-g6feb From c19f7584e14522043da141189711c8db72dfbc90 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 09:58:03 +0100 Subject: Convert all mailutils/* applets to "new style" applet definitions Signed-off-by: Denys Vlasenko --- include/applets.src.h | 4 ---- mailutils/Config.src | 43 ------------------------------------------- mailutils/makemime.c | 7 +++++++ mailutils/popmaildir.c | 18 ++++++++++++++++++ mailutils/reformime.c | 15 +++++++++++++++ mailutils/sendmail.c | 7 +++++++ 6 files changed, 47 insertions(+), 47 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index 18baee155..83f6237b2 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -144,7 +144,6 @@ IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP)) IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls)) IF_LSPCI(APPLET(lspci, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_LSUSB(APPLET(lsusb, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_MAKEMIME(APPLET(makemime, BB_DIR_BIN, BB_SUID_DROP)) 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)) @@ -165,7 +164,6 @@ IF_OD(APPLET(od, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_OPENVT(APPLET(openvt, BB_DIR_USR_BIN, BB_SUID_DROP)) //IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, BB_SUID_DROP)) -IF_POPMAILDIR(APPLET(popmaildir, BB_DIR_USR_SBIN, 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)) @@ -174,7 +172,6 @@ IF_RDEV(APPLET(rdev, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_REFORMIME(APPLET(reformime, BB_DIR_BIN, BB_SUID_DROP)) IF_RESET(APPLET(reset, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_RESIZE(APPLET(resize, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon)) @@ -185,7 +182,6 @@ IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SCRIPT(APPLET(script, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_SCRIPTREPLAY(APPLET(scriptreplay, BB_DIR_BIN, BB_SUID_DROP)) IF_SELINUXENABLED(APPLET(selinuxenabled, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_SENDMAIL(APPLET(sendmail, 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_SETCONSOLE(APPLET(setconsole, BB_DIR_SBIN, BB_SUID_DROP)) diff --git a/mailutils/Config.src b/mailutils/Config.src index 2a9c5c074..e45a0f8fb 100644 --- a/mailutils/Config.src +++ b/mailutils/Config.src @@ -2,12 +2,6 @@ menu "Mail Utilities" INSERT -config MAKEMIME - bool "makemime" - default y - help - Create MIME-formatted messages. - config FEATURE_MIME_CHARSET string "Default charset" default "us-ascii" @@ -15,41 +9,4 @@ config FEATURE_MIME_CHARSET help Default charset of the message. -config POPMAILDIR - bool "popmaildir" - default y - help - Simple yet powerful POP3 mail popper. Delivers content - of remote mailboxes to local Maildir. - -config FEATURE_POPMAILDIR_DELIVERY - bool "Allow message filters and custom delivery program" - default y - depends on POPMAILDIR - help - Allow to use a custom program to filter the content - of the message before actual delivery (-F "prog [args...]"). - Allow to use a custom program for message actual delivery - (-M "prog [args...]"). - -config REFORMIME - bool "reformime" - default y - help - Parse MIME-formatted messages. - -config FEATURE_REFORMIME_COMPAT - bool "Accept and ignore options other than -x and -X" - default y - depends on REFORMIME - help - Accept (for compatibility only) and ignore options - other than -x and -X. - -config SENDMAIL - bool "sendmail" - default y - help - Barebones sendmail. - endmenu diff --git a/mailutils/makemime.c b/mailutils/makemime.c index 8e1bc664c..78f78bbcc 100644 --- a/mailutils/makemime.c +++ b/mailutils/makemime.c @@ -6,6 +6,13 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config MAKEMIME +//config: bool "makemime" +//config: default y +//config: help +//config: Create MIME-formatted messages. + +//applet:IF_MAKEMIME(APPLET(makemime, BB_DIR_BIN, BB_SUID_DROP)) //kbuild:lib-$(CONFIG_MAKEMIME) += makemime.o mail.o diff --git a/mailutils/popmaildir.c b/mailutils/popmaildir.c index 69eca6164..ffe373865 100644 --- a/mailutils/popmaildir.c +++ b/mailutils/popmaildir.c @@ -9,6 +9,24 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config POPMAILDIR +//config: bool "popmaildir" +//config: default y +//config: help +//config: Simple yet powerful POP3 mail popper. Delivers content +//config: of remote mailboxes to local Maildir. +//config: +//config:config FEATURE_POPMAILDIR_DELIVERY +//config: bool "Allow message filters and custom delivery program" +//config: default y +//config: depends on POPMAILDIR +//config: help +//config: Allow to use a custom program to filter the content +//config: of the message before actual delivery (-F "prog [args...]"). +//config: Allow to use a custom program for message actual delivery +//config: (-M "prog [args...]"). + +//applet:IF_POPMAILDIR(APPLET(popmaildir, BB_DIR_USR_SBIN, BB_SUID_DROP)) //kbuild:lib-$(CONFIG_POPMAILDIR) += popmaildir.o mail.o diff --git a/mailutils/reformime.c b/mailutils/reformime.c index b967dfbc7..e97bc0130 100644 --- a/mailutils/reformime.c +++ b/mailutils/reformime.c @@ -6,6 +6,21 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config REFORMIME +//config: bool "reformime" +//config: default y +//config: help +//config: Parse MIME-formatted messages. +//config: +//config:config FEATURE_REFORMIME_COMPAT +//config: bool "Accept and ignore options other than -x and -X" +//config: default y +//config: depends on REFORMIME +//config: help +//config: Accept (for compatibility only) and ignore options +//config: other than -x and -X. + +//applet:IF_REFORMIME(APPLET(reformime, BB_DIR_BIN, BB_SUID_DROP)) //kbuild:lib-$(CONFIG_REFORMIME) += reformime.o mail.o diff --git a/mailutils/sendmail.c b/mailutils/sendmail.c index 1242795b8..8ddb7826b 100644 --- a/mailutils/sendmail.c +++ b/mailutils/sendmail.c @@ -6,6 +6,13 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config SENDMAIL +//config: bool "sendmail" +//config: default y +//config: help +//config: Barebones sendmail. + +//applet:IF_SENDMAIL(APPLET(sendmail, BB_DIR_USR_SBIN, BB_SUID_DROP)) //kbuild:lib-$(CONFIG_SENDMAIL) += sendmail.o mail.o -- cgit v1.2.3-55-g6feb From 6d9329935c0621ddc056aee0d30cec52a24da499 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 10:39:27 +0100 Subject: Convert all console-tools/* applets to "new style" applet definitions Signed-off-by: Denys Vlasenko --- console-tools/Config.src | 166 -------------------------------------------- console-tools/Kbuild.src | 16 ----- console-tools/chvt.c | 11 +++ console-tools/clear.c | 9 +++ console-tools/deallocvt.c | 10 ++- console-tools/dumpkmap.c | 12 +++- console-tools/fgconsole.c | 10 +++ console-tools/kbd_mode.c | 10 +++ console-tools/loadfont.c | 51 ++++++++++++++ console-tools/loadkmap.c | 11 +++ console-tools/openvt.c | 11 +++ console-tools/reset.c | 13 +++- console-tools/resize.c | 21 +++++- console-tools/setconsole.c | 18 +++++ console-tools/setkeycodes.c | 11 +++ console-tools/setlogcons.c | 10 +++ console-tools/showkey.c | 10 +++ include/applets.src.h | 16 ----- 18 files changed, 213 insertions(+), 203 deletions(-) diff --git a/console-tools/Config.src b/console-tools/Config.src index c65704478..e6587ade4 100644 --- a/console-tools/Config.src +++ b/console-tools/Config.src @@ -7,170 +7,4 @@ menu "Console Utilities" INSERT -config CHVT - bool "chvt" - default y - select PLATFORM_LINUX - help - This program is used to change to another terminal. - Example: chvt 4 (change to terminal /dev/tty4) - -config FGCONSOLE - bool "fgconsole" - default y - select PLATFORM_LINUX - help - This program prints active (foreground) console number. - -config CLEAR - bool "clear" - default y - help - This program clears the terminal screen. - -config DEALLOCVT - bool "deallocvt" - default y - select PLATFORM_LINUX - help - This program deallocates unused virtual consoles. - -config DUMPKMAP - bool "dumpkmap" - default y - select PLATFORM_LINUX - help - This program dumps the kernel's keyboard translation table to - stdout, in binary format. You can then use loadkmap to load it. - -config KBD_MODE - bool "kbd_mode" - default y - select PLATFORM_LINUX - help - This program reports and sets keyboard mode. - -config LOADFONT - bool "loadfont" - default y - select PLATFORM_LINUX - help - This program loads a console font from standard input. - -config LOADKMAP - bool "loadkmap" - default y - select PLATFORM_LINUX - help - This program loads a keyboard translation table from - standard input. - -config OPENVT - bool "openvt" - default y - select PLATFORM_LINUX - help - This program is used to start a command on an unused - virtual terminal. - -config RESET - bool "reset" - default y - help - This program is used to reset the terminal screen, if it - gets messed up. - -config RESIZE - bool "resize" - default y - help - This program is used to (re)set the width and height of your current - terminal. - -config FEATURE_RESIZE_PRINT - bool "Print environment variables" - default y - depends on RESIZE - help - Prints the newly set size (number of columns and rows) of - the terminal. - E.g.: - COLUMNS=80;LINES=44;export COLUMNS LINES; - -config SETCONSOLE - bool "setconsole" - default y - select PLATFORM_LINUX - help - This program redirects the system console to another device, - like the current tty while logged in via telnet. - -config FEATURE_SETCONSOLE_LONG_OPTIONS - bool "Enable long options" - default y - depends on SETCONSOLE && LONG_OPTS - help - Support long options for the setconsole applet. - -config SETFONT - bool "setfont" - default y - select PLATFORM_LINUX - help - Allows to load console screen map. Useful for i18n. - -config FEATURE_SETFONT_TEXTUAL_MAP - bool "Support reading textual screen maps" - default y - depends on SETFONT - help - Support reading textual screen maps. - -config DEFAULT_SETFONT_DIR - string "Default directory for console-tools files" - default "" - depends on SETFONT - help - Directory to use if setfont's params are simple filenames - (not /path/to/file or ./file). Default is "" (no default directory). - -config SETKEYCODES - bool "setkeycodes" - default y - select PLATFORM_LINUX - help - This program loads entries into the kernel's scancode-to-keycode - map, allowing unusual keyboards to generate usable keycodes. - -config SETLOGCONS - bool "setlogcons" - default y - select PLATFORM_LINUX - help - This program redirects the output console of kernel messages. - -config SHOWKEY - bool "showkey" - default y - select PLATFORM_LINUX - help - Shows keys pressed. - -comment "Common options for loadfont and setfont" - depends on LOADFONT || SETFONT - -config FEATURE_LOADFONT_PSF2 - bool "Support for PSF2 console fonts" - default y - depends on LOADFONT || SETFONT - help - Support PSF2 console fonts. - -config FEATURE_LOADFONT_RAW - bool "Support for old (raw) console fonts" - default y - depends on LOADFONT || SETFONT - help - Support old (raw) console fonts. - endmenu diff --git a/console-tools/Kbuild.src b/console-tools/Kbuild.src index 94de9ad9f..6b4fb7470 100644 --- a/console-tools/Kbuild.src +++ b/console-tools/Kbuild.src @@ -7,19 +7,3 @@ lib-y:= INSERT -lib-$(CONFIG_CHVT) += chvt.o -lib-$(CONFIG_FGCONSOLE) += fgconsole.o -lib-$(CONFIG_CLEAR) += clear.o -lib-$(CONFIG_DEALLOCVT) += deallocvt.o -lib-$(CONFIG_DUMPKMAP) += dumpkmap.o -lib-$(CONFIG_SETCONSOLE) += setconsole.o -lib-$(CONFIG_KBD_MODE) += kbd_mode.o -lib-$(CONFIG_LOADFONT) += loadfont.o -lib-$(CONFIG_LOADKMAP) += loadkmap.o -lib-$(CONFIG_OPENVT) += openvt.o -lib-$(CONFIG_RESET) += reset.o -lib-$(CONFIG_RESIZE) += resize.o -lib-$(CONFIG_SETFONT) += loadfont.o -lib-$(CONFIG_SETKEYCODES) += setkeycodes.o -lib-$(CONFIG_SETLOGCONS) += setlogcons.o -lib-$(CONFIG_SHOWKEY) += showkey.o diff --git a/console-tools/chvt.c b/console-tools/chvt.c index b9c974f4a..2b993eb62 100644 --- a/console-tools/chvt.c +++ b/console-tools/chvt.c @@ -6,6 +6,17 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config CHVT +//config: bool "chvt" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program is used to change to another terminal. +//config: Example: chvt 4 (change to terminal /dev/tty4) + +//applet:IF_CHVT(APPLET(chvt, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_CHVT) += chvt.o //usage:#define chvt_trivial_usage //usage: "N" diff --git a/console-tools/clear.c b/console-tools/clear.c index ac22b787e..b360d34d9 100644 --- a/console-tools/clear.c +++ b/console-tools/clear.c @@ -6,6 +6,15 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config CLEAR +//config: bool "clear" +//config: default y +//config: help +//config: This program clears the terminal screen. + +//applet:IF_CLEAR(APPLET(clear, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_CLEAR) += clear.o //usage:#define clear_trivial_usage //usage: "" diff --git a/console-tools/deallocvt.c b/console-tools/deallocvt.c index b131c0a64..37c966af3 100644 --- a/console-tools/deallocvt.c +++ b/console-tools/deallocvt.c @@ -7,8 +7,16 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config DEALLOCVT +//config: bool "deallocvt" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program deallocates unused virtual consoles. -/* no options, no getopt */ +//applet:IF_DEALLOCVT(APPLET(deallocvt, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_DEALLOCVT) += deallocvt.o //usage:#define deallocvt_trivial_usage //usage: "[N]" diff --git a/console-tools/dumpkmap.c b/console-tools/dumpkmap.c index b6fd466dc..4a249868a 100644 --- a/console-tools/dumpkmap.c +++ b/console-tools/dumpkmap.c @@ -7,7 +7,17 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. * */ -/* no options, no getopt */ +//config:config DUMPKMAP +//config: bool "dumpkmap" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program dumps the kernel's keyboard translation table to +//config: stdout, in binary format. You can then use loadkmap to load it. + +//applet:IF_DUMPKMAP(APPLET(dumpkmap, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_DUMPKMAP) += dumpkmap.o //usage:#define dumpkmap_trivial_usage //usage: "> keymap" diff --git a/console-tools/fgconsole.c b/console-tools/fgconsole.c index 54355bee6..019761726 100644 --- a/console-tools/fgconsole.c +++ b/console-tools/fgconsole.c @@ -6,6 +6,16 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config FGCONSOLE +//config: bool "fgconsole" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program prints active (foreground) console number. + +//applet:IF_FGCONSOLE(APPLET(fgconsole, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FGCONSOLE) += fgconsole.o //usage:#define fgconsole_trivial_usage //usage: "" diff --git a/console-tools/kbd_mode.c b/console-tools/kbd_mode.c index 138536721..f1238c6b4 100644 --- a/console-tools/kbd_mode.c +++ b/console-tools/kbd_mode.c @@ -8,6 +8,16 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config KBD_MODE +//config: bool "kbd_mode" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program reports and sets keyboard mode. + +//applet:IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_KBD_MODE) += kbd_mode.o //usage:#define kbd_mode_trivial_usage //usage: "[-a|k|s|u] [-C TTY]" diff --git a/console-tools/loadfont.c b/console-tools/loadfont.c index 58073e0dc..52605baa1 100644 --- a/console-tools/loadfont.c +++ b/console-tools/loadfont.c @@ -9,6 +9,57 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config LOADFONT +//config: bool "loadfont" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program loads a console font from standard input. +//config: +//config:config SETFONT +//config: bool "setfont" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Allows to load console screen map. Useful for i18n. +//config: +//config:config FEATURE_SETFONT_TEXTUAL_MAP +//config: bool "Support reading textual screen maps" +//config: default y +//config: depends on SETFONT +//config: help +//config: Support reading textual screen maps. +//config: +//config:config DEFAULT_SETFONT_DIR +//config: string "Default directory for console-tools files" +//config: default "" +//config: depends on SETFONT +//config: help +//config: Directory to use if setfont's params are simple filenames +//config: (not /path/to/file or ./file). Default is "" (no default directory). +//config: +//config:comment "Common options for loadfont and setfont" +//config: depends on LOADFONT || SETFONT +//config: +//config:config FEATURE_LOADFONT_PSF2 +//config: bool "Support for PSF2 console fonts" +//config: default y +//config: depends on LOADFONT || SETFONT +//config: help +//config: Support PSF2 console fonts. +//config: +//config:config FEATURE_LOADFONT_RAW +//config: bool "Support for old (raw) console fonts" +//config: default y +//config: depends on LOADFONT || SETFONT +//config: help +//config: Support old (raw) console fonts. + +//applet:IF_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP)) +//applet:IF_SETFONT(APPLET(setfont, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_LOADFONT) += loadfont.o +//kbuild:lib-$(CONFIG_SETFONT) += loadfont.o //usage:#define loadfont_trivial_usage //usage: "< font" diff --git a/console-tools/loadkmap.c b/console-tools/loadkmap.c index f525ee5d1..70ab55a8e 100644 --- a/console-tools/loadkmap.c +++ b/console-tools/loadkmap.c @@ -6,6 +6,17 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config LOADKMAP +//config: bool "loadkmap" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program loads a keyboard translation table from +//config: standard input. + +//applet:IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_LOADKMAP) += loadkmap.o //usage:#define loadkmap_trivial_usage //usage: "< keymap" diff --git a/console-tools/openvt.c b/console-tools/openvt.c index e52356692..5cbc717ec 100644 --- a/console-tools/openvt.c +++ b/console-tools/openvt.c @@ -7,6 +7,17 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config OPENVT +//config: bool "openvt" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program is used to start a command on an unused +//config: virtual terminal. + +//applet:IF_OPENVT(APPLET(openvt, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_OPENVT) += openvt.o //usage:#define openvt_trivial_usage //usage: "[-c N] [-sw] [PROG ARGS]" diff --git a/console-tools/reset.c b/console-tools/reset.c index 65940bdec..57cebb4ea 100644 --- a/console-tools/reset.c +++ b/console-tools/reset.c @@ -7,9 +7,18 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +/* "Standard" version of this tool is in ncurses package */ -/* BTW, which "standard" package has this utility? It doesn't seem - * to be ncurses, coreutils, console-tools... then what? */ +//config:config RESET +//config: bool "reset" +//config: default y +//config: help +//config: This program is used to reset the terminal screen, if it +//config: gets messed up. + +//applet:IF_RESET(APPLET(reset, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RESET) += reset.o //usage:#define reset_trivial_usage //usage: "" diff --git a/console-tools/resize.c b/console-tools/resize.c index a3342a195..567086f09 100644 --- a/console-tools/resize.c +++ b/console-tools/resize.c @@ -6,7 +6,26 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ -/* no options, no getopt */ +//config:config RESIZE +//config: bool "resize" +//config: default y +//config: help +//config: This program is used to (re)set the width and height of your current +//config: terminal. +//config: +//config:config FEATURE_RESIZE_PRINT +//config: bool "Print environment variables" +//config: default y +//config: depends on RESIZE +//config: help +//config: Prints the newly set size (number of columns and rows) of +//config: the terminal. +//config: E.g.: +//config: COLUMNS=80;LINES=44;export COLUMNS LINES; + +//applet:IF_RESIZE(APPLET(resize, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RESIZE) += resize.o //usage:#define resize_trivial_usage //usage: "" diff --git a/console-tools/setconsole.c b/console-tools/setconsole.c index c0051dcc8..58057268d 100644 --- a/console-tools/setconsole.c +++ b/console-tools/setconsole.c @@ -7,6 +7,24 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config SETCONSOLE +//config: bool "setconsole" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program redirects the system console to another device, +//config: like the current tty while logged in via telnet. +//config: +//config:config FEATURE_SETCONSOLE_LONG_OPTIONS +//config: bool "Enable long options" +//config: default y +//config: depends on SETCONSOLE && LONG_OPTS +//config: help +//config: Support long options for the setconsole applet. + +//applet:IF_SETCONSOLE(APPLET(setconsole, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SETCONSOLE) += setconsole.o //usage:#define setconsole_trivial_usage //usage: "[-r" IF_FEATURE_SETCONSOLE_LONG_OPTIONS("|--reset") "] [DEVICE]" diff --git a/console-tools/setkeycodes.c b/console-tools/setkeycodes.c index a6a7c2374..11fc37ae9 100644 --- a/console-tools/setkeycodes.c +++ b/console-tools/setkeycodes.c @@ -8,6 +8,17 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config SETKEYCODES +//config: bool "setkeycodes" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program loads entries into the kernel's scancode-to-keycode +//config: map, allowing unusual keyboards to generate usable keycodes. + +//applet:IF_SETKEYCODES(APPLET(setkeycodes, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SETKEYCODES) += setkeycodes.o //usage:#define setkeycodes_trivial_usage //usage: "SCANCODE KEYCODE..." diff --git a/console-tools/setlogcons.c b/console-tools/setlogcons.c index 2a11da329..2ea36f039 100644 --- a/console-tools/setlogcons.c +++ b/console-tools/setlogcons.c @@ -8,6 +8,16 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config SETLOGCONS +//config: bool "setlogcons" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: This program redirects the output console of kernel messages. + +//applet:IF_SETLOGCONS(APPLET(setlogcons, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SETLOGCONS) += setlogcons.o //usage:#define setlogcons_trivial_usage //usage: "[N]" diff --git a/console-tools/showkey.c b/console-tools/showkey.c index b7b4c32a8..c2447b887 100644 --- a/console-tools/showkey.c +++ b/console-tools/showkey.c @@ -6,6 +6,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config SHOWKEY +//config: bool "showkey" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Shows keys pressed. + +//applet:IF_SHOWKEY(APPLET(showkey, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SHOWKEY) += showkey.o //usage:#define showkey_trivial_usage //usage: "[-a | -k | -s]" diff --git a/include/applets.src.h b/include/applets.src.h index 83f6237b2..adce804e5 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -86,21 +86,17 @@ 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_CHVT(APPLET(chvt, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_CKSUM(APPLET_NOEXEC(cksum, cksum, BB_DIR_USR_BIN, BB_SUID_DROP, cksum)) -IF_CLEAR(APPLET(clear, BB_DIR_USR_BIN, BB_SUID_DROP)) 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_DEALLOCVT(APPLET(deallocvt, BB_DIR_USR_BIN, BB_SUID_DROP)) 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_DMESG(APPLET(dmesg, BB_DIR_BIN, BB_SUID_DROP)) 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_DUMPKMAP(APPLET(dumpkmap, BB_DIR_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)) @@ -113,7 +109,6 @@ IF_FBSET(APPLET(fbset, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, BB_DIR_BIN, BB_SUID_DROP, fdflush)) IF_FDFORMAT(APPLET(fdformat, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_FDISK(APPLET(fdisk, BB_DIR_SBIN, BB_SUID_DROP)) -IF_FGCONSOLE(APPLET(fgconsole, BB_DIR_USR_BIN, BB_SUID_DROP)) /* Benefits from suid root: better access to /dev/BLOCKDEVs: */ IF_FINDFS(APPLET(findfs, BB_DIR_SBIN, BB_SUID_MAYBE)) IF_FLOCK(APPLET(flock, BB_DIR_USR_BIN, BB_SUID_DROP)) @@ -133,12 +128,9 @@ IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP)) IF_INSTALL(APPLET(install, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_IPCRM(APPLET(ipcrm, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_IPCS(APPLET(ipcs, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_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_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP)) IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname)) IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP)) IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls)) @@ -161,7 +153,6 @@ 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_OPENVT(APPLET(openvt, BB_DIR_USR_BIN, BB_SUID_DROP)) //IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, BB_SUID_DROP)) IF_PRINTENV(APPLET_NOFORK(printenv, printenv, BB_DIR_BIN, BB_SUID_DROP, printenv)) @@ -172,8 +163,6 @@ IF_RDEV(APPLET(rdev, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_RESET(APPLET(reset, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_RESIZE(APPLET(resize, 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)) @@ -184,14 +173,9 @@ IF_SCRIPTREPLAY(APPLET(scriptreplay, BB_DIR_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_SETCONSOLE(APPLET(setconsole, BB_DIR_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_SETFONT(APPLET(setfont, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_SETKEYCODES(APPLET(setkeycodes, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_SETLOGCONS(APPLET(setlogcons, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_SHOWKEY(APPLET(showkey, BB_DIR_USR_BIN, 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)) -- cgit v1.2.3-55-g6feb From e5dd71f94f8691c41382b89de35088695cca34b9 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 10:43:39 +0100 Subject: Remove trailing empty lines Signed-off-by: Denys Vlasenko --- miscutils/Kbuild.src | 2 -- 1 file changed, 2 deletions(-) diff --git a/miscutils/Kbuild.src b/miscutils/Kbuild.src index 60848ffc1..6b4fb7470 100644 --- a/miscutils/Kbuild.src +++ b/miscutils/Kbuild.src @@ -7,5 +7,3 @@ lib-y:= INSERT - - -- cgit v1.2.3-55-g6feb From dd898c9f3388fca1d7339a45150fbb7406de0971 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 11:46:32 +0100 Subject: Convert all util-linux/* applets to "new style" applet definitions Signed-off-by: Denys Vlasenko --- include/applets.src.h | 39 ---- util-linux/Config.src | 505 ---------------------------------------------- util-linux/Kbuild.src | 33 --- util-linux/acpid.c | 26 +++ util-linux/blkdiscard.c | 1 - util-linux/blkid.c | 20 ++ util-linux/blockdev.c | 9 +- util-linux/dmesg.c | 37 ++++ util-linux/fatattr.c | 1 + util-linux/fbset.c | 32 +++ util-linux/fdformat.c | 10 + util-linux/fdisk.c | 80 ++++++++ util-linux/findfs.c | 14 ++ util-linux/flock.c | 9 + util-linux/freeramdisk.c | 30 +++ util-linux/fsck_minix.c | 14 ++ util-linux/getopt.c | 22 +- util-linux/hexdump.c | 29 +++ util-linux/hwclock.c | 36 +++- util-linux/ipcrm.c | 11 + util-linux/ipcs.c | 11 + util-linux/losetup.c | 12 ++ util-linux/lspci.c | 13 ++ util-linux/lsusb.c | 13 ++ util-linux/mkfs_minix.c | 21 ++ util-linux/mkfs_reiser.c | 11 + util-linux/mkswap.c | 23 +++ util-linux/more.c | 13 ++ util-linux/mount.c | 8 + util-linux/pivot_root.c | 16 ++ util-linux/rdate.c | 14 +- util-linux/rdev.c | 9 + util-linux/readprofile.c | 10 + util-linux/rev.c | 9 +- util-linux/rtcwake.c | 10 + util-linux/script.c | 9 + util-linux/scriptreplay.c | 10 + util-linux/swaponoff.c | 1 - util-linux/switch_root.c | 23 +++ util-linux/uevent.c | 1 - util-linux/umount.c | 20 ++ util-linux/unshare.c | 1 - 42 files changed, 622 insertions(+), 594 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index adce804e5..23453b0ef 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -75,9 +75,7 @@ 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_ACPID(APPLET(acpid, BB_DIR_SBIN, BB_SUID_DROP)) IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename)) -IF_BLKID(APPLET(blkid, BB_DIR_SBIN, BB_SUID_DROP)) 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)) @@ -94,7 +92,6 @@ 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_DMESG(APPLET(dmesg, BB_DIR_BIN, BB_SUID_DROP)) 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)) @@ -105,71 +102,37 @@ 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_FBSET(APPLET(fbset, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, BB_DIR_BIN, BB_SUID_DROP, fdflush)) -IF_FDFORMAT(APPLET(fdformat, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_FDISK(APPLET(fdisk, BB_DIR_SBIN, BB_SUID_DROP)) -/* Benefits from suid root: better access to /dev/BLOCKDEVs: */ -IF_FINDFS(APPLET(findfs, BB_DIR_SBIN, BB_SUID_MAYBE)) -IF_FLOCK(APPLET(flock, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_FOLD(APPLET_NOEXEC(fold, fold, BB_DIR_USR_BIN, BB_SUID_DROP, fold)) -IF_FREERAMDISK(APPLET(freeramdisk, BB_DIR_SBIN, BB_SUID_DROP)) //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_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, BB_DIR_SBIN, BB_SUID_DROP, fsck_minix)) 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_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP)) IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd)) IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head)) -IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump)) -IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP)) IF_INSTALL(APPLET(install, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_IPCRM(APPLET(ipcrm, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_IPCS(APPLET(ipcs, 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_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP)) IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls)) -IF_LSPCI(APPLET(lspci, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_LSUSB(APPLET(lsusb, BB_DIR_USR_BIN, BB_SUID_DROP)) 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_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, BB_DIR_SBIN, BB_SUID_DROP, mkfs_minix)) -IF_MKFS_REISER(APPLET_ODDNAME(mkfs.reiser, mkfs_reiser, BB_DIR_SBIN, BB_SUID_DROP, mkfs_reiser)) IF_MKNOD(APPLET_NOEXEC(mknod, mknod, BB_DIR_BIN, BB_SUID_DROP, mknod)) -IF_MKSWAP(APPLET(mkswap, BB_DIR_SBIN, BB_SUID_DROP)) -IF_MORE(APPLET(more, BB_DIR_BIN, BB_SUID_DROP)) -/* On full-blown systems, requires suid for user mounts. - * But it's not unthinkable to have it available in non-suid flavor on some systems, - * for viewing mount table. - * Therefore we use BB_SUID_MAYBE instead of BB_SUID_REQUIRE: */ -IF_MOUNT(APPLET(mount, BB_DIR_BIN, IF_DESKTOP(BB_SUID_MAYBE) IF_NOT_DESKTOP(BB_SUID_DROP))) 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_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, 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_RDATE(APPLET(rdate, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_RDEV(APPLET(rdev, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, 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_RTCWAKE(APPLET(rtcwake, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_SCRIPT(APPLET(script, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_SCRIPTREPLAY(APPLET(scriptreplay, BB_DIR_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)) @@ -183,7 +146,6 @@ 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_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, 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)) @@ -193,7 +155,6 @@ 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_UMOUNT(APPLET(umount, BB_DIR_BIN, 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)) diff --git a/util-linux/Config.src b/util-linux/Config.src index 9bef0d532..3c522f948 100644 --- a/util-linux/Config.src +++ b/util-linux/Config.src @@ -7,511 +7,6 @@ menu "Linux System Utilities" INSERT -config ACPID - bool "acpid" - default y - select PLATFORM_LINUX - help - acpid listens to ACPI events coming either in textual form from - /proc/acpi/event (though it is marked deprecated it is still widely - used and _is_ a standard) or in binary form from specified evdevs - (just use /dev/input/event*). - - It parses the event to retrieve ACTION and a possible PARAMETER. - It then spawns /etc/acpi/[/] either via run-parts - (if the resulting path is a directory) or directly as an executable. - - N.B. acpid relies on run-parts so have the latter installed. - -config FEATURE_ACPID_COMPAT - bool "Accept and ignore redundant options" - default y - depends on ACPID - help - Accept and ignore compatibility options -g -m -s -S -v. - -config BLKID - bool "blkid" - default y - select PLATFORM_LINUX - select VOLUMEID - help - Lists labels and UUIDs of all filesystems. - WARNING: - With all submodules selected, it will add ~8k to busybox. - -config FEATURE_BLKID_TYPE - bool "Print filesystem type" - default n - depends on BLKID - help - Show TYPE="filesystem type" - -config DMESG - bool "dmesg" - default y - select PLATFORM_LINUX - help - dmesg is used to examine or control the kernel ring buffer. When the - Linux kernel prints messages to the system log, they are stored in - the kernel ring buffer. You can use dmesg to print the kernel's ring - buffer, clear the kernel ring buffer, change the size of the kernel - ring buffer, and change the priority level at which kernel messages - are also logged to the system console. Enable this option if you - wish to enable the 'dmesg' utility. - -config FEATURE_DMESG_PRETTY - bool "Pretty dmesg output" - default y - depends on DMESG - help - If you wish to scrub the syslog level from the output, say 'Y' here. - The syslog level is a string prefixed to every line with the form - "<#>". - - With this option you will see: - # dmesg - Linux version 2.6.17.4 ..... - BIOS-provided physical RAM map: - BIOS-e820: 0000000000000000 - 000000000009f000 (usable) - - Without this option you will see: - # dmesg - <5>Linux version 2.6.17.4 ..... - <6>BIOS-provided physical RAM map: - <6> BIOS-e820: 0000000000000000 - 000000000009f000 (usable) - -config FBSET - bool "fbset" - default y - select PLATFORM_LINUX - help - fbset is used to show or change the settings of a Linux frame buffer - device. The frame buffer device provides a simple and unique - interface to access a graphics display. Enable this option - if you wish to enable the 'fbset' utility. - -config FEATURE_FBSET_FANCY - bool "Turn on extra fbset options" - default y - depends on FBSET - help - This option enables extended fbset options, allowing one to set the - framebuffer size, color depth, etc. interface to access a graphics - display. Enable this option if you wish to enable extended fbset - options. - -config FEATURE_FBSET_READMODE - bool "Turn on fbset readmode support" - default y - depends on FBSET - help - This option allows fbset to read the video mode database stored by - default as /etc/fb.modes, which can be used to set frame buffer - device to pre-defined video modes. - -config FDFLUSH - bool "fdflush" - default y - select PLATFORM_LINUX - help - fdflush is only needed when changing media on slightly-broken - removable media drives. It is used to make Linux believe that a - hardware disk-change switch has been actuated, which causes Linux to - forget anything it has cached from the previous media. If you have - such a slightly-broken drive, you will need to run fdflush every time - you change a disk. Most people have working hardware and can safely - leave this disabled. - -config FDFORMAT - bool "fdformat" - default y - select PLATFORM_LINUX - help - fdformat is used to low-level format a floppy disk. - -config FDISK - bool "fdisk" - default y - select PLATFORM_LINUX - help - The fdisk utility is used to divide hard disks into one or more - logical disks, which are generally called partitions. This utility - can be used to list and edit the set of partitions or BSD style - 'disk slices' that are defined on a hard drive. - -config FDISK_SUPPORT_LARGE_DISKS - bool "Support over 4GB disks" - default y - depends on FDISK - depends on !LFS # with LFS no special code is needed - help - Enable this option to support large disks > 4GB. - -config FEATURE_FDISK_WRITABLE - bool "Write support" - default y - depends on FDISK - help - Enabling this option allows you to create or change a partition table - and write those changes out to disk. If you leave this option - disabled, you will only be able to view the partition table. - -config FEATURE_AIX_LABEL - bool "Support AIX disklabels" - default n - depends on FDISK && FEATURE_FDISK_WRITABLE - help - Enabling this option allows you to create or change AIX disklabels. - Most people can safely leave this option disabled. - -config FEATURE_SGI_LABEL - bool "Support SGI disklabels" - default n - depends on FDISK && FEATURE_FDISK_WRITABLE - help - Enabling this option allows you to create or change SGI disklabels. - Most people can safely leave this option disabled. - -config FEATURE_SUN_LABEL - bool "Support SUN disklabels" - default n - depends on FDISK && FEATURE_FDISK_WRITABLE - help - Enabling this option allows you to create or change SUN disklabels. - Most people can safely leave this option disabled. - -config FEATURE_OSF_LABEL - bool "Support BSD disklabels" - default n - depends on FDISK && FEATURE_FDISK_WRITABLE - help - Enabling this option allows you to create or change BSD disklabels - and define and edit BSD disk slices. - -config FEATURE_GPT_LABEL - bool "Support GPT disklabels" - default n - depends on FDISK && FEATURE_FDISK_WRITABLE - help - Enabling this option allows you to view GUID Partition Table - disklabels. - -config FEATURE_FDISK_ADVANCED - bool "Support expert mode" - default y - depends on FDISK && FEATURE_FDISK_WRITABLE - help - Enabling this option allows you to do terribly unsafe things like - define arbitrary drive geometry, move the beginning of data in a - partition, and similarly evil things. Unless you have a very good - reason you would be wise to leave this disabled. - -config FINDFS - bool "findfs" - default y - select PLATFORM_LINUX - select VOLUMEID - help - Prints the name of a filesystem with given label or UUID. - WARNING: - With all submodules selected, it will add ~8k to busybox. - -config FLOCK - bool "flock" - default y - help - Manage locks from shell scripts - -config FREERAMDISK - bool "freeramdisk" - default y - select PLATFORM_LINUX - help - Linux allows you to create ramdisks. This utility allows you to - delete them and completely free all memory that was used for the - ramdisk. For example, if you boot Linux into a ramdisk and later - pivot_root, you may want to free the memory that is allocated to the - ramdisk. If you have no use for freeing memory from a ramdisk, leave - this disabled. - -config FSCK_MINIX - bool "fsck_minix" - default y - help - The minix filesystem is a nice, small, compact, read-write filesystem - with little overhead. It is not a journaling filesystem however and - can experience corruption if it is not properly unmounted or if the - power goes off in the middle of a write. This utility allows you to - check for and attempt to repair any corruption that occurs to a minix - filesystem. - -config MKFS_MINIX - bool "mkfs_minix" - default y - select PLATFORM_LINUX - help - The minix filesystem is a nice, small, compact, read-write filesystem - with little overhead. If you wish to be able to create minix - filesystems this utility will do the job for you. - -config FEATURE_MINIX2 - bool "Support Minix fs v2 (fsck_minix/mkfs_minix)" - default y - depends on FSCK_MINIX || MKFS_MINIX - help - If you wish to be able to create version 2 minix filesystems, enable - this. If you enabled 'mkfs_minix' then you almost certainly want to - be using the version 2 filesystem support. - -config MKFS_REISER - bool "mkfs_reiser" - default n - select PLATFORM_LINUX - help - Utility to create ReiserFS filesystems. - Note: this applet needs a lot of testing and polishing. - -config GETOPT - bool "getopt" - default y - help - The getopt utility is used to break up (parse) options in command - lines to make it easy to write complex shell scripts that also check - for legal (and illegal) options. If you want to write horribly - complex shell scripts, or use some horribly complex shell script - written by others, this utility may be for you. Most people will - wisely leave this disabled. - -config FEATURE_GETOPT_LONG - bool "Support option -l" - default y if LONG_OPTS - depends on GETOPT - help - Enable support for long options (option -l). - -config HEXDUMP - bool "hexdump" - default y - help - The hexdump utility is used to display binary data in a readable - way that is comparable to the output from most hex editors. - -config FEATURE_HEXDUMP_REVERSE - bool "Support -R, reverse of 'hexdump -Cv'" - default y - depends on HEXDUMP - help - The hexdump utility is used to display binary data in an ascii - readable way. This option creates binary data from an ascii input. - NB: this option is non-standard. It's unwise to use it in scripts - aimed to be portable. - -config HD - bool "hd" - default y - depends on HEXDUMP - help - hd is an alias to hexdump -C. - -config HWCLOCK - bool "hwclock" - default y - select PLATFORM_LINUX - help - The hwclock utility is used to read and set the hardware clock - on a system. This is primarily used to set the current time on - shutdown in the hardware clock, so the hardware will keep the - correct time when Linux is _not_ running. - -config FEATURE_HWCLOCK_LONG_OPTIONS - bool "Support long options (--hctosys,...)" - default y - depends on HWCLOCK && LONG_OPTS - help - By default, the hwclock utility only uses short options. If you - are overly fond of its long options, such as --hctosys, --utc, etc) - then enable this option. - -config FEATURE_HWCLOCK_ADJTIME_FHS - bool "Use FHS /var/lib/hwclock/adjtime" - default n # util-linux-ng in Fedora 13 still uses /etc/adjtime - depends on HWCLOCK - help - Starting with FHS 2.3, the adjtime state file is supposed to exist - at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish - to use the FHS behavior, answer Y here, otherwise answer N for the - classic /etc/adjtime path. - - pathname.com/fhs/pub/fhs-2.3.html#VARLIBHWCLOCKSTATEDIRECTORYFORHWCLO - -config IPCRM - bool "ipcrm" - default y - help - The ipcrm utility allows the removal of System V interprocess - communication (IPC) objects and the associated data structures - from the system. - -config IPCS - bool "ipcs" - default y - select PLATFORM_LINUX - help - The ipcs utility is used to provide information on the currently - allocated System V interprocess (IPC) objects in the system. - -config LOSETUP - bool "losetup" - default y - select PLATFORM_LINUX - help - losetup is used to associate or detach a loop device with a regular - file or block device, and to query the status of a loop device. This - version does not currently support enabling data encryption. - -config LSPCI - bool "lspci" - default y - #select PLATFORM_LINUX - help - lspci is a utility for displaying information about PCI buses in the - system and devices connected to them. - - This version uses sysfs (/sys/bus/pci/devices) only. - -config LSUSB - bool "lsusb" - default y - #select PLATFORM_LINUX - help - lsusb is a utility for displaying information about USB buses in the - system and devices connected to them. - - This version uses sysfs (/sys/bus/usb/devices) only. - -config MKSWAP - bool "mkswap" - default y - help - The mkswap utility is used to configure a file or disk partition as - Linux swap space. This allows Linux to use the entire file or - partition as if it were additional RAM, which can greatly increase - the capability of low-memory machines. This additional memory is - much slower than real RAM, but can be very helpful at preventing your - applications being killed by the Linux out of memory (OOM) killer. - Once you have created swap space using 'mkswap' you need to enable - the swap space using the 'swapon' utility. - -config FEATURE_MKSWAP_UUID - bool "UUID support" - default y - depends on MKSWAP - help - Generate swap spaces with universally unique identifiers. - -config MORE - bool "more" - default y - help - more is a simple utility which allows you to read text one screen - sized page at a time. If you want to read text that is larger than - the screen, and you are using anything faster than a 300 baud modem, - you will probably find this utility very helpful. If you don't have - any need to reading text files, you can leave this disabled. - -config PIVOT_ROOT - bool "pivot_root" - default y - select PLATFORM_LINUX - help - The pivot_root utility swaps the mount points for the root filesystem - with some other mounted filesystem. This allows you to do all sorts - of wild and crazy things with your Linux system and is far more - powerful than 'chroot'. - - Note: This is for initrd in linux 2.4. Under initramfs (introduced - in linux 2.6) use switch_root instead. - -config RDATE - bool "rdate" - default y - help - The rdate utility allows you to synchronize the date and time of your - system clock with the date and time of a remote networked system using - the RFC868 protocol, which is built into the inetd daemon on most - systems. - -config RDEV - bool "rdev" - default y - help - Print the device node associated with the filesystem mounted at '/'. - -config READPROFILE - bool "readprofile" - default y - #select PLATFORM_LINUX - help - This allows you to parse /proc/profile for basic profiling. - -config RTCWAKE - bool "rtcwake" - default y - select PLATFORM_LINUX - help - Enter a system sleep state until specified wakeup time. - -config SCRIPT - bool "script" - default y - help - The script makes typescript of terminal session. - -config SCRIPTREPLAY - bool "scriptreplay" - default y - help - This program replays a typescript, using timing information - given by script -t. - -config SWITCH_ROOT - bool "switch_root" - default y - select PLATFORM_LINUX - help - The switch_root utility is used from initramfs to select a new - root device. Under initramfs, you have to use this instead of - pivot_root. (Stop reading here if you don't care why.) - - Booting with initramfs extracts a gzipped cpio archive into rootfs - (which is a variant of ramfs/tmpfs). Because rootfs can't be moved - or unmounted*, pivot_root will not work from initramfs. Instead, - switch_root deletes everything out of rootfs (including itself), - does a mount --move that overmounts rootfs with the new root, and - then execs the specified init program. - - * Because the Linux kernel uses rootfs internally as the starting - and ending point for searching through the kernel's doubly linked - list of active mount points. That's why. - -config UMOUNT - bool "umount" - default y - select PLATFORM_LINUX - help - When you want to remove a mounted filesystem from its current mount - point, for example when you are shutting down the system, the - 'umount' utility is the tool to use. If you enabled the 'mount' - utility, you almost certainly also want to enable 'umount'. - -config FEATURE_UMOUNT_ALL - bool "Support option -a" - default y - depends on UMOUNT - help - Support -a option to unmount all currently mounted filesystems. - comment "Common options for mount/umount" depends on MOUNT || UMOUNT diff --git a/util-linux/Kbuild.src b/util-linux/Kbuild.src index dfd50afa2..6b4fb7470 100644 --- a/util-linux/Kbuild.src +++ b/util-linux/Kbuild.src @@ -7,36 +7,3 @@ lib-y:= INSERT -lib-$(CONFIG_ACPID) += acpid.o -lib-$(CONFIG_BLKID) += blkid.o -lib-$(CONFIG_DMESG) += dmesg.o -lib-$(CONFIG_FBSET) += fbset.o -lib-$(CONFIG_FDFLUSH) += freeramdisk.o -lib-$(CONFIG_FDFORMAT) += fdformat.o -lib-$(CONFIG_FDISK) += fdisk.o -lib-$(CONFIG_FINDFS) += findfs.o -lib-$(CONFIG_FLOCK) += flock.o -lib-$(CONFIG_FREERAMDISK) += freeramdisk.o -lib-$(CONFIG_FSCK_MINIX) += fsck_minix.o -lib-$(CONFIG_GETOPT) += getopt.o -lib-$(CONFIG_HEXDUMP) += hexdump.o -lib-$(CONFIG_HWCLOCK) += hwclock.o -lib-$(CONFIG_IPCRM) += ipcrm.o -lib-$(CONFIG_IPCS) += ipcs.o -lib-$(CONFIG_LOSETUP) += losetup.o -lib-$(CONFIG_LSPCI) += lspci.o -lib-$(CONFIG_LSUSB) += lsusb.o -lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o -lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o -lib-$(CONFIG_MKSWAP) += mkswap.o -lib-$(CONFIG_MORE) += more.o -lib-$(CONFIG_MOUNT) += mount.o -lib-$(CONFIG_PIVOT_ROOT) += pivot_root.o -lib-$(CONFIG_RDATE) += rdate.o -lib-$(CONFIG_RDEV) += rdev.o -lib-$(CONFIG_READPROFILE) += readprofile.o -lib-$(CONFIG_RTCWAKE) += rtcwake.o -lib-$(CONFIG_SCRIPT) += script.o -lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o -lib-$(CONFIG_SWITCH_ROOT) += switch_root.o -lib-$(CONFIG_UMOUNT) += umount.o diff --git a/util-linux/acpid.c b/util-linux/acpid.c index 0f2cb6bdc..3e68b61ab 100644 --- a/util-linux/acpid.c +++ b/util-linux/acpid.c @@ -6,6 +6,32 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config ACPID +//config: bool "acpid" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: acpid listens to ACPI events coming either in textual form from +//config: /proc/acpi/event (though it is marked deprecated it is still widely +//config: used and _is_ a standard) or in binary form from specified evdevs +//config: (just use /dev/input/event*). +//config: +//config: It parses the event to retrieve ACTION and a possible PARAMETER. +//config: It then spawns /etc/acpi/[/] either via run-parts +//config: (if the resulting path is a directory) or directly as an executable. +//config: +//config: N.B. acpid relies on run-parts so have the latter installed. +//config: +//config:config FEATURE_ACPID_COMPAT +//config: bool "Accept and ignore redundant options" +//config: default y +//config: depends on ACPID +//config: help +//config: Accept and ignore compatibility options -g -m -s -S -v. + +//applet:IF_ACPID(APPLET(acpid, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_ACPID) += acpid.o //usage:#define acpid_trivial_usage //usage: "[-df] [-c CONFDIR] [-l LOGFILE] [-a ACTIONFILE] [-M MAPFILE] [-e PROC_EVENT_FILE] [-p PIDFILE]" diff --git a/util-linux/blkdiscard.c b/util-linux/blkdiscard.c index ace88a1f0..af0bc946d 100644 --- a/util-linux/blkdiscard.c +++ b/util-linux/blkdiscard.c @@ -5,7 +5,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - //config:config BLKDISCARD //config: bool "blkdiscard" //config: default y diff --git a/util-linux/blkid.c b/util-linux/blkid.c index 1bbc80311..b6f33b513 100644 --- a/util-linux/blkid.c +++ b/util-linux/blkid.c @@ -6,6 +6,26 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config BLKID +//config: bool "blkid" +//config: default y +//config: select PLATFORM_LINUX +//config: select VOLUMEID +//config: help +//config: Lists labels and UUIDs of all filesystems. +//config: WARNING: +//config: With all submodules selected, it will add ~8k to busybox. +//config: +//config:config FEATURE_BLKID_TYPE +//config: bool "Print filesystem type" +//config: default n +//config: depends on BLKID +//config: help +//config: Show TYPE="filesystem type" + +//applet:IF_BLKID(APPLET(blkid, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_BLKID) += blkid.o //usage:#define blkid_trivial_usage //usage: "[BLOCKDEV]..." diff --git a/util-linux/blockdev.c b/util-linux/blockdev.c index e25e529db..bf4d49792 100644 --- a/util-linux/blockdev.c +++ b/util-linux/blockdev.c @@ -5,17 +5,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - -//applet:IF_BLOCKDEV(APPLET(blockdev, BB_DIR_SBIN, BB_SUID_DROP)) - -//kbuild:lib-$(CONFIG_BLOCKDEV) += blockdev.o - //config:config BLOCKDEV //config: bool "blockdev" //config: default y //config: help //config: Performs some ioctls with block devices. +//applet:IF_BLOCKDEV(APPLET(blockdev, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_BLOCKDEV) += blockdev.o + //usage:#define blockdev_trivial_usage //usage: "OPTION BLOCKDEV" //usage:#define blockdev_full_usage "\n\n" diff --git a/util-linux/dmesg.c b/util-linux/dmesg.c index 50e8a0fce..b7b2c6924 100644 --- a/util-linux/dmesg.c +++ b/util-linux/dmesg.c @@ -8,6 +8,43 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config DMESG +//config: bool "dmesg" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: dmesg is used to examine or control the kernel ring buffer. When the +//config: Linux kernel prints messages to the system log, they are stored in +//config: the kernel ring buffer. You can use dmesg to print the kernel's ring +//config: buffer, clear the kernel ring buffer, change the size of the kernel +//config: ring buffer, and change the priority level at which kernel messages +//config: are also logged to the system console. Enable this option if you +//config: wish to enable the 'dmesg' utility. +//config: +//config:config FEATURE_DMESG_PRETTY +//config: bool "Pretty dmesg output" +//config: default y +//config: depends on DMESG +//config: help +//config: If you wish to scrub the syslog level from the output, say 'Y' here. +//config: The syslog level is a string prefixed to every line with the form +//config: "<#>". +//config: +//config: With this option you will see: +//config: # dmesg +//config: Linux version 2.6.17.4 ..... +//config: BIOS-provided physical RAM map: +//config: BIOS-e820: 0000000000000000 - 000000000009f000 (usable) +//config: +//config: Without this option you will see: +//config: # dmesg +//config: <5>Linux version 2.6.17.4 ..... +//config: <6>BIOS-provided physical RAM map: +//config: <6> BIOS-e820: 0000000000000000 - 000000000009f000 (usable) + +//applet:IF_DMESG(APPLET(dmesg, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_DMESG) += dmesg.o //usage:#define dmesg_trivial_usage //usage: "[-c] [-n LEVEL] [-s SIZE]" diff --git a/util-linux/fatattr.c b/util-linux/fatattr.c index 6dca24a73..030978f64 100644 --- a/util-linux/fatattr.c +++ b/util-linux/fatattr.c @@ -16,6 +16,7 @@ //config: fatattr lists or changes the file attributes on a fat file system. //applet:IF_FATATTR(APPLET(fatattr, BB_DIR_BIN, BB_SUID_DROP)) + //kbuild:lib-$(CONFIG_FATATTR) += fatattr.o //usage:#define fatattr_trivial_usage diff --git a/util-linux/fbset.c b/util-linux/fbset.c index b75ec1921..8a78c1ef9 100644 --- a/util-linux/fbset.c +++ b/util-linux/fbset.c @@ -11,6 +11,38 @@ * the GPL, and is (c) 1995-1999 by: * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be) */ +//config:config FBSET +//config: bool "fbset" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: fbset is used to show or change the settings of a Linux frame buffer +//config: device. The frame buffer device provides a simple and unique +//config: interface to access a graphics display. Enable this option +//config: if you wish to enable the 'fbset' utility. +//config: +//config:config FEATURE_FBSET_FANCY +//config: bool "Turn on extra fbset options" +//config: default y +//config: depends on FBSET +//config: help +//config: This option enables extended fbset options, allowing one to set the +//config: framebuffer size, color depth, etc. interface to access a graphics +//config: display. Enable this option if you wish to enable extended fbset +//config: options. +//config: +//config:config FEATURE_FBSET_READMODE +//config: bool "Turn on fbset readmode support" +//config: default y +//config: depends on FBSET +//config: help +//config: This option allows fbset to read the video mode database stored by +//config: default as /etc/fb.modes, which can be used to set frame buffer +//config: device to pre-defined video modes. + +//applet:IF_FBSET(APPLET(fbset, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FBSET) += fbset.o //usage:#define fbset_trivial_usage //usage: "[OPTIONS] [MODE]" diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index 6ef6445e6..67c6e1504 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c @@ -4,6 +4,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config FDFORMAT +//config: bool "fdformat" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: fdformat is used to low-level format a floppy disk. + +//applet:IF_FDFORMAT(APPLET(fdformat, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FDFORMAT) += fdformat.o //usage:#define fdformat_trivial_usage //usage: "[-n] DEVICE" diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index 32a66d03d..af8073532 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -6,6 +6,86 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config FDISK +//config: bool "fdisk" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: The fdisk utility is used to divide hard disks into one or more +//config: logical disks, which are generally called partitions. This utility +//config: can be used to list and edit the set of partitions or BSD style +//config: 'disk slices' that are defined on a hard drive. +//config: +//config:config FDISK_SUPPORT_LARGE_DISKS +//config: bool "Support over 4GB disks" +//config: default y +//config: depends on FDISK +//config: depends on !LFS # with LFS no special code is needed +//config: help +//config: Enable this option to support large disks > 4GB. +//config: +//config:config FEATURE_FDISK_WRITABLE +//config: bool "Write support" +//config: default y +//config: depends on FDISK +//config: help +//config: Enabling this option allows you to create or change a partition table +//config: and write those changes out to disk. If you leave this option +//config: disabled, you will only be able to view the partition table. +//config: +//config:config FEATURE_AIX_LABEL +//config: bool "Support AIX disklabels" +//config: default n +//config: depends on FDISK && FEATURE_FDISK_WRITABLE +//config: help +//config: Enabling this option allows you to create or change AIX disklabels. +//config: Most people can safely leave this option disabled. +//config: +//config:config FEATURE_SGI_LABEL +//config: bool "Support SGI disklabels" +//config: default n +//config: depends on FDISK && FEATURE_FDISK_WRITABLE +//config: help +//config: Enabling this option allows you to create or change SGI disklabels. +//config: Most people can safely leave this option disabled. +//config: +//config:config FEATURE_SUN_LABEL +//config: bool "Support SUN disklabels" +//config: default n +//config: depends on FDISK && FEATURE_FDISK_WRITABLE +//config: help +//config: Enabling this option allows you to create or change SUN disklabels. +//config: Most people can safely leave this option disabled. +//config: +//config:config FEATURE_OSF_LABEL +//config: bool "Support BSD disklabels" +//config: default n +//config: depends on FDISK && FEATURE_FDISK_WRITABLE +//config: help +//config: Enabling this option allows you to create or change BSD disklabels +//config: and define and edit BSD disk slices. +//config: +//config:config FEATURE_GPT_LABEL +//config: bool "Support GPT disklabels" +//config: default n +//config: depends on FDISK && FEATURE_FDISK_WRITABLE +//config: help +//config: Enabling this option allows you to view GUID Partition Table +//config: disklabels. +//config: +//config:config FEATURE_FDISK_ADVANCED +//config: bool "Support expert mode" +//config: default y +//config: depends on FDISK && FEATURE_FDISK_WRITABLE +//config: help +//config: Enabling this option allows you to do terribly unsafe things like +//config: define arbitrary drive geometry, move the beginning of data in a +//config: partition, and similarly evil things. Unless you have a very good +//config: reason you would be wise to leave this disabled. + +//applet:IF_FDISK(APPLET(fdisk, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FDISK) += fdisk.o /* Looks like someone forgot to add this to config system */ //usage:#ifndef ENABLE_FEATURE_FDISK_BLKSIZE diff --git a/util-linux/findfs.c b/util-linux/findfs.c index 07734f359..daa46b039 100644 --- a/util-linux/findfs.c +++ b/util-linux/findfs.c @@ -7,6 +7,20 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config FINDFS +//config: bool "findfs" +//config: default y +//config: select PLATFORM_LINUX +//config: select VOLUMEID +//config: help +//config: Prints the name of a filesystem with given label or UUID. +//config: WARNING: +//config: With all submodules selected, it will add ~8k to busybox. + +/* Benefits from suid root: better access to /dev/BLOCKDEVs: */ +//applet:IF_FINDFS(APPLET(findfs, BB_DIR_SBIN, BB_SUID_MAYBE)) + +//kbuild:lib-$(CONFIG_FINDFS) += findfs.o //usage:#define findfs_trivial_usage //usage: "LABEL=label or UUID=uuid" diff --git a/util-linux/flock.c b/util-linux/flock.c index 1f7ade7c4..f34c0ad8f 100644 --- a/util-linux/flock.c +++ b/util-linux/flock.c @@ -3,6 +3,15 @@ * * This is free software, licensed under the GNU General Public License v2. */ +//config:config FLOCK +//config: bool "flock" +//config: default y +//config: help +//config: Manage locks from shell scripts + +//applet:IF_FLOCK(APPLET(flock, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FLOCK) += flock.o //usage:#define flock_trivial_usage //usage: "[-sxun] FD|{FILE [-c] PROG ARGS}" diff --git a/util-linux/freeramdisk.c b/util-linux/freeramdisk.c index a89ae1a39..8bc2c443b 100644 --- a/util-linux/freeramdisk.c +++ b/util-linux/freeramdisk.c @@ -8,6 +8,36 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config FDFLUSH +//config: bool "fdflush" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: fdflush is only needed when changing media on slightly-broken +//config: removable media drives. It is used to make Linux believe that a +//config: hardware disk-change switch has been actuated, which causes Linux to +//config: forget anything it has cached from the previous media. If you have +//config: such a slightly-broken drive, you will need to run fdflush every time +//config: you change a disk. Most people have working hardware and can safely +//config: leave this disabled. +//config: +//config:config FREERAMDISK +//config: bool "freeramdisk" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Linux allows you to create ramdisks. This utility allows you to +//config: delete them and completely free all memory that was used for the +//config: ramdisk. For example, if you boot Linux into a ramdisk and later +//config: pivot_root, you may want to free the memory that is allocated to the +//config: ramdisk. If you have no use for freeing memory from a ramdisk, leave +//config: this disabled. + +//applet:IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, BB_DIR_BIN, BB_SUID_DROP, fdflush)) +//applet:IF_FREERAMDISK(APPLET(freeramdisk, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_FDFLUSH) += freeramdisk.o +//kbuild:lib-$(CONFIG_FREERAMDISK) += freeramdisk.o //usage:#define freeramdisk_trivial_usage //usage: "DEVICE" diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index d2f3524b4..0eaac17c0 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c @@ -85,6 +85,20 @@ * The device may be a block device or a image of one, but this isn't * enforced (but it's not much fun on a character device :-). */ +//config:config FSCK_MINIX +//config: bool "fsck_minix" +//config: default y +//config: help +//config: The minix filesystem is a nice, small, compact, read-write filesystem +//config: with little overhead. It is not a journaling filesystem however and +//config: can experience corruption if it is not properly unmounted or if the +//config: power goes off in the middle of a write. This utility allows you to +//config: check for and attempt to repair any corruption that occurs to a minix +//config: filesystem. + +//applet:IF_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, BB_DIR_SBIN, BB_SUID_DROP, fsck_minix)) + +//kbuild:lib-$(CONFIG_FSCK_MINIX) += fsck_minix.o //usage:#define fsck_minix_trivial_usage //usage: "[-larvsmf] BLOCKDEV" diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 18d490987..83cc1efea 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -28,8 +28,28 @@ * Removed --version/-V and --help/-h * Removed parse_error(), using bb_error_msg() from Busybox instead * Replaced our_malloc with xmalloc and our_realloc with xrealloc - * */ +//config:config GETOPT +//config: bool "getopt" +//config: default y +//config: help +//config: The getopt utility is used to break up (parse) options in command +//config: lines to make it easy to write complex shell scripts that also check +//config: for legal (and illegal) options. If you want to write horribly +//config: complex shell scripts, or use some horribly complex shell script +//config: written by others, this utility may be for you. Most people will +//config: wisely leave this disabled. +//config: +//config:config FEATURE_GETOPT_LONG +//config: bool "Support option -l" +//config: default y if LONG_OPTS +//config: depends on GETOPT +//config: help +//config: Enable support for long options (option -l). + +//applet:IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_GETOPT) += getopt.o //usage:#define getopt_trivial_usage //usage: "[OPTIONS] [--] OPTSTRING PARAMS" diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index ac7e24ff8..5e1ef6938 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c @@ -8,6 +8,35 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config HEXDUMP +//config: bool "hexdump" +//config: default y +//config: help +//config: The hexdump utility is used to display binary data in a readable +//config: way that is comparable to the output from most hex editors. +//config: +//config:config FEATURE_HEXDUMP_REVERSE +//config: bool "Support -R, reverse of 'hexdump -Cv'" +//config: default y +//config: depends on HEXDUMP +//config: help +//config: The hexdump utility is used to display binary data in an ascii +//config: readable way. This option creates binary data from an ascii input. +//config: NB: this option is non-standard. It's unwise to use it in scripts +//config: aimed to be portable. +//config: +//config:config HD +//config: bool "hd" +//config: default y +//config: depends on HEXDUMP +//config: help +//config: hd is an alias to hexdump -C. + +//applet:IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump)) +//applet:IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd)) + +//kbuild:lib-$(CONFIG_HEXDUMP) += hexdump.o +//kbuild:lib-$(CONFIG_HD) += hexdump.o //usage:#define hexdump_trivial_usage //usage: "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..." diff --git a/util-linux/hwclock.c b/util-linux/hwclock.c index 6c99977cf..084a7f1e9 100644 --- a/util-linux/hwclock.c +++ b/util-linux/hwclock.c @@ -5,7 +5,41 @@ * Copyright (C) 2002 Robert Griebl * * Licensed under GPLv2 or later, see file LICENSE in this source tree. -*/ + */ +//config:config HWCLOCK +//config: bool "hwclock" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: The hwclock utility is used to read and set the hardware clock +//config: on a system. This is primarily used to set the current time on +//config: shutdown in the hardware clock, so the hardware will keep the +//config: correct time when Linux is _not_ running. +//config: +//config:config FEATURE_HWCLOCK_LONG_OPTIONS +//config: bool "Support long options (--hctosys,...)" +//config: default y +//config: depends on HWCLOCK && LONG_OPTS +//config: help +//config: By default, the hwclock utility only uses short options. If you +//config: are overly fond of its long options, such as --hctosys, --utc, etc) +//config: then enable this option. +//config: +//config:config FEATURE_HWCLOCK_ADJTIME_FHS +//config: bool "Use FHS /var/lib/hwclock/adjtime" +//config: default n # util-linux-ng in Fedora 13 still uses /etc/adjtime +//config: depends on HWCLOCK +//config: help +//config: Starting with FHS 2.3, the adjtime state file is supposed to exist +//config: at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish +//config: to use the FHS behavior, answer Y here, otherwise answer N for the +//config: classic /etc/adjtime path. +//config: +//config: pathname.com/fhs/pub/fhs-2.3.html#VARLIBHWCLOCKSTATEDIRECTORYFORHWCLO + +//applet:IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_HWCLOCK) += hwclock.o #include "libbb.h" /* After libbb.h, since it needs sys/types.h on some systems */ diff --git a/util-linux/ipcrm.c b/util-linux/ipcrm.c index 38d81af50..76ea3ca4f 100644 --- a/util-linux/ipcrm.c +++ b/util-linux/ipcrm.c @@ -7,6 +7,17 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config IPCRM +//config: bool "ipcrm" +//config: default y +//config: help +//config: The ipcrm utility allows the removal of System V interprocess +//config: communication (IPC) objects and the associated data structures +//config: from the system. + +//applet:IF_IPCRM(APPLET(ipcrm, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_IPCRM) += ipcrm.o //usage:#define ipcrm_trivial_usage //usage: "[-MQS key] [-mqs id]" diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index 67a25a8ef..88ae9225d 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c @@ -7,6 +7,17 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config IPCS +//config: bool "ipcs" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: The ipcs utility is used to provide information on the currently +//config: allocated System V interprocess (IPC) objects in the system. + +//applet:IF_IPCS(APPLET(ipcs, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_IPCS) += ipcs.o //usage:#define ipcs_trivial_usage //usage: "[[-smq] -i shmid] | [[-asmq] [-tcplu]]" diff --git a/util-linux/losetup.c b/util-linux/losetup.c index d450b5a78..4424d9cbb 100644 --- a/util-linux/losetup.c +++ b/util-linux/losetup.c @@ -6,6 +6,18 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config LOSETUP +//config: bool "losetup" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: losetup is used to associate or detach a loop device with a regular +//config: file or block device, and to query the status of a loop device. This +//config: version does not currently support enabling data encryption. + +//kbuild:lib-$(CONFIG_LOSETUP) += losetup.o + +//applet:IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP)) //usage:#define losetup_trivial_usage //usage: "[-r] [-o OFS] {-f|LOOPDEV} FILE - associate loop devices\n" diff --git a/util-linux/lspci.c b/util-linux/lspci.c index 514678afd..8b38a2366 100644 --- a/util-linux/lspci.c +++ b/util-linux/lspci.c @@ -6,6 +6,19 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config LSPCI +//config: bool "lspci" +//config: default y +//config: #select PLATFORM_LINUX +//config: help +//config: lspci is a utility for displaying information about PCI buses in the +//config: system and devices connected to them. +//config: +//config: This version uses sysfs (/sys/bus/pci/devices) only. + +//applet:IF_LSPCI(APPLET(lspci, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_LSPCI) += lspci.o //usage:#define lspci_trivial_usage //usage: "[-mk]" diff --git a/util-linux/lsusb.c b/util-linux/lsusb.c index 540f21ec6..7d36d6f5a 100644 --- a/util-linux/lsusb.c +++ b/util-linux/lsusb.c @@ -6,6 +6,19 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config LSUSB +//config: bool "lsusb" +//config: default y +//config: #select PLATFORM_LINUX +//config: help +//config: lsusb is a utility for displaying information about USB buses in the +//config: system and devices connected to them. +//config: +//config: This version uses sysfs (/sys/bus/usb/devices) only. + +//applet:IF_LSUSB(APPLET(lsusb, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_LSUSB) += lsusb.o //usage:#define lsusb_trivial_usage NOUSAGE_STR //usage:#define lsusb_full_usage "" diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index aaabf8453..912246b93 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c @@ -62,6 +62,27 @@ * Modified for BusyBox by Erik Andersen -- * removed getopt based parser and added a hand rolled one. */ +//config:config MKFS_MINIX +//config: bool "mkfs_minix" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: The minix filesystem is a nice, small, compact, read-write filesystem +//config: with little overhead. If you wish to be able to create minix +//config: filesystems this utility will do the job for you. +//config: +//config:config FEATURE_MINIX2 +//config: bool "Support Minix fs v2 (fsck_minix/mkfs_minix)" +//config: default y +//config: depends on FSCK_MINIX || MKFS_MINIX +//config: help +//config: If you wish to be able to create version 2 minix filesystems, enable +//config: this. If you enabled 'mkfs_minix' then you almost certainly want to +//config: be using the version 2 filesystem support. + +//applet:IF_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, BB_DIR_SBIN, BB_SUID_DROP, mkfs_minix)) + +//kbuild:lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o //usage:#define mkfs_minix_trivial_usage //usage: "[-c | -l FILE] [-nXX] [-iXX] BLOCKDEV [KBYTES]" diff --git a/util-linux/mkfs_reiser.c b/util-linux/mkfs_reiser.c index 0a31ee44f..d01119f7f 100644 --- a/util-linux/mkfs_reiser.c +++ b/util-linux/mkfs_reiser.c @@ -6,6 +6,17 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config MKFS_REISER +//config: bool "mkfs_reiser" +//config: default n +//config: select PLATFORM_LINUX +//config: help +//config: Utility to create ReiserFS filesystems. +//config: Note: this applet needs a lot of testing and polishing. + +//applet:IF_MKFS_REISER(APPLET_ODDNAME(mkfs.reiser, mkfs_reiser, BB_DIR_SBIN, BB_SUID_DROP, mkfs_reiser)) + +//kbuild:lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o //usage:#define mkfs_reiser_trivial_usage //usage: "[-f] [-l LABEL] BLOCKDEV [4K-BLOCKS]" diff --git a/util-linux/mkswap.c b/util-linux/mkswap.c index dcb53f008..954a1948d 100644 --- a/util-linux/mkswap.c +++ b/util-linux/mkswap.c @@ -5,6 +5,29 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config MKSWAP +//config: bool "mkswap" +//config: default y +//config: help +//config: The mkswap utility is used to configure a file or disk partition as +//config: Linux swap space. This allows Linux to use the entire file or +//config: partition as if it were additional RAM, which can greatly increase +//config: the capability of low-memory machines. This additional memory is +//config: much slower than real RAM, but can be very helpful at preventing your +//config: applications being killed by the Linux out of memory (OOM) killer. +//config: Once you have created swap space using 'mkswap' you need to enable +//config: the swap space using the 'swapon' utility. +//config: +//config:config FEATURE_MKSWAP_UUID +//config: bool "UUID support" +//config: default y +//config: depends on MKSWAP +//config: help +//config: Generate swap spaces with universally unique identifiers. + +//applet:IF_MKSWAP(APPLET(mkswap, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_MKSWAP) += mkswap.o //usage:#define mkswap_trivial_usage //usage: "[-L LBL] BLOCKDEV [KBYTES]" diff --git a/util-linux/more.c b/util-linux/more.c index 07836e29d..934b30f8a 100644 --- a/util-linux/more.c +++ b/util-linux/more.c @@ -13,6 +13,19 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config MORE +//config: bool "more" +//config: default y +//config: help +//config: more is a simple utility which allows you to read text one screen +//config: sized page at a time. If you want to read text that is larger than +//config: the screen, and you are using anything faster than a 300 baud modem, +//config: you will probably find this utility very helpful. If you don't have +//config: any need to reading text files, you can leave this disabled. + +//applet:IF_MORE(APPLET(more, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_MORE) += more.o //usage:#define more_trivial_usage //usage: "[FILE]..." diff --git a/util-linux/mount.c b/util-linux/mount.c index eb8b7ba7b..42962b859 100644 --- a/util-linux/mount.c +++ b/util-linux/mount.c @@ -112,6 +112,14 @@ //config: help //config: Support mount -T (specifying an alternate fstab) +/* On full-blown systems, requires suid for user mounts. + * But it's not unthinkable to have it available in non-suid flavor on some systems, + * for viewing mount table. + * Therefore we use BB_SUID_MAYBE instead of BB_SUID_REQUIRE: */ +//applet:IF_MOUNT(APPLET(mount, BB_DIR_BIN, IF_DESKTOP(BB_SUID_MAYBE) IF_NOT_DESKTOP(BB_SUID_DROP))) + +//kbuild:lib-$(CONFIG_MOUNT) += mount.o + //usage:#define mount_trivial_usage //usage: "[OPTIONS] [-o OPT] DEVICE NODE" //usage:#define mount_full_usage "\n\n" diff --git a/util-linux/pivot_root.c b/util-linux/pivot_root.c index 83f01fabd..9bdae506c 100644 --- a/util-linux/pivot_root.c +++ b/util-linux/pivot_root.c @@ -8,6 +8,22 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config PIVOT_ROOT +//config: bool "pivot_root" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: The pivot_root utility swaps the mount points for the root filesystem +//config: with some other mounted filesystem. This allows you to do all sorts +//config: of wild and crazy things with your Linux system and is far more +//config: powerful than 'chroot'. +//config: +//config: Note: This is for initrd in linux 2.4. Under initramfs (introduced +//config: in linux 2.6) use switch_root instead. + +//applet:IF_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_PIVOT_ROOT) += pivot_root.o //usage:#define pivot_root_trivial_usage //usage: "NEW_ROOT PUT_OLD" diff --git a/util-linux/rdate.c b/util-linux/rdate.c index 8075ef6af..8dd784d3d 100644 --- a/util-linux/rdate.c +++ b/util-linux/rdate.c @@ -6,7 +6,19 @@ * by Sterling Huxley * * Licensed under GPLv2 or later, see file LICENSE in this source tree. -*/ + */ +//config:config RDATE +//config: bool "rdate" +//config: default y +//config: help +//config: The rdate utility allows you to synchronize the date and time of your +//config: system clock with the date and time of a remote networked system using +//config: the RFC868 protocol, which is built into the inetd daemon on most +//config: systems. + +//applet:IF_RDATE(APPLET(rdate, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RDATE) += rdate.o //usage:#define rdate_trivial_usage //usage: "[-sp] HOST" diff --git a/util-linux/rdev.c b/util-linux/rdev.c index 465281756..0e1578e33 100644 --- a/util-linux/rdev.c +++ b/util-linux/rdev.c @@ -8,6 +8,15 @@ * Licensed under GPLv2, see file LICENSE in this source tree. * */ +//config:config RDEV +//config: bool "rdev" +//config: default y +//config: help +//config: Print the device node associated with the filesystem mounted at '/'. + +//applet:IF_RDEV(APPLET(rdev, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RDEV) += rdev.o //usage:#define rdev_trivial_usage //usage: "" diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index 345b676ba..d5230387c 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c @@ -31,6 +31,16 @@ * Taken from util-linux and adapted for busybox by * Paul Mundt . */ +//config:config READPROFILE +//config: bool "readprofile" +//config: default y +//config: #select PLATFORM_LINUX +//config: help +//config: This allows you to parse /proc/profile for basic profiling. + +//applet:IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_READPROFILE) += readprofile.o //usage:#define readprofile_trivial_usage //usage: "[OPTIONS]" diff --git a/util-linux/rev.c b/util-linux/rev.c index 3c1b22f09..c22505314 100644 --- a/util-linux/rev.c +++ b/util-linux/rev.c @@ -5,17 +5,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - -//applet:IF_REV(APPLET(rev, BB_DIR_BIN, BB_SUID_DROP)) - -//kbuild:lib-$(CONFIG_REV) += rev.o - //config:config REV //config: bool "rev" //config: default y //config: help //config: Reverse lines of a file or files. +//applet:IF_REV(APPLET(rev, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_REV) += rev.o + //usage:#define rev_trivial_usage //usage: "[FILE]..." //usage:#define rev_full_usage "\n\n" diff --git a/util-linux/rtcwake.c b/util-linux/rtcwake.c index 8aee0cfcb..54fc70583 100644 --- a/util-linux/rtcwake.c +++ b/util-linux/rtcwake.c @@ -22,6 +22,16 @@ * RTC uses a local timezone instead (maybe you dual-boot MS-Windows). * That flag should not be needed on systems with adjtime support. */ +//config:config RTCWAKE +//config: bool "rtcwake" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: Enter a system sleep state until specified wakeup time. + +//applet:IF_RTCWAKE(APPLET(rtcwake, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RTCWAKE) += rtcwake.o //usage:#define rtcwake_trivial_usage //usage: "[-a | -l | -u] [-d DEV] [-m MODE] [-s SEC | -t TIME]" diff --git a/util-linux/script.c b/util-linux/script.c index 86475c1f1..c5063e8a1 100644 --- a/util-linux/script.c +++ b/util-linux/script.c @@ -10,6 +10,15 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//config:config SCRIPT +//config: bool "script" +//config: default y +//config: help +//config: The script makes typescript of terminal session. + +//applet:IF_SCRIPT(APPLET(script, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SCRIPT) += script.o //usage:#define script_trivial_usage //usage: "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]" diff --git a/util-linux/scriptreplay.c b/util-linux/scriptreplay.c index 382f56d9a..8a0c7489d 100644 --- a/util-linux/scriptreplay.c +++ b/util-linux/scriptreplay.c @@ -7,6 +7,16 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. * */ +//config:config SCRIPTREPLAY +//config: bool "scriptreplay" +//config: default y +//config: help +//config: This program replays a typescript, using timing information +//config: given by script -t. + +//applet:IF_SCRIPTREPLAY(APPLET(scriptreplay, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o //usage:#define scriptreplay_trivial_usage //usage: "timingfile [typescript [divisor]]" diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c index 0a2d23f50..b8f4e9447 100644 --- a/util-linux/swaponoff.c +++ b/util-linux/swaponoff.c @@ -6,7 +6,6 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - //config:config SWAPON //config: bool "swapon" //config: default y diff --git a/util-linux/switch_root.c b/util-linux/switch_root.c index 7960b672c..6034485d7 100644 --- a/util-linux/switch_root.c +++ b/util-linux/switch_root.c @@ -5,6 +5,29 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config SWITCH_ROOT +//config: bool "switch_root" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: The switch_root utility is used from initramfs to select a new +//config: root device. Under initramfs, you have to use this instead of +//config: pivot_root. (Stop reading here if you don't care why.) +//config: +//config: Booting with initramfs extracts a gzipped cpio archive into rootfs +//config: (which is a variant of ramfs/tmpfs). Because rootfs can't be moved +//config: or unmounted*, pivot_root will not work from initramfs. Instead, +//config: switch_root deletes everything out of rootfs (including itself), +//config: does a mount --move that overmounts rootfs with the new root, and +//config: then execs the specified init program. +//config: +//config: * Because the Linux kernel uses rootfs internally as the starting +//config: and ending point for searching through the kernel's doubly linked +//config: list of active mount points. That's why. + +//applet:IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SWITCH_ROOT) += switch_root.o //usage:#define switch_root_trivial_usage //usage: "[-c /dev/console] NEW_ROOT NEW_INIT [ARGS]" diff --git a/util-linux/uevent.c b/util-linux/uevent.c index b98fe6160..c22216a8a 100644 --- a/util-linux/uevent.c +++ b/util-linux/uevent.c @@ -3,7 +3,6 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ - //config:config UEVENT //config: bool "uevent" //config: default y diff --git a/util-linux/umount.c b/util-linux/umount.c index 91da69674..78eef57a5 100644 --- a/util-linux/umount.c +++ b/util-linux/umount.c @@ -7,6 +7,26 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config UMOUNT +//config: bool "umount" +//config: default y +//config: select PLATFORM_LINUX +//config: help +//config: When you want to remove a mounted filesystem from its current mount +//config: point, for example when you are shutting down the system, the +//config: 'umount' utility is the tool to use. If you enabled the 'mount' +//config: utility, you almost certainly also want to enable 'umount'. +//config: +//config:config FEATURE_UMOUNT_ALL +//config: bool "Support option -a" +//config: default y +//config: depends on UMOUNT +//config: help +//config: Support -a option to unmount all currently mounted filesystems. + +//applet:IF_UMOUNT(APPLET(umount, BB_DIR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_UMOUNT) += umount.o //usage:#define umount_trivial_usage //usage: "[OPTIONS] FILESYSTEM|DIRECTORY" diff --git a/util-linux/unshare.c b/util-linux/unshare.c index dcc59559a..bbabeef55 100644 --- a/util-linux/unshare.c +++ b/util-linux/unshare.c @@ -6,7 +6,6 @@ * * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ - //config:config UNSHARE //config: bool "unshare" //config: default y -- cgit v1.2.3-55-g6feb From 5b966c6180c139fba6846d632fd9bc0c34a8e1bc Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 11:53:12 +0100 Subject: Make "hd" independently selectable Signed-off-by: Denys Vlasenko --- util-linux/hexdump.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c index 5e1ef6938..4a7f641db 100644 --- a/util-linux/hexdump.c +++ b/util-linux/hexdump.c @@ -28,7 +28,6 @@ //config:config HD //config: bool "hd" //config: default y -//config: depends on HEXDUMP //config: help //config: hd is an alias to hexdump -C. @@ -106,7 +105,9 @@ int hexdump_main(int argc, char **argv) smallint rdump = 0; #endif - if (ENABLE_HD && !applet_name[2]) { /* we are "hd" */ + if (ENABLE_HD + && (!ENABLE_HEXDUMP || !applet_name[2]) + ) { /* we are "hd" */ ch = 'C'; goto hd_applet; } -- cgit v1.2.3-55-g6feb From af3f42011628585cd5c8f5c1fd4b43f2e370a23d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 14:46:56 +0100 Subject: Convert all coreutils/* applets to "new style" applet definitions Signed-off-by: Denys Vlasenko --- coreutils/Config.src | 644 -------------------------------------------------- coreutils/Kbuild.src | 73 +----- coreutils/basename.c | 13 +- coreutils/cal.c | 18 +- coreutils/cat.c | 16 +- coreutils/catv.c | 11 + coreutils/chgrp.c | 9 + coreutils/chmod.c | 9 + coreutils/chown.c | 17 ++ coreutils/chroot.c | 10 + coreutils/cksum.c | 9 + coreutils/comm.c | 10 + coreutils/cp.c | 22 +- coreutils/cut.c | 10 + coreutils/date.c | 11 +- coreutils/dd.c | 6 +- coreutils/df.c | 28 ++- coreutils/dirname.c | 10 + coreutils/dos2unix.c | 22 +- coreutils/du.c | 24 +- coreutils/echo.c | 24 +- coreutils/env.c | 26 +- coreutils/expand.c | 31 +++ coreutils/expr.c | 25 +- coreutils/false.c | 9 + coreutils/fold.c | 9 + coreutils/fsync.c | 9 + coreutils/head.c | 19 +- coreutils/hostid.c | 5 +- coreutils/id.c | 11 +- coreutils/install.c | 16 ++ coreutils/ln.c | 9 + coreutils/logname.c | 16 +- coreutils/ls.c | 70 +++++- coreutils/mkdir.c | 24 +- coreutils/mkfifo.c | 10 + coreutils/mknod.c | 10 + coreutils/mv.c | 23 +- coreutils/nice.c | 9 + coreutils/nohup.c | 9 + coreutils/od.c | 9 + coreutils/printenv.c | 9 + coreutils/printf.c | 11 + coreutils/pwd.c | 11 +- coreutils/readlink.c | 17 ++ coreutils/realpath.c | 15 +- coreutils/rm.c | 16 +- coreutils/rmdir.c | 17 ++ coreutils/seq.c | 9 + coreutils/sleep.c | 44 +++- coreutils/sort.c | 21 ++ coreutils/split.c | 19 ++ coreutils/stat.c | 3 + coreutils/stty.c | 10 +- coreutils/sum.c | 9 + coreutils/sync.c | 7 +- coreutils/tac.c | 14 +- coreutils/tail.c | 30 ++- coreutils/tee.c | 17 ++ coreutils/test.c | 13 +- coreutils/touch.c | 14 +- coreutils/tr.c | 7 +- coreutils/true.c | 9 + coreutils/truncate.c | 4 +- coreutils/tty.c | 10 + coreutils/uname.c | 25 +- coreutils/uniq.c | 9 + coreutils/unlink.c | 5 +- coreutils/usleep.c | 9 + coreutils/uudecode.c | 9 + coreutils/uuencode.c | 9 + coreutils/wc.c | 25 +- coreutils/who.c | 8 +- coreutils/whoami.c | 12 +- coreutils/yes.c | 17 +- include/applets.src.h | 70 ------ 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 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 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 */ - -/* 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 (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 * 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 : 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 Special for busybox ported by Vladimir Oleynik 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 * Copyright (C) 2007 Natanael Copa * Copyright (C) 2007 Tito Ragusa * * 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) -- cgit v1.2.3-55-g6feb From 7caf1369f5a84196d8e1b75f2febbc63d963a548 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 14:52:19 +0100 Subject: Make dos2unix/unix2dos independently selectable Signed-off-by: Denys Vlasenko --- coreutils/dos2unix.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c index 03986ad39..6d2347163 100644 --- a/coreutils/dos2unix.c +++ b/coreutils/dos2unix.c @@ -12,16 +12,15 @@ * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ //config:config DOS2UNIX -//config: bool "dos2unix/unix2dos" +//config: bool "dos2unix" //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: bool "unix2dos" //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. @@ -112,9 +111,12 @@ int dos2unix_main(int argc UNUSED_PARAM, char **argv) int o, conv_type; /* See if we are supposed to be doing dos2unix or unix2dos */ - conv_type = CT_UNIX2DOS; - if (applet_name[0] == 'd') { + if (ENABLE_DOS2UNIX + && (!ENABLE_UNIX2DOS || applet_name[0] == 'd') + ) { conv_type = CT_DOS2UNIX; + } else { + conv_type = CT_UNIX2DOS; } /* -u convert to unix, -d convert to dos */ -- cgit v1.2.3-55-g6feb From 73f743a381dc389287d2d0e56a2b7988f67c0bfc Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 14:54:38 +0100 Subject: Remove remnants of disabled "length" applet Signed-off-by: Denys Vlasenko --- coreutils/Config.src | 6 ------ coreutils/Kbuild.src | 2 -- coreutils/length.c.disabled | 31 ------------------------------- include/applets.src.h | 1 - 4 files changed, 40 deletions(-) delete mode 100644 coreutils/length.c.disabled diff --git a/coreutils/Config.src b/coreutils/Config.src index a35198a3b..c056320f8 100644 --- a/coreutils/Config.src +++ b/coreutils/Config.src @@ -7,12 +7,6 @@ menu "Coreutils" INSERT -####config LENGTH -#### bool "length" -#### default y -#### help -#### length is used to print out the length of a specified string. - comment "Common options" config FEATURE_VERBOSE diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src index c93aa63a1..8e2c097a3 100644 --- a/coreutils/Kbuild.src +++ b/coreutils/Kbuild.src @@ -10,8 +10,6 @@ lib-y:= INSERT -#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 diff --git a/coreutils/length.c.disabled b/coreutils/length.c.disabled deleted file mode 100644 index aee898d22..000000000 --- a/coreutils/length.c.disabled +++ /dev/null @@ -1,31 +0,0 @@ -/* vi: set sw=4 ts=4: */ -/* - * Licensed under GPLv2, see file LICENSE in this source tree. - */ - -/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */ - -//usage:#define length_trivial_usage -//usage: "STRING" -//usage:#define length_full_usage "\n\n" -//usage: "Print STRING's length" -//usage: -//usage:#define length_example_usage -//usage: "$ length Hello\n" -//usage: "5\n" - -#include "libbb.h" - -/* This is a NOFORK applet. Be very careful! */ - -int length_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; -int length_main(int argc, char **argv) -{ - if ((argc != 2) || (**(++argv) == '-')) { - bb_show_usage(); - } - - printf("%u\n", (unsigned)strlen(*argv)); - - return fflush_all(); -} diff --git a/include/applets.src.h b/include/applets.src.h index 82907e2a5..c72dca849 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -82,7 +82,6 @@ IF_DUMPLEASES(APPLET(dumpleases, BB_DIR_USR_BIN, BB_SUID_DROP)) //IF_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext3)) IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) -//IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length)) IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP)) IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP)) //IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP)) -- cgit v1.2.3-55-g6feb From 15fb91cefb22d64952f34fe246fc8f257172af63 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 18:31:48 +0100 Subject: test: make [ and [[ forms individually selectable Signed-off-by: Denys Vlasenko --- coreutils/test.c | 26 +++++++++++++++++++++----- include/applets.h.sh | 8 ++++++-- shell/ash.c | 4 ++-- 3 files changed, 29 insertions(+), 9 deletions(-) diff --git a/coreutils/test.c b/coreutils/test.c index 81c9b7dfe..9e18ee986 100644 --- a/coreutils/test.c +++ b/coreutils/test.c @@ -27,19 +27,33 @@ //config: returning an appropriate exit code. The bash shell //config: has test built in, ash can build it in optionally. //config: +//config:config TEST1 +//config: bool "test as [" +//config: default y +//config: help +//config: Provide test command in the "[ EXPR ]" form +//config: +//config:config TEST2 +//config: bool "test as [[" +//config: default y +//config: help +//config: Provide test command in the "[[ EXPR ]]" form +//config: //config:config FEATURE_TEST_64 //config: bool "Extend test to 64 bit" //config: default y -//config: depends on TEST || ASH_BUILTIN_TEST || HUSH +//config: depends on TEST || TEST1 || TEST2 || ASH_BUILTIN_TEST || HUSH //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)) +//applet:IF_TEST1(APPLET_NOFORK([, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) +//applet:IF_TEST2(APPLET_NOFORK([[, 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_TEST1) += test.o test_ptr_hack.o +//kbuild:lib-$(CONFIG_TEST2) += test.o test_ptr_hack.o +//kbuild:lib-$(CONFIG_ASH_BUILTIN_TEST) += test.o test_ptr_hack.o //kbuild:lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o /* "test --help" is special-cased to ignore --help */ @@ -827,7 +841,9 @@ int test_main(int argc, char **argv) const char *arg0; arg0 = bb_basename(argv[0]); - if (arg0[0] == '[') { + if ((ENABLE_TEST1 || ENABLE_TEST2 || ENABLE_ASH_BUILTIN_TEST || ENABLE_HUSH) + && (arg0[0] == '[') + ) { --argc; if (!arg0[1]) { /* "[" ? */ if (NOT_LONE_CHAR(argv[argc], ']')) { diff --git a/include/applets.h.sh b/include/applets.h.sh index 6b8046c4b..bab4e0d72 100755 --- a/include/applets.h.sh +++ b/include/applets.h.sh @@ -5,13 +5,17 @@ # CONFIG_applet names grep ^IF_ applets.h | grep -v IF_FEATURE_ | sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \ -| grep -v MODPROBE_SMALL | sed 's/BB_SYSCTL/SYSCTL/' \ +| grep -v MODPROBE_SMALL \ +| sed 's/BB_SYSCTL/SYSCTL/' \ +| sed 's/TEST1/[/' \ +| sed 's/TEST2/[[/' \ | sort | uniq \ >applets_APP1 # command line applet names grep ^IF_ applets.h | sed -e's/ //g' -e's/.*(\([a-z[][^,]*\),.*/\1/' \ -| grep -v '^bash$' | grep -v '^sh$' \ +| grep -v '^bash$' \ +| grep -v '^sh$' \ | tr a-z A-Z \ | sort | uniq \ >applets_APP2 diff --git a/shell/ash.c b/shell/ash.c index 87f2127a1..15246f55f 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -9282,9 +9282,9 @@ static const struct builtincmd builtintab[] = { { BUILTIN_SPEC_REG ":" , truecmd }, #if ENABLE_ASH_BUILTIN_TEST { BUILTIN_REGULAR "[" , testcmd }, -#if ENABLE_ASH_BASH_COMPAT +# if ENABLE_ASH_BASH_COMPAT { BUILTIN_REGULAR "[[" , testcmd }, -#endif +# endif #endif #if ENABLE_ASH_ALIAS { BUILTIN_REG_ASSG "alias" , aliascmd }, -- cgit v1.2.3-55-g6feb From a8e52da7742b2bc8a3993f7f7c3c70da8fe79848 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 18:46:40 +0100 Subject: Convert all selinux/* applets to "new style" applet definitions Signed-off-by: Denys Vlasenko --- include/applets.src.h | 12 ----- selinux/Config.src | 113 ----------------------------------------------- selinux/Kbuild.src | 12 ----- selinux/chcon.c | 17 +++++++ selinux/getenforce.c | 10 +++++ selinux/getsebool.c | 10 +++++ selinux/load_policy.c | 10 +++++ selinux/matchpathcon.c | 11 +++++ selinux/runcon.c | 17 +++++++ selinux/selinuxenabled.c | 11 +++++ selinux/sestatus.c | 10 +++++ selinux/setenforce.c | 10 +++++ selinux/setfiles.c | 31 +++++++++++++ selinux/setsebool.c | 11 +++++ 14 files changed, 148 insertions(+), 137 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index c72dca849..4e789151d 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -73,25 +73,13 @@ s - suid type: INSERT -IF_CHCON(APPLET(chcon, BB_DIR_USR_BIN, BB_SUID_DROP)) IF_DHCPRELAY(APPLET(dhcprelay, BB_DIR_USR_SBIN, 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_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_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP)) -IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP)) //IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon)) -IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP)) -IF_SELINUXENABLED(APPLET(selinuxenabled, BB_DIR_USR_SBIN, BB_SUID_DROP)) -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)) IF_UDHCPC(APPLET(udhcpc, BB_DIR_SBIN, BB_SUID_DROP)) IF_UDHCPD(APPLET(udhcpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) diff --git a/selinux/Config.src b/selinux/Config.src index d4701f60b..9cb755a0f 100644 --- a/selinux/Config.src +++ b/selinux/Config.src @@ -8,117 +8,4 @@ menu "SELinux Utilities" INSERT -config CHCON - bool "chcon" - default n - depends on SELINUX - help - Enable support to change the security context of file. - -config FEATURE_CHCON_LONG_OPTIONS - bool "Enable long options" - default y - depends on CHCON && LONG_OPTS - help - Support long options for the chcon applet. - -config GETENFORCE - bool "getenforce" - default n - depends on SELINUX - help - Enable support to get the current mode of SELinux. - -config GETSEBOOL - bool "getsebool" - default n - depends on SELINUX - help - Enable support to get SELinux boolean values. - -config LOAD_POLICY - bool "load_policy" - default n - depends on SELINUX - help - Enable support to load SELinux policy. - -config MATCHPATHCON - bool "matchpathcon" - default n - depends on SELINUX - help - Enable support to get default security context of the - specified path from the file contexts configuration. - -config RESTORECON - bool "restorecon" - default n - depends on SELINUX - help - Enable support to relabel files. The feature is almost - the same as setfiles, but usage is a little different. - -config RUNCON - bool "runcon" - default n - depends on SELINUX - help - Enable support to run command in specified security context. - -config FEATURE_RUNCON_LONG_OPTIONS - bool "Enable long options" - default y - depends on RUNCON && LONG_OPTS - help - Support long options for the runcon applet. - -config SELINUXENABLED - bool "selinuxenabled" - default n - depends on SELINUX - help - Enable support for this command to be used within shell scripts - to determine if selinux is enabled. - -config SETENFORCE - bool "setenforce" - default n - depends on SELINUX - help - Enable support to modify the mode SELinux is running in. - -config SETFILES - bool "setfiles" - default n - depends on SELINUX - help - Enable support to modify to relabel files. - Notice: If you built libselinux with -D_FILE_OFFSET_BITS=64, - (It is default in libselinux's Makefile), you _must_ enable - CONFIG_LFS. - -config FEATURE_SETFILES_CHECK_OPTION - bool "Enable check option" - default n - depends on SETFILES - help - Support "-c" option (check the validity of the contexts against - the specified binary policy) for setfiles. Requires libsepol. - -config SETSEBOOL - bool "setsebool" - default n - depends on SELINUX - help - Enable support for change boolean. - semanage and -P option is not supported yet. - -config SESTATUS - bool "sestatus" - default n - depends on SELINUX - help - Displays the status of SELinux. - endmenu diff --git a/selinux/Kbuild.src b/selinux/Kbuild.src index cdd5f2adf..62c9e64cd 100644 --- a/selinux/Kbuild.src +++ b/selinux/Kbuild.src @@ -8,15 +8,3 @@ lib-y:= INSERT -lib-$(CONFIG_CHCON) += chcon.o -lib-$(CONFIG_GETENFORCE) += getenforce.o -lib-$(CONFIG_GETSEBOOL) += getsebool.o -lib-$(CONFIG_LOAD_POLICY) += load_policy.o -lib-$(CONFIG_MATCHPATHCON) += matchpathcon.o -lib-$(CONFIG_RUNCON) += runcon.o -lib-$(CONFIG_SELINUXENABLED) += selinuxenabled.o -lib-$(CONFIG_SETENFORCE) += setenforce.o -lib-$(CONFIG_SETFILES) += setfiles.o -lib-$(CONFIG_RESTORECON) += setfiles.o -lib-$(CONFIG_SETSEBOOL) += setsebool.o -lib-$(CONFIG_SESTATUS) += sestatus.o diff --git a/selinux/chcon.c b/selinux/chcon.c index f947c2c12..c743013ce 100644 --- a/selinux/chcon.c +++ b/selinux/chcon.c @@ -7,6 +7,23 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config CHCON +//config: bool "chcon" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support to change the security context of file. +//config: +//config:config FEATURE_CHCON_LONG_OPTIONS +//config: bool "Enable long options" +//config: default y +//config: depends on CHCON && LONG_OPTS +//config: help +//config: Support long options for the chcon applet. + +//applet:IF_CHCON(APPLET(chcon, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_CHCON) += chcon.o //usage:#define chcon_trivial_usage //usage: "[OPTIONS] CONTEXT FILE..." diff --git a/selinux/getenforce.c b/selinux/getenforce.c index 56611d693..37477652b 100644 --- a/selinux/getenforce.c +++ b/selinux/getenforce.c @@ -6,6 +6,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config GETENFORCE +//config: bool "getenforce" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support to get the current mode of SELinux. + +//applet:IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_GETENFORCE) += getenforce.o //usage:#define getenforce_trivial_usage NOUSAGE_STR //usage:#define getenforce_full_usage "" diff --git a/selinux/getsebool.c b/selinux/getsebool.c index e8f0fefb0..fce478f5b 100644 --- a/selinux/getsebool.c +++ b/selinux/getsebool.c @@ -6,6 +6,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config GETSEBOOL +//config: bool "getsebool" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support to get SELinux boolean values. + +//applet:IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_GETSEBOOL) += getsebool.o //usage:#define getsebool_trivial_usage //usage: "-a or getsebool boolean..." diff --git a/selinux/load_policy.c b/selinux/load_policy.c index ce139dbf2..f969453e3 100644 --- a/selinux/load_policy.c +++ b/selinux/load_policy.c @@ -4,6 +4,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config LOAD_POLICY +//config: bool "load_policy" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support to load SELinux policy. + +//applet:IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_LOAD_POLICY) += load_policy.o //usage:#define load_policy_trivial_usage NOUSAGE_STR //usage:#define load_policy_full_usage "" diff --git a/selinux/matchpathcon.c b/selinux/matchpathcon.c index 9e5728eb3..a3b2fcb74 100644 --- a/selinux/matchpathcon.c +++ b/selinux/matchpathcon.c @@ -5,6 +5,17 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config MATCHPATHCON +//config: bool "matchpathcon" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support to get default security context of the +//config: specified path from the file contexts configuration. + +//applet:IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_MATCHPATHCON) += matchpathcon.o //usage:#define matchpathcon_trivial_usage //usage: "[-n] [-N] [-f file_contexts_file] [-p prefix] [-V]" diff --git a/selinux/runcon.c b/selinux/runcon.c index 27f2be3a9..366834e46 100644 --- a/selinux/runcon.c +++ b/selinux/runcon.c @@ -28,6 +28,23 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config RUNCON +//config: bool "runcon" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support to run command in specified security context. +//config: +//config:config FEATURE_RUNCON_LONG_OPTIONS +//config: bool "Enable long options" +//config: default y +//config: depends on RUNCON && LONG_OPTS +//config: help +//config: Support long options for the runcon applet. + +//applet:IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_RUNCON) += runcon.o //usage:#define runcon_trivial_usage //usage: "[-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] PROG ARGS\n" diff --git a/selinux/selinuxenabled.c b/selinux/selinuxenabled.c index ce830dc22..b80c4e71b 100644 --- a/selinux/selinuxenabled.c +++ b/selinux/selinuxenabled.c @@ -6,6 +6,17 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config SELINUXENABLED +//config: bool "selinuxenabled" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support for this command to be used within shell scripts +//config: to determine if selinux is enabled. + +//applet:IF_SELINUXENABLED(APPLET(selinuxenabled, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SELINUXENABLED) += selinuxenabled.o //usage:#define selinuxenabled_trivial_usage NOUSAGE_STR //usage:#define selinuxenabled_full_usage "" diff --git a/selinux/sestatus.c b/selinux/sestatus.c index e59431873..ad49c9d25 100644 --- a/selinux/sestatus.c +++ b/selinux/sestatus.c @@ -7,6 +7,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config SESTATUS +//config: bool "sestatus" +//config: default n +//config: depends on SELINUX +//config: help +//config: Displays the status of SELinux. + +//applet:IF_SESTATUS(APPLET(sestatus, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SESTATUS) += sestatus.o //usage:#define sestatus_trivial_usage //usage: "[-vb]" diff --git a/selinux/setenforce.c b/selinux/setenforce.c index c5bc0a5a6..8d18abd29 100644 --- a/selinux/setenforce.c +++ b/selinux/setenforce.c @@ -6,6 +6,16 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config SETENFORCE +//config: bool "setenforce" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support to modify the mode SELinux is running in. + +//applet:IF_SETENFORCE(APPLET(setenforce, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SETENFORCE) += setenforce.o //usage:#define setenforce_trivial_usage //usage: "[Enforcing | Permissive | 1 | 0]" diff --git a/selinux/setfiles.c b/selinux/setfiles.c index c9597d54e..4fc307f55 100644 --- a/selinux/setfiles.c +++ b/selinux/setfiles.c @@ -3,6 +3,37 @@ policycoreutils was released under GPL 2. Port to BusyBox (c) 2007 by Yuichi Nakamura */ +//config:config SETFILES +//config: bool "setfiles" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support to modify to relabel files. +//config: Notice: If you built libselinux with -D_FILE_OFFSET_BITS=64, +//config: (It is default in libselinux's Makefile), you _must_ enable +//config: CONFIG_LFS. +//config: +//config:config FEATURE_SETFILES_CHECK_OPTION +//config: bool "Enable check option" +//config: default n +//config: depends on SETFILES +//config: help +//config: Support "-c" option (check the validity of the contexts against +//config: the specified binary policy) for setfiles. Requires libsepol. +//config: +//config:config RESTORECON +//config: bool "restorecon" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support to relabel files. The feature is almost +//config: the same as setfiles, but usage is a little different. + +//applet:IF_SETFILES(APPLET(setfiles, BB_DIR_SBIN, BB_SUID_DROP)) +//applet:IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon)) + +//kbuild:lib-$(CONFIG_SETFILES) += setfiles.o +//kbuild:lib-$(CONFIG_RESTORECON) += setfiles.o //usage:#define setfiles_trivial_usage //usage: "[-dnpqsvW] [-e DIR]... [-o FILE] [-r alt_root_path]" diff --git a/selinux/setsebool.c b/selinux/setsebool.c index ec682e5c5..6a6bd031c 100644 --- a/selinux/setsebool.c +++ b/selinux/setsebool.c @@ -7,6 +7,17 @@ * * Licensed under GPLv2, see file LICENSE in this source tree. */ +//config:config SETSEBOOL +//config: bool "setsebool" +//config: default n +//config: depends on SELINUX +//config: help +//config: Enable support for change boolean. +//config: semanage and -P option is not supported yet. + +//applet:IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_SETSEBOOL) += setsebool.o //usage:#define setsebool_trivial_usage //usage: "boolean value" -- cgit v1.2.3-55-g6feb From f7683cdf83f9eb6793b0be34058dcff92e41252d Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 18:54:59 +0100 Subject: Convert all udhcp applets to "new style" applet definitions Signed-off-by: Denys Vlasenko --- include/applets.src.h | 5 +---- networking/udhcp/dhcpc.c | 7 +++++++ networking/udhcp/dhcpd.c | 5 +++++ networking/udhcp/dhcprelay.c | 3 +++ networking/udhcp/dumpleases.c | 3 +++ 5 files changed, 19 insertions(+), 4 deletions(-) diff --git a/include/applets.src.h b/include/applets.src.h index 4e789151d..10e85de78 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -73,15 +73,12 @@ s - suid type: INSERT -IF_DHCPRELAY(APPLET(dhcprelay, BB_DIR_USR_SBIN, 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_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_PARSE(APPLET(parse, 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 !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \ && !defined(MAKE_LINKS) && !defined(MAKE_SUID) diff --git a/networking/udhcp/dhcpc.c b/networking/udhcp/dhcpc.c index 1c1051107..0e236261b 100644 --- a/networking/udhcp/dhcpc.c +++ b/networking/udhcp/dhcpc.c @@ -18,6 +18,13 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +//applet:IF_UDHCPC(APPLET(udhcpc, BB_DIR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_UDHCPC) += common.o packet.o signalpipe.o socket.o +//kbuild:lib-$(CONFIG_UDHCPC) += dhcpc.o +//kbuild:lib-$(CONFIG_FEATURE_UDHCPC_ARPING) += arpping.o +//kbuild:lib-$(CONFIG_FEATURE_UDHCP_RFC3397) += domain_codec.o + #include /* Override ENABLE_FEATURE_PIDFILE - ifupdown needs our pidfile to always exist */ #define WANT_PIDFILE 1 diff --git a/networking/udhcp/dhcpd.c b/networking/udhcp/dhcpd.c index 56116d01f..e116ba3af 100644 --- a/networking/udhcp/dhcpd.c +++ b/networking/udhcp/dhcpd.c @@ -20,6 +20,11 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ +//applet:IF_UDHCPD(APPLET(udhcpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_UDHCPD) += common.o packet.o signalpipe.o socket.o +//kbuild:lib-$(CONFIG_UDHCPD) += dhcpd.o arpping.o +//kbuild:lib-$(CONFIG_FEATURE_UDHCP_RFC3397) += domain_codec.o //usage:#define udhcpd_trivial_usage //usage: "[-fS] [-I ADDR]" IF_FEATURE_UDHCP_PORT(" [-P N]") " [CONFFILE]" diff --git a/networking/udhcp/dhcprelay.c b/networking/udhcp/dhcprelay.c index f52a0cf88..7cb19b14e 100644 --- a/networking/udhcp/dhcprelay.c +++ b/networking/udhcp/dhcprelay.c @@ -9,6 +9,9 @@ * Netbeat AG * Upstream has GPL v2 or later */ +//applet:IF_DHCPRELAY(APPLET(dhcprelay, BB_DIR_USR_SBIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_DHCPRELAY) += dhcprelay.o //usage:#define dhcprelay_trivial_usage //usage: "CLIENT_IFACE[,CLIENT_IFACE2]... SERVER_IFACE [SERVER_IP]" diff --git a/networking/udhcp/dumpleases.c b/networking/udhcp/dumpleases.c index 987cc9aff..d83344a8d 100644 --- a/networking/udhcp/dumpleases.c +++ b/networking/udhcp/dumpleases.c @@ -2,6 +2,9 @@ /* * Licensed under GPLv2 or later, see file LICENSE in this source tree. */ +//applet:IF_DUMPLEASES(APPLET(dumpleases, BB_DIR_USR_BIN, BB_SUID_DROP)) + +//kbuild:lib-$(CONFIG_DUMPLEASES) += dumpleases.o //usage:#define dumpleases_trivial_usage //usage: "[-r|-a] [-d] [-f LEASEFILE]" -- cgit v1.2.3-55-g6feb From 5bbee27c0fcafe60f43a294afa1352b5ddcab6f3 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Wed, 23 Nov 2016 21:51:11 +0100 Subject: Remove outdated comments Signed-off-by: Denys Vlasenko --- e2fsprogs/tune2fs.c | 2 ++ include/applets.src.h | 5 ----- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/e2fsprogs/tune2fs.c b/e2fsprogs/tune2fs.c index c9f88b39d..e9bad66ad 100644 --- a/e2fsprogs/tune2fs.c +++ b/e2fsprogs/tune2fs.c @@ -15,6 +15,8 @@ //applet:IF_TUNE2FS(APPLET(tune2fs, BB_DIR_SBIN, BB_SUID_DROP)) +//TODO alias to "tune2fs -L LABEL": //applet:IF_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, BB_DIR_SBIN, BB_SUID_DROP, e2label)) + //kbuild:lib-$(CONFIG_TUNE2FS) += tune2fs.o //usage:#define tune2fs_trivial_usage diff --git a/include/applets.src.h b/include/applets.src.h index 10e85de78..2ddf120ad 100644 --- a/include/applets.src.h +++ b/include/applets.src.h @@ -74,11 +74,6 @@ s - suid type: INSERT -//IF_E2FSCK(APPLET(e2fsck, BB_DIR_SBIN, BB_SUID_DROP)) -//IF_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, BB_DIR_SBIN, BB_SUID_DROP, e2label)) -//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_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP)) #if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \ && !defined(MAKE_LINKS) && !defined(MAKE_SUID) -- cgit v1.2.3-55-g6feb From 2eff59667d3c590f27ee39cd0969b2221af739a0 Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Tue, 22 Nov 2016 00:19:50 +0200 Subject: patch: fix debug log failure If we reach the end of plist it means the input has still data while we are expecting EOF. Fix the log to avoid a crash. Signed-off-by: Aaro Koskinen Signed-off-by: Denys Vlasenko --- editors/patch.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/editors/patch.c b/editors/patch.c index 988021d77..4ee9339a7 100644 --- a/editors/patch.c +++ b/editors/patch.c @@ -295,7 +295,7 @@ static int apply_one_hunk(void) // recheck remaining buffered data for a new match. if (PATCH_DEBUG) - fdprintf(2, "NOT: %s\n", plist->data); + fdprintf(2, "NOT: %s\n", plist ? plist->data : "EOF"); TT.state = 3; check = buf; -- cgit v1.2.3-55-g6feb From cb810c48c036f50c19b08df7e161cdb0550a2abd Mon Sep 17 00:00:00 2001 From: Aaro Koskinen Date: Tue, 22 Nov 2016 00:19:51 +0200 Subject: patch: fix matching failure Fix matching failure when plist is advanced while checking for buffered lines - the lines in the hunk that are about to be added should be skipped when checking for matching context. Also add a valid test case that fails with current busybox and is fixed by the change. Signed-off-by: Aaro Koskinen Signed-off-by: Denys Vlasenko --- editors/patch.c | 11 +++++++++++ testsuite/patch.tests | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/editors/patch.c b/editors/patch.c index 4ee9339a7..ea1fc0974 100644 --- a/editors/patch.c +++ b/editors/patch.c @@ -290,6 +290,17 @@ static int apply_one_hunk(void) // out of buffer. for (;;) { + while (plist && *plist->data == "+-"[reverse]) { + if (!strcmp(check->data, plist->data+1) && + !backwarn) { + backwarn = TT.linenum; + if (option_mask32 & FLAG_IGNORE) { + dummy_revert = 1; + reverse ^= 1; + } + } + plist = plist->next; + } if (!plist || strcmp(check->data, plist->data+1)) { // Match failed. Write out first line of buffered data and // recheck remaining buffered data for a new match. diff --git a/testsuite/patch.tests b/testsuite/patch.tests index 2759d2ad4..39205242c 100755 --- a/testsuite/patch.tests +++ b/testsuite/patch.tests @@ -242,6 +242,51 @@ patch: can't open 'dir2///file': No such file or directory zxc " +testing "patch internal buffering bug?" \ + 'patch -p1 2>&1; echo $?; cat input' \ +"\ +patching file input +0 +foo + + + + + + +1 +2 +3 + +bar +" \ +"\ +foo + + + + + + + +bar +" \ +"\ +--- a/input.orig ++++ b/input +@@ -5,5 +5,8 @@ foo + + + ++1 ++2 ++3 + + bar +-- +2.9.2 +" \ + rm input.orig 2>/dev/null exit $FAILCOUNT -- cgit v1.2.3-55-g6feb From 2e4ef38743c3d4aef109b5cc04429ec1f0e2f6c8 Mon Sep 17 00:00:00 2001 From: Rostislav Skudnov Date: Thu, 24 Nov 2016 15:04:00 +0100 Subject: lineedit: fix handling of repeating Alt-b, Alt-f, Alt-d, Alt-Backspace These key combinations should repeat correctly when the keys are pressed and held. Before this change, they do this erratically - many repeats are "eaten" because they are treated as unrecognized ESC seqs: ESC 0x7f is treated by Alt+baskspace, but ESC 0x7f ESC 0x7f ESC 0x7f is unrecognized. Escape sequences corresponding to these key combinations are moved from read_line_input to lineedit_read_key. Also, these key sequences are now enabled regardless of whether FEATURE_EDITING_VI is set, since Vim does not actually support these key combinations, but they are present in readline library. function old new delta static.esccmds 93 103 +10 read_line_input 3737 3687 -50 Signed-off-by: Rostislav Skudnov Signed-off-by: Denys Vlasenko --- include/libbb.h | 76 ++++++++++++++++++++++++++++---------------------------- libbb/lineedit.c | 60 ++++++++++++++------------------------------ libbb/read_key.c | 12 +++++++++ 3 files changed, 68 insertions(+), 80 deletions(-) diff --git a/include/libbb.h b/include/libbb.h index 20fc7329f..bdafcf5a6 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -1463,46 +1463,46 @@ unsigned long long bb_makedev(unsigned major, unsigned minor) FAST_FUNC; * yet doesn't represent any valid Unicode character. * Also, -1 is reserved for error indication and we don't use it. */ enum { - KEYCODE_UP = -2, - KEYCODE_DOWN = -3, - KEYCODE_RIGHT = -4, - KEYCODE_LEFT = -5, - KEYCODE_HOME = -6, - KEYCODE_END = -7, - KEYCODE_INSERT = -8, - KEYCODE_DELETE = -9, - KEYCODE_PAGEUP = -10, - KEYCODE_PAGEDOWN = -11, - // -12 is reserved for Alt/Ctrl/Shift-TAB + KEYCODE_UP = -2, + KEYCODE_DOWN = -3, + KEYCODE_RIGHT = -4, + KEYCODE_LEFT = -5, + KEYCODE_HOME = -6, + KEYCODE_END = -7, + KEYCODE_INSERT = -8, + KEYCODE_DELETE = -9, + KEYCODE_PAGEUP = -10, + KEYCODE_PAGEDOWN = -11, + KEYCODE_BACKSPACE = -12, /* Used only if Alt/Ctrl/Shifted */ + KEYCODE_D = -13, /* Used only if Alted */ #if 0 - KEYCODE_FUN1 = -13, - KEYCODE_FUN2 = -14, - KEYCODE_FUN3 = -15, - KEYCODE_FUN4 = -16, - KEYCODE_FUN5 = -17, - KEYCODE_FUN6 = -18, - KEYCODE_FUN7 = -19, - KEYCODE_FUN8 = -20, - KEYCODE_FUN9 = -21, - KEYCODE_FUN10 = -22, - KEYCODE_FUN11 = -23, - KEYCODE_FUN12 = -24, -#endif - /* Be sure that last defined value is small enough - * to not interfere with Alt/Ctrl/Shift bits. - * So far we do not exceed -31 (0xfff..fffe1), - * which gives us three upper bits in LSB to play with. + KEYCODE_FUN1 = , + KEYCODE_FUN2 = , + KEYCODE_FUN3 = , + KEYCODE_FUN4 = , + KEYCODE_FUN5 = , + KEYCODE_FUN6 = , + KEYCODE_FUN7 = , + KEYCODE_FUN8 = , + KEYCODE_FUN9 = , + KEYCODE_FUN10 = , + KEYCODE_FUN11 = , + KEYCODE_FUN12 = , +#endif + /* ^^^^^ Be sure that last defined value is small enough. + * Current read_key() code allows going up to -32 (0xfff..fffe0). + * This gives three upper bits in LSB to play with: + * KEYCODE_foo values are 0xfff..fffXX, lowest XX bits are: scavvvvv, + * s=0 if SHIFT, c=0 if CTRL, a=0 if ALT, + * vvvvv bits are the same for same key regardless of "shift bits". */ - //KEYCODE_SHIFT_TAB = (-12) & ~0x80, - //KEYCODE_SHIFT_... = KEYCODE_... & ~0x80, - //KEYCODE_CTRL_UP = KEYCODE_UP & ~0x40, - //KEYCODE_CTRL_DOWN = KEYCODE_DOWN & ~0x40, - KEYCODE_CTRL_RIGHT = KEYCODE_RIGHT & ~0x40, - KEYCODE_CTRL_LEFT = KEYCODE_LEFT & ~0x40, - //KEYCODE_ALT_UP = KEYCODE_UP & ~0x20, - //KEYCODE_ALT_DOWN = KEYCODE_DOWN & ~0x20, - KEYCODE_ALT_RIGHT = KEYCODE_RIGHT & ~0x20, - KEYCODE_ALT_LEFT = KEYCODE_LEFT & ~0x20, + //KEYCODE_SHIFT_... = KEYCODE_... & ~0x80, + KEYCODE_CTRL_RIGHT = KEYCODE_RIGHT & ~0x40, + KEYCODE_CTRL_LEFT = KEYCODE_LEFT & ~0x40, + KEYCODE_ALT_RIGHT = KEYCODE_RIGHT & ~0x20, + KEYCODE_ALT_LEFT = KEYCODE_LEFT & ~0x20, + KEYCODE_ALT_BACKSPACE = KEYCODE_BACKSPACE & ~0x20, + KEYCODE_ALT_D = KEYCODE_D & ~0x20, KEYCODE_CURSOR_POS = -0x100, /* 0xfff..fff00 */ /* How long is the longest ESC sequence we know? diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 2cc61db40..ac049f57d 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -13,7 +13,6 @@ * * This code is 'as is' with no warranty. */ - /* * Usage and known bugs: * Terminal key codes are not extensive, more needs to be added. @@ -23,9 +22,6 @@ * Ctrl-E also works as End. * * The following readline-like commands are not implemented: - * ESC-b -- Move back one word - * ESC-f -- Move forward one word - * ESC-d -- Delete forward one word * CTL-t -- Transpose two characters * * lineedit does not know that the terminal escape sequences do not @@ -2483,6 +2479,24 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman while (cursor > 0 && !BB_isspace(command_ps[cursor-1])) input_backspace(); break; + case KEYCODE_ALT_D: { + /* Delete word forward */ + int nc, sc = cursor; + ctrl_right(); + nc = cursor - sc; + input_backward(nc); + while (--nc >= 0) + input_delete(1); + break; + } + case KEYCODE_ALT_BACKSPACE: { + /* Delete word backward */ + int sc = cursor; + ctrl_left(); + while (sc-- > cursor) + input_delete(1); + break; + } #if ENABLE_FEATURE_REVERSE_SEARCH case CTRL('R'): ic = ic_raw = reverse_i_search(); @@ -2625,44 +2639,6 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman vi_cmdmode = 1; input_backward(1); } - /* Handle a few ESC- combinations the same way - * standard readline bindings (IOW: bash) do. - * Often, Alt- generates ESC-. - */ - ic = lineedit_read_key(read_key_buffer, 50); - switch (ic) { - //case KEYCODE_LEFT: - bash doesn't do this - case 'b': - ctrl_left(); - break; - //case KEYCODE_RIGHT: - bash doesn't do this - case 'f': - ctrl_right(); - break; - //case KEYCODE_DELETE: - bash doesn't do this - case 'd': /* Alt-D */ - { - /* Delete word forward */ - int nc, sc = cursor; - ctrl_right(); - nc = cursor - sc; - input_backward(nc); - while (--nc >= 0) - input_delete(1); - break; - } - case '\b': /* Alt-Backspace(?) */ - case '\x7f': /* Alt-Backspace(?) */ - //case 'w': - bash doesn't do this - { - /* Delete word backward */ - int sc = cursor; - ctrl_left(); - while (sc-- > cursor) - input_delete(1); - break; - } - } break; #endif /* FEATURE_COMMAND_EDITING_VI */ diff --git a/libbb/read_key.c b/libbb/read_key.c index ace23defb..951786869 100644 --- a/libbb/read_key.c +++ b/libbb/read_key.c @@ -18,8 +18,20 @@ int64_t FAST_FUNC read_key(int fd, char *buffer, int timeout) /* Known escape sequences for cursor and function keys. * See "Xterm Control Sequences" * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html + * Array should be sorted from shortest to longest. */ static const char esccmds[] ALIGN1 = { + '\x7f' |0x80,KEYCODE_ALT_BACKSPACE, + '\b' |0x80,KEYCODE_ALT_BACKSPACE, + 'd' |0x80,KEYCODE_ALT_D , + /* lineedit mimics bash: Alt-f and Alt-b are forward/backward + * word jumps. We cheat here and make them return ALT_LEFT/RIGHT + * keycodes. This way, lineedit need no special code to handle them. + * If we'll need to distinguish them, introduce new ALT_F/B keycodes, + * and update lineedit to react to them. + */ + 'f' |0x80,KEYCODE_ALT_RIGHT, + 'b' |0x80,KEYCODE_ALT_LEFT, 'O','A' |0x80,KEYCODE_UP , 'O','B' |0x80,KEYCODE_DOWN , 'O','C' |0x80,KEYCODE_RIGHT , -- cgit v1.2.3-55-g6feb From 8660aeb3127416a53e0b2e43bb1a82907f468692 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 24 Nov 2016 17:44:02 +0100 Subject: ash,hush: ^C from command line should set $? to 128+SIGINT Signed-off-by: Denys Vlasenko --- shell/ash.c | 1 + shell/hush.c | 26 +++++++++++++++++++++----- 2 files changed, 22 insertions(+), 5 deletions(-) diff --git a/shell/ash.c b/shell/ash.c index 15246f55f..3e5a3b3e9 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -9876,6 +9876,7 @@ preadfd(void) raise(SIGINT); return 1; } + exitstatus = 128 + SIGINT; goto retry; } if (nr < 0) { diff --git a/shell/hush.c b/shell/hush.c index 2f07f4ac1..5b720ce98 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -1746,6 +1746,7 @@ static int check_and_run_traps(void) argv[2] = NULL; save_rcode = G.last_exitcode; builtin_eval(argv); +//FIXME: shouldn't it be set to 128 + sig instead? G.last_exitcode = save_rcode; last_sig = sig; } /* else: "" trap, ignoring signal */ @@ -2192,7 +2193,7 @@ static int get_user_input(struct in_str *i) prompt_str = setup_prompt_string(i->promptmode); # if ENABLE_FEATURE_EDITING - do { + for (;;) { reinit_unicode_for_hush(); G.flag_SIGINT = 0; /* buglet: SIGINT will not make new prompt to appear _at once_, @@ -2201,9 +2202,15 @@ static int get_user_input(struct in_str *i) G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1, /*timeout*/ -1 ); - /* catch *SIGINT* etc (^C is handled by read_line_input) */ + /* read_line_input intercepts ^C, "convert" it into SIGINT */ + if (r == 0) + raise(SIGINT); check_and_run_traps(); - } while (r == 0 || G.flag_SIGINT); /* repeat if ^C or SIGINT */ + if (r != 0 && !G.flag_SIGINT) + break; + /* ^C or SIGINT: repeat */ + G.last_exitcode = 128 + SIGINT; + } if (r < 0) { /* EOF/error detected */ i->p = NULL; @@ -2213,7 +2220,7 @@ static int get_user_input(struct in_str *i) i->p = G.user_input_buf; return (unsigned char)*i->p++; # else - do { + for (;;) { G.flag_SIGINT = 0; if (i->last_char == '\0' || i->last_char == '\n') { /* Why check_and_run_traps here? Try this interactively: @@ -2226,7 +2233,16 @@ static int get_user_input(struct in_str *i) } fflush_all(); r = fgetc(i->file); - } while (G.flag_SIGINT || r == '\0'); + /* In !ENABLE_FEATURE_EDITING we don't use read_line_input, + * no ^C masking happens during fgetc, no special code for ^C: + * it generates SIGINT as usual. + */ + check_and_run_traps(); + if (G.flag_SIGINT) + G.last_exitcode = 128 + SIGINT; + if (r != '\0') + break; + } return r; # endif } -- cgit v1.2.3-55-g6feb From 336022663a5a38d1dfed6e1dc68d776d1e7e67fe Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 24 Nov 2016 22:08:12 +0100 Subject: Collapse three levers of menuconfig to two levels. Signed-off-by: Denys Vlasenko --- Config.in | 157 ++++++++++++++++++++++++++++++-------------------------------- 1 file changed, 76 insertions(+), 81 deletions(-) diff --git a/Config.in b/Config.in index 3d1870966..089879914 100644 --- a/Config.in +++ b/Config.in @@ -11,15 +11,18 @@ config HAVE_DOT_CONFIG menu "Busybox Settings" -menu "General Configuration" - config DESKTOP bool "Enable options for full-blown desktop systems" default y help Enable options and features which are not essential. - Select this only if you plan to use busybox on full-blown - desktop machine with common Linux distro, not on an embedded box. + Select this if you plan to use busybox on full-blown desktop machine + with common Linux distro, which needs higher level of command-line + compatibility. + + If you are preparing your build to be used on an embedded box + where you have tighter control over the entire set of userspace + tools, you can unselect this option for smaller code size. config EXTRA_COMPAT bool "Provide compatible behavior for rare corner cases (bigger code)" @@ -199,9 +202,9 @@ config LAST_SUPPORTED_WCHAR help Any character with Unicode value bigger than this is assumed to be non-printable on output device. Many applets replace - such chars with substitution character. + such characters with substitution character. - The idea is that many valid printable Unicode chars are + The idea is that many valid printable Unicode chars nevertheless are not displayed correctly. Think about combining charachers, double-wide hieroglyphs, obscure characters in dozens of ancient scripts... @@ -497,9 +500,7 @@ config FEATURE_HAVE_RPC # This is automatically selected if any of enabled applets need it. # You do not need to select it manually. -endmenu - -menu 'Build Options' +comment 'Build Options' config STATIC bool "Build BusyBox as a static binary (no shared libs)" @@ -674,9 +675,73 @@ config EXTRA_LDLIBS help Additional LDLIBS to pass to the linker with -l. -endmenu +comment 'Installation Options ("make install" behavior)' + +choice + prompt "What kind of applet links to install" + default INSTALL_APPLET_SYMLINKS + help + Choose what kind of links to applets are created by "make install". + +config INSTALL_APPLET_SYMLINKS + bool "as soft-links" + help + Install applets as soft-links to the busybox binary. This needs some + free inodes on the filesystem, but might help with filesystem + generators that can't cope with hard-links. + +config INSTALL_APPLET_HARDLINKS + bool "as hard-links" + help + Install applets as hard-links to the busybox binary. This might + count on a filesystem with few inodes. + +config INSTALL_APPLET_SCRIPT_WRAPPERS + bool "as script wrappers" + help + Install applets as script wrappers that call the busybox binary. + +config INSTALL_APPLET_DONT + bool "not installed" + help + Do not install applet links. Useful when you plan to use + busybox --install for installing links, or plan to use + a standalone shell and thus don't need applet links. + +endchoice + +choice + prompt "/bin/sh applet link" + default INSTALL_SH_APPLET_SYMLINK + depends on INSTALL_APPLET_SCRIPT_WRAPPERS + help + Choose how you install /bin/sh applet link. + +config INSTALL_SH_APPLET_SYMLINK + bool "as soft-link" + help + Install /bin/sh applet as soft-link to the busybox binary. + +config INSTALL_SH_APPLET_HARDLINK + bool "as hard-link" + help + Install /bin/sh applet as hard-link to the busybox binary. + +config INSTALL_SH_APPLET_SCRIPT_WRAPPER + bool "as script wrapper" + help + Install /bin/sh applet as script wrapper that calls + the busybox binary. + +endchoice + +config PREFIX + string "BusyBox installation prefix" + default "./_install" + help + Define your directory to install BusyBox files/subdirs in. -menu 'Debugging Options' +comment 'Debugging Options' config DEBUG bool "Build BusyBox with extra Debugging symbols" @@ -770,78 +835,8 @@ endchoice endmenu -menu 'Installation Options ("make install" behavior)' - -choice - prompt "What kind of applet links to install" - default INSTALL_APPLET_SYMLINKS - help - Choose what kind of links to applets are created by "make install". - -config INSTALL_APPLET_SYMLINKS - bool "as soft-links" - help - Install applets as soft-links to the busybox binary. This needs some - free inodes on the filesystem, but might help with filesystem - generators that can't cope with hard-links. - -config INSTALL_APPLET_HARDLINKS - bool "as hard-links" - help - Install applets as hard-links to the busybox binary. This might - count on a filesystem with few inodes. - -config INSTALL_APPLET_SCRIPT_WRAPPERS - bool "as script wrappers" - help - Install applets as script wrappers that call the busybox binary. - -config INSTALL_APPLET_DONT - bool "not installed" - help - Do not install applet links. Useful when you plan to use - busybox --install for installing links, or plan to use - a standalone shell and thus don't need applet links. - -endchoice - -choice - prompt "/bin/sh applet link" - default INSTALL_SH_APPLET_SYMLINK - depends on INSTALL_APPLET_SCRIPT_WRAPPERS - help - Choose how you install /bin/sh applet link. - -config INSTALL_SH_APPLET_SYMLINK - bool "as soft-link" - help - Install /bin/sh applet as soft-link to the busybox binary. - -config INSTALL_SH_APPLET_HARDLINK - bool "as hard-link" - help - Install /bin/sh applet as hard-link to the busybox binary. - -config INSTALL_SH_APPLET_SCRIPT_WRAPPER - bool "as script wrapper" - help - Install /bin/sh applet as script wrapper that calls - the busybox binary. - -endchoice - -config PREFIX - string "BusyBox installation prefix" - default "./_install" - help - Define your directory to install BusyBox files/subdirs in. - -endmenu - source libbb/Config.in -endmenu - comment "Applets" source archival/Config.in -- cgit v1.2.3-55-g6feb From 1255925a6121cc5f2f09fbe40f2434ab11cc84f7 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 24 Nov 2016 22:18:55 +0100 Subject: Move locale, unicode, and "use sendfile?" options to library tuning Signed-off-by: Denys Vlasenko --- Config.in | 138 ------------------------------------------------------- libbb/Config.src | 138 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 138 insertions(+), 138 deletions(-) diff --git a/Config.in b/Config.in index 089879914..3d1759e21 100644 --- a/Config.in +++ b/Config.in @@ -147,131 +147,6 @@ config INSTALL_NO_USR will install applets only to /bin and /sbin, never to /usr/bin or /usr/sbin. -config LOCALE_SUPPORT - bool "Enable locale support (system needs locale for this to work)" - default n - help - Enable this if your system has locale support and you would like - busybox to support locale settings. - -config UNICODE_SUPPORT - bool "Support Unicode" - default y - help - This makes various applets aware that one byte is not - one character on screen. - - Busybox aims to eventually work correctly with Unicode displays. - Any older encodings are not guaranteed to work. - Probably by the time when busybox will be fully Unicode-clean, - other encodings will be mainly of historic interest. - -config UNICODE_USING_LOCALE - bool "Use libc routines for Unicode (else uses internal ones)" - default n - depends on UNICODE_SUPPORT && LOCALE_SUPPORT - help - With this option on, Unicode support is implemented using libc - routines. Otherwise, internal implementation is used. - Internal implementation is smaller. - -config FEATURE_CHECK_UNICODE_IN_ENV - bool "Check $LC_ALL, $LC_CTYPE and $LANG environment variables" - default n - depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE - help - With this option on, Unicode support is activated - only if locale-related variables have the value of the form - "xxxx.utf8" - - Otherwise, Unicode support will be always enabled and active. - -config SUBST_WCHAR - int "Character code to substitute unprintable characters with" - depends on UNICODE_SUPPORT - default 63 - help - Typical values are 63 for '?' (works with any output device), - 30 for ASCII substitute control code, - 65533 (0xfffd) for Unicode replacement character. - -config LAST_SUPPORTED_WCHAR - int "Range of supported Unicode characters" - depends on UNICODE_SUPPORT - default 767 - help - Any character with Unicode value bigger than this is assumed - to be non-printable on output device. Many applets replace - such characters with substitution character. - - The idea is that many valid printable Unicode chars - nevertheless are not displayed correctly. Think about - combining charachers, double-wide hieroglyphs, obscure - characters in dozens of ancient scripts... - Many terminals, terminal emulators, xterms etc will fail - to handle them correctly. Choose the smallest value - which suits your needs. - - Typical values are: - 126 - ASCII only - 767 (0x2ff) - there are no combining chars in [0..767] range - (the range includes Latin 1, Latin Ext. A and B), - code is ~700 bytes smaller for this case. - 4351 (0x10ff) - there are no double-wide chars in [0..4351] range, - code is ~300 bytes smaller for this case. - 12799 (0x31ff) - nearly all non-ideographic characters are - available in [0..12799] range, including - East Asian scripts like katakana, hiragana, hangul, - bopomofo... - 0 - off, any valid printable Unicode character will be printed. - -config UNICODE_COMBINING_WCHARS - bool "Allow zero-width Unicode characters on output" - default n - depends on UNICODE_SUPPORT - help - With this option off, any Unicode char with width of 0 - is substituted on output. - -config UNICODE_WIDE_WCHARS - bool "Allow wide Unicode characters on output" - default n - depends on UNICODE_SUPPORT - help - With this option off, any Unicode char with width > 1 - is substituted on output. - -config UNICODE_BIDI_SUPPORT - bool "Bidirectional character-aware line input" - default n - depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE - help - With this option on, right-to-left Unicode characters - are treated differently on input (e.g. cursor movement). - -config UNICODE_NEUTRAL_TABLE - bool "In bidi input, support non-ASCII neutral chars too" - default n - depends on UNICODE_BIDI_SUPPORT - help - In most cases it's enough to treat only ASCII non-letters - (i.e. punctuation, numbers and space) as characters - with neutral directionality. - With this option on, more extensive (and bigger) table - of neutral chars will be used. - -config UNICODE_PRESERVE_BROKEN - bool "Make it possible to enter sequences of chars which are not Unicode" - default n - depends on UNICODE_SUPPORT - help - With this option on, on line-editing input (such as used by shells) - invalid UTF-8 bytes are not substituted with the selected - substitution character. - For example, this means that entering 'l', 's', ' ', 0xff, [Enter] - at shell prompt will list file named 0xff (single char name - with char value 255), not file named '?'. - config PAM bool "Support for PAM (Pluggable Authentication Modules)" default n @@ -279,19 +154,6 @@ config PAM Use PAM in some busybox applets (currently login and httpd) instead of direct access to password database. -config FEATURE_USE_SENDFILE - bool "Use sendfile system call" - default y - select PLATFORM_LINUX - help - When enabled, busybox will use the kernel sendfile() function - instead of read/write loops to copy data between file descriptors - (for example, cp command does this a lot). - If sendfile() doesn't work, copying code falls back to read/write - loop. sendfile() was originally implemented for faster I/O - from files to sockets, but since Linux 2.6.33 it was extended - to work for many more file types. - config LONG_OPTS bool "Support for --long-options" default y diff --git a/libbb/Config.src b/libbb/Config.src index 6ba256290..18a40f2ac 100644 --- a/libbb/Config.src +++ b/libbb/Config.src @@ -153,6 +153,131 @@ config FEATURE_EDITING_ASK_TERMINAL correctly, or want to save on code size (about 400 bytes), then do not turn this option on. +config LOCALE_SUPPORT + bool "Enable locale support (system needs locale for this to work)" + default n + help + Enable this if your system has locale support and you would like + busybox to support locale settings. + +config UNICODE_SUPPORT + bool "Support Unicode" + default y + help + This makes various applets aware that one byte is not + one character on screen. + + Busybox aims to eventually work correctly with Unicode displays. + Any older encodings are not guaranteed to work. + Probably by the time when busybox will be fully Unicode-clean, + other encodings will be mainly of historic interest. + +config UNICODE_USING_LOCALE + bool "Use libc routines for Unicode (else uses internal ones)" + default n + depends on UNICODE_SUPPORT && LOCALE_SUPPORT + help + With this option on, Unicode support is implemented using libc + routines. Otherwise, internal implementation is used. + Internal implementation is smaller. + +config FEATURE_CHECK_UNICODE_IN_ENV + bool "Check $LC_ALL, $LC_CTYPE and $LANG environment variables" + default n + depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE + help + With this option on, Unicode support is activated + only if locale-related variables have the value of the form + "xxxx.utf8" + + Otherwise, Unicode support will be always enabled and active. + +config SUBST_WCHAR + int "Character code to substitute unprintable characters with" + depends on UNICODE_SUPPORT + default 63 + help + Typical values are 63 for '?' (works with any output device), + 30 for ASCII substitute control code, + 65533 (0xfffd) for Unicode replacement character. + +config LAST_SUPPORTED_WCHAR + int "Range of supported Unicode characters" + depends on UNICODE_SUPPORT + default 767 + help + Any character with Unicode value bigger than this is assumed + to be non-printable on output device. Many applets replace + such characters with substitution character. + + The idea is that many valid printable Unicode chars + nevertheless are not displayed correctly. Think about + combining charachers, double-wide hieroglyphs, obscure + characters in dozens of ancient scripts... + Many terminals, terminal emulators, xterms etc will fail + to handle them correctly. Choose the smallest value + which suits your needs. + + Typical values are: + 126 - ASCII only + 767 (0x2ff) - there are no combining chars in [0..767] range + (the range includes Latin 1, Latin Ext. A and B), + code is ~700 bytes smaller for this case. + 4351 (0x10ff) - there are no double-wide chars in [0..4351] range, + code is ~300 bytes smaller for this case. + 12799 (0x31ff) - nearly all non-ideographic characters are + available in [0..12799] range, including + East Asian scripts like katakana, hiragana, hangul, + bopomofo... + 0 - off, any valid printable Unicode character will be printed. + +config UNICODE_COMBINING_WCHARS + bool "Allow zero-width Unicode characters on output" + default n + depends on UNICODE_SUPPORT + help + With this option off, any Unicode char with width of 0 + is substituted on output. + +config UNICODE_WIDE_WCHARS + bool "Allow wide Unicode characters on output" + default n + depends on UNICODE_SUPPORT + help + With this option off, any Unicode char with width > 1 + is substituted on output. + +config UNICODE_BIDI_SUPPORT + bool "Bidirectional character-aware line input" + default n + depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE + help + With this option on, right-to-left Unicode characters + are treated differently on input (e.g. cursor movement). + +config UNICODE_NEUTRAL_TABLE + bool "In bidi input, support non-ASCII neutral chars too" + default n + depends on UNICODE_BIDI_SUPPORT + help + In most cases it's enough to treat only ASCII non-letters + (i.e. punctuation, numbers and space) as characters + with neutral directionality. + With this option on, more extensive (and bigger) table + of neutral chars will be used. + +config UNICODE_PRESERVE_BROKEN + bool "Make it possible to enter sequences of chars which are not Unicode" + default n + depends on UNICODE_SUPPORT + help + With this option on, on line-editing input (such as used by shells) + invalid UTF-8 bytes are not substituted with the selected + substitution character. + For example, this means that entering 'l', 's', ' ', 0xff, [Enter] + at shell prompt will list file named 0xff (single char name + with char value 255), not file named '?'. + config FEATURE_NON_POSIX_CP bool "Non-POSIX, but safer, copying to special nodes" default y @@ -177,6 +302,19 @@ config FEATURE_VERBOSE_CP_MESSAGE cp: cannot stat '/vmlinuz/file': Not a directory This will cost you ~60 bytes. +config FEATURE_USE_SENDFILE + bool "Use sendfile system call" + default y + select PLATFORM_LINUX + help + When enabled, busybox will use the kernel sendfile() function + instead of read/write loops to copy data between file descriptors + (for example, cp command does this a lot). + If sendfile() doesn't work, copying code falls back to read/write + loop. sendfile() was originally implemented for faster I/O + from files to sockets, but since Linux 2.6.33 it was extended + to work for many more file types. + config FEATURE_COPYBUF_KB int "Copy buffer size, in kilobytes" range 1 1024 -- cgit v1.2.3-55-g6feb From 24860fa09cf954704232406055d7ca291c636eab Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Thu, 24 Nov 2016 22:30:52 +0100 Subject: Move FEATURE_BUFFERS_USE_foo options to library tuning Signed-off-by: Denys Vlasenko --- Config.in | 24 ------------------------ libbb/Config.src | 24 ++++++++++++++++++++++++ 2 files changed, 24 insertions(+), 24 deletions(-) diff --git a/Config.in b/Config.in index 3d1759e21..924a197da 100644 --- a/Config.in +++ b/Config.in @@ -61,30 +61,6 @@ config PLATFORM_LINUX Answering 'N' here will disable such applets and hide the corresponding configuration options. -choice - prompt "Buffer allocation policy" - default FEATURE_BUFFERS_USE_MALLOC - help - There are 3 ways BusyBox can handle buffer allocations: - - Use malloc. This costs code size for the call to xmalloc. - - Put them on stack. For some very small machines with limited stack - space, this can be deadly. For most folks, this works just fine. - - Put them in BSS. This works beautifully for computers with a real - MMU (and OS support), but wastes runtime RAM for uCLinux. This - behavior was the only one available for BusyBox versions 0.48 and - earlier. - -config FEATURE_BUFFERS_USE_MALLOC - bool "Allocate with Malloc" - -config FEATURE_BUFFERS_GO_ON_STACK - bool "Allocate on the Stack" - -config FEATURE_BUFFERS_GO_IN_BSS - bool "Allocate in the .bss section" - -endchoice - config SHOW_USAGE bool "Show applet usage messages" default y diff --git a/libbb/Config.src b/libbb/Config.src index 18a40f2ac..00804e31e 100644 --- a/libbb/Config.src +++ b/libbb/Config.src @@ -7,6 +7,30 @@ menu "Busybox Library Tuning" INSERT +choice + prompt "Buffer allocation policy" + default FEATURE_BUFFERS_USE_MALLOC + help + There are 3 ways BusyBox can handle buffer allocations: + - Use malloc. This costs code size for the call to xmalloc. + - Put them on stack. For some very small machines with limited stack + space, this can be deadly. For most folks, this works just fine. + - Put them in BSS. This works beautifully for computers with a real + MMU (and OS support), but wastes runtime RAM for uCLinux. This + behavior was the only one available for BusyBox versions 0.48 and + earlier. + +config FEATURE_BUFFERS_USE_MALLOC + bool "Allocate with Malloc" + +config FEATURE_BUFFERS_GO_ON_STACK + bool "Allocate on the Stack" + +config FEATURE_BUFFERS_GO_IN_BSS + bool "Allocate in the .bss section" + +endchoice + config PASSWORD_MINLEN int "Minimum password length" default 6 -- cgit v1.2.3-55-g6feb From 4b89d512b1215e7b9d619af03496540d30cbbd1a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 25 Nov 2016 03:41:03 +0100 Subject: ash,hush: make ^C in interactive mode visually much closer to bash behavior Signed-off-by: Denys Vlasenko --- libbb/lineedit.c | 2 +- shell/ash.c | 4 +++- shell/hush.c | 17 +++++++++++------ 3 files changed, 15 insertions(+), 8 deletions(-) diff --git a/libbb/lineedit.c b/libbb/lineedit.c index ac049f57d..4d7828cfa 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -2251,6 +2251,7 @@ static int32_t reverse_i_search(void) * Returns: * -1 on read errors or EOF, or on bare Ctrl-D, * 0 on ctrl-C (the line entered is still returned in 'command'), + * (in both cases the cursor remains on the input line, '\n' is not printed) * >0 length of input string, including terminating '\n' */ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize, int timeout) @@ -2686,7 +2687,6 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman && ic_raw == initial_settings.c_cc[VINTR] ) { /* Ctrl-C (usually) - stop gathering input */ - goto_new_line(); command_len = 0; break_out = -1; /* "do not append '\n'" */ break; diff --git a/shell/ash.c b/shell/ash.c index 3e5a3b3e9..2bdb4aad7 100644 --- a/shell/ash.c +++ b/shell/ash.c @@ -9869,7 +9869,8 @@ preadfd(void) reinit_unicode_for_ash(); nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout); if (nr == 0) { - /* Ctrl+C pressed */ + /* ^C pressed, "convert" to SIGINT */ + write(STDOUT_FILENO, "^C", 2); if (trap[SIGINT]) { buf[0] = '\n'; buf[1] = '\0'; @@ -9877,6 +9878,7 @@ preadfd(void) return 1; } exitstatus = 128 + SIGINT; + bb_putchar('\n'); goto retry; } if (nr < 0) { diff --git a/shell/hush.c b/shell/hush.c index 5b720ce98..bcd4dffee 100644 --- a/shell/hush.c +++ b/shell/hush.c @@ -1756,8 +1756,6 @@ static int check_and_run_traps(void) switch (sig) { case SIGINT: debug_printf_exec("%s: sig:%d default SIGINT handler\n", __func__, sig); - /* Builtin was ^C'ed, make it look prettier: */ - bb_putchar('\n'); G.flag_SIGINT = 1; last_sig = sig; break; @@ -2195,16 +2193,22 @@ static int get_user_input(struct in_str *i) # if ENABLE_FEATURE_EDITING for (;;) { reinit_unicode_for_hush(); - G.flag_SIGINT = 0; + if (G.flag_SIGINT) { + /* There was ^C'ed, make it look prettier: */ + bb_putchar('\n'); + G.flag_SIGINT = 0; + } /* buglet: SIGINT will not make new prompt to appear _at once_, - * only after . (^C will work) */ + * only after . (^C works immediately) */ r = read_line_input(G.line_input_state, prompt_str, G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1, /*timeout*/ -1 ); - /* read_line_input intercepts ^C, "convert" it into SIGINT */ - if (r == 0) + /* read_line_input intercepts ^C, "convert" it to SIGINT */ + if (r == 0) { + write(STDOUT_FILENO, "^C", 2); raise(SIGINT); + } check_and_run_traps(); if (r != 0 && !G.flag_SIGINT) break; @@ -2232,6 +2236,7 @@ static int get_user_input(struct in_str *i) fputs(prompt_str, stdout); } fflush_all(); +//FIXME: here ^C or SIGINT will have effect only after r = fgetc(i->file); /* In !ENABLE_FEATURE_EDITING we don't use read_line_input, * no ^C masking happens during fgetc, no special code for ^C: -- cgit v1.2.3-55-g6feb From ccc9985c455753298a8799a4d12d5f531c67ae81 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 25 Nov 2016 20:14:33 +0100 Subject: find: fix handling of trailing slashes in -name PATTERN comparisons Signed-off-by: Denys Vlasenko --- findutils/find.c | 46 +++++++++++++++++++++++++++++++++++++--------- testsuite/find.tests | 27 +++++++++++++++++++++++++++ 2 files changed, 64 insertions(+), 9 deletions(-) diff --git a/findutils/find.c b/findutils/find.c index d71c69782..27698e537 100644 --- a/findutils/find.c +++ b/findutils/find.c @@ -502,26 +502,54 @@ static char *strcpy_upcase(char *dst, const char *src) ACTF(name) { + int r; const char *tmp = bb_basename(fileName); - if (tmp != fileName && *tmp == '\0') { - /* "foo/bar/". Oh no... go back to 'b' */ - tmp--; - while (tmp != fileName && *--tmp != '/') - continue; - if (*tmp == '/') - tmp++; + /* GNU findutils: find DIR/ -name DIR + * prints "DIR/" (DIR// prints "DIR//" etc). + * Need to strip trailing "/". + * Such names can come only from top-level names, but + * we can't do this before recursive_action() call, + * since then "find FILE/ -name FILE" + * would also work (on non-directories), which is wrong. + */ + char *trunc_slash = NULL; + + if (*tmp == '\0') { + /* "foo/bar/[//...]" */ + while (tmp != fileName && tmp[-1] == '/') + tmp--; + if (tmp == fileName) { /* entire fileName is "//.."? */ + /* yes, convert "//..." to "/" + * Testcases: + * find / -maxdepth 1 -name /: prints / + * find // -maxdepth 1 -name /: prints // + * find / -maxdepth 1 -name //: prints nothing + * find // -maxdepth 1 -name //: prints nothing + */ + if (tmp[1]) + trunc_slash = (char*)tmp + 1; + } else { + /* no, it's "foo/bar/[//...]", go back to 'b' */ + trunc_slash = (char*)tmp; + while (tmp != fileName && tmp[-1] != '/') + tmp--; + } } + /* Was using FNM_PERIOD flag too, * but somewhere between 4.1.20 and 4.4.0 GNU find stopped using it. * find -name '*foo' should match .foo too: */ + if (trunc_slash) *trunc_slash = '\0'; #if FNM_CASEFOLD - return fnmatch(ap->pattern, tmp, (ap->iname ? FNM_CASEFOLD : 0)) == 0; + r = fnmatch(ap->pattern, tmp, (ap->iname ? FNM_CASEFOLD : 0)); #else if (ap->iname) tmp = strcpy_upcase(alloca(strlen(tmp) + 1), tmp); - return fnmatch(ap->pattern, tmp, 0) == 0; + r = fnmatch(ap->pattern, tmp, 0); #endif + if (trunc_slash) *trunc_slash = '/'; + return r == 0; } #if ENABLE_FEATURE_FIND_PATH diff --git a/testsuite/find.tests b/testsuite/find.tests index 78dfa1230..138236c81 100755 --- a/testsuite/find.tests +++ b/testsuite/find.tests @@ -41,6 +41,33 @@ testing "find -exec exitcode 4" \ "1\n" \ "" "" SKIP= +optional FEATURE_FIND_MAXDEPTH +testing "find / -maxdepth 0 -name /" \ + "find / -maxdepth 0 -name /" \ + "/\n" \ + "" "" +testing "find // -maxdepth 0 -name /" \ + "find // -maxdepth 0 -name /" \ + "//\n" \ + "" "" +testing "find / -maxdepth 0 -name //" \ + "find / -maxdepth 0 -name //" \ + "" \ + "" "" +testing "find // -maxdepth 0 -name //" \ + "find // -maxdepth 0 -name //" \ + "" \ + "" "" +SKIP= + +testing "find ./// -name ." \ + "find ./// -name ." \ + ".///\n" \ + "" "" +testing "find ./// -name .///" \ + "find ./// -name .///" \ + "" \ + "" "" # testing "description" "command" "result" "infile" "stdin" -- cgit v1.2.3-55-g6feb From 6747bdac88d44d1b3729f56760ae7f6829c85d9f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 27 Nov 2016 03:57:08 +0100 Subject: dpkg-deb: remove unused FEATURE_DPKG_DEB_EXTRACT_ONLY config option Its usage in C code was removed in 2004. Signed-off-by: Denys Vlasenko --- archival/dpkg_deb.c | 11 +---------- configs/TEST_nommu_defconfig | 1 - configs/TEST_noprintf_defconfig | 1 - configs/TEST_rh9_defconfig | 1 - configs/android2_defconfig | 1 - configs/android_502_defconfig | 1 - configs/android_defconfig | 1 - configs/android_ndk_defconfig | 1 - configs/cygwin_defconfig | 1 - configs/freebsd_defconfig | 1 - 10 files changed, 1 insertion(+), 19 deletions(-) diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index 0285273fe..d34de254a 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -16,18 +16,9 @@ //config: //config: Unless you have a specific application which requires dpkg-deb, //config: say N here. -//config: -//config:config FEATURE_DPKG_DEB_EXTRACT_ONLY -//config: bool "Extract only (-x)" -//config: default n -//config: depends on DPKG_DEB -//config: help -//config: This reduces dpkg-deb to the equivalent of -//config: "ar -p data.tar.gz | tar -zx". However it saves space as none -//config: of the extra dpkg-deb, ar or tar options are needed, they are linked -//config: to internally. //applet:IF_DPKG_DEB(APPLET_ODDNAME(dpkg-deb, dpkg_deb, BB_DIR_USR_BIN, BB_SUID_DROP, dpkg_deb)) + //kbuild:lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o //usage:#define dpkg_deb_trivial_usage diff --git a/configs/TEST_nommu_defconfig b/configs/TEST_nommu_defconfig index 20c2e1550..08351a294 100644 --- a/configs/TEST_nommu_defconfig +++ b/configs/TEST_nommu_defconfig @@ -118,7 +118,6 @@ CONFIG_FEATURE_CPIO_O=y CONFIG_FEATURE_CPIO_P=y CONFIG_DPKG=y CONFIG_DPKG_DEB=y -CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY=y CONFIG_GUNZIP=y CONFIG_GZIP=y CONFIG_FEATURE_GZIP_LONG_OPTIONS=y diff --git a/configs/TEST_noprintf_defconfig b/configs/TEST_noprintf_defconfig index 845032ea1..70dacece0 100644 --- a/configs/TEST_noprintf_defconfig +++ b/configs/TEST_noprintf_defconfig @@ -130,7 +130,6 @@ CONFIG_FEATURE_SEAMLESS_Z=y # CONFIG_FEATURE_CPIO_P is not set # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set # CONFIG_GUNZIP is not set # CONFIG_GZIP is not set # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set diff --git a/configs/TEST_rh9_defconfig b/configs/TEST_rh9_defconfig index d8c5af4f7..4a5fad324 100644 --- a/configs/TEST_rh9_defconfig +++ b/configs/TEST_rh9_defconfig @@ -128,7 +128,6 @@ CONFIG_FEATURE_CPIO_O=y CONFIG_FEATURE_CPIO_P=y # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GUNZIP=y CONFIG_GZIP=y CONFIG_FEATURE_GZIP_LONG_OPTIONS=y diff --git a/configs/android2_defconfig b/configs/android2_defconfig index 857f9f5df..754f612c6 100644 --- a/configs/android2_defconfig +++ b/configs/android2_defconfig @@ -134,7 +134,6 @@ CONFIG_FEATURE_CPIO_O=y CONFIG_FEATURE_CPIO_P=y CONFIG_DPKG=y CONFIG_DPKG_DEB=y -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GUNZIP=y CONFIG_GZIP=y # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set diff --git a/configs/android_502_defconfig b/configs/android_502_defconfig index cd06affab..8ea6c295d 100644 --- a/configs/android_502_defconfig +++ b/configs/android_502_defconfig @@ -224,7 +224,6 @@ CONFIG_FEATURE_CPIO_O=y CONFIG_FEATURE_CPIO_P=y # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GZIP=y CONFIG_FEATURE_GZIP_LONG_OPTIONS=y CONFIG_GZIP_FAST=0 diff --git a/configs/android_defconfig b/configs/android_defconfig index f1ddc45d4..30e888ac7 100644 --- a/configs/android_defconfig +++ b/configs/android_defconfig @@ -154,7 +154,6 @@ CONFIG_FEATURE_CPIO_O=y CONFIG_FEATURE_CPIO_P=y CONFIG_DPKG=y CONFIG_DPKG_DEB=y -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GUNZIP=y CONFIG_GZIP=y # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set diff --git a/configs/android_ndk_defconfig b/configs/android_ndk_defconfig index 18651fd7c..716ec9a5d 100644 --- a/configs/android_ndk_defconfig +++ b/configs/android_ndk_defconfig @@ -151,7 +151,6 @@ CONFIG_FEATURE_CPIO_O=y CONFIG_FEATURE_CPIO_P=y CONFIG_DPKG=y CONFIG_DPKG_DEB=y -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GZIP=y # CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set CONFIG_GZIP_FAST=0 diff --git a/configs/cygwin_defconfig b/configs/cygwin_defconfig index dd7c21edb..b856482f6 100644 --- a/configs/cygwin_defconfig +++ b/configs/cygwin_defconfig @@ -134,7 +134,6 @@ CONFIG_FEATURE_CPIO_O=y CONFIG_FEATURE_CPIO_P=y # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GUNZIP=y CONFIG_GZIP=y CONFIG_FEATURE_GZIP_LONG_OPTIONS=y diff --git a/configs/freebsd_defconfig b/configs/freebsd_defconfig index 265ab1307..4f14d3be9 100644 --- a/configs/freebsd_defconfig +++ b/configs/freebsd_defconfig @@ -132,7 +132,6 @@ CONFIG_CPIO=y # CONFIG_FEATURE_CPIO_P is not set # CONFIG_DPKG is not set # CONFIG_DPKG_DEB is not set -# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set CONFIG_GUNZIP=y CONFIG_GZIP=y CONFIG_FEATURE_GZIP_LONG_OPTIONS=y -- cgit v1.2.3-55-g6feb From 351ab8278e9719cfdc2abb348017b4e5909bcee8 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 27 Nov 2016 04:48:53 +0100 Subject: dpkg-deb: shorten code, improve help text function old new delta packed_usage 30261 30236 -25 dpkg_deb_main 437 401 -36 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-61) Total: -61 bytes Signed-off-by: Denys Vlasenko --- archival/dpkg_deb.c | 77 +++++++++++++++++++++++------------------------------ 1 file changed, 34 insertions(+), 43 deletions(-) diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c index d34de254a..86850469d 100644 --- a/archival/dpkg_deb.c +++ b/archival/dpkg_deb.c @@ -22,14 +22,14 @@ //kbuild:lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o //usage:#define dpkg_deb_trivial_usage -//usage: "[-cefxX] FILE [argument]" +//usage: "[-cefxX] FILE [DIR]" //usage:#define dpkg_deb_full_usage "\n\n" -//usage: "Perform actions on Debian packages (.debs)\n" -//usage: "\n -c List contents of filesystem tree" -//usage: "\n -e Extract control files to [argument] directory" -//usage: "\n -f Display control field name starting with [argument]" -//usage: "\n -x Extract packages filesystem tree to directory" -//usage: "\n -X Verbose extract" +//usage: "Perform actions on Debian packages (.deb)\n" +//usage: "\n -c List files" +//usage: "\n -f Print control fields" +//usage: "\n -e Extract control files to DIR (default: ./DEBIAN)" +//usage: "\n -x Extract files to DIR (no default)" +//usage: "\n -X Verbose -x" //usage: //usage:#define dpkg_deb_example_usage //usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" @@ -40,18 +40,17 @@ #define DPKG_DEB_OPT_CONTENTS 1 #define DPKG_DEB_OPT_CONTROL 2 #define DPKG_DEB_OPT_FIELD 4 -#define DPKG_DEB_OPT_EXTRACT 8 -#define DPKG_DEB_OPT_EXTRACT_VERBOSE 16 +#define DPKG_DEB_OPT_EXTRACT_VERBOSE 8 +#define DPKG_DEB_OPT_EXTRACT 16 int dpkg_deb_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; -int dpkg_deb_main(int argc, char **argv) +int dpkg_deb_main(int argc UNUSED_PARAM, char **argv) { archive_handle_t *ar_archive; archive_handle_t *tar_archive; llist_t *control_tar_llist = NULL; unsigned opt; const char *extract_dir; - int need_args; /* Setup the tar archive handle */ tar_archive = init_handle(); @@ -80,53 +79,45 @@ int dpkg_deb_main(int argc, char **argv) llist_add_to(&control_tar_llist, (char*)"control.tar.xz"); #endif - opt_complementary = "c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"; + /* Must have 1 or 2 args */ + opt_complementary = "-1:?2:c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"; opt = getopt32(argv, "cefXx"); argv += optind; - argc -= optind; + //argc -= optind; - if (opt & DPKG_DEB_OPT_CONTENTS) { + extract_dir = argv[1]; + if (opt & DPKG_DEB_OPT_CONTENTS) { // -c tar_archive->action_header = header_verbose_list; + if (extract_dir) + bb_show_usage(); } - extract_dir = NULL; - need_args = 1; - if (opt & DPKG_DEB_OPT_CONTROL) { - ar_archive->accept = control_tar_llist; - tar_archive->action_data = data_extract_all; - if (1 == argc) { - extract_dir = "./DEBIAN"; - } else { - need_args++; - } - } - if (opt & DPKG_DEB_OPT_FIELD) { - /* Print the entire control file - * it should accept a second argument which specifies a - * specific field to print */ + if (opt & DPKG_DEB_OPT_FIELD) { // -f + /* Print the entire control file */ +//TODO: standard tool accepts an optional list of fields to print ar_archive->accept = control_tar_llist; llist_add_to(&(tar_archive->accept), (char*)"./control"); tar_archive->filter = filter_accept_list; tar_archive->action_data = data_extract_to_stdout; + if (extract_dir) + bb_show_usage(); } - if (opt & DPKG_DEB_OPT_EXTRACT) { - tar_archive->action_header = header_list; - } - if (opt & (DPKG_DEB_OPT_EXTRACT_VERBOSE | DPKG_DEB_OPT_EXTRACT)) { + if (opt & DPKG_DEB_OPT_CONTROL) { // -e + ar_archive->accept = control_tar_llist; tar_archive->action_data = data_extract_all; - need_args = 2; + if (!extract_dir) + extract_dir = "./DEBIAN"; } - - if (need_args != argc) { - bb_show_usage(); + if (opt & (DPKG_DEB_OPT_EXTRACT_VERBOSE | DPKG_DEB_OPT_EXTRACT)) { // -Xx + if (opt & DPKG_DEB_OPT_EXTRACT_VERBOSE) + tar_archive->action_header = header_list; + tar_archive->action_data = data_extract_all; + if (!extract_dir) + bb_show_usage(); } - tar_archive->src_fd = ar_archive->src_fd = xopen(argv[0], O_RDONLY); + /* Standard tool supports "-" */ + tar_archive->src_fd = ar_archive->src_fd = xopen_stdin(argv[0]); - /* Work out where to extract the files */ - /* 2nd argument is a dir name */ - if (argv[1]) { - extract_dir = argv[1]; - } if (extract_dir) { mkdir(extract_dir, 0777); /* bb_make_directory(extract_dir, 0777, 0) */ xchdir(extract_dir); -- cgit v1.2.3-55-g6feb From 29516ac0e41fc41dd15b7d0c67bd160f03d21bbb Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 27 Nov 2016 06:13:43 +0100 Subject: fdisk: sanitize partition name printing; drop "Code" column; get rid of one static var function old new delta list_table 2335 2373 +38 fill_bounds 131 128 -3 part_array_len 4 - -4 get_boot 1584 1574 -10 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/2 up/down: 38/-17) Total: 21 bytes Signed-off-by: Denys Vlasenko --- util-linux/fdisk.c | 1 + util-linux/fdisk_gpt.c | 56 ++++++++++++++++++++++++++++++++++++-------------- 2 files changed, 42 insertions(+), 15 deletions(-) diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c index af8073532..b988e65a9 100644 --- a/util-linux/fdisk.c +++ b/util-linux/fdisk.c @@ -121,6 +121,7 @@ # define BLKGETSIZE64 _IOR(0x12,114,size_t) #endif #include "libbb.h" +#include "unicode.h" #if BB_LITTLE_ENDIAN # define inline_if_little_endian ALWAYS_INLINE diff --git a/util-linux/fdisk_gpt.c b/util-linux/fdisk_gpt.c index 715e227ca..9b17b4a57 100644 --- a/util-linux/fdisk_gpt.c +++ b/util-linux/fdisk_gpt.c @@ -36,14 +36,13 @@ typedef struct { uint64_t lba_start; uint64_t lba_end; uint64_t flags; - uint16_t name[36]; + uint16_t name36[36]; } gpt_partition; static gpt_header *gpt_hdr; static char *part_array; static unsigned int n_parts; -static unsigned int part_array_len; static unsigned int part_entry_len; static inline gpt_partition * @@ -73,18 +72,34 @@ gpt_print_guid(uint8_t *buf) buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]); } -/* TODO: real unicode support */ static void -gpt_print_wide(uint16_t *s, int max_len) +gpt_print_wide36(uint16_t *s) { +#if ENABLE_UNICODE_SUPPORT + char buf[37 * 4]; + wchar_t wc[37]; int i = 0; - - while (i < max_len) { - if (*s == 0) - return; - fputc(*s, stdout); - s++; + while (i < ARRAY_SIZE(wc)-1) { + if (s[i] == 0) + break; + wc[i] = s[i]; + i++; + } + wc[i] = 0; + if (wcstombs(buf, wc, sizeof(buf)) <= sizeof(buf)-1) + fputs(printable_string(NULL, buf), stdout); +#else + char buf[37]; + int i = 0; + while (i < ARRAY_SIZE(buf)-1) { + if (s[i] == 0) + break; + buf[i] = (s[i] < 0x7f) ? s[i] : '?'; + i++; } + buf[i] = '\0'; + fputs(printable_string(NULL, buf), stdout); +#endif } static void @@ -106,19 +121,28 @@ gpt_list_table(int xtra UNUSED_PARAM) (unsigned long long)SWAP_LE64(gpt_hdr->first_usable_lba), (unsigned long long)SWAP_LE64(gpt_hdr->last_usable_lba)); - puts("Number Start (sector) End (sector) Size Code Name"); +/* "GPT fdisk" has a concept of 16-bit extension of the original MBR 8-bit type codes, + * which it displays here: its output columns are ... Size Code Name + * They are their own invention and are not stored on disk. + * Looks like they use them to support "hybrid" GPT: for example, they have + * AddType(0x8307, "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3", "Linux ARM32 root (/)"); + * and then (code>>8) matches what you need to put into MBR's type field for such a partition. + * To print those codes, we'd need a GUID lookup table. Lets just drop the "Code" column instead: + */ + puts("Number Start (sector) End (sector) Size Name"); + // 123456 123456789012345 123456789012345 12345 abc for (i = 0; i < n_parts; i++) { gpt_partition *p = gpt_part(i); if (p->lba_start) { smart_ulltoa5((1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start)) * sector_size, numstr6, " KMGTPEZY")[0] = '\0'; - printf("%4u %15llu %15llu %11s %04x ", + printf("%6u %15llu %15llu %s ", i + 1, (unsigned long long)SWAP_LE64(p->lba_start), (unsigned long long)SWAP_LE64(p->lba_end), - numstr6, - 0x0700 /* FIXME */); - gpt_print_wide(p->name, 18); + numstr6 + ); + gpt_print_wide36(p->name36); bb_putchar('\n'); } } @@ -127,6 +151,7 @@ gpt_list_table(int xtra UNUSED_PARAM) static int check_gpt_label(void) { + unsigned part_array_len; struct partition *first = pt_offset(MBRbuffer, 0); struct pte pe; uint32_t crc; @@ -150,6 +175,7 @@ check_gpt_label(void) return 0; } + init_unicode(); if (!global_crc32_table) { global_crc32_table = crc32_filltable(NULL, 0); } -- cgit v1.2.3-55-g6feb From 710b6ce9b0dba1b13028e7205bade70eefc2543f Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 27 Nov 2016 20:47:01 +0100 Subject: fdisk_gpt: simplify GPT partition name printing Signed-off-by: Denys Vlasenko --- util-linux/fdisk_gpt.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/util-linux/fdisk_gpt.c b/util-linux/fdisk_gpt.c index 9b17b4a57..45d2aa6e7 100644 --- a/util-linux/fdisk_gpt.c +++ b/util-linux/fdisk_gpt.c @@ -94,11 +94,11 @@ gpt_print_wide36(uint16_t *s) while (i < ARRAY_SIZE(buf)-1) { if (s[i] == 0) break; - buf[i] = (s[i] < 0x7f) ? s[i] : '?'; + buf[i] = (0x20 <= s[i] && s[i] < 0x7f) ? s[i] : '?'; i++; } buf[i] = '\0'; - fputs(printable_string(NULL, buf), stdout); + fputs(buf, stdout); #endif } -- cgit v1.2.3-55-g6feb From bff71d3b9d4244abc5182c38d0a98f4913188391 Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 27 Nov 2016 22:25:07 +0100 Subject: lineedit: fix two bugs in SIGWINCH signal handling (1) restore entire sigaction, not only signal handler function (2) do not use stdio when not sure WINCH did not interrupt a printf() or such. function old new delta cmdedit_setwidth - 81 +81 read_line_input 3682 3722 +40 lineedit_read_key 138 155 +17 put_prompt 55 51 -4 win_changed 93 47 -46 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/2 up/down: 138/-50) Total: 88 bytes Signed-off-by: Denys Vlasenko --- libbb/lineedit.c | 70 +++++++++++++++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 4d7828cfa..7a1b5433d 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -129,8 +129,7 @@ static const char null_str[] ALIGN1 = ""; struct lineedit_statics { line_input_t *state; - volatile unsigned cmdedit_termw; /* = 80; */ /* actual terminal width */ - sighandler_t previous_SIGWINCH_handler; + unsigned cmdedit_termw; /* = 80; */ /* actual terminal width */ unsigned cmdedit_x; /* real x (col) terminal position */ unsigned cmdedit_y; /* pseudoreal y (row) terminal position */ @@ -155,15 +154,22 @@ struct lineedit_statics { unsigned num_matches; #endif + unsigned SIGWINCH_saved; + volatile unsigned SIGWINCH_count; + volatile smallint ok_to_redraw; + #if ENABLE_FEATURE_EDITING_VI # define DELBUFSIZ 128 - CHAR_T *delptr; smallint newdelflag; /* whether delbuf should be reused yet */ + CHAR_T *delptr; CHAR_T delbuf[DELBUFSIZ]; /* a place to store deleted characters */ #endif #if ENABLE_FEATURE_EDITING_ASK_TERMINAL smallint sent_ESC_br6n; #endif + + /* Largish struct, keeping it last results in smaller code */ + struct sigaction SIGWINCH_handler; }; /* See lineedit_ptr_hack.c */ @@ -172,7 +178,6 @@ extern struct lineedit_statics *const lineedit_ptr_to_statics; #define S (*lineedit_ptr_to_statics) #define state (S.state ) #define cmdedit_termw (S.cmdedit_termw ) -#define previous_SIGWINCH_handler (S.previous_SIGWINCH_handler) #define cmdedit_x (S.cmdedit_x ) #define cmdedit_y (S.cmdedit_y ) #define cmdedit_prmt_len (S.cmdedit_prmt_len) @@ -434,14 +439,11 @@ static void beep(void) static void put_prompt(void) { - unsigned w; - fputs(cmdedit_prompt, stdout); fflush_all(); cursor = 0; - w = cmdedit_termw; /* read volatile var once */ - cmdedit_y = cmdedit_prmt_len / w; /* new quasireal y */ - cmdedit_x = cmdedit_prmt_len % w; + cmdedit_y = cmdedit_prmt_len / cmdedit_termw; /* new quasireal y */ + cmdedit_x = cmdedit_prmt_len % cmdedit_termw; } /* Move back one character */ @@ -513,13 +515,11 @@ static void input_backward(unsigned num) put_cur_glyph_and_inc_cursor(); } else { int lines_up; - unsigned width; /* num = chars to go back from the beginning of current line: */ num -= cmdedit_x; - width = cmdedit_termw; /* read volatile var once */ /* num=1...w: one line up, w+1...2w: two, etc: */ - lines_up = 1 + (num - 1) / width; - cmdedit_x = (width * cmdedit_y - num) % width; + lines_up = 1 + (num - 1) / cmdedit_termw; + cmdedit_x = (cmdedit_termw * cmdedit_y - num) % cmdedit_termw; cmdedit_y -= lines_up; /* go to 1st column; go up */ printf("\r" ESC"[%uA", lines_up); @@ -1978,28 +1978,29 @@ static void parse_and_put_prompt(const char *prmt_ptr) } #endif -static void cmdedit_setwidth(unsigned w, int redraw_flg) +static void cmdedit_setwidth(int redraw_flg) { - cmdedit_termw = w; + get_terminal_width_height(STDIN_FILENO, &cmdedit_termw, NULL); if (redraw_flg) { /* new y for current cursor */ - int new_y = (cursor + cmdedit_prmt_len) / w; + int new_y = (cursor + cmdedit_prmt_len) / cmdedit_termw; /* redraw */ redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), command_len - cursor); fflush_all(); } } -static void win_changed(int nsig) +static void win_changed(int nsig UNUSED_PARAM) { - int sv_errno = errno; - unsigned width; - - get_terminal_width_height(0, &width, NULL); -//FIXME: cmdedit_setwidth() -> redraw() -> printf() -> KABOOM! (we are in signal handler!) - cmdedit_setwidth(width, /*redraw_flg:*/ nsig); - - errno = sv_errno; + if (S.ok_to_redraw) { + /* We are in read_key(), safe to redraw immediately */ + int sv_errno = errno; + cmdedit_setwidth(/*redraw_flg:*/ 1); + errno = sv_errno; + } else { + /* Signal main loop that redraw is necessary */ + S.SIGWINCH_count++; + } } static int lineedit_read_key(char *read_key_buffer, int timeout) @@ -2018,7 +2019,9 @@ static int lineedit_read_key(char *read_key_buffer, int timeout) * * Note: read_key sets errno to 0 on success. */ + S.ok_to_redraw = 1; ic = read_key(STDIN_FILENO, read_key_buffer, timeout); + S.ok_to_redraw = 0; if (errno) { #if ENABLE_UNICODE_SUPPORT if (errno == EAGAIN && unicode_idx != 0) @@ -2355,9 +2358,11 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman ask_terminal(); /* Install window resize handler (NB: after *all* init is complete) */ -//FIXME: save entire sigaction! - previous_SIGWINCH_handler = signal(SIGWINCH, win_changed); - win_changed(0); /* get initial window size */ + S.SIGWINCH_handler.sa_handler = win_changed; + S.SIGWINCH_handler.sa_flags = SA_RESTART; + sigaction(SIGWINCH, &S.SIGWINCH_handler, &S.SIGWINCH_handler); + + cmdedit_setwidth(/*redraw_flg:*/ 0); /* get initial window size */ read_key_buffer[0] = 0; while (1) { @@ -2370,6 +2375,13 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman * in one place. */ int32_t ic, ic_raw; + unsigned count; + + count = S.SIGWINCH_count; + if (S.SIGWINCH_saved != count) { + S.SIGWINCH_saved = count; + cmdedit_setwidth(/*redraw_flg:*/ 1); + } fflush_all(); ic = ic_raw = lineedit_read_key(read_key_buffer, timeout); @@ -2808,7 +2820,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman /* restore initial_settings */ tcsetattr_stdin_TCSANOW(&initial_settings); /* restore SIGWINCH handler */ - signal(SIGWINCH, previous_SIGWINCH_handler); + sigaction_set(SIGWINCH, &S.SIGWINCH_handler); fflush_all(); len = command_len; -- cgit v1.2.3-55-g6feb From 2c769c69b269f43d8c9ecf4a7f5ce5cce290750a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Sun, 27 Nov 2016 23:27:54 +0100 Subject: makedevs: make special node creation idempotent When makedevs is called for a second time with the same device file, it fails because the files already exist and mknod() gives -EEXIST. Ignore EEXIST errors. Signed-off-by: Denys Vlasenko --- miscutils/makedevs.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index 6278ee77c..c5eeed0e0 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c @@ -157,8 +157,11 @@ int makedevs_main(int argc, char **argv) /* if mode != S_IFCHR and != S_IFBLK, * third param in mknod() ignored */ - if (mknod(nodname, mode, makedev(Smajor, Sminor))) + if (mknod(nodname, mode, makedev(Smajor, Sminor)) != 0 + && errno != EEXIST + ) { bb_perror_msg("can't create '%s'", nodname); + } /*if (nodname == basedev)*/ /* ex. /dev/hda - to /dev/hda1 ... */ nodname = buf; @@ -279,7 +282,9 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv) for (i = start; i <= start + count; i++) { sprintf(full_name_inc, count ? "%s%u" : "%s", full_name, i); rdev = makedev(major, minor + (i - start) * increment); - if (mknod(full_name_inc, mode, rdev) < 0) { + if (mknod(full_name_inc, mode, rdev) != 0 + && errno != EEXIST + ) { bb_perror_msg("line %d: can't create node %s", linenum, full_name_inc); ret = EXIT_FAILURE; } else if (chown(full_name_inc, uid, gid) < 0) { -- cgit v1.2.3-55-g6feb From 038a977d47c99c3e59d7a2393799b2afa838604c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 28 Nov 2016 01:10:16 +0100 Subject: lineedit: simplify code a bit function old new delta lineedit_read_key 155 162 +7 put_prompt 51 46 -5 read_line_input 3722 3715 -7 cmdedit_setwidth 81 50 -31 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 7/-43) Total: -36 bytes Signed-off-by: Denys Vlasenko --- libbb/lineedit.c | 30 ++++++++++++++---------------- 1 file changed, 14 insertions(+), 16 deletions(-) diff --git a/libbb/lineedit.c b/libbb/lineedit.c index 7a1b5433d..31e392147 100644 --- a/libbb/lineedit.c +++ b/libbb/lineedit.c @@ -440,7 +440,6 @@ static void beep(void) static void put_prompt(void) { fputs(cmdedit_prompt, stdout); - fflush_all(); cursor = 0; cmdedit_y = cmdedit_prmt_len / cmdedit_termw; /* new quasireal y */ cmdedit_x = cmdedit_prmt_len % cmdedit_termw; @@ -1978,16 +1977,15 @@ static void parse_and_put_prompt(const char *prmt_ptr) } #endif -static void cmdedit_setwidth(int redraw_flg) +static void cmdedit_setwidth(void) { - get_terminal_width_height(STDIN_FILENO, &cmdedit_termw, NULL); - if (redraw_flg) { - /* new y for current cursor */ - int new_y = (cursor + cmdedit_prmt_len) / cmdedit_termw; - /* redraw */ - redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), command_len - cursor); - fflush_all(); - } + int new_y; + + cmdedit_termw = get_terminal_width(STDIN_FILENO); + /* new y for current cursor */ + new_y = (cursor + cmdedit_prmt_len) / cmdedit_termw; + /* redraw */ + redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), command_len - cursor); } static void win_changed(int nsig UNUSED_PARAM) @@ -1995,7 +1993,8 @@ static void win_changed(int nsig UNUSED_PARAM) if (S.ok_to_redraw) { /* We are in read_key(), safe to redraw immediately */ int sv_errno = errno; - cmdedit_setwidth(/*redraw_flg:*/ 1); + cmdedit_setwidth(); + fflush_all(); errno = sv_errno; } else { /* Signal main loop that redraw is necessary */ @@ -2011,6 +2010,7 @@ static int lineedit_read_key(char *read_key_buffer, int timeout) int unicode_idx = 0; #endif + fflush_all(); while (1) { /* Wait for input. TIMEOUT = -1 makes read_key wait even * on nonblocking stdin, TIMEOUT = 50 makes sure we won't @@ -2152,7 +2152,6 @@ static int32_t reverse_i_search(void) int h; unsigned match_buf_len = strlen(match_buf); - fflush_all(); //FIXME: correct timeout? ic = lineedit_read_key(read_key_buffer, -1); @@ -2282,7 +2281,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman * tty is still in "raw mode"). */ parse_and_put_prompt(prompt); - /* fflush_all(); - done by parse_and_put_prompt */ + fflush_all(); if (fgets(command, maxsize, stdin) == NULL) len = -1; /* EOF or error */ else @@ -2362,7 +2361,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman S.SIGWINCH_handler.sa_flags = SA_RESTART; sigaction(SIGWINCH, &S.SIGWINCH_handler, &S.SIGWINCH_handler); - cmdedit_setwidth(/*redraw_flg:*/ 0); /* get initial window size */ + cmdedit_termw = get_terminal_width(STDIN_FILENO); read_key_buffer[0] = 0; while (1) { @@ -2380,10 +2379,9 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman count = S.SIGWINCH_count; if (S.SIGWINCH_saved != count) { S.SIGWINCH_saved = count; - cmdedit_setwidth(/*redraw_flg:*/ 1); + cmdedit_setwidth(); } - fflush_all(); ic = ic_raw = lineedit_read_key(read_key_buffer, timeout); #if ENABLE_FEATURE_REVERSE_SEARCH -- cgit v1.2.3-55-g6feb From 1d3a04a3a4be8682d4317251fc14e81ad655d58a Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 28 Nov 2016 01:22:57 +0100 Subject: Code style fixes, no code changes Signed-off-by: Denys Vlasenko --- e2fsprogs/fsck.c | 2 +- editors/patch.c | 11 ++++++----- editors/patch_toybox.c | 7 +++---- editors/sed.c | 5 ++++- loginutils/addgroup.c | 2 +- miscutils/makedevs.c | 2 +- miscutils/rx.c | 2 +- networking/interface.c | 8 ++++---- networking/tc.c | 6 +++--- procps/pgrep.c | 2 +- runit/sv.c | 2 +- util-linux/getopt.c | 4 ++-- util-linux/readprofile.c | 7 ++++--- 13 files changed, 32 insertions(+), 28 deletions(-) diff --git a/e2fsprogs/fsck.c b/e2fsprogs/fsck.c index 59514a1a6..6414988b4 100644 --- a/e2fsprogs/fsck.c +++ b/e2fsprogs/fsck.c @@ -658,7 +658,7 @@ static int device_already_active(char *device) return (G.instance_list != NULL); for (inst = G.instance_list; inst; inst = inst->next) { - if (!inst->base_device || !strcmp(base, inst->base_device)) { + if (!inst->base_device || strcmp(base, inst->base_device) == 0) { free(base); return 1; } diff --git a/editors/patch.c b/editors/patch.c index ea1fc0974..731a8c58a 100644 --- a/editors/patch.c +++ b/editors/patch.c @@ -247,7 +247,7 @@ static int apply_one_hunk(void) // Figure out which line of hunk to compare with next. (Skip lines // of the hunk we'd be adding.) while (plist && *plist->data == "+-"[reverse]) { - if (data && !strcmp(data, plist->data+1)) { + if (data && strcmp(data, plist->data+1) == 0) { if (!backwarn) { backwarn = TT.linenum; if (option_mask32 & FLAG_IGNORE) { @@ -291,8 +291,9 @@ static int apply_one_hunk(void) for (;;) { while (plist && *plist->data == "+-"[reverse]) { - if (!strcmp(check->data, plist->data+1) && - !backwarn) { + if (strcmp(check->data, plist->data+1) == 0 + && !backwarn + ) { backwarn = TT.linenum; if (option_mask32 & FLAG_IGNORE) { dummy_revert = 1; @@ -491,7 +492,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv) // We're deleting oldname if new file is /dev/null (before -p) // or if new hunk is empty (zero context) after patching - if (!strcmp(name, "/dev/null") || !(reverse ? oldsum : newsum)) { + if (strcmp(name, "/dev/null") == 0 || !(reverse ? oldsum : newsum)) { name = reverse ? newname : oldname; empty = 1; } @@ -527,7 +528,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv) struct stat statbuf; // If the old file was null, we're creating a new one. - if (!strcmp(oldname, "/dev/null") || !oldsum) { + if (strcmp(oldname, "/dev/null") == 0 || !oldsum) { printf("creating %s\n", name); s = strrchr(name, '/'); if (s) { diff --git a/editors/patch_toybox.c b/editors/patch_toybox.c index a60bf070f..5174acd6a 100644 --- a/editors/patch_toybox.c +++ b/editors/patch_toybox.c @@ -335,7 +335,7 @@ static int apply_one_hunk(void) // Figure out which line of hunk to compare with next. (Skip lines // of the hunk we'd be adding.) while (plist && *plist->data == "+-"[reverse]) { - if (data && !strcmp(data, plist->data+1)) { + if (data && strcmp(data, plist->data+1) == 0) { if (!backwarn) { fdprintf(2,"Possibly reversed hunk %d at %ld\n", TT.hunknum, TT.linenum); @@ -529,8 +529,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv) // We're deleting oldname if new file is /dev/null (before -p) // or if new hunk is empty (zero context) after patching - if (!strcmp(name, "/dev/null") || !(reverse ? oldsum : newsum)) - { + if (strcmp(name, "/dev/null") == 0 || !(reverse ? oldsum : newsum)) { name = reverse ? newname : oldname; del++; } @@ -551,7 +550,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv) // If we've got a file to open, do so. } else if (!(option_mask32 & FLAG_PATHLEN) || i <= TT.prefix) { // If the old file was null, we're creating a new one. - if (!strcmp(oldname, "/dev/null") || !oldsum) { + if (strcmp(oldname, "/dev/null") == 0 || !oldsum) { printf("creating %s\n", name); s = strrchr(name, '/'); if (s) { diff --git a/editors/sed.c b/editors/sed.c index b7add1fb1..637a6851b 100644 --- a/editors/sed.c +++ b/editors/sed.c @@ -892,7 +892,10 @@ static sed_cmd_t *branch_to(char *label) sed_cmd_t *sed_cmd; for (sed_cmd = G.sed_cmd_head; sed_cmd; sed_cmd = sed_cmd->next) { - if (sed_cmd->cmd == ':' && sed_cmd->string && !strcmp(sed_cmd->string, label)) { + if (sed_cmd->cmd == ':' + && sed_cmd->string + && strcmp(sed_cmd->string, label) == 0 + ) { return sed_cmd; } } diff --git a/loginutils/addgroup.c b/loginutils/addgroup.c index 4d4fc3f28..6b2fd7ba9 100644 --- a/loginutils/addgroup.c +++ b/loginutils/addgroup.c @@ -186,7 +186,7 @@ int addgroup_main(int argc UNUSED_PARAM, char **argv) gr = xgetgrnam(argv[1]); /* unknown group: exit */ /* check if user is already in this group */ for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) { - if (!strcmp(argv[0], *(gr->gr_mem))) { + if (strcmp(argv[0], *(gr->gr_mem)) == 0) { /* user is already in group: do nothing */ return EXIT_SUCCESS; } diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c index c5eeed0e0..9e7ca340f 100644 --- a/miscutils/makedevs.c +++ b/miscutils/makedevs.c @@ -283,7 +283,7 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv) sprintf(full_name_inc, count ? "%s%u" : "%s", full_name, i); rdev = makedev(major, minor + (i - start) * increment); if (mknod(full_name_inc, mode, rdev) != 0 - && errno != EEXIST + && errno != EEXIST ) { bb_perror_msg("line %d: can't create node %s", linenum, full_name_inc); ret = EXIT_FAILURE; diff --git a/miscutils/rx.c b/miscutils/rx.c index 7fca8e36b..660f66a89 100644 --- a/miscutils/rx.c +++ b/miscutils/rx.c @@ -111,7 +111,7 @@ static int receive(/*int read_fd, */int file_fd) && blockBuf[blockLength - 3] == PAD ) { while (blockLength - && blockBuf[blockLength - 1] == PAD + && blockBuf[blockLength - 1] == PAD ) { blockLength--; } diff --git a/networking/interface.c b/networking/interface.c index e5723b428..c5c8f2cdd 100644 --- a/networking/interface.c +++ b/networking/interface.c @@ -264,7 +264,7 @@ const struct aftype* FAST_FUNC get_aftype(const char *name) afp = aftypes; while (*afp != NULL) { - if (!strcmp((*afp)->name, name)) + if (strcmp((*afp)->name, name) == 0) return (*afp); afp++; } @@ -572,7 +572,7 @@ static int if_readlist_proc(char *target) ife = add_interface(name); get_dev_fields(s, ife, procnetdev_vsn); ife->statistics_valid = 1; - if (target && !strcmp(target, name)) + if (target && strcmp(target, name) == 0) break; } if (ferror(fh)) { @@ -781,7 +781,7 @@ const struct hwtype* FAST_FUNC get_hwtype(const char *name) hwp = hwtypes; while (*hwp != NULL) { - if (!strcmp((*hwp)->name, name)) + if (strcmp((*hwp)->name, name) == 0) return (*hwp); hwp++; } @@ -877,7 +877,7 @@ static void ife_print6(struct interface *ptr) addr6p[5], addr6p[6], addr6p[7], &if_idx, &plen, &scope, &dad_status, devname) != EOF ) { - if (!strcmp(devname, ptr->name)) { + if (strcmp(devname, ptr->name) == 0) { sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s", addr6p[0], addr6p[1], addr6p[2], addr6p[3], addr6p[4], addr6p[5], addr6p[6], addr6p[7]); diff --git a/networking/tc.c b/networking/tc.c index 271d569e4..25875aa3e 100644 --- a/networking/tc.c +++ b/networking/tc.c @@ -116,7 +116,7 @@ static int get_qdisc_handle(uint32_t *h, const char *str) { char *p; maj = TC_H_UNSPEC; - if (!strcmp(str, "none")) + if (strcmp(str, "none") == 0) goto ok; maj = strtoul(str, &p, 16); if (p == str) @@ -135,10 +135,10 @@ static int get_tc_classid(uint32_t *h, const char *str) { char *p; maj = TC_H_ROOT; - if (!strcmp(str, "root")) + if (strcmp(str, "root") == 0) goto ok; maj = TC_H_UNSPEC; - if (!strcmp(str, "none")) + if (strcmp(str, "none") == 0) goto ok; maj = strtoul(str, &p, 16); if (p == str) { diff --git a/procps/pgrep.c b/procps/pgrep.c index 974d007f3..ac82b5156 100644 --- a/procps/pgrep.c +++ b/procps/pgrep.c @@ -168,7 +168,7 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv) if (ppid2match >= 0 && ppid2match != proc->ppid) continue; - if (sid2match >= 0 && sid2match != proc->sid) + if (sid2match >= 0 && sid2match != proc->sid) continue; /* NB: OPT_INVERT is always 0 or 1 */ diff --git a/runit/sv.c b/runit/sv.c index 37df9a929..42abbbbb5 100644 --- a/runit/sv.c +++ b/runit/sv.c @@ -210,7 +210,7 @@ struct globals { #define INIT_G() do { setup_common_bufsiz(); } while (0) -#define str_equal(s,t) (!strcmp((s), (t))) +#define str_equal(s,t) (strcmp((s), (t)) == 0) static void fatal_cannot(const char *m1) NORETURN; diff --git a/util-linux/getopt.c b/util-linux/getopt.c index 83cc1efea..f6ecc3dde 100644 --- a/util-linux/getopt.c +++ b/util-linux/getopt.c @@ -347,9 +347,9 @@ static struct option *add_long_options(struct option *long_options, char *option static void set_shell(const char *new_shell) { - if (!strcmp(new_shell, "bash") || !strcmp(new_shell, "sh")) + if (strcmp(new_shell, "bash") == 0 || strcmp(new_shell, "sh") == 0) return; - if (!strcmp(new_shell, "tcsh") || !strcmp(new_shell, "csh")) + if (strcmp(new_shell, "tcsh") == 0 || strcmp(new_shell, "csh") == 0) option_mask32 |= SHELL_IS_TCSH; else bb_error_msg("unknown shell '%s', assuming bash", new_shell); diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index d5230387c..31abb6bb2 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c @@ -174,7 +174,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv) bb_error_msg_and_die("%s(%i): wrong map line", mapFile, maplineno); - if (!strcmp(fn_name, "_stext")) /* only elf works like this */ { + if (strcmp(fn_name, "_stext") == 0) /* only elf works like this */ { add0 = fn_add; break; } @@ -224,8 +224,9 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv) if (optBins) { if (optVerbose || this > 0) printf(" total\t\t\t\t%u\n", this); - } else if ((this || optAll) - && (fn_len = next_add-fn_add) != 0 + } else + if ((this || optAll) + && (fn_len = next_add-fn_add) != 0 ) { if (optVerbose) printf("%016llx %-40s %6u %8.4f\n", fn_add, -- cgit v1.2.3-55-g6feb From 7d877fc9312a742b06125927bb1d34bd35398c6c Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Mon, 28 Nov 2016 01:29:28 +0100 Subject: Do not print useless empty line after list of applets Signed-off-by: Denys Vlasenko --- libbb/appletlib.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/libbb/appletlib.c b/libbb/appletlib.c index bb7e905db..9425c7bd4 100644 --- a/libbb/appletlib.c +++ b/libbb/appletlib.c @@ -777,7 +777,7 @@ static int busybox_main(char **argv) col += len2; a += len2 - 1; } - full_write2_str("\n\n"); + full_write2_str("\n"); return 0; } -- cgit v1.2.3-55-g6feb