aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2016-11-29 11:26:45 +0000
committerRon Yorston <rmy@pobox.com>2016-11-29 11:26:45 +0000
commitbb8d79eadbba1942dbdb9f9cee5c47833afe269f (patch)
treeb8c517e9ca895d60d7227aef7177b6291df5e2cd
parent9fa1e4990e655a85025c9d270a1606983e375e47 (diff)
parent7d877fc9312a742b06125927bb1d34bd35398c6c (diff)
downloadbusybox-w32-bb8d79eadbba1942dbdb9f9cee5c47833afe269f.tar.gz
busybox-w32-bb8d79eadbba1942dbdb9f9cee5c47833afe269f.tar.bz2
busybox-w32-bb8d79eadbba1942dbdb9f9cee5c47833afe269f.zip
Merge branch 'busybox' into merge
-rw-r--r--Config.in315
-rw-r--r--archival/Config.src2
-rw-r--r--archival/bbunzip.c82
-rw-r--r--archival/dpkg_deb.c88
-rw-r--r--archival/libarchive/get_header_tar.c32
-rw-r--r--archival/lzop.c32
-rw-r--r--configs/TEST_nommu_defconfig1
-rw-r--r--configs/TEST_noprintf_defconfig1
-rw-r--r--configs/TEST_rh9_defconfig1
-rw-r--r--configs/android2_defconfig1
-rw-r--r--configs/android_502_defconfig1
-rw-r--r--configs/android_defconfig1
-rw-r--r--configs/android_ndk_defconfig1
-rw-r--r--configs/cygwin_defconfig1
-rw-r--r--configs/freebsd_defconfig1
-rw-r--r--console-tools/Config.src166
-rw-r--r--console-tools/Kbuild.src16
-rw-r--r--console-tools/chvt.c11
-rw-r--r--console-tools/clear.c9
-rw-r--r--console-tools/deallocvt.c10
-rw-r--r--console-tools/dumpkmap.c12
-rw-r--r--console-tools/fgconsole.c10
-rw-r--r--console-tools/kbd_mode.c10
-rw-r--r--console-tools/loadfont.c51
-rw-r--r--console-tools/loadkmap.c11
-rw-r--r--console-tools/openvt.c11
-rw-r--r--console-tools/reset.c13
-rw-r--r--console-tools/resize.c21
-rw-r--r--console-tools/setconsole.c18
-rw-r--r--console-tools/setkeycodes.c11
-rw-r--r--console-tools/setlogcons.c10
-rw-r--r--console-tools/showkey.c10
-rw-r--r--coreutils/Config.src650
-rw-r--r--coreutils/Kbuild.src71
-rw-r--r--coreutils/basename.c13
-rw-r--r--coreutils/cal.c18
-rw-r--r--coreutils/cat.c16
-rw-r--r--coreutils/catv.c11
-rw-r--r--coreutils/chgrp.c9
-rw-r--r--coreutils/chmod.c9
-rw-r--r--coreutils/chown.c17
-rw-r--r--coreutils/chroot.c10
-rw-r--r--coreutils/cksum.c9
-rw-r--r--coreutils/comm.c10
-rw-r--r--coreutils/cp.c22
-rw-r--r--coreutils/cut.c10
-rw-r--r--coreutils/date.c11
-rw-r--r--coreutils/dd.c6
-rw-r--r--coreutils/df.c28
-rw-r--r--coreutils/dirname.c10
-rw-r--r--coreutils/dos2unix.c28
-rw-r--r--coreutils/du.c24
-rw-r--r--coreutils/echo.c24
-rw-r--r--coreutils/env.c26
-rw-r--r--coreutils/expand.c31
-rw-r--r--coreutils/expr.c25
-rw-r--r--coreutils/false.c9
-rw-r--r--coreutils/fold.c9
-rw-r--r--coreutils/fsync.c9
-rw-r--r--coreutils/head.c19
-rw-r--r--coreutils/hostid.c5
-rw-r--r--coreutils/id.c11
-rw-r--r--coreutils/install.c16
-rw-r--r--coreutils/length.c.disabled31
-rw-r--r--coreutils/ln.c9
-rw-r--r--coreutils/logname.c16
-rw-r--r--coreutils/ls.c70
-rw-r--r--coreutils/mkdir.c24
-rw-r--r--coreutils/mkfifo.c10
-rw-r--r--coreutils/mknod.c10
-rw-r--r--coreutils/mv.c23
-rw-r--r--coreutils/nice.c9
-rw-r--r--coreutils/nohup.c9
-rw-r--r--coreutils/od.c9
-rw-r--r--coreutils/printenv.c9
-rw-r--r--coreutils/printf.c11
-rw-r--r--coreutils/pwd.c11
-rw-r--r--coreutils/readlink.c17
-rw-r--r--coreutils/realpath.c15
-rw-r--r--coreutils/rm.c16
-rw-r--r--coreutils/rmdir.c17
-rw-r--r--coreutils/seq.c9
-rw-r--r--coreutils/sleep.c44
-rw-r--r--coreutils/sort.c21
-rw-r--r--coreutils/split.c19
-rw-r--r--coreutils/stat.c3
-rw-r--r--coreutils/stty.c10
-rw-r--r--coreutils/sum.c9
-rw-r--r--coreutils/sync.c7
-rw-r--r--coreutils/tac.c14
-rw-r--r--coreutils/tail.c30
-rw-r--r--coreutils/tee.c17
-rw-r--r--coreutils/test.c33
-rw-r--r--coreutils/touch.c14
-rw-r--r--coreutils/tr.c7
-rw-r--r--coreutils/true.c9
-rw-r--r--coreutils/truncate.c4
-rw-r--r--coreutils/tty.c10
-rw-r--r--coreutils/uname.c25
-rw-r--r--coreutils/uniq.c9
-rw-r--r--coreutils/unlink.c5
-rw-r--r--coreutils/usleep.c9
-rw-r--r--coreutils/uudecode.c9
-rw-r--r--coreutils/uuencode.c9
-rw-r--r--coreutils/wc.c25
-rw-r--r--coreutils/who.c8
-rw-r--r--coreutils/whoami.c12
-rw-r--r--coreutils/yes.c17
-rw-r--r--e2fsprogs/fsck.c2
-rw-r--r--e2fsprogs/tune2fs.c2
-rw-r--r--editors/patch.c20
-rw-r--r--editors/patch_toybox.c7
-rw-r--r--editors/sed.c5
-rw-r--r--findutils/find.c46
-rw-r--r--findutils/grep.c52
-rwxr-xr-xinclude/applets.h.sh24
-rw-r--r--include/applets.src.h264
-rw-r--r--include/libbb.h76
-rw-r--r--init/halt.c41
-rw-r--r--libbb/Config.src162
-rw-r--r--libbb/appletlib.c26
-rw-r--r--libbb/lineedit.c112
-rw-r--r--libbb/read_key.c12
-rw-r--r--loginutils/addgroup.c2
-rw-r--r--mailutils/Config.src43
-rw-r--r--mailutils/makemime.c7
-rw-r--r--mailutils/popmaildir.c18
-rw-r--r--mailutils/reformime.c15
-rw-r--r--mailutils/sendmail.c7
-rw-r--r--miscutils/Config.src524
-rw-r--r--miscutils/Kbuild.src42
-rw-r--r--miscutils/adjtimex.c11
-rw-r--r--miscutils/bbconfig.c24
-rw-r--r--miscutils/beep.c26
-rw-r--r--miscutils/chat.c70
-rw-r--r--miscutils/chrt.c10
-rw-r--r--miscutils/conspy.c9
-rw-r--r--miscutils/crontab.c13
-rw-r--r--miscutils/dc.c26
-rw-r--r--miscutils/devfsd.c60
-rw-r--r--miscutils/devmem.c10
-rw-r--r--miscutils/eject.c18
-rw-r--r--miscutils/fbsplash.c25
-rw-r--r--miscutils/flash_eraseall.c10
-rw-r--r--miscutils/flash_lock_unlock.c19
-rw-r--r--miscutils/flashcp.c10
-rw-r--r--miscutils/hdparm.c62
-rw-r--r--miscutils/inotifyd.c10
-rw-r--r--miscutils/ionice.c11
-rw-r--r--miscutils/last.c22
-rw-r--r--miscutils/less.c4
-rw-r--r--miscutils/makedevs.c44
-rw-r--r--miscutils/man.c9
-rw-r--r--miscutils/microcom.c9
-rw-r--r--miscutils/mountpoint.c9
-rw-r--r--miscutils/mt.c11
-rw-r--r--miscutils/raidautorun.c11
-rw-r--r--miscutils/readahead.c21
-rw-r--r--miscutils/runlevel.c13
-rw-r--r--miscutils/rx.c12
-rw-r--r--miscutils/setsid.c9
-rw-r--r--miscutils/strings.c10
-rw-r--r--miscutils/time.c11
-rw-r--r--miscutils/timeout.c10
-rw-r--r--miscutils/ttysize.c12
-rw-r--r--miscutils/volname.c9
-rw-r--r--miscutils/watchdog.c15
-rw-r--r--modutils/Config.src111
-rw-r--r--modutils/Kbuild.src7
-rw-r--r--modutils/depmod.c11
-rw-r--r--modutils/insmod.c9
-rw-r--r--modutils/lsmod.c19
-rw-r--r--modutils/modprobe-small.c47
-rw-r--r--modutils/modprobe.c22
-rw-r--r--modutils/modutils-24.c2
-rw-r--r--modutils/rmmod.c9
-rw-r--r--networking/Config.src915
-rw-r--r--networking/Kbuild.src38
-rw-r--r--networking/arp.c10
-rw-r--r--networking/arping.c11
-rw-r--r--networking/brctl.c30
-rw-r--r--networking/dnsd.c9
-rw-r--r--networking/ether-wake.c10
-rw-r--r--networking/ftpd.c56
-rw-r--r--networking/ftpgetput.c24
-rw-r--r--networking/hostname.c26
-rw-r--r--networking/httpd.c178
-rw-r--r--networking/ifconfig.c51
-rw-r--r--networking/ifenslave.c11
-rw-r--r--networking/ifplugd.c10
-rw-r--r--networking/ifupdown.c135
-rw-r--r--networking/inetd.c53
-rw-r--r--networking/interface.c8
-rw-r--r--networking/ip.c125
-rw-r--r--networking/ipcalc.c25
-rw-r--r--networking/isrv_identd.c11
-rw-r--r--networking/nameif.c4
-rw-r--r--networking/nc.c10
-rw-r--r--networking/netstat.c26
-rw-r--r--networking/nslookup.c9
-rw-r--r--networking/ntpd.c26
-rw-r--r--networking/ping.c12
-rw-r--r--networking/pscan.c9
-rw-r--r--networking/route.c10
-rw-r--r--networking/slattach.c11
-rw-r--r--networking/tc.c22
-rw-r--r--networking/tcpudp.c19
-rw-r--r--networking/telnet.c29
-rw-r--r--networking/telnetd.c72
-rw-r--r--networking/tftp.c72
-rw-r--r--networking/traceroute.c37
-rw-r--r--networking/tunctl.c18
-rw-r--r--networking/udhcp/dhcpc.c7
-rw-r--r--networking/udhcp/dhcpd.c5
-rw-r--r--networking/udhcp/dhcprelay.c3
-rw-r--r--networking/udhcp/dumpleases.c3
-rw-r--r--networking/vconfig.c11
-rw-r--r--networking/zcip.c16
-rw-r--r--procps/Config.src140
-rw-r--r--procps/Kbuild.src15
-rw-r--r--procps/free.c12
-rw-r--r--procps/fuser.c11
-rw-r--r--procps/kill.c48
-rw-r--r--procps/pgrep.c19
-rw-r--r--procps/pidof.c26
-rw-r--r--procps/ps.c49
-rw-r--r--procps/renice.c10
-rw-r--r--procps/sysctl.c9
-rw-r--r--procps/top.c5
-rw-r--r--procps/uptime.c7
-rw-r--r--procps/watch.c11
-rw-r--r--runit/sv.c2
-rw-r--r--selinux/Config.src113
-rw-r--r--selinux/Kbuild.src12
-rw-r--r--selinux/chcon.c17
-rw-r--r--selinux/getenforce.c10
-rw-r--r--selinux/getsebool.c10
-rw-r--r--selinux/load_policy.c10
-rw-r--r--selinux/matchpathcon.c11
-rw-r--r--selinux/runcon.c17
-rw-r--r--selinux/selinuxenabled.c11
-rw-r--r--selinux/sestatus.c10
-rw-r--r--selinux/setenforce.c10
-rw-r--r--selinux/setfiles.c31
-rw-r--r--selinux/setsebool.c11
-rw-r--r--shell/ash.c9
-rw-r--r--shell/hush.c39
-rwxr-xr-xtestsuite/find.tests27
-rwxr-xr-xtestsuite/grep.tests2
-rwxr-xr-xtestsuite/patch.tests45
-rwxr-xr-xtestsuite/tar.tests20
-rw-r--r--testsuite/tar.utf8.tar.bz2bin0 -> 519 bytes
-rw-r--r--util-linux/Config.src547
-rw-r--r--util-linux/Kbuild.src36
-rw-r--r--util-linux/acpid.c26
-rw-r--r--util-linux/blkdiscard.c1
-rw-r--r--util-linux/blkid.c20
-rw-r--r--util-linux/blockdev.c9
-rw-r--r--util-linux/dmesg.c37
-rw-r--r--util-linux/fatattr.c1
-rw-r--r--util-linux/fbset.c32
-rw-r--r--util-linux/fdformat.c10
-rw-r--r--util-linux/fdisk.c81
-rw-r--r--util-linux/fdisk_gpt.c56
-rw-r--r--util-linux/findfs.c14
-rw-r--r--util-linux/flock.c9
-rw-r--r--util-linux/freeramdisk.c30
-rw-r--r--util-linux/fsck_minix.c14
-rw-r--r--util-linux/getopt.c26
-rw-r--r--util-linux/hexdump.c32
-rw-r--r--util-linux/hwclock.c36
-rw-r--r--util-linux/ipcrm.c11
-rw-r--r--util-linux/ipcs.c11
-rw-r--r--util-linux/losetup.c12
-rw-r--r--util-linux/lspci.c13
-rw-r--r--util-linux/lsusb.c13
-rw-r--r--util-linux/mkfs_ext2.c20
-rw-r--r--util-linux/mkfs_minix.c21
-rw-r--r--util-linux/mkfs_reiser.c11
-rw-r--r--util-linux/mkfs_vfat.c19
-rw-r--r--util-linux/mkswap.c23
-rw-r--r--util-linux/more.c13
-rw-r--r--util-linux/mount.c8
-rw-r--r--util-linux/pivot_root.c16
-rw-r--r--util-linux/rdate.c14
-rw-r--r--util-linux/rdev.c9
-rw-r--r--util-linux/readprofile.c17
-rw-r--r--util-linux/rev.c9
-rw-r--r--util-linux/rtcwake.c10
-rw-r--r--util-linux/script.c9
-rw-r--r--util-linux/scriptreplay.c10
-rw-r--r--util-linux/setarch.c29
-rw-r--r--util-linux/swaponoff.c50
-rw-r--r--util-linux/switch_root.c23
-rw-r--r--util-linux/uevent.c1
-rw-r--r--util-linux/umount.c20
-rw-r--r--util-linux/unshare.c1
297 files changed, 5075 insertions, 4522 deletions
diff --git a/Config.in b/Config.in
index f9f6a3735..594b16b76 100644
--- a/Config.in
+++ b/Config.in
@@ -25,15 +25,18 @@ endchoice
25 25
26menu "Busybox Settings" 26menu "Busybox Settings"
27 27
28menu "General Configuration"
29
30config DESKTOP 28config DESKTOP
31 bool "Enable options for full-blown desktop systems" 29 bool "Enable options for full-blown desktop systems"
32 default y 30 default y
33 help 31 help
34 Enable options and features which are not essential. 32 Enable options and features which are not essential.
35 Select this only if you plan to use busybox on full-blown 33 Select this if you plan to use busybox on full-blown desktop machine
36 desktop machine with common Linux distro, not on an embedded box. 34 with common Linux distro, which needs higher level of command-line
35 compatibility.
36
37 If you are preparing your build to be used on an embedded box
38 where you have tighter control over the entire set of userspace
39 tools, you can unselect this option for smaller code size.
37 40
38config EXTRA_COMPAT 41config EXTRA_COMPAT
39 bool "Provide compatible behavior for rare corner cases (bigger code)" 42 bool "Provide compatible behavior for rare corner cases (bigger code)"
@@ -72,30 +75,6 @@ config PLATFORM_LINUX
72 Answering 'N' here will disable such applets and hide the 75 Answering 'N' here will disable such applets and hide the
73 corresponding configuration options. 76 corresponding configuration options.
74 77
75choice
76 prompt "Buffer allocation policy"
77 default FEATURE_BUFFERS_USE_MALLOC
78 help
79 There are 3 ways BusyBox can handle buffer allocations:
80 - Use malloc. This costs code size for the call to xmalloc.
81 - Put them on stack. For some very small machines with limited stack
82 space, this can be deadly. For most folks, this works just fine.
83 - Put them in BSS. This works beautifully for computers with a real
84 MMU (and OS support), but wastes runtime RAM for uCLinux. This
85 behavior was the only one available for BusyBox versions 0.48 and
86 earlier.
87
88config FEATURE_BUFFERS_USE_MALLOC
89 bool "Allocate with Malloc"
90
91config FEATURE_BUFFERS_GO_ON_STACK
92 bool "Allocate on the Stack"
93
94config FEATURE_BUFFERS_GO_IN_BSS
95 bool "Allocate in the .bss section"
96
97endchoice
98
99config SHOW_USAGE 78config SHOW_USAGE
100 bool "Show applet usage messages" 79 bool "Show applet usage messages"
101 default y 80 default y
@@ -158,131 +137,6 @@ config INSTALL_NO_USR
158 will install applets only to /bin and /sbin, 137 will install applets only to /bin and /sbin,
159 never to /usr/bin or /usr/sbin. 138 never to /usr/bin or /usr/sbin.
160 139
161config LOCALE_SUPPORT
162 bool "Enable locale support (system needs locale for this to work)"
163 default n
164 help
165 Enable this if your system has locale support and you would like
166 busybox to support locale settings.
167
168config UNICODE_SUPPORT
169 bool "Support Unicode"
170 default y
171 help
172 This makes various applets aware that one byte is not
173 one character on screen.
174
175 Busybox aims to eventually work correctly with Unicode displays.
176 Any older encodings are not guaranteed to work.
177 Probably by the time when busybox will be fully Unicode-clean,
178 other encodings will be mainly of historic interest.
179
180config UNICODE_USING_LOCALE
181 bool "Use libc routines for Unicode (else uses internal ones)"
182 default n
183 depends on UNICODE_SUPPORT && LOCALE_SUPPORT
184 help
185 With this option on, Unicode support is implemented using libc
186 routines. Otherwise, internal implementation is used.
187 Internal implementation is smaller.
188
189config FEATURE_CHECK_UNICODE_IN_ENV
190 bool "Check $LC_ALL, $LC_CTYPE and $LANG environment variables"
191 default n
192 depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE
193 help
194 With this option on, Unicode support is activated
195 only if locale-related variables have the value of the form
196 "xxxx.utf8"
197
198 Otherwise, Unicode support will be always enabled and active.
199
200config SUBST_WCHAR
201 int "Character code to substitute unprintable characters with"
202 depends on UNICODE_SUPPORT
203 default 63
204 help
205 Typical values are 63 for '?' (works with any output device),
206 30 for ASCII substitute control code,
207 65533 (0xfffd) for Unicode replacement character.
208
209config LAST_SUPPORTED_WCHAR
210 int "Range of supported Unicode characters"
211 depends on UNICODE_SUPPORT
212 default 767
213 help
214 Any character with Unicode value bigger than this is assumed
215 to be non-printable on output device. Many applets replace
216 such chars with substitution character.
217
218 The idea is that many valid printable Unicode chars are
219 nevertheless are not displayed correctly. Think about
220 combining charachers, double-wide hieroglyphs, obscure
221 characters in dozens of ancient scripts...
222 Many terminals, terminal emulators, xterms etc will fail
223 to handle them correctly. Choose the smallest value
224 which suits your needs.
225
226 Typical values are:
227 126 - ASCII only
228 767 (0x2ff) - there are no combining chars in [0..767] range
229 (the range includes Latin 1, Latin Ext. A and B),
230 code is ~700 bytes smaller for this case.
231 4351 (0x10ff) - there are no double-wide chars in [0..4351] range,
232 code is ~300 bytes smaller for this case.
233 12799 (0x31ff) - nearly all non-ideographic characters are
234 available in [0..12799] range, including
235 East Asian scripts like katakana, hiragana, hangul,
236 bopomofo...
237 0 - off, any valid printable Unicode character will be printed.
238
239config UNICODE_COMBINING_WCHARS
240 bool "Allow zero-width Unicode characters on output"
241 default n
242 depends on UNICODE_SUPPORT
243 help
244 With this option off, any Unicode char with width of 0
245 is substituted on output.
246
247config UNICODE_WIDE_WCHARS
248 bool "Allow wide Unicode characters on output"
249 default n
250 depends on UNICODE_SUPPORT
251 help
252 With this option off, any Unicode char with width > 1
253 is substituted on output.
254
255config UNICODE_BIDI_SUPPORT
256 bool "Bidirectional character-aware line input"
257 default n
258 depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE
259 help
260 With this option on, right-to-left Unicode characters
261 are treated differently on input (e.g. cursor movement).
262
263config UNICODE_NEUTRAL_TABLE
264 bool "In bidi input, support non-ASCII neutral chars too"
265 default n
266 depends on UNICODE_BIDI_SUPPORT
267 help
268 In most cases it's enough to treat only ASCII non-letters
269 (i.e. punctuation, numbers and space) as characters
270 with neutral directionality.
271 With this option on, more extensive (and bigger) table
272 of neutral chars will be used.
273
274config UNICODE_PRESERVE_BROKEN
275 bool "Make it possible to enter sequences of chars which are not Unicode"
276 default n
277 depends on UNICODE_SUPPORT
278 help
279 With this option on, on line-editing input (such as used by shells)
280 invalid UTF-8 bytes are not substituted with the selected
281 substitution character.
282 For example, this means that entering 'l', 's', ' ', 0xff, [Enter]
283 at shell prompt will list file named 0xff (single char name
284 with char value 255), not file named '?'.
285
286config PAM 140config PAM
287 bool "Support for PAM (Pluggable Authentication Modules)" 141 bool "Support for PAM (Pluggable Authentication Modules)"
288 default n 142 default n
@@ -290,19 +144,6 @@ config PAM
290 Use PAM in some busybox applets (currently login and httpd) instead 144 Use PAM in some busybox applets (currently login and httpd) instead
291 of direct access to password database. 145 of direct access to password database.
292 146
293config FEATURE_USE_SENDFILE
294 bool "Use sendfile system call"
295 default y
296 select PLATFORM_LINUX
297 help
298 When enabled, busybox will use the kernel sendfile() function
299 instead of read/write loops to copy data between file descriptors
300 (for example, cp command does this a lot).
301 If sendfile() doesn't work, copying code falls back to read/write
302 loop. sendfile() was originally implemented for faster I/O
303 from files to sockets, but since Linux 2.6.33 it was extended
304 to work for many more file types.
305
306config LONG_OPTS 147config LONG_OPTS
307 bool "Support for --long-options" 148 bool "Support for --long-options"
308 default y 149 default y
@@ -511,9 +352,7 @@ config FEATURE_HAVE_RPC
511 # This is automatically selected if any of enabled applets need it. 352 # This is automatically selected if any of enabled applets need it.
512 # You do not need to select it manually. 353 # You do not need to select it manually.
513 354
514endmenu 355comment 'Build Options'
515
516menu 'Build Options'
517 356
518config STATIC 357config STATIC
519 bool "Build BusyBox as a static binary (no shared libs)" 358 bool "Build BusyBox as a static binary (no shared libs)"
@@ -710,9 +549,73 @@ config EXTRA_LDLIBS
710 help 549 help
711 Additional LDLIBS to pass to the linker with -l. 550 Additional LDLIBS to pass to the linker with -l.
712 551
713endmenu 552comment 'Installation Options ("make install" behavior)'
553
554choice
555 prompt "What kind of applet links to install"
556 default INSTALL_APPLET_SYMLINKS
557 help
558 Choose what kind of links to applets are created by "make install".
559
560config INSTALL_APPLET_SYMLINKS
561 bool "as soft-links"
562 help
563 Install applets as soft-links to the busybox binary. This needs some
564 free inodes on the filesystem, but might help with filesystem
565 generators that can't cope with hard-links.
566
567config INSTALL_APPLET_HARDLINKS
568 bool "as hard-links"
569 help
570 Install applets as hard-links to the busybox binary. This might
571 count on a filesystem with few inodes.
572
573config INSTALL_APPLET_SCRIPT_WRAPPERS
574 bool "as script wrappers"
575 help
576 Install applets as script wrappers that call the busybox binary.
577
578config INSTALL_APPLET_DONT
579 bool "not installed"
580 help
581 Do not install applet links. Useful when you plan to use
582 busybox --install for installing links, or plan to use
583 a standalone shell and thus don't need applet links.
584
585endchoice
586
587choice
588 prompt "/bin/sh applet link"
589 default INSTALL_SH_APPLET_SYMLINK
590 depends on INSTALL_APPLET_SCRIPT_WRAPPERS
591 help
592 Choose how you install /bin/sh applet link.
593
594config INSTALL_SH_APPLET_SYMLINK
595 bool "as soft-link"
596 help
597 Install /bin/sh applet as soft-link to the busybox binary.
714 598
715menu 'Debugging Options' 599config INSTALL_SH_APPLET_HARDLINK
600 bool "as hard-link"
601 help
602 Install /bin/sh applet as hard-link to the busybox binary.
603
604config INSTALL_SH_APPLET_SCRIPT_WRAPPER
605 bool "as script wrapper"
606 help
607 Install /bin/sh applet as script wrapper that calls
608 the busybox binary.
609
610endchoice
611
612config PREFIX
613 string "BusyBox installation prefix"
614 default "./_install"
615 help
616 Define your directory to install BusyBox files/subdirs in.
617
618comment 'Debugging Options'
716 619
717config DEBUG 620config DEBUG
718 bool "Build BusyBox with extra Debugging symbols" 621 bool "Build BusyBox with extra Debugging symbols"
@@ -806,78 +709,8 @@ endchoice
806 709
807endmenu 710endmenu
808 711
809menu 'Installation Options ("make install" behavior)'
810
811choice
812 prompt "What kind of applet links to install"
813 default INSTALL_APPLET_SYMLINKS
814 help
815 Choose what kind of links to applets are created by "make install".
816
817config INSTALL_APPLET_SYMLINKS
818 bool "as soft-links"
819 help
820 Install applets as soft-links to the busybox binary. This needs some
821 free inodes on the filesystem, but might help with filesystem
822 generators that can't cope with hard-links.
823
824config INSTALL_APPLET_HARDLINKS
825 bool "as hard-links"
826 help
827 Install applets as hard-links to the busybox binary. This might
828 count on a filesystem with few inodes.
829
830config INSTALL_APPLET_SCRIPT_WRAPPERS
831 bool "as script wrappers"
832 help
833 Install applets as script wrappers that call the busybox binary.
834
835config INSTALL_APPLET_DONT
836 bool "not installed"
837 help
838 Do not install applet links. Useful when you plan to use
839 busybox --install for installing links, or plan to use
840 a standalone shell and thus don't need applet links.
841
842endchoice
843
844choice
845 prompt "/bin/sh applet link"
846 default INSTALL_SH_APPLET_SYMLINK
847 depends on INSTALL_APPLET_SCRIPT_WRAPPERS
848 help
849 Choose how you install /bin/sh applet link.
850
851config INSTALL_SH_APPLET_SYMLINK
852 bool "as soft-link"
853 help
854 Install /bin/sh applet as soft-link to the busybox binary.
855
856config INSTALL_SH_APPLET_HARDLINK
857 bool "as hard-link"
858 help
859 Install /bin/sh applet as hard-link to the busybox binary.
860
861config INSTALL_SH_APPLET_SCRIPT_WRAPPER
862 bool "as script wrapper"
863 help
864 Install /bin/sh applet as script wrapper that calls
865 the busybox binary.
866
867endchoice
868
869config PREFIX
870 string "BusyBox installation prefix"
871 default "./_install"
872 help
873 Define your directory to install BusyBox files/subdirs in.
874
875endmenu
876
877source libbb/Config.in 712source libbb/Config.in
878 713
879endmenu
880
881comment "Applets" 714comment "Applets"
882 715
883source archival/Config.in 716source archival/Config.in
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
30 Make tar, rpm, modprobe etc understand .gz data. 30 Make tar, rpm, modprobe etc understand .gz data.
31 31
32config FEATURE_SEAMLESS_Z 32config FEATURE_SEAMLESS_Z
33 bool "tar, rpm, modprobe etc understand .Z data" 33 bool "Make tar, rpm, modprobe etc understand .Z data"
34 default n # it is ancient 34 default n # it is ancient
35 help 35 help
36 Make tar, rpm, modprobe etc understand .Z data. 36 Make tar, rpm, modprobe etc understand .Z data.
diff --git a/archival/bbunzip.c b/archival/bbunzip.c
index 3a483219d..e1eec6d4b 100644
--- a/archival/bbunzip.c
+++ b/archival/bbunzip.c
@@ -293,18 +293,24 @@ int uncompress_main(int argc UNUSED_PARAM, char **argv)
293//config: You can use the `-t' option to test the integrity of 293//config: You can use the `-t' option to test the integrity of
294//config: an archive, without decompressing it. 294//config: an archive, without decompressing it.
295//config: 295//config:
296//config:config ZCAT
297//config: bool "zcat"
298//config: default y
299//config: help
300//config: Alias to "gunzip -c".
301//config:
296//config:config FEATURE_GUNZIP_LONG_OPTIONS 302//config:config FEATURE_GUNZIP_LONG_OPTIONS
297//config: bool "Enable long options" 303//config: bool "Enable long options"
298//config: default y 304//config: default y
299//config: depends on GUNZIP && LONG_OPTS 305//config: depends on (GUNZIP || ZCAT) && LONG_OPTS
300//config: help 306//config: help
301//config: Enable use of long options. 307//config: Enable use of long options.
302 308
303//applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP)) 309//applet:IF_GUNZIP(APPLET(gunzip, BB_DIR_BIN, BB_SUID_DROP))
304//applet:IF_GUNZIP(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat)) 310//applet:IF_ZCAT(APPLET_ODDNAME(zcat, gunzip, BB_DIR_BIN, BB_SUID_DROP, zcat))
305//kbuild:lib-$(CONFIG_GZIP) += bbunzip.o
306//kbuild:lib-$(CONFIG_GUNZIP) += bbunzip.o 311//kbuild:lib-$(CONFIG_GUNZIP) += bbunzip.o
307#if ENABLE_GUNZIP 312//kbuild:lib-$(CONFIG_ZCAT) += bbunzip.o
313#if ENABLE_GUNZIP || ENABLE_ZCAT
308static 314static
309char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM) 315char* FAST_FUNC make_new_name_gunzip(char *filename, const char *expected_ext UNUSED_PARAM)
310{ 316{
@@ -367,7 +373,7 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
367 * Normally, "zcat" is just "gunzip -c". 373 * Normally, "zcat" is just "gunzip -c".
368 * But if seamless magic is enabled, then we are much more clever. 374 * But if seamless magic is enabled, then we are much more clever.
369 */ 375 */
370 if (applet_name[1] == 'c') 376 if (ENABLE_ZCAT && applet_name[1] == 'c')
371 option_mask32 |= OPT_STDOUT | SEAMLESS_MAGIC; 377 option_mask32 |= OPT_STDOUT | SEAMLESS_MAGIC;
372 378
373 return bbunpack(argv, unpack_gz_stream, make_new_name_gunzip, /*unused:*/ NULL); 379 return bbunpack(argv, unpack_gz_stream, make_new_name_gunzip, /*unused:*/ NULL);
@@ -404,18 +410,24 @@ int gunzip_main(int argc UNUSED_PARAM, char **argv)
404//config: 410//config:
405//config: Unless you have a specific application which requires bunzip2, you 411//config: Unless you have a specific application which requires bunzip2, you
406//config: should probably say N here. 412//config: should probably say N here.
413//config:
414//config:config BZCAT
415//config: bool "bzcat"
416//config: default y
417//config: help
418//config: Alias to "bunzip2 -c".
407 419
408//applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP)) 420//applet:IF_BUNZIP2(APPLET(bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP))
409//applet:IF_BUNZIP2(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat)) 421//applet:IF_BZCAT(APPLET_ODDNAME(bzcat, bunzip2, BB_DIR_USR_BIN, BB_SUID_DROP, bzcat))
410//kbuild:lib-$(CONFIG_BZIP2) += bbunzip.o
411//kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o 422//kbuild:lib-$(CONFIG_BUNZIP2) += bbunzip.o
412#if ENABLE_BUNZIP2 423//kbuild:lib-$(CONFIG_BZCAT) += bbunzip.o
424#if ENABLE_BUNZIP2 || ENABLE_BZCAT
413int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 425int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
414int bunzip2_main(int argc UNUSED_PARAM, char **argv) 426int bunzip2_main(int argc UNUSED_PARAM, char **argv)
415{ 427{
416 getopt32(argv, "cfvqdt"); 428 getopt32(argv, "cfvqdt");
417 argv += optind; 429 argv += optind;
418 if (applet_name[2] == 'c') /* bzcat */ 430 if (ENABLE_BZCAT && applet_name[2] == 'c') /* bzcat */
419 option_mask32 |= OPT_STDOUT; 431 option_mask32 |= OPT_STDOUT;
420 432
421 return bbunpack(argv, unpack_bz2_stream, make_new_name_generic, "bz2"); 433 return bbunpack(argv, unpack_bz2_stream, make_new_name_generic, "bz2");
@@ -483,27 +495,40 @@ int bunzip2_main(int argc UNUSED_PARAM, char **argv)
483//config: The BusyBox unlzma applet is limited to decompression only. 495//config: The BusyBox unlzma applet is limited to decompression only.
484//config: On an x86 system, this applet adds about 4K. 496//config: On an x86 system, this applet adds about 4K.
485//config: 497//config:
486//config:config FEATURE_LZMA_FAST 498//config:config LZCAT
487//config: bool "Optimize unlzma for speed" 499//config: bool "lzcat"
488//config: default n 500//config: default y
489//config: depends on UNLZMA
490//config: help 501//config: help
491//config: This option reduces decompression time by about 25% at the cost of 502//config: unlzma is a compression utility using the Lempel-Ziv-Markov chain
492//config: a 1K bigger binary. 503//config: compression algorithm, and range coding. Compression
504//config: is generally considerably better than that achieved by the bzip2
505//config: compressors.
506//config:
507//config: The BusyBox unlzma applet is limited to decompression only.
508//config: On an x86 system, this applet adds about 4K.
493//config: 509//config:
494//config:config LZMA 510//config:config LZMA
495//config: bool "Provide lzma alias which supports only unpacking" 511//config: bool "lzma -d"
496//config: default y 512//config: default y
497//config: depends on UNLZMA
498//config: help 513//config: help
499//config: Enable this option if you want commands like "lzma -d" to work. 514//config: Enable this option if you want commands like "lzma -d" to work.
500//config: IOW: you'll get lzma applet, but it will always require -d option. 515//config: IOW: you'll get lzma applet, but it will always require -d option.
516//config:
517//config:config FEATURE_LZMA_FAST
518//config: bool "Optimize unlzma for speed"
519//config: default n
520//config: depends on UNLZMA || LZCAT || LZMA
521//config: help
522//config: This option reduces decompression time by about 25% at the cost of
523//config: a 1K bigger binary.
501 524
502//applet:IF_UNLZMA(APPLET(unlzma, BB_DIR_USR_BIN, BB_SUID_DROP)) 525//applet:IF_UNLZMA(APPLET(unlzma, BB_DIR_USR_BIN, BB_SUID_DROP))
503//applet:IF_UNLZMA(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat)) 526//applet:IF_LZCAT(APPLET_ODDNAME(lzcat, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzcat))
504//applet:IF_LZMA(APPLET_ODDNAME(lzma, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzma)) 527//applet:IF_LZMA(APPLET_ODDNAME(lzma, unlzma, BB_DIR_USR_BIN, BB_SUID_DROP, lzma))
505//kbuild:lib-$(CONFIG_UNLZMA) += bbunzip.o 528//kbuild:lib-$(CONFIG_UNLZMA) += bbunzip.o
506#if ENABLE_UNLZMA 529//kbuild:lib-$(CONFIG_LZCAT) += bbunzip.o
530//kbuild:lib-$(CONFIG_LZMA) += bbunzip.o
531#if ENABLE_UNLZMA || ENABLE_LZCAT || ENABLE_LZMA
507int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 532int unlzma_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
508int unlzma_main(int argc UNUSED_PARAM, char **argv) 533int unlzma_main(int argc UNUSED_PARAM, char **argv)
509{ 534{
@@ -514,7 +539,7 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv)
514 bb_show_usage(); 539 bb_show_usage();
515# endif 540# endif
516 /* lzcat? */ 541 /* lzcat? */
517 if (applet_name[2] == 'c') 542 if (ENABLE_LZCAT && applet_name[2] == 'c')
518 option_mask32 |= OPT_STDOUT; 543 option_mask32 |= OPT_STDOUT;
519 544
520 argv += optind; 545 argv += optind;
@@ -529,19 +554,26 @@ int unlzma_main(int argc UNUSED_PARAM, char **argv)
529//config: help 554//config: help
530//config: unxz is a unlzma successor. 555//config: unxz is a unlzma successor.
531//config: 556//config:
557//config:config XZCAT
558//config: bool "xzcat"
559//config: default y
560//config: help
561//config: Alias to "unxz -c".
562//config:
532//config:config XZ 563//config:config XZ
533//config: bool "Provide xz alias which supports only unpacking" 564//config: bool "xz -d"
534//config: default y 565//config: default y
535//config: depends on UNXZ
536//config: help 566//config: help
537//config: Enable this option if you want commands like "xz -d" to work. 567//config: Enable this option if you want commands like "xz -d" to work.
538//config: IOW: you'll get xz applet, but it will always require -d option. 568//config: IOW: you'll get xz applet, but it will always require -d option.
539 569
540//applet:IF_UNXZ(APPLET(unxz, BB_DIR_USR_BIN, BB_SUID_DROP)) 570//applet:IF_UNXZ(APPLET(unxz, BB_DIR_USR_BIN, BB_SUID_DROP))
541//applet:IF_UNXZ(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat)) 571//applet:IF_XZCAT(APPLET_ODDNAME(xzcat, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xzcat))
542//applet:IF_XZ(APPLET_ODDNAME(xz, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xz)) 572//applet:IF_XZ(APPLET_ODDNAME(xz, unxz, BB_DIR_USR_BIN, BB_SUID_DROP, xz))
543//kbuild:lib-$(CONFIG_UNXZ) += bbunzip.o 573//kbuild:lib-$(CONFIG_UNXZ) += bbunzip.o
544#if ENABLE_UNXZ 574//kbuild:lib-$(CONFIG_XZCAT) += bbunzip.o
575//kbuild:lib-$(CONFIG_XZ) += bbunzip.o
576#if ENABLE_UNXZ || ENABLE_XZCAT || ENABLE_XZ
545int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 577int unxz_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
546int unxz_main(int argc UNUSED_PARAM, char **argv) 578int unxz_main(int argc UNUSED_PARAM, char **argv)
547{ 579{
@@ -552,7 +584,7 @@ int unxz_main(int argc UNUSED_PARAM, char **argv)
552 bb_show_usage(); 584 bb_show_usage();
553# endif 585# endif
554 /* xzcat? */ 586 /* xzcat? */
555 if (applet_name[2] == 'c') 587 if (ENABLE_XZCAT && applet_name[2] == 'c')
556 option_mask32 |= OPT_STDOUT; 588 option_mask32 |= OPT_STDOUT;
557 589
558 argv += optind; 590 argv += optind;
diff --git a/archival/dpkg_deb.c b/archival/dpkg_deb.c
index 0285273fe..86850469d 100644
--- a/archival/dpkg_deb.c
+++ b/archival/dpkg_deb.c
@@ -16,29 +16,20 @@
16//config: 16//config:
17//config: Unless you have a specific application which requires dpkg-deb, 17//config: Unless you have a specific application which requires dpkg-deb,
18//config: say N here. 18//config: say N here.
19//config:
20//config:config FEATURE_DPKG_DEB_EXTRACT_ONLY
21//config: bool "Extract only (-x)"
22//config: default n
23//config: depends on DPKG_DEB
24//config: help
25//config: This reduces dpkg-deb to the equivalent of
26//config: "ar -p <deb> data.tar.gz | tar -zx". However it saves space as none
27//config: of the extra dpkg-deb, ar or tar options are needed, they are linked
28//config: to internally.
29 19
30//applet:IF_DPKG_DEB(APPLET_ODDNAME(dpkg-deb, dpkg_deb, BB_DIR_USR_BIN, BB_SUID_DROP, dpkg_deb)) 20//applet:IF_DPKG_DEB(APPLET_ODDNAME(dpkg-deb, dpkg_deb, BB_DIR_USR_BIN, BB_SUID_DROP, dpkg_deb))
21
31//kbuild:lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o 22//kbuild:lib-$(CONFIG_DPKG_DEB) += dpkg_deb.o
32 23
33//usage:#define dpkg_deb_trivial_usage 24//usage:#define dpkg_deb_trivial_usage
34//usage: "[-cefxX] FILE [argument]" 25//usage: "[-cefxX] FILE [DIR]"
35//usage:#define dpkg_deb_full_usage "\n\n" 26//usage:#define dpkg_deb_full_usage "\n\n"
36//usage: "Perform actions on Debian packages (.debs)\n" 27//usage: "Perform actions on Debian packages (.deb)\n"
37//usage: "\n -c List contents of filesystem tree" 28//usage: "\n -c List files"
38//usage: "\n -e Extract control files to [argument] directory" 29//usage: "\n -f Print control fields"
39//usage: "\n -f Display control field name starting with [argument]" 30//usage: "\n -e Extract control files to DIR (default: ./DEBIAN)"
40//usage: "\n -x Extract packages filesystem tree to directory" 31//usage: "\n -x Extract files to DIR (no default)"
41//usage: "\n -X Verbose extract" 32//usage: "\n -X Verbose -x"
42//usage: 33//usage:
43//usage:#define dpkg_deb_example_usage 34//usage:#define dpkg_deb_example_usage
44//usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n" 35//usage: "$ dpkg-deb -X ./busybox_0.48-1_i386.deb /tmp\n"
@@ -49,18 +40,17 @@
49#define DPKG_DEB_OPT_CONTENTS 1 40#define DPKG_DEB_OPT_CONTENTS 1
50#define DPKG_DEB_OPT_CONTROL 2 41#define DPKG_DEB_OPT_CONTROL 2
51#define DPKG_DEB_OPT_FIELD 4 42#define DPKG_DEB_OPT_FIELD 4
52#define DPKG_DEB_OPT_EXTRACT 8 43#define DPKG_DEB_OPT_EXTRACT_VERBOSE 8
53#define DPKG_DEB_OPT_EXTRACT_VERBOSE 16 44#define DPKG_DEB_OPT_EXTRACT 16
54 45
55int dpkg_deb_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 46int dpkg_deb_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
56int dpkg_deb_main(int argc, char **argv) 47int dpkg_deb_main(int argc UNUSED_PARAM, char **argv)
57{ 48{
58 archive_handle_t *ar_archive; 49 archive_handle_t *ar_archive;
59 archive_handle_t *tar_archive; 50 archive_handle_t *tar_archive;
60 llist_t *control_tar_llist = NULL; 51 llist_t *control_tar_llist = NULL;
61 unsigned opt; 52 unsigned opt;
62 const char *extract_dir; 53 const char *extract_dir;
63 int need_args;
64 54
65 /* Setup the tar archive handle */ 55 /* Setup the tar archive handle */
66 tar_archive = init_handle(); 56 tar_archive = init_handle();
@@ -89,53 +79,45 @@ int dpkg_deb_main(int argc, char **argv)
89 llist_add_to(&control_tar_llist, (char*)"control.tar.xz"); 79 llist_add_to(&control_tar_llist, (char*)"control.tar.xz");
90#endif 80#endif
91 81
92 opt_complementary = "c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX"; 82 /* Must have 1 or 2 args */
83 opt_complementary = "-1:?2:c--efXx:e--cfXx:f--ceXx:X--cefx:x--cefX";
93 opt = getopt32(argv, "cefXx"); 84 opt = getopt32(argv, "cefXx");
94 argv += optind; 85 argv += optind;
95 argc -= optind; 86 //argc -= optind;
96 87
97 if (opt & DPKG_DEB_OPT_CONTENTS) { 88 extract_dir = argv[1];
89 if (opt & DPKG_DEB_OPT_CONTENTS) { // -c
98 tar_archive->action_header = header_verbose_list; 90 tar_archive->action_header = header_verbose_list;
91 if (extract_dir)
92 bb_show_usage();
99 } 93 }
100 extract_dir = NULL; 94 if (opt & DPKG_DEB_OPT_FIELD) { // -f
101 need_args = 1; 95 /* Print the entire control file */
102 if (opt & DPKG_DEB_OPT_CONTROL) { 96//TODO: standard tool accepts an optional list of fields to print
103 ar_archive->accept = control_tar_llist;
104 tar_archive->action_data = data_extract_all;
105 if (1 == argc) {
106 extract_dir = "./DEBIAN";
107 } else {
108 need_args++;
109 }
110 }
111 if (opt & DPKG_DEB_OPT_FIELD) {
112 /* Print the entire control file
113 * it should accept a second argument which specifies a
114 * specific field to print */
115 ar_archive->accept = control_tar_llist; 97 ar_archive->accept = control_tar_llist;
116 llist_add_to(&(tar_archive->accept), (char*)"./control"); 98 llist_add_to(&(tar_archive->accept), (char*)"./control");
117 tar_archive->filter = filter_accept_list; 99 tar_archive->filter = filter_accept_list;
118 tar_archive->action_data = data_extract_to_stdout; 100 tar_archive->action_data = data_extract_to_stdout;
101 if (extract_dir)
102 bb_show_usage();
119 } 103 }
120 if (opt & DPKG_DEB_OPT_EXTRACT) { 104 if (opt & DPKG_DEB_OPT_CONTROL) { // -e
121 tar_archive->action_header = header_list; 105 ar_archive->accept = control_tar_llist;
122 }
123 if (opt & (DPKG_DEB_OPT_EXTRACT_VERBOSE | DPKG_DEB_OPT_EXTRACT)) {
124 tar_archive->action_data = data_extract_all; 106 tar_archive->action_data = data_extract_all;
125 need_args = 2; 107 if (!extract_dir)
108 extract_dir = "./DEBIAN";
126 } 109 }
127 110 if (opt & (DPKG_DEB_OPT_EXTRACT_VERBOSE | DPKG_DEB_OPT_EXTRACT)) { // -Xx
128 if (need_args != argc) { 111 if (opt & DPKG_DEB_OPT_EXTRACT_VERBOSE)
129 bb_show_usage(); 112 tar_archive->action_header = header_list;
113 tar_archive->action_data = data_extract_all;
114 if (!extract_dir)
115 bb_show_usage();
130 } 116 }
131 117
132 tar_archive->src_fd = ar_archive->src_fd = xopen(argv[0], O_RDONLY); 118 /* Standard tool supports "-" */
119 tar_archive->src_fd = ar_archive->src_fd = xopen_stdin(argv[0]);
133 120
134 /* Work out where to extract the files */
135 /* 2nd argument is a dir name */
136 if (argv[1]) {
137 extract_dir = argv[1];
138 }
139 if (extract_dir) { 121 if (extract_dir) {
140 mkdir(extract_dir, 0777); /* bb_make_directory(extract_dir, 0777, 0) */ 122 mkdir(extract_dir, 0777); /* bb_make_directory(extract_dir, 0777, 0) */
141 xchdir(extract_dir); 123 xchdir(extract_dir);
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
113 value = end + 1; 113 value = end + 1;
114 114
115# if ENABLE_FEATURE_TAR_GNU_EXTENSIONS 115# if ENABLE_FEATURE_TAR_GNU_EXTENSIONS
116 if (!global && is_prefixed_with(value, "path=")) { 116 if (!global) {
117 value += sizeof("path=") - 1; 117 if (is_prefixed_with(value, "path=")) {
118 free(archive_handle->tar__longname); 118 value += sizeof("path=") - 1;
119 archive_handle->tar__longname = xstrdup(value); 119 free(archive_handle->tar__longname);
120 continue; 120 archive_handle->tar__longname = xstrdup(value);
121 continue;
122 }
123 if (is_prefixed_with(value, "linkpath=")) {
124 value += sizeof("linkpath=") - 1;
125 free(archive_handle->tar__linkname);
126 archive_handle->tar__linkname = xstrdup(value);
127 continue;
128 }
121 } 129 }
122# endif 130# endif
123 131
@@ -179,7 +187,13 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
179 * the message and we don't check whether we indeed 187 * the message and we don't check whether we indeed
180 * saw zero block directly before this. */ 188 * saw zero block directly before this. */
181 if (i == 0) { 189 if (i == 0) {
182 bb_error_msg("short read"); 190 /* GNU tar 1.29 will be silent if tar archive ends abruptly
191 * (if there are no zero blocks at all, and last read returns zero,
192 * not short read 0 < len < 512). Complain only if
193 * the very first read fails. Grrr.
194 */
195 if (archive_handle->offset == 0)
196 bb_error_msg("short read");
183 /* this merely signals end of archive, not exit(1): */ 197 /* this merely signals end of archive, not exit(1): */
184 return EXIT_FAILURE; 198 return EXIT_FAILURE;
185 } 199 }
@@ -195,7 +209,11 @@ char FAST_FUNC get_header_tar(archive_handle_t *archive_handle)
195 archive_handle->offset += i; 209 archive_handle->offset += i;
196 210
197 /* If there is no filename its an empty header */ 211 /* If there is no filename its an empty header */
198 if (tar.name[0] == 0 && tar.prefix[0] == 0) { 212 if (tar.name[0] == 0 && tar.prefix[0] == 0
213 /* Have seen a tar archive with pax 'x' header supplying UTF8 filename,
214 * with actual file having all name fields NUL-filled. Check this: */
215 && !p_longname
216 ) {
199 if (archive_handle->tar__end) { 217 if (archive_handle->tar__end) {
200 /* Second consecutive empty header - end of archive. 218 /* Second consecutive empty header - end of archive.
201 * Read until the end to empty the pipe from gz or bz2 219 * Read until the end to empty the pipe from gz or bz2
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 @@
31//config: help 31//config: help
32//config: Lzop compression/decompresion. 32//config: Lzop compression/decompresion.
33//config: 33//config:
34//config:config UNLZOP
35//config: bool "unlzop"
36//config: default y
37//config: help
38//config: Lzop decompresion.
39//config:
40//config:config LZOPCAT
41//config: bool "lzopcat"
42//config: default y
43//config: help
44//config: Alias to "unlzop -c".
45//config:
34//config:config LZOP_COMPR_HIGH 46//config:config LZOP_COMPR_HIGH
35//config: bool "lzop compression levels 7,8,9 (not very useful)" 47//config: bool "lzop compression levels 7,8,9 (not very useful)"
36//config: default n 48//config: default n
37//config: depends on LZOP 49//config: depends on LZOP || UNLZOP || LZOPCAT
38//config: help 50//config: help
39//config: High levels (7,8,9) of lzop compression. These levels 51//config: High levels (7,8,9) of lzop compression. These levels
40//config: are actually slower than gzip at equivalent compression ratios 52//config: are actually slower than gzip at equivalent compression ratios
41//config: and take up 3.2K of code. 53//config: and take up 3.2K of code.
42 54
43//applet:IF_LZOP(APPLET(lzop, BB_DIR_BIN, BB_SUID_DROP)) 55//applet:IF_LZOP(APPLET(lzop, BB_DIR_BIN, BB_SUID_DROP))
44//applet:IF_LZOP(APPLET_ODDNAME(lzopcat, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, lzopcat)) 56//applet:IF_UNLZOP(APPLET_ODDNAME(unlzop, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, unlzop))
45//applet:IF_LZOP(APPLET_ODDNAME(unlzop, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, unlzop)) 57//applet:IF_LZOPCAT(APPLET_ODDNAME(lzopcat, lzop, BB_DIR_USR_BIN, BB_SUID_DROP, lzopcat))
46//kbuild:lib-$(CONFIG_LZOP) += lzop.o 58//kbuild:lib-$(CONFIG_LZOP) += lzop.o
59//kbuild:lib-$(CONFIG_UNLZOP) += lzop.o
60//kbuild:lib-$(CONFIG_LZOPCAT) += lzop.o
47 61
48//usage:#define lzop_trivial_usage 62//usage:#define lzop_trivial_usage
49//usage: "[-cfvd123456789CF] [FILE]..." 63//usage: "[-cfvd123456789CF] [FILE]..."
@@ -57,18 +71,18 @@
57//usage: "\n -C Also write checksum of compressed block" 71//usage: "\n -C Also write checksum of compressed block"
58//usage: 72//usage:
59//usage:#define lzopcat_trivial_usage 73//usage:#define lzopcat_trivial_usage
60//usage: "[-vCF] [FILE]..." 74//usage: "[-vF] [FILE]..."
61//usage:#define lzopcat_full_usage "\n\n" 75//usage:#define lzopcat_full_usage "\n\n"
62//usage: " -v Verbose" 76//usage: " -v Verbose"
63//usage: "\n -F Don't store or verify checksum" 77//usage: "\n -F Don't verify checksum"
64//usage: 78//usage:
65//usage:#define unlzop_trivial_usage 79//usage:#define unlzop_trivial_usage
66//usage: "[-cfvCF] [FILE]..." 80//usage: "[-cfvF] [FILE]..."
67//usage:#define unlzop_full_usage "\n\n" 81//usage:#define unlzop_full_usage "\n\n"
68//usage: " -c Write to stdout" 82//usage: " -c Write to stdout"
69//usage: "\n -f Force" 83//usage: "\n -f Force"
70//usage: "\n -v Verbose" 84//usage: "\n -v Verbose"
71//usage: "\n -F Don't store or verify checksum" 85//usage: "\n -F Don't verify checksum"
72 86
73#include "libbb.h" 87#include "libbb.h"
74#include "common_bufsiz.h" 88#include "common_bufsiz.h"
@@ -1111,10 +1125,10 @@ int lzop_main(int argc UNUSED_PARAM, char **argv)
1111 getopt32(argv, OPTION_STRING); 1125 getopt32(argv, OPTION_STRING);
1112 argv += optind; 1126 argv += optind;
1113 /* lzopcat? */ 1127 /* lzopcat? */
1114 if (applet_name[4] == 'c') 1128 if (ENABLE_LZOPCAT && applet_name[4] == 'c')
1115 option_mask32 |= (OPT_STDOUT | OPT_DECOMPRESS); 1129 option_mask32 |= (OPT_STDOUT | OPT_DECOMPRESS);
1116 /* unlzop? */ 1130 /* unlzop? */
1117 if (applet_name[4] == 'o') 1131 if (ENABLE_UNLZOP && applet_name[4] == 'o')
1118 option_mask32 |= OPT_DECOMPRESS; 1132 option_mask32 |= OPT_DECOMPRESS;
1119 1133
1120 global_crc32_table = crc32_filltable(NULL, 0); 1134 global_crc32_table = crc32_filltable(NULL, 0);
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
118CONFIG_FEATURE_CPIO_P=y 118CONFIG_FEATURE_CPIO_P=y
119CONFIG_DPKG=y 119CONFIG_DPKG=y
120CONFIG_DPKG_DEB=y 120CONFIG_DPKG_DEB=y
121CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY=y
122CONFIG_GUNZIP=y 121CONFIG_GUNZIP=y
123CONFIG_GZIP=y 122CONFIG_GZIP=y
124CONFIG_FEATURE_GZIP_LONG_OPTIONS=y 123CONFIG_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
130# CONFIG_FEATURE_CPIO_P is not set 130# CONFIG_FEATURE_CPIO_P is not set
131# CONFIG_DPKG is not set 131# CONFIG_DPKG is not set
132# CONFIG_DPKG_DEB is not set 132# CONFIG_DPKG_DEB is not set
133# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
134# CONFIG_GUNZIP is not set 133# CONFIG_GUNZIP is not set
135# CONFIG_GZIP is not set 134# CONFIG_GZIP is not set
136# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set 135# 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
128CONFIG_FEATURE_CPIO_P=y 128CONFIG_FEATURE_CPIO_P=y
129# CONFIG_DPKG is not set 129# CONFIG_DPKG is not set
130# CONFIG_DPKG_DEB is not set 130# CONFIG_DPKG_DEB is not set
131# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
132CONFIG_GUNZIP=y 131CONFIG_GUNZIP=y
133CONFIG_GZIP=y 132CONFIG_GZIP=y
134CONFIG_FEATURE_GZIP_LONG_OPTIONS=y 133CONFIG_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
134CONFIG_FEATURE_CPIO_P=y 134CONFIG_FEATURE_CPIO_P=y
135CONFIG_DPKG=y 135CONFIG_DPKG=y
136CONFIG_DPKG_DEB=y 136CONFIG_DPKG_DEB=y
137# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
138CONFIG_GUNZIP=y 137CONFIG_GUNZIP=y
139CONFIG_GZIP=y 138CONFIG_GZIP=y
140# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set 139# 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
224CONFIG_FEATURE_CPIO_P=y 224CONFIG_FEATURE_CPIO_P=y
225# CONFIG_DPKG is not set 225# CONFIG_DPKG is not set
226# CONFIG_DPKG_DEB is not set 226# CONFIG_DPKG_DEB is not set
227# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
228CONFIG_GZIP=y 227CONFIG_GZIP=y
229CONFIG_FEATURE_GZIP_LONG_OPTIONS=y 228CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
230CONFIG_GZIP_FAST=0 229CONFIG_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
154CONFIG_FEATURE_CPIO_P=y 154CONFIG_FEATURE_CPIO_P=y
155CONFIG_DPKG=y 155CONFIG_DPKG=y
156CONFIG_DPKG_DEB=y 156CONFIG_DPKG_DEB=y
157# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
158CONFIG_GUNZIP=y 157CONFIG_GUNZIP=y
159CONFIG_GZIP=y 158CONFIG_GZIP=y
160# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set 159# 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
151CONFIG_FEATURE_CPIO_P=y 151CONFIG_FEATURE_CPIO_P=y
152CONFIG_DPKG=y 152CONFIG_DPKG=y
153CONFIG_DPKG_DEB=y 153CONFIG_DPKG_DEB=y
154# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
155CONFIG_GZIP=y 154CONFIG_GZIP=y
156# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set 155# CONFIG_FEATURE_GZIP_LONG_OPTIONS is not set
157CONFIG_GZIP_FAST=0 156CONFIG_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
134CONFIG_FEATURE_CPIO_P=y 134CONFIG_FEATURE_CPIO_P=y
135# CONFIG_DPKG is not set 135# CONFIG_DPKG is not set
136# CONFIG_DPKG_DEB is not set 136# CONFIG_DPKG_DEB is not set
137# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
138CONFIG_GUNZIP=y 137CONFIG_GUNZIP=y
139CONFIG_GZIP=y 138CONFIG_GZIP=y
140CONFIG_FEATURE_GZIP_LONG_OPTIONS=y 139CONFIG_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
132# CONFIG_FEATURE_CPIO_P is not set 132# CONFIG_FEATURE_CPIO_P is not set
133# CONFIG_DPKG is not set 133# CONFIG_DPKG is not set
134# CONFIG_DPKG_DEB is not set 134# CONFIG_DPKG_DEB is not set
135# CONFIG_FEATURE_DPKG_DEB_EXTRACT_ONLY is not set
136CONFIG_GUNZIP=y 135CONFIG_GUNZIP=y
137CONFIG_GZIP=y 136CONFIG_GZIP=y
138CONFIG_FEATURE_GZIP_LONG_OPTIONS=y 137CONFIG_FEATURE_GZIP_LONG_OPTIONS=y
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"
7 7
8INSERT 8INSERT
9 9
10config CHVT
11 bool "chvt"
12 default y
13 select PLATFORM_LINUX
14 help
15 This program is used to change to another terminal.
16 Example: chvt 4 (change to terminal /dev/tty4)
17
18config FGCONSOLE
19 bool "fgconsole"
20 default y
21 select PLATFORM_LINUX
22 help
23 This program prints active (foreground) console number.
24
25config CLEAR
26 bool "clear"
27 default y
28 help
29 This program clears the terminal screen.
30
31config DEALLOCVT
32 bool "deallocvt"
33 default y
34 select PLATFORM_LINUX
35 help
36 This program deallocates unused virtual consoles.
37
38config DUMPKMAP
39 bool "dumpkmap"
40 default y
41 select PLATFORM_LINUX
42 help
43 This program dumps the kernel's keyboard translation table to
44 stdout, in binary format. You can then use loadkmap to load it.
45
46config KBD_MODE
47 bool "kbd_mode"
48 default y
49 select PLATFORM_LINUX
50 help
51 This program reports and sets keyboard mode.
52
53config LOADFONT
54 bool "loadfont"
55 default y
56 select PLATFORM_LINUX
57 help
58 This program loads a console font from standard input.
59
60config LOADKMAP
61 bool "loadkmap"
62 default y
63 select PLATFORM_LINUX
64 help
65 This program loads a keyboard translation table from
66 standard input.
67
68config OPENVT
69 bool "openvt"
70 default y
71 select PLATFORM_LINUX
72 help
73 This program is used to start a command on an unused
74 virtual terminal.
75
76config RESET
77 bool "reset"
78 default y
79 help
80 This program is used to reset the terminal screen, if it
81 gets messed up.
82
83config RESIZE
84 bool "resize"
85 default y
86 help
87 This program is used to (re)set the width and height of your current
88 terminal.
89
90config FEATURE_RESIZE_PRINT
91 bool "Print environment variables"
92 default y
93 depends on RESIZE
94 help
95 Prints the newly set size (number of columns and rows) of
96 the terminal.
97 E.g.:
98 COLUMNS=80;LINES=44;export COLUMNS LINES;
99
100config SETCONSOLE
101 bool "setconsole"
102 default y
103 select PLATFORM_LINUX
104 help
105 This program redirects the system console to another device,
106 like the current tty while logged in via telnet.
107
108config FEATURE_SETCONSOLE_LONG_OPTIONS
109 bool "Enable long options"
110 default y
111 depends on SETCONSOLE && LONG_OPTS
112 help
113 Support long options for the setconsole applet.
114
115config SETFONT
116 bool "setfont"
117 default y
118 select PLATFORM_LINUX
119 help
120 Allows to load console screen map. Useful for i18n.
121
122config FEATURE_SETFONT_TEXTUAL_MAP
123 bool "Support reading textual screen maps"
124 default y
125 depends on SETFONT
126 help
127 Support reading textual screen maps.
128
129config DEFAULT_SETFONT_DIR
130 string "Default directory for console-tools files"
131 default ""
132 depends on SETFONT
133 help
134 Directory to use if setfont's params are simple filenames
135 (not /path/to/file or ./file). Default is "" (no default directory).
136
137config SETKEYCODES
138 bool "setkeycodes"
139 default y
140 select PLATFORM_LINUX
141 help
142 This program loads entries into the kernel's scancode-to-keycode
143 map, allowing unusual keyboards to generate usable keycodes.
144
145config SETLOGCONS
146 bool "setlogcons"
147 default y
148 select PLATFORM_LINUX
149 help
150 This program redirects the output console of kernel messages.
151
152config SHOWKEY
153 bool "showkey"
154 default y
155 select PLATFORM_LINUX
156 help
157 Shows keys pressed.
158
159comment "Common options for loadfont and setfont"
160 depends on LOADFONT || SETFONT
161
162config FEATURE_LOADFONT_PSF2
163 bool "Support for PSF2 console fonts"
164 default y
165 depends on LOADFONT || SETFONT
166 help
167 Support PSF2 console fonts.
168
169config FEATURE_LOADFONT_RAW
170 bool "Support for old (raw) console fonts"
171 default y
172 depends on LOADFONT || SETFONT
173 help
174 Support old (raw) console fonts.
175
176endmenu 10endmenu
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 @@
7lib-y:= 7lib-y:=
8 8
9INSERT 9INSERT
10lib-$(CONFIG_CHVT) += chvt.o
11lib-$(CONFIG_FGCONSOLE) += fgconsole.o
12lib-$(CONFIG_CLEAR) += clear.o
13lib-$(CONFIG_DEALLOCVT) += deallocvt.o
14lib-$(CONFIG_DUMPKMAP) += dumpkmap.o
15lib-$(CONFIG_SETCONSOLE) += setconsole.o
16lib-$(CONFIG_KBD_MODE) += kbd_mode.o
17lib-$(CONFIG_LOADFONT) += loadfont.o
18lib-$(CONFIG_LOADKMAP) += loadkmap.o
19lib-$(CONFIG_OPENVT) += openvt.o
20lib-$(CONFIG_RESET) += reset.o
21lib-$(CONFIG_RESIZE) += resize.o
22lib-$(CONFIG_SETFONT) += loadfont.o
23lib-$(CONFIG_SETKEYCODES) += setkeycodes.o
24lib-$(CONFIG_SETLOGCONS) += setlogcons.o
25lib-$(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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config CHVT
10//config: bool "chvt"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: This program is used to change to another terminal.
15//config: Example: chvt 4 (change to terminal /dev/tty4)
16
17//applet:IF_CHVT(APPLET(chvt, BB_DIR_USR_BIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_CHVT) += chvt.o
9 20
10//usage:#define chvt_trivial_usage 21//usage:#define chvt_trivial_usage
11//usage: "N" 22//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config CLEAR
10//config: bool "clear"
11//config: default y
12//config: help
13//config: This program clears the terminal screen.
14
15//applet:IF_CLEAR(APPLET(clear, BB_DIR_USR_BIN, BB_SUID_DROP))
16
17//kbuild:lib-$(CONFIG_CLEAR) += clear.o
9 18
10//usage:#define clear_trivial_usage 19//usage:#define clear_trivial_usage
11//usage: "" 20//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config DEALLOCVT
11//config: bool "deallocvt"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: This program deallocates unused virtual consoles.
10 16
11/* no options, no getopt */ 17//applet:IF_DEALLOCVT(APPLET(deallocvt, BB_DIR_USR_BIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_DEALLOCVT) += deallocvt.o
12 20
13//usage:#define deallocvt_trivial_usage 21//usage:#define deallocvt_trivial_usage
14//usage: "[N]" 22//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 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 */ 9 */
10/* no options, no getopt */ 10//config:config DUMPKMAP
11//config: bool "dumpkmap"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: This program dumps the kernel's keyboard translation table to
16//config: stdout, in binary format. You can then use loadkmap to load it.
17
18//applet:IF_DUMPKMAP(APPLET(dumpkmap, BB_DIR_BIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_DUMPKMAP) += dumpkmap.o
11 21
12//usage:#define dumpkmap_trivial_usage 22//usage:#define dumpkmap_trivial_usage
13//usage: "> keymap" 23//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config FGCONSOLE
10//config: bool "fgconsole"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: This program prints active (foreground) console number.
15
16//applet:IF_FGCONSOLE(APPLET(fgconsole, BB_DIR_USR_BIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_FGCONSOLE) += fgconsole.o
9 19
10//usage:#define fgconsole_trivial_usage 20//usage:#define fgconsole_trivial_usage
11//usage: "" 21//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 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11//config:config KBD_MODE
12//config: bool "kbd_mode"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: This program reports and sets keyboard mode.
17
18//applet:IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_BIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_KBD_MODE) += kbd_mode.o
11 21
12//usage:#define kbd_mode_trivial_usage 22//usage:#define kbd_mode_trivial_usage
13//usage: "[-a|k|s|u] [-C TTY]" 23//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 @@
9 * 9 *
10 * Licensed under GPLv2, see file LICENSE in this source tree. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12//config:config LOADFONT
13//config: bool "loadfont"
14//config: default y
15//config: select PLATFORM_LINUX
16//config: help
17//config: This program loads a console font from standard input.
18//config:
19//config:config SETFONT
20//config: bool "setfont"
21//config: default y
22//config: select PLATFORM_LINUX
23//config: help
24//config: Allows to load console screen map. Useful for i18n.
25//config:
26//config:config FEATURE_SETFONT_TEXTUAL_MAP
27//config: bool "Support reading textual screen maps"
28//config: default y
29//config: depends on SETFONT
30//config: help
31//config: Support reading textual screen maps.
32//config:
33//config:config DEFAULT_SETFONT_DIR
34//config: string "Default directory for console-tools files"
35//config: default ""
36//config: depends on SETFONT
37//config: help
38//config: Directory to use if setfont's params are simple filenames
39//config: (not /path/to/file or ./file). Default is "" (no default directory).
40//config:
41//config:comment "Common options for loadfont and setfont"
42//config: depends on LOADFONT || SETFONT
43//config:
44//config:config FEATURE_LOADFONT_PSF2
45//config: bool "Support for PSF2 console fonts"
46//config: default y
47//config: depends on LOADFONT || SETFONT
48//config: help
49//config: Support PSF2 console fonts.
50//config:
51//config:config FEATURE_LOADFONT_RAW
52//config: bool "Support for old (raw) console fonts"
53//config: default y
54//config: depends on LOADFONT || SETFONT
55//config: help
56//config: Support old (raw) console fonts.
57
58//applet:IF_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
59//applet:IF_SETFONT(APPLET(setfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
60
61//kbuild:lib-$(CONFIG_LOADFONT) += loadfont.o
62//kbuild:lib-$(CONFIG_SETFONT) += loadfont.o
12 63
13//usage:#define loadfont_trivial_usage 64//usage:#define loadfont_trivial_usage
14//usage: "< font" 65//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config LOADKMAP
10//config: bool "loadkmap"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: This program loads a keyboard translation table from
15//config: standard input.
16
17//applet:IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_LOADKMAP) += loadkmap.o
9 20
10//usage:#define loadkmap_trivial_usage 21//usage:#define loadkmap_trivial_usage
11//usage: "< keymap" 22//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config OPENVT
11//config: bool "openvt"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: This program is used to start a command on an unused
16//config: virtual terminal.
17
18//applet:IF_OPENVT(APPLET(openvt, BB_DIR_USR_BIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_OPENVT) += openvt.o
10 21
11//usage:#define openvt_trivial_usage 22//usage:#define openvt_trivial_usage
12//usage: "[-c N] [-sw] [PROG ARGS]" 23//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10/* "Standard" version of this tool is in ncurses package */
10 11
11/* BTW, which "standard" package has this utility? It doesn't seem 12//config:config RESET
12 * to be ncurses, coreutils, console-tools... then what? */ 13//config: bool "reset"
14//config: default y
15//config: help
16//config: This program is used to reset the terminal screen, if it
17//config: gets messed up.
18
19//applet:IF_RESET(APPLET(reset, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_RESET) += reset.o
13 22
14//usage:#define reset_trivial_usage 23//usage:#define reset_trivial_usage
15//usage: "" 24//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9/* no options, no getopt */ 9//config:config RESIZE
10//config: bool "resize"
11//config: default y
12//config: help
13//config: This program is used to (re)set the width and height of your current
14//config: terminal.
15//config:
16//config:config FEATURE_RESIZE_PRINT
17//config: bool "Print environment variables"
18//config: default y
19//config: depends on RESIZE
20//config: help
21//config: Prints the newly set size (number of columns and rows) of
22//config: the terminal.
23//config: E.g.:
24//config: COLUMNS=80;LINES=44;export COLUMNS LINES;
25
26//applet:IF_RESIZE(APPLET(resize, BB_DIR_USR_BIN, BB_SUID_DROP))
27
28//kbuild:lib-$(CONFIG_RESIZE) += resize.o
10 29
11//usage:#define resize_trivial_usage 30//usage:#define resize_trivial_usage
12//usage: "" 31//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config SETCONSOLE
11//config: bool "setconsole"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: This program redirects the system console to another device,
16//config: like the current tty while logged in via telnet.
17//config:
18//config:config FEATURE_SETCONSOLE_LONG_OPTIONS
19//config: bool "Enable long options"
20//config: default y
21//config: depends on SETCONSOLE && LONG_OPTS
22//config: help
23//config: Support long options for the setconsole applet.
24
25//applet:IF_SETCONSOLE(APPLET(setconsole, BB_DIR_SBIN, BB_SUID_DROP))
26
27//kbuild:lib-$(CONFIG_SETCONSOLE) += setconsole.o
10 28
11//usage:#define setconsole_trivial_usage 29//usage:#define setconsole_trivial_usage
12//usage: "[-r" IF_FEATURE_SETCONSOLE_LONG_OPTIONS("|--reset") "] [DEVICE]" 30//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 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11//config:config SETKEYCODES
12//config: bool "setkeycodes"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: This program loads entries into the kernel's scancode-to-keycode
17//config: map, allowing unusual keyboards to generate usable keycodes.
18
19//applet:IF_SETKEYCODES(APPLET(setkeycodes, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_SETKEYCODES) += setkeycodes.o
11 22
12//usage:#define setkeycodes_trivial_usage 23//usage:#define setkeycodes_trivial_usage
13//usage: "SCANCODE KEYCODE..." 24//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 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11//config:config SETLOGCONS
12//config: bool "setlogcons"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: This program redirects the output console of kernel messages.
17
18//applet:IF_SETLOGCONS(APPLET(setlogcons, BB_DIR_USR_SBIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_SETLOGCONS) += setlogcons.o
11 21
12//usage:#define setlogcons_trivial_usage 22//usage:#define setlogcons_trivial_usage
13//usage: "[N]" 23//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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config SHOWKEY
10//config: bool "showkey"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: Shows keys pressed.
15
16//applet:IF_SHOWKEY(APPLET(showkey, BB_DIR_USR_BIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_SHOWKEY) += showkey.o
9 19
10//usage:#define showkey_trivial_usage 20//usage:#define showkey_trivial_usage
11//usage: "[-a | -k | -s]" 21//usage: "[-a | -k | -s]"
diff --git a/coreutils/Config.src b/coreutils/Config.src
index b9dde1209..c056320f8 100644
--- a/coreutils/Config.src
+++ b/coreutils/Config.src
@@ -7,656 +7,6 @@ menu "Coreutils"
7 7
8INSERT 8INSERT
9 9
10config CAL
11 bool "cal"
12 default y
13 help
14 cal is used to display a monthly calendar.
15
16config CATV
17 bool "catv"
18 default y
19 help
20 Display nonprinting characters as escape sequences (like some
21 implementations' cat -v option).
22
23config CHGRP
24 bool "chgrp"
25 default y
26 help
27 chgrp is used to change the group ownership of files.
28
29config CHMOD
30 bool "chmod"
31 default y
32 help
33 chmod is used to change the access permission of files.
34
35config CHOWN
36 bool "chown"
37 default y
38 help
39 chown is used to change the user and/or group ownership
40 of files.
41
42config FEATURE_CHOWN_LONG_OPTIONS
43 bool "Enable long options"
44 default y
45 depends on CHOWN && LONG_OPTS
46 help
47 Enable use of long options
48
49config CHROOT
50 bool "chroot"
51 default y
52 help
53 chroot is used to change the root directory and run a command.
54 The default command is `/bin/sh'.
55
56config CKSUM
57 bool "cksum"
58 default y
59 help
60 cksum is used to calculate the CRC32 checksum of a file.
61
62config COMM
63 bool "comm"
64 default y
65 help
66 comm is used to compare two files line by line and return
67 a three-column output.
68
69config CP
70 bool "cp"
71 default y
72 help
73 cp is used to copy files and directories.
74
75config FEATURE_CP_LONG_OPTIONS
76 bool "Enable long options for cp"
77 default y
78 depends on CP && LONG_OPTS
79 help
80 Enable long options for cp.
81 Also add support for --parents option.
82
83config CUT
84 bool "cut"
85 default y
86 help
87 cut is used to print selected parts of lines from
88 each file to stdout.
89
90config DF
91 bool "df"
92 default y
93 help
94 df reports the amount of disk space used and available
95 on filesystems.
96
97config FEATURE_DF_FANCY
98 bool "Enable -a, -i, -B"
99 default y
100 depends on DF
101 help
102 This option enables -a, -i and -B.
103
104 -a Show all filesystems
105 -i Inodes
106 -B <SIZE> Blocksize
107
108config DIRNAME
109 bool "dirname"
110 default y
111 help
112 dirname is used to strip a non-directory suffix from
113 a file name.
114
115config DOS2UNIX
116 bool "dos2unix/unix2dos"
117 default y
118 help
119 dos2unix is used to convert a text file from DOS format to
120 UNIX format, and vice versa.
121
122config UNIX2DOS
123 bool
124 default y
125 depends on DOS2UNIX
126 help
127 unix2dos is used to convert a text file from UNIX format to
128 DOS format, and vice versa.
129
130config DU
131 bool "du (default blocksize of 512 bytes)"
132 default y
133 help
134 du is used to report the amount of disk space used
135 for specified files.
136
137config FEATURE_DU_DEFAULT_BLOCKSIZE_1K
138 bool "Use a default blocksize of 1024 bytes (1K)"
139 default y
140 depends on DU
141 help
142 Use a blocksize of (1K) instead of the default 512b.
143
144config ECHO
145 bool "echo (basic SuSv3 version taking no options)"
146 default y
147 help
148 echo is used to print a specified string to stdout.
149
150# this entry also appears in shell/Config.in, next to the echo builtin
151config FEATURE_FANCY_ECHO
152 bool "Enable echo options (-n and -e)"
153 default y
154 depends on ECHO || ASH_BUILTIN_ECHO || HUSH
155 help
156 This adds options (-n and -e) to echo.
157
158config ENV
159 bool "env"
160 default y
161 help
162 env is used to set an environment variable and run
163 a command; without options it displays the current
164 environment.
165
166config FEATURE_ENV_LONG_OPTIONS
167 bool "Enable long options"
168 default y
169 depends on ENV && LONG_OPTS
170 help
171 Support long options for the env applet.
172
173config EXPAND
174 bool "expand"
175 default y
176 help
177 By default, convert all tabs to spaces.
178
179config FEATURE_EXPAND_LONG_OPTIONS
180 bool "Enable long options"
181 default y
182 depends on EXPAND && LONG_OPTS
183 help
184 Support long options for the expand applet.
185
186config EXPR
187 bool "expr"
188 default y
189 help
190 expr is used to calculate numbers and print the result
191 to standard output.
192
193config EXPR_MATH_SUPPORT_64
194 bool "Extend Posix numbers support to 64 bit"
195 default y
196 depends on EXPR
197 help
198 Enable 64-bit math support in the expr applet. This will make
199 the applet slightly larger, but will allow computation with very
200 large numbers.
201
202config FALSE
203 bool "false"
204 default y
205 help
206 false returns an exit code of FALSE (1).
207
208config FOLD
209 bool "fold"
210 default y
211 help
212 Wrap text to fit a specific width.
213
214config FSYNC
215 bool "fsync"
216 default y
217 help
218 fsync is used to flush file-related cached blocks to disk.
219
220config HEAD
221 bool "head"
222 default y
223 help
224 head is used to print the first specified number of lines
225 from files.
226
227config FEATURE_FANCY_HEAD
228 bool "Enable head options (-c, -q, and -v)"
229 default y
230 depends on HEAD
231 help
232 This enables the head options (-c, -q, and -v).
233
234config INSTALL
235 bool "install"
236 default y
237 help
238 Copy files and set attributes.
239
240config FEATURE_INSTALL_LONG_OPTIONS
241 bool "Enable long options"
242 default y
243 depends on INSTALL && LONG_OPTS
244 help
245 Support long options for the install applet.
246
247####config LENGTH
248#### bool "length"
249#### default y
250#### help
251#### length is used to print out the length of a specified string.
252
253config LN
254 bool "ln"
255 default y
256 help
257 ln is used to create hard or soft links between files.
258
259config LOGNAME
260 bool "logname"
261 default y
262 help
263 logname is used to print the current user's login name.
264
265config LS
266 bool "ls"
267 default y
268 help
269 ls is used to list the contents of directories.
270
271config FEATURE_LS_FILETYPES
272 bool "Enable filetyping options (-p and -F)"
273 default y
274 depends on LS
275 help
276 Enable the ls options (-p and -F).
277
278config FEATURE_LS_FOLLOWLINKS
279 bool "Enable symlinks dereferencing (-L)"
280 default y
281 depends on LS
282 help
283 Enable the ls option (-L).
284
285config FEATURE_LS_RECURSIVE
286 bool "Enable recursion (-R)"
287 default y
288 depends on LS
289 help
290 Enable the ls option (-R).
291
292config FEATURE_LS_SORTFILES
293 bool "Sort the file names"
294 default y
295 depends on LS
296 help
297 Allow ls to sort file names alphabetically.
298
299config FEATURE_LS_TIMESTAMPS
300 bool "Show file timestamps"
301 default y
302 depends on LS
303 help
304 Allow ls to display timestamps for files.
305
306config FEATURE_LS_USERNAME
307 bool "Show username/groupnames"
308 default y
309 depends on LS
310 help
311 Allow ls to display username/groupname for files.
312
313config FEATURE_LS_COLOR
314 bool "Allow use of color to identify file types"
315 default y
316 depends on LS && LONG_OPTS
317 help
318 This enables the --color option to ls.
319
320config FEATURE_LS_COLOR_IS_DEFAULT
321 bool "Produce colored ls output by default"
322 default y
323 depends on FEATURE_LS_COLOR
324 help
325 Saying yes here will turn coloring on by default,
326 even if no "--color" option is given to the ls command.
327 This is not recommended, since the colors are not
328 configurable, and the output may not be legible on
329 many output screens.
330
331config MKDIR
332 bool "mkdir"
333 default y
334 help
335 mkdir is used to create directories with the specified names.
336
337config FEATURE_MKDIR_LONG_OPTIONS
338 bool "Enable long options"
339 default y
340 depends on MKDIR && LONG_OPTS
341 help
342 Support long options for the mkdir applet.
343
344config MKFIFO
345 bool "mkfifo"
346 default y
347 help
348 mkfifo is used to create FIFOs (named pipes).
349 The `mknod' program can also create FIFOs.
350
351config MKNOD
352 bool "mknod"
353 default y
354 help
355 mknod is used to create FIFOs or block/character special
356 files with the specified names.
357
358config MV
359 bool "mv"
360 default y
361 help
362 mv is used to move or rename files or directories.
363
364config FEATURE_MV_LONG_OPTIONS
365 bool "Enable long options"
366 default y
367 depends on MV && LONG_OPTS
368 help
369 Support long options for the mv applet.
370
371config NICE
372 bool "nice"
373 default y
374 help
375 nice runs a program with modified scheduling priority.
376
377config NOHUP
378 bool "nohup"
379 default y
380 help
381 run a command immune to hangups, with output to a non-tty.
382
383config OD
384 bool "od"
385 default y
386 help
387 od is used to dump binary files in octal and other formats.
388
389config PRINTENV
390 bool "printenv"
391 default y
392 help
393 printenv is used to print all or part of environment.
394
395config PRINTF
396 bool "printf"
397 default y
398 help
399 printf is used to format and print specified strings.
400 It's similar to `echo' except it has more options.
401
402config PWD
403 bool "pwd"
404 default y
405 help
406 pwd is used to print the current directory.
407
408config READLINK
409 bool "readlink"
410 default y
411 help
412 This program reads a symbolic link and returns the name
413 of the file it points to
414
415config FEATURE_READLINK_FOLLOW
416 bool "Enable canonicalization by following all symlinks (-f)"
417 default y
418 depends on READLINK
419 help
420 Enable the readlink option (-f).
421
422config REALPATH
423 bool "realpath"
424 default y
425 help
426 Return the canonicalized absolute pathname.
427 This isn't provided by GNU shellutils, but where else does it belong.
428
429config RM
430 bool "rm"
431 default y
432 help
433 rm is used to remove files or directories.
434
435config RMDIR
436 bool "rmdir"
437 default y
438 help
439 rmdir is used to remove empty directories.
440
441config FEATURE_RMDIR_LONG_OPTIONS
442 bool "Enable long options"
443 default y
444 depends on RMDIR && LONG_OPTS
445 help
446 Support long options for the rmdir applet, including
447 --ignore-fail-on-non-empty for compatibility with GNU rmdir.
448
449config SEQ
450 bool "seq"
451 default y
452 help
453 print a sequence of numbers
454
455config SLEEP
456 bool "sleep"
457 default y
458 help
459 sleep is used to pause for a specified number of seconds.
460 It comes in 3 versions:
461 - small: takes one integer parameter
462 - fancy: takes multiple integer arguments with suffixes:
463 sleep 1d 2h 3m 15s
464 - fancy with fractional numbers:
465 sleep 2.3s 4.5h sleeps for 16202.3 seconds
466 Last one is "the most compatible" with coreutils sleep,
467 but it adds around 1k of code.
468
469config FEATURE_FANCY_SLEEP
470 bool "Enable multiple arguments and s/m/h/d suffixes"
471 default y
472 depends on SLEEP
473 help
474 Allow sleep to pause for specified minutes, hours, and days.
475
476config FEATURE_FLOAT_SLEEP
477 bool "Enable fractional arguments"
478 default y
479 depends on FEATURE_FANCY_SLEEP
480 help
481 Allow for fractional numeric parameters.
482
483config SORT
484 bool "sort"
485 default y
486 help
487 sort is used to sort lines of text in specified files.
488
489config FEATURE_SORT_BIG
490 bool "Full SuSv3 compliant sort (support -ktcsbdfiozgM)"
491 default y
492 depends on SORT
493 help
494 Without this, sort only supports -r, -u, and an integer version
495 of -n. Selecting this adds sort keys, floating point support, and
496 more. This adds a little over 3k to a nonstatic build on x86.
497
498 The SuSv3 sort standard is available at:
499 http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
500
501config SPLIT
502 bool "split"
503 default y
504 help
505 split a file into pieces.
506
507config FEATURE_SPLIT_FANCY
508 bool "Fancy extensions"
509 default y
510 depends on SPLIT
511 help
512 Add support for features not required by SUSv3.
513 Supports additional suffixes 'b' for 512 bytes,
514 'g' for 1GiB for the -b option.
515
516config STTY
517 bool "stty"
518 default y
519 help
520 stty is used to change and print terminal line settings.
521
522config SUM
523 bool "sum"
524 default y
525 help
526 checksum and count the blocks in a file
527
528config TAC
529 bool "tac"
530 default y
531 help
532 tac is used to concatenate and print files in reverse.
533
534config TAIL
535 bool "tail"
536 default y
537 help
538 tail is used to print the last specified number of lines
539 from files.
540
541config FEATURE_FANCY_TAIL
542 bool "Enable extra tail options (-q, -s, -v, and -F)"
543 default y
544 depends on TAIL
545 help
546 The options (-q, -s, -v and -F) are provided by GNU tail, but
547 are not specific in the SUSv3 standard.
548
549 -q Never output headers giving file names
550 -s SEC Wait SEC seconds between reads with -f
551 -v Always output headers giving file names
552 -F Same as -f, but keep retrying
553
554config TEE
555 bool "tee"
556 default y
557 help
558 tee is used to read from standard input and write
559 to standard output and files.
560
561config FEATURE_TEE_USE_BLOCK_IO
562 bool "Enable block I/O (larger/faster) instead of byte I/O"
563 default y
564 depends on TEE
565 help
566 Enable this option for a faster tee, at expense of size.
567
568config TRUE
569 bool "true"
570 default y
571 help
572 true returns an exit code of TRUE (0).
573
574config TTY
575 bool "tty"
576 default y
577 help
578 tty is used to print the name of the current terminal to
579 standard output.
580
581config UNAME
582 bool "uname"
583 default y
584 help
585 uname is used to print system information.
586
587config UNAME_OSNAME
588 string "Operating system name"
589 default "GNU/Linux"
590 depends on UNAME
591 help
592 Sets the operating system name reported by uname -o. The
593 default is "GNU/Linux".
594
595config UNEXPAND
596 bool "unexpand"
597 default y
598 help
599 By default, convert only leading sequences of blanks to tabs.
600
601config FEATURE_UNEXPAND_LONG_OPTIONS
602 bool "Enable long options"
603 default y
604 depends on UNEXPAND && LONG_OPTS
605 help
606 Support long options for the unexpand applet.
607
608config UNIQ
609 bool "uniq"
610 default y
611 help
612 uniq is used to remove duplicate lines from a sorted file.
613
614config USLEEP
615 bool "usleep"
616 default y
617 help
618 usleep is used to pause for a specified number of microseconds.
619
620config UUDECODE
621 bool "uudecode"
622 default y
623 help
624 uudecode is used to decode a uuencoded file.
625
626config UUENCODE
627 bool "uuencode"
628 default y
629 help
630 uuencode is used to uuencode a file.
631
632config WC
633 bool "wc"
634 default y
635 help
636 wc is used to print the number of bytes, words, and lines,
637 in specified files.
638
639config FEATURE_WC_LARGE
640 bool "Support very large files in wc"
641 default y
642 depends on WC
643 help
644 Use "unsigned long long" in wc for counter variables.
645
646config WHOAMI
647 bool "whoami"
648 default y
649 help
650 whoami is used to print the username of the current
651 user id (same as id -un).
652
653config YES
654 bool "yes"
655 default y
656 help
657 yes is used to repeatedly output a specific string, or
658 the default string `y'.
659
660comment "Common options" 10comment "Common options"
661 11
662config FEATURE_VERBOSE 12config FEATURE_VERBOSE
diff --git a/coreutils/Kbuild.src b/coreutils/Kbuild.src
index 5a64fee35..8e2c097a3 100644
--- a/coreutils/Kbuild.src
+++ b/coreutils/Kbuild.src
@@ -9,70 +9,13 @@ libs-y += libcoreutils/
9lib-y:= 9lib-y:=
10 10
11INSERT 11INSERT
12lib-$(CONFIG_CAL) += cal.o 12
13lib-$(CONFIG_CATV) += catv.o 13lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty
14lib-$(CONFIG_CHGRP) += chgrp.o chown.o 14lib-$(CONFIG_LESS) += cat.o # less too
15lib-$(CONFIG_CHMOD) += chmod.o 15lib-$(CONFIG_CRONTAB) += cat.o # crontab -l
16lib-$(CONFIG_CHOWN) += chown.o
17lib-$(CONFIG_ADDUSER) += chown.o # used by adduser 16lib-$(CONFIG_ADDUSER) += chown.o # used by adduser
18lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser 17lib-$(CONFIG_ADDGROUP) += chown.o # used by adduser
19lib-$(CONFIG_CHROOT) += chroot.o 18lib-$(CONFIG_ASH) += echo.o # used by ash
20lib-$(CONFIG_CKSUM) += cksum.o 19lib-$(CONFIG_HUSH) += echo.o # used by hush
21lib-$(CONFIG_COMM) += comm.o 20lib-$(CONFIG_FTPD) += ls.o # used by ftpd
22lib-$(CONFIG_CP) += cp.o
23lib-$(CONFIG_CUT) += cut.o
24lib-$(CONFIG_DD) += dd.o
25lib-$(CONFIG_DF) += df.o
26lib-$(CONFIG_DIRNAME) += dirname.o
27lib-$(CONFIG_DOS2UNIX) += dos2unix.o
28lib-$(CONFIG_DU) += du.o
29lib-$(CONFIG_ECHO) += echo.o
30lib-$(CONFIG_ASH) += echo.o # used by ash
31lib-$(CONFIG_HUSH) += echo.o # used by hush
32lib-$(CONFIG_ENV) += env.o
33lib-$(CONFIG_EXPR) += expr.o
34lib-$(CONFIG_EXPAND) += expand.o
35lib-$(CONFIG_FALSE) += false.o
36lib-$(CONFIG_FOLD) += fold.o
37lib-$(CONFIG_FSYNC) += fsync.o
38lib-$(CONFIG_INSTALL) += install.o
39#lib-$(CONFIG_LENGTH) += length.o
40lib-$(CONFIG_LN) += ln.o
41lib-$(CONFIG_LOGNAME) += logname.o
42lib-$(CONFIG_LS) += ls.o
43lib-$(CONFIG_FTPD) += ls.o
44lib-$(CONFIG_MKDIR) += mkdir.o
45lib-$(CONFIG_MKFIFO) += mkfifo.o
46lib-$(CONFIG_MKNOD) += mknod.o
47lib-$(CONFIG_MV) += mv.o
48lib-$(CONFIG_NICE) += nice.o
49lib-$(CONFIG_NOHUP) += nohup.o
50lib-$(CONFIG_OD) += od.o
51lib-$(CONFIG_PRINTENV) += printenv.o
52lib-$(CONFIG_PRINTF) += printf.o
53lib-$(CONFIG_ASH_BUILTIN_PRINTF) += printf.o 21lib-$(CONFIG_ASH_BUILTIN_PRINTF) += printf.o
54lib-$(CONFIG_PWD) += pwd.o
55lib-$(CONFIG_READLINK) += readlink.o
56lib-$(CONFIG_REALPATH) += realpath.o
57lib-$(CONFIG_RM) += rm.o
58lib-$(CONFIG_RMDIR) += rmdir.o
59lib-$(CONFIG_SEQ) += seq.o
60lib-$(CONFIG_SLEEP) += sleep.o
61lib-$(CONFIG_SPLIT) += split.o
62lib-$(CONFIG_SORT) += sort.o
63lib-$(CONFIG_STAT) += stat.o
64lib-$(CONFIG_STTY) += stty.o
65lib-$(CONFIG_SUM) += sum.o
66lib-$(CONFIG_TAC) += tac.o
67lib-$(CONFIG_TEE) += tee.o
68lib-$(CONFIG_TRUE) += true.o
69lib-$(CONFIG_TTY) += tty.o
70lib-$(CONFIG_UNAME) += uname.o
71lib-$(CONFIG_UNEXPAND) += expand.o
72lib-$(CONFIG_UNIQ) += uniq.o
73lib-$(CONFIG_USLEEP) += usleep.o
74lib-$(CONFIG_UUDECODE) += uudecode.o
75lib-$(CONFIG_UUENCODE) += uuencode.o
76lib-$(CONFIG_WC) += wc.o
77lib-$(CONFIG_WHOAMI) += whoami.o
78lib-$(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 @@
14 * 2) Don't check for options, as per SUSv3. 14 * 2) Don't check for options, as per SUSv3.
15 * 3) Save some space by using strcmp(). Calling strncmp() here was silly. 15 * 3) Save some space by using strcmp(). Calling strncmp() here was silly.
16 */ 16 */
17
18/* BB_AUDIT SUSv3 compliant */
19/* http://www.opengroup.org/onlinepubs/007904975/utilities/basename.html */
20
21//kbuild:lib-$(CONFIG_BASENAME) += basename.o
22
23//config:config BASENAME 17//config:config BASENAME
24//config: bool "basename" 18//config: bool "basename"
25//config: default y 19//config: default y
@@ -28,6 +22,13 @@
28//config: leaving just the filename itself. Enable this option if you wish 22//config: leaving just the filename itself. Enable this option if you wish
29//config: to enable the 'basename' utility. 23//config: to enable the 'basename' utility.
30 24
25//applet:IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename))
26
27//kbuild:lib-$(CONFIG_BASENAME) += basename.o
28
29/* BB_AUDIT SUSv3 compliant */
30/* http://www.opengroup.org/onlinepubs/007904975/utilities/basename.html */
31
31//usage:#define basename_trivial_usage 32//usage:#define basename_trivial_usage
32//usage: "FILE [SUFFIX]" 33//usage: "FILE [SUFFIX]"
33//usage:#define basename_full_usage "\n\n" 34//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
10 *
11 * Major size reduction... over 50% (>1.5k) on i386.
12 */
13//config:config CAL
14//config: bool "cal"
15//config: default y
16//config: help
17//config: cal is used to display a monthly calendar.
18
19//applet:IF_CAL(APPLET(cal, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_CAL) += cal.o
9 22
10/* BB_AUDIT SUSv3 compliant with -j and -y extensions (from util-linux). */ 23/* BB_AUDIT SUSv3 compliant with -j and -y extensions (from util-linux). */
11/* BB_AUDIT BUG: The output of 'cal -j 1752' is incorrect. The upstream 24/* BB_AUDIT BUG: The output of 'cal -j 1752' is incorrect. The upstream
12 * BB_AUDIT BUG: version in util-linux seems to be broken as well. */ 25 * BB_AUDIT BUG: version in util-linux seems to be broken as well. */
13/* http://www.opengroup.org/onlinepubs/007904975/utilities/cal.html */ 26/* http://www.opengroup.org/onlinepubs/007904975/utilities/cal.html */
14 27
15/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
16 *
17 * Major size reduction... over 50% (>1.5k) on i386.
18 */
19
20//usage:#define cal_trivial_usage 28//usage:#define cal_trivial_usage
21//usage: "[-jy] [[MONTH] YEAR]" 29//usage: "[-jy] [[MONTH] YEAR]"
22//usage:#define cal_full_usage "\n\n" 30//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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9
10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
12
13//kbuild:lib-$(CONFIG_CAT) += cat.o
14//kbuild:lib-$(CONFIG_MORE) += cat.o # more uses it if stdout isn't a tty
15//kbuild:lib-$(CONFIG_LESS) += cat.o # less too
16//kbuild:lib-$(CONFIG_CRONTAB) += cat.o # crontab -l
17
18//config:config CAT 9//config:config CAT
19//config: bool "cat" 10//config: bool "cat"
20//config: default y 11//config: default y
@@ -22,6 +13,13 @@
22//config: cat is used to concatenate files and print them to the standard 13//config: cat is used to concatenate files and print them to the standard
23//config: output. Enable this option if you wish to enable the 'cat' utility. 14//config: output. Enable this option if you wish to enable the 'cat' utility.
24 15
16//applet:IF_CAT(APPLET_NOFORK(cat, cat, BB_DIR_BIN, BB_SUID_DROP, cat))
17
18//kbuild:lib-$(CONFIG_CAT) += cat.o
19
20/* BB_AUDIT SUSv3 compliant */
21/* http://www.opengroup.org/onlinepubs/007904975/utilities/cat.html */
22
25//usage:#define cat_trivial_usage 23//usage:#define cat_trivial_usage
26//usage: "[FILE]..." 24//usage: "[FILE]..."
27//usage:#define cat_full_usage "\n\n" 25//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 @@
10/* See "Cat -v considered harmful" at 10/* See "Cat -v considered harmful" at
11 * http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */ 11 * http://cm.bell-labs.com/cm/cs/doc/84/kp.ps.gz */
12 12
13//config:config CATV
14//config: bool "catv"
15//config: default y
16//config: help
17//config: Display nonprinting characters as escape sequences (like some
18//config: implementations' cat -v option).
19
20//applet:IF_CATV(APPLET(catv, BB_DIR_BIN, BB_SUID_DROP))
21
22//kbuild:lib-$(CONFIG_CATV) += catv.o
23
13//usage:#define catv_trivial_usage 24//usage:#define catv_trivial_usage
14//usage: "[-etv] [FILE]..." 25//usage: "[-etv] [FILE]..."
15//usage:#define catv_full_usage "\n\n" 26//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config CHGRP
10//config: bool "chgrp"
11//config: default y
12//config: help
13//config: chgrp is used to change the group ownership of files.
14
15//applet:IF_CHGRP(APPLET_NOEXEC(chgrp, chgrp, BB_DIR_BIN, BB_SUID_DROP, chgrp))
16
17//kbuild:lib-$(CONFIG_CHGRP) += chgrp.o chown.o
9 18
10/* BB_AUDIT SUSv3 defects - none? */ 19/* BB_AUDIT SUSv3 defects - none? */
11/* BB_AUDIT GNU defects - unsupported long options. */ 20/* 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 @@
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12//config:config CHMOD
13//config: bool "chmod"
14//config: default y
15//config: help
16//config: chmod is used to change the access permission of files.
17
18//applet:IF_CHMOD(APPLET_NOEXEC(chmod, chmod, BB_DIR_BIN, BB_SUID_DROP, chmod))
19
20//kbuild:lib-$(CONFIG_CHMOD) += chmod.o
12 21
13/* BB_AUDIT SUSv3 compliant */ 22/* BB_AUDIT SUSv3 compliant */
14/* BB_AUDIT GNU defects - unsupported long options. */ 23/* 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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config CHOWN
10//config: bool "chown"
11//config: default y
12//config: help
13//config: chown is used to change the user and/or group ownership
14//config: of files.
15//config:
16//config:config FEATURE_CHOWN_LONG_OPTIONS
17//config: bool "Enable long options"
18//config: default y
19//config: depends on CHOWN && LONG_OPTS
20//config: help
21//config: Enable use of long options
22
23//applet:IF_CHOWN(APPLET_NOEXEC(chown, chown, BB_DIR_BIN, BB_SUID_DROP, chown))
24
25//kbuild:lib-$(CONFIG_CHOWN) += chown.o
9 26
10/* BB_AUDIT SUSv3 defects - none? */ 27/* BB_AUDIT SUSv3 defects - none? */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/chown.html */ 28/* 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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config CHROOT
10//config: bool "chroot"
11//config: default y
12//config: help
13//config: chroot is used to change the root directory and run a command.
14//config: The default command is `/bin/sh'.
15
16//applet:IF_CHROOT(APPLET(chroot, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_CHROOT) += chroot.o
9 19
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 20/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11 21
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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config CKSUM
10//config: bool "cksum"
11//config: default y
12//config: help
13//config: cksum is used to calculate the CRC32 checksum of a file.
14
15//applet:IF_CKSUM(APPLET_NOEXEC(cksum, cksum, BB_DIR_USR_BIN, BB_SUID_DROP, cksum))
16
17//kbuild:lib-$(CONFIG_CKSUM) += cksum.o
9 18
10//usage:#define cksum_trivial_usage 19//usage:#define cksum_trivial_usage
11//usage: "FILES..." 20//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config COMM
10//config: bool "comm"
11//config: default y
12//config: help
13//config: comm is used to compare two files line by line and return
14//config: a three-column output.
15
16//applet:IF_COMM(APPLET(comm, BB_DIR_USR_BIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_COMM) += comm.o
9 19
10//usage:#define comm_trivial_usage 20//usage:#define comm_trivial_usage
11//usage: "[-123] FILE1 FILE2" 21//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/cp.html */
12
13/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 10/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
14 * 11 *
15 * Size reduction. 12 * Size reduction.
16 */ 13 */
14//config:config CP
15//config: bool "cp"
16//config: default y
17//config: help
18//config: cp is used to copy files and directories.
19//config:
20//config:config FEATURE_CP_LONG_OPTIONS
21//config: bool "Enable long options for cp"
22//config: default y
23//config: depends on CP && LONG_OPTS
24//config: help
25//config: Enable long options for cp.
26//config: Also add support for --parents option.
27
28//applet:IF_CP(APPLET_NOEXEC(cp, cp, BB_DIR_BIN, BB_SUID_DROP, cp))
29
30//kbuild:lib-$(CONFIG_CP) += cp.o
31
32/* http://www.opengroup.org/onlinepubs/007904975/utilities/cp.html */
17 33
18//usage:#define cp_trivial_usage 34//usage:#define cp_trivial_usage
19//usage: "[OPTIONS] SOURCE... DEST" 35//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 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11//config:config CUT
12//config: bool "cut"
13//config: default y
14//config: help
15//config: cut is used to print selected parts of lines from
16//config: each file to stdout.
17
18//applet:IF_CUT(APPLET_NOEXEC(cut, cut, BB_DIR_USR_BIN, BB_SUID_DROP, cut))
19
20//kbuild:lib-$(CONFIG_CUT) += cut.o
11 21
12//usage:#define cut_trivial_usage 22//usage:#define cut_trivial_usage
13//usage: "[OPTIONS] [FILE]..." 23//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 @@
8 * bugfixes and cleanup by Bernhard Reutner-Fischer 8 * bugfixes and cleanup by Bernhard Reutner-Fischer
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11*/ 11 */
12
13/* This 'date' command supports only 2 time setting formats, 12/* This 'date' command supports only 2 time setting formats,
14 all the GNU strftime stuff (its in libc, lets use it), 13 all the GNU strftime stuff (its in libc, lets use it),
15 setting time using UTC and displaying it, as well as 14 setting time using UTC and displaying it, as well as
@@ -19,10 +18,6 @@
19/* Input parsing code is always bulky - used heavy duty libc stuff as 18/* Input parsing code is always bulky - used heavy duty libc stuff as
20 much as possible, missed out a lot of bounds checking */ 19 much as possible, missed out a lot of bounds checking */
21 20
22//applet:IF_DATE(APPLET(date, BB_DIR_BIN, BB_SUID_DROP))
23
24//kbuild:lib-$(CONFIG_DATE) += date.o
25
26//config:config DATE 21//config:config DATE
27//config: bool "date" 22//config: bool "date"
28//config: default y 23//config: default y
@@ -63,6 +58,10 @@
63//config: the same format. With it on, 'date DATE' additionally supports 58//config: the same format. With it on, 'date DATE' additionally supports
64//config: MMDDhhmm[[YY]YY][.ss] format. 59//config: MMDDhhmm[[YY]YY][.ss] format.
65 60
61//applet:IF_DATE(APPLET(date, BB_DIR_BIN, BB_SUID_DROP))
62
63//kbuild:lib-$(CONFIG_DATE) += date.o
64
66/* GNU coreutils 6.9 man page: 65/* GNU coreutils 6.9 man page:
67 * date [OPTION]... [+FORMAT] 66 * date [OPTION]... [+FORMAT]
68 * date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]] 67 * date [-u|--utc|--universal] [MMDDhhmm[[CC]YY][.ss]]
diff --git a/coreutils/dd.c b/coreutils/dd.c
index 00139773e..8c144cfd2 100644
--- a/coreutils/dd.c
+++ b/coreutils/dd.c
@@ -2,12 +2,10 @@
2/* 2/*
3 * Mini dd implementation for busybox 3 * Mini dd implementation for busybox
4 * 4 *
5 *
6 * Copyright (C) 2000,2001 Matt Kraai 5 * Copyright (C) 2000,2001 Matt Kraai
7 * 6 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 8 */
10
11//config:config DD 9//config:config DD
12//config: bool "dd" 10//config: bool "dd"
13//config: default y 11//config: default y
@@ -53,6 +51,10 @@
53//config: help 51//config: help
54//config: Enables support for status=noxfer/none option. 52//config: Enables support for status=noxfer/none option.
55 53
54//applet:IF_DD(APPLET_NOEXEC(dd, dd, BB_DIR_BIN, BB_SUID_DROP, dd))
55
56//kbuild:lib-$(CONFIG_DD) += dd.o
57
56//usage:#define dd_trivial_usage 58//usage:#define dd_trivial_usage
57//usage: "[if=FILE] [of=FILE] " IF_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n" 59//usage: "[if=FILE] [of=FILE] " IF_FEATURE_DD_IBS_OBS("[ibs=N] [obs=N] ") "[bs=N] [count=N] [skip=N]\n"
58//usage: " [seek=N]" IF_FEATURE_DD_IBS_OBS(" [conv=notrunc|noerror|sync|fsync] [iflag=skip_bytes]") 60//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11/* BB_AUDIT SUSv3 _NOT_ compliant -- option -t missing. */
12/* http://www.opengroup.org/onlinepubs/007904975/utilities/df.html */
13
14/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 10/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
15 * 11 *
16 * Size reduction. Removed floating point dependency. Added error checking 12 * Size reduction. Removed floating point dependency. Added error checking
@@ -21,6 +17,30 @@
21 * 17 *
22 * Implement -P and -B; better coreutils compat; cleanup 18 * Implement -P and -B; better coreutils compat; cleanup
23 */ 19 */
20//config:config DF
21//config: bool "df"
22//config: default y
23//config: help
24//config: df reports the amount of disk space used and available
25//config: on filesystems.
26//config:
27//config:config FEATURE_DF_FANCY
28//config: bool "Enable -a, -i, -B"
29//config: default y
30//config: depends on DF
31//config: help
32//config: This option enables -a, -i and -B.
33//config:
34//config: -a Show all filesystems
35//config: -i Inodes
36//config: -B <SIZE> Blocksize
37
38//applet:IF_DF(APPLET(df, BB_DIR_BIN, BB_SUID_DROP))
39
40//kbuild:lib-$(CONFIG_DF) += df.o
41
42/* BB_AUDIT SUSv3 _NOT_ compliant -- option -t missing. */
43/* http://www.opengroup.org/onlinepubs/007904975/utilities/df.html */
24 44
25//usage:#define df_trivial_usage 45//usage:#define df_trivial_usage
26//usage: "[-Pk" 46//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config DIRNAME
10//config: bool "dirname"
11//config: default y
12//config: help
13//config: dirname is used to strip a non-directory suffix from
14//config: a file name.
15
16//applet:IF_DIRNAME(APPLET_NOFORK(dirname, dirname, BB_DIR_USR_BIN, BB_SUID_DROP, dirname))
17
18//kbuild:lib-$(CONFIG_DIRNAME) += dirname.o
9 19
10/* BB_AUDIT SUSv3 compliant */ 20/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */ 21/* http://www.opengroup.org/onlinepubs/007904975/utilities/dirname.html */
diff --git a/coreutils/dos2unix.c b/coreutils/dos2unix.c
index ccb74a113..6d2347163 100644
--- a/coreutils/dos2unix.c
+++ b/coreutils/dos2unix.c
@@ -10,7 +10,26 @@
10 * dos2unix filters reading input from stdin and writing output to stdout. 10 * dos2unix filters reading input from stdin and writing output to stdout.
11 * 11 *
12 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 12 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
13*/ 13 */
14//config:config DOS2UNIX
15//config: bool "dos2unix"
16//config: default y
17//config: help
18//config: dos2unix is used to convert a text file from DOS format to
19//config: UNIX format, and vice versa.
20//config:
21//config:config UNIX2DOS
22//config: bool "unix2dos"
23//config: default y
24//config: help
25//config: unix2dos is used to convert a text file from UNIX format to
26//config: DOS format, and vice versa.
27
28//applet:IF_DOS2UNIX(APPLET_NOEXEC(dos2unix, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, dos2unix))
29//applet:IF_UNIX2DOS(APPLET_NOEXEC(unix2dos, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, unix2dos))
30
31//kbuild:lib-$(CONFIG_DOS2UNIX) += dos2unix.o
32//kbuild:lib-$(CONFIG_UNIX2DOS) += dos2unix.o
14 33
15//usage:#define dos2unix_trivial_usage 34//usage:#define dos2unix_trivial_usage
16//usage: "[-ud] [FILE]" 35//usage: "[-ud] [FILE]"
@@ -92,9 +111,12 @@ int dos2unix_main(int argc UNUSED_PARAM, char **argv)
92 int o, conv_type; 111 int o, conv_type;
93 112
94 /* See if we are supposed to be doing dos2unix or unix2dos */ 113 /* See if we are supposed to be doing dos2unix or unix2dos */
95 conv_type = CT_UNIX2DOS; 114 if (ENABLE_DOS2UNIX
96 if (applet_name[0] == 'd') { 115 && (!ENABLE_UNIX2DOS || applet_name[0] == 'd')
116 ) {
97 conv_type = CT_DOS2UNIX; 117 conv_type = CT_DOS2UNIX;
118 } else {
119 conv_type = CT_UNIX2DOS;
98 } 120 }
99 121
100 /* -u convert to unix, -d convert to dos */ 122 /* -u convert to unix, -d convert to dos */
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 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11
12/* BB_AUDIT SUSv3 compliant (unless default blocksize set to 1k) */
13/* http://www.opengroup.org/onlinepubs/007904975/utilities/du.html */
14
15/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 11/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
16 * 12 *
17 * Mostly rewritten for SUSv3 compliance and to fix bugs/defects. 13 * Mostly rewritten for SUSv3 compliance and to fix bugs/defects.
@@ -22,6 +18,26 @@
22 * 3) Added error checking of output. 18 * 3) Added error checking of output.
23 * 4) Fixed busybox bug #1284 involving long overflow with human_readable. 19 * 4) Fixed busybox bug #1284 involving long overflow with human_readable.
24 */ 20 */
21//config:config DU
22//config: bool "du (default blocksize of 512 bytes)"
23//config: default y
24//config: help
25//config: du is used to report the amount of disk space used
26//config: for specified files.
27//config:
28//config:config FEATURE_DU_DEFAULT_BLOCKSIZE_1K
29//config: bool "Use a default blocksize of 1024 bytes (1K)"
30//config: default y
31//config: depends on DU
32//config: help
33//config: Use a blocksize of (1K) instead of the default 512b.
34
35//applet:IF_DU(APPLET(du, BB_DIR_USR_BIN, BB_SUID_DROP))
36
37//kbuild:lib-$(CONFIG_DU) += du.o
38
39/* BB_AUDIT SUSv3 compliant (unless default blocksize set to 1k) */
40/* http://www.opengroup.org/onlinepubs/007904975/utilities/du.html */
25 41
26//usage:#define du_trivial_usage 42//usage:#define du_trivial_usage
27//usage: "[-aHLdclsx" IF_FEATURE_HUMAN_READABLE("hm") "k] [FILE]..." 43//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 @@
9 * 9 *
10 * Original copyright notice is retained at the end of this file. 10 * Original copyright notice is retained at the end of this file.
11 */ 11 */
12
13/* BB_AUDIT SUSv3 compliant -- unless configured as fancy echo. */
14/* http://www.opengroup.org/onlinepubs/007904975/utilities/echo.html */
15
16/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 12/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
17 * 13 *
18 * Because of behavioral differences, implemented configurable SUSv3 14 * Because of behavioral differences, implemented configurable SUSv3
@@ -22,6 +18,26 @@
22 * 2) SUSv3 specifies that octal escapes are of the form \0{#{#{#}}}. 18 * 2) SUSv3 specifies that octal escapes are of the form \0{#{#{#}}}.
23 * The previous version did not allow 4-digit octals. 19 * The previous version did not allow 4-digit octals.
24 */ 20 */
21//config:config ECHO
22//config: bool "echo (basic SuSv3 version taking no options)"
23//config: default y
24//config: help
25//config: echo is used to print a specified string to stdout.
26//config:
27//config:# this entry also appears in shell/Config.in, next to the echo builtin
28//config:config FEATURE_FANCY_ECHO
29//config: bool "Enable echo options (-n and -e)"
30//config: default y
31//config: depends on ECHO || ASH_BUILTIN_ECHO || HUSH
32//config: help
33//config: This adds options (-n and -e) to echo.
34
35//applet:IF_ECHO(APPLET_NOFORK(echo, echo, BB_DIR_BIN, BB_SUID_DROP, echo))
36
37//kbuild:lib-$(CONFIG_ECHO) += echo.o
38
39/* BB_AUDIT SUSv3 compliant -- unless configured as fancy echo. */
40/* http://www.opengroup.org/onlinepubs/007904975/utilities/echo.html */
25 41
26//usage:#define echo_trivial_usage 42//usage:#define echo_trivial_usage
27//usage: IF_FEATURE_FANCY_ECHO("[-neE] ") "[ARG]..." 43//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 @@
11 * 11 *
12 * Modified for BusyBox by Erik Andersen <andersen@codepoet.org> 12 * Modified for BusyBox by Erik Andersen <andersen@codepoet.org>
13 */ 13 */
14
15/* BB_AUDIT SUSv3 compliant */
16/* http://www.opengroup.org/onlinepubs/007904975/utilities/env.html */
17
18/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 14/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
19 * 15 *
20 * Fixed bug involving exit return codes if execvp fails. Also added 16 * Fixed bug involving exit return codes if execvp fails. Also added
21 * output error checking. 17 * output error checking.
22 */ 18 */
23
24/* 19/*
25 * Modified by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003 20 * Modified by Vladimir Oleynik <dzo@simtreas.ru> (C) 2003
26 * - correct "-" option usage 21 * - correct "-" option usage
@@ -28,8 +23,27 @@
28 * - GNU long option support 23 * - GNU long option support
29 * - use xfunc_error_retval 24 * - use xfunc_error_retval
30 */ 25 */
26//config:config ENV
27//config: bool "env"
28//config: default y
29//config: help
30//config: env is used to set an environment variable and run
31//config: a command; without options it displays the current
32//config: environment.
33//config:
34//config:config FEATURE_ENV_LONG_OPTIONS
35//config: bool "Enable long options"
36//config: default y
37//config: depends on ENV && LONG_OPTS
38//config: help
39//config: Support long options for the env applet.
31 40
32/* This is a NOEXEC applet. Be very careful! */ 41//applet:IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env))
42
43//kbuild:lib-$(CONFIG_ENV) += env.o
44
45/* BB_AUDIT SUSv3 compliant */
46/* http://www.opengroup.org/onlinepubs/007904975/utilities/env.html */
33 47
34//usage:#define env_trivial_usage 48//usage:#define env_trivial_usage
35//usage: "[-iu] [-] [name=value]... [PROG ARGS]" 49//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 @@
20 * 20 *
21 * Caveat: this versions of expand and unexpand don't accept tab lists. 21 * Caveat: this versions of expand and unexpand don't accept tab lists.
22 */ 22 */
23//config:config EXPAND
24//config: bool "expand"
25//config: default y
26//config: help
27//config: By default, convert all tabs to spaces.
28//config:
29//config:config FEATURE_EXPAND_LONG_OPTIONS
30//config: bool "Enable long options"
31//config: default y
32//config: depends on EXPAND && LONG_OPTS
33//config: help
34//config: Support long options for the expand applet.
35//config:
36//config:config UNEXPAND
37//config: bool "unexpand"
38//config: default y
39//config: help
40//config: By default, convert only leading sequences of blanks to tabs.
41//config:
42//config:config FEATURE_UNEXPAND_LONG_OPTIONS
43//config: bool "Enable long options"
44//config: default y
45//config: depends on UNEXPAND && LONG_OPTS
46//config: help
47//config: Support long options for the unexpand applet.
48
49//applet:IF_EXPAND(APPLET(expand, BB_DIR_USR_BIN, BB_SUID_DROP))
50//applet:IF_UNEXPAND(APPLET_ODDNAME(unexpand, expand, BB_DIR_USR_BIN, BB_SUID_DROP, unexpand))
51
52//kbuild:lib-$(CONFIG_EXPAND) += expand.o
53//kbuild:lib-$(CONFIG_UNEXPAND) += expand.o
23 54
24//usage:#define expand_trivial_usage 55//usage:#define expand_trivial_usage
25//usage: "[-i] [-t N] [FILE]..." 56//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 @@
13 * 13 *
14 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 14 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
15 */ 15 */
16
17/* This program evaluates expressions. Each token (operator, operand, 16/* This program evaluates expressions. Each token (operator, operand,
18 * parenthesis) of the expression must be a separate argument. The 17 * parenthesis) of the expression must be a separate argument. The
19 * parser used is a reasonably general one, though any incarnation of 18 * parser used is a reasonably general one, though any incarnation of
@@ -21,9 +20,27 @@
21 * 20 *
22 * No parse tree is needed; a new node is evaluated immediately. 21 * No parse tree is needed; a new node is evaluated immediately.
23 * One function can handle multiple operators all of equal precedence, 22 * One function can handle multiple operators all of equal precedence,
24 * provided they all associate ((x op x) op x). */ 23 * provided they all associate ((x op x) op x).
25 24 */
26/* no getopt needed */ 25//config:config EXPR
26//config: bool "expr"
27//config: default y
28//config: help
29//config: expr is used to calculate numbers and print the result
30//config: to standard output.
31//config:
32//config:config EXPR_MATH_SUPPORT_64
33//config: bool "Extend Posix numbers support to 64 bit"
34//config: default y
35//config: depends on EXPR
36//config: help
37//config: Enable 64-bit math support in the expr applet. This will make
38//config: the applet slightly larger, but will allow computation with very
39//config: large numbers.
40
41//applet:IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP))
42
43//kbuild:lib-$(CONFIG_EXPR) += expr.o
27 44
28//usage:#define expr_trivial_usage 45//usage:#define expr_trivial_usage
29//usage: "EXPRESSION" 46//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config FALSE
10//config: bool "false"
11//config: default y
12//config: help
13//config: false returns an exit code of FALSE (1).
14
15//applet:IF_FALSE(APPLET_NOFORK(false, false, BB_DIR_BIN, BB_SUID_DROP, false))
16
17//kbuild:lib-$(CONFIG_FALSE) += false.o
9 18
10/* BB_AUDIT SUSv3 compliant */ 19/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/000095399/utilities/false.html */ 20/* 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 @@
9 9
10 Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 Licensed under GPLv2 or later, see file LICENSE in this source tree.
11*/ 11*/
12//config:config FOLD
13//config: bool "fold"
14//config: default y
15//config: help
16//config: Wrap text to fit a specific width.
17
18//applet:IF_FOLD(APPLET_NOEXEC(fold, fold, BB_DIR_USR_BIN, BB_SUID_DROP, fold))
19
20//kbuild:lib-$(CONFIG_FOLD) += fold.o
12 21
13//usage:#define fold_trivial_usage 22//usage:#define fold_trivial_usage
14//usage: "[-bs] [-w WIDTH] [FILE]..." 23//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config FSYNC
10//config: bool "fsync"
11//config: default y
12//config: help
13//config: fsync is used to flush file-related cached blocks to disk.
14
15//applet:IF_FSYNC(APPLET_NOFORK(fsync, fsync, BB_DIR_BIN, BB_SUID_DROP, fsync))
16
17//kbuild:lib-$(CONFIG_FSYNC) += fsync.o
9 18
10//usage:#define fsync_trivial_usage 19//usage:#define fsync_trivial_usage
11//usage: "[-d] FILE..." 20//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config HEAD
10//config: bool "head"
11//config: default y
12//config: help
13//config: head is used to print the first specified number of lines
14//config: from files.
15//config:
16//config:config FEATURE_FANCY_HEAD
17//config: bool "Enable head options (-c, -q, and -v)"
18//config: default y
19//config: depends on HEAD
20//config: help
21//config: This enables the head options (-c, -q, and -v).
22
23//applet:IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head))
24
25//kbuild:lib-$(CONFIG_HEAD) += head.o
9 26
10/* BB_AUDIT SUSv3 compliant */ 27/* BB_AUDIT SUSv3 compliant */
11/* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */ 28/* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */
12/* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */ 29/* http://www.opengroup.org/onlinepubs/007904975/utilities/head.html */
13 30
14//kbuild:lib-$(CONFIG_HEAD) += head.o
15
16//usage:#define head_trivial_usage 31//usage:#define head_trivial_usage
17//usage: "[OPTIONS] [FILE]..." 32//usage: "[OPTIONS] [FILE]..."
18//usage:#define head_full_usage "\n\n" 33//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11
12//config:config HOSTID 9//config:config HOSTID
13//config: bool "hostid" 10//config: bool "hostid"
14//config: default y 11//config: default y
@@ -20,6 +17,8 @@
20 17
21//kbuild:lib-$(CONFIG_HOSTID) += hostid.o 18//kbuild:lib-$(CONFIG_HOSTID) += hostid.o
22 19
20/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
21
23//usage:#define hostid_trivial_usage 22//usage:#define hostid_trivial_usage
24//usage: "" 23//usage: ""
25//usage:#define hostid_full_usage "\n\n" 24//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11/* BB_AUDIT SUSv3 compliant. */
12/* Hacked by Tito Ragusa (C) 2004 to handle usernames of whatever 10/* Hacked by Tito Ragusa (C) 2004 to handle usernames of whatever
13 * length and to be more similar to GNU id. 11 * length and to be more similar to GNU id.
14 * -Z option support: by Yuichi Nakamura <ynakam@hitachisoft.jp> 12 * -Z option support: by Yuichi Nakamura <ynakam@hitachisoft.jp>
15 * Added -G option Tito Ragusa (C) 2008 for SUSv3. 13 * Added -G option Tito Ragusa (C) 2008 for SUSv3.
16 */ 14 */
17
18//config:config ID 15//config:config ID
19//config: bool "id" 16//config: bool "id"
20//config: default y 17//config: default y
21//config: help 18//config: help
22//config: id displays the current user and group ID names. 19//config: id displays the current user and group ID names.
23 20//config:
24//config:config GROUPS 21//config:config GROUPS
25//config: bool "groups" 22//config: bool "groups"
26//config: default y 23//config: default y
27//config: help 24//config: help
28//config: Print the group names associated with current user id. 25//config: Print the group names associated with current user id.
29 26
27//applet:IF_GROUPS(APPLET_NOEXEC(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups))
28//applet:IF_ID( APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id ))
29
30//kbuild:lib-$(CONFIG_GROUPS) += id.o 30//kbuild:lib-$(CONFIG_GROUPS) += id.o
31//kbuild:lib-$(CONFIG_ID) += id.o 31//kbuild:lib-$(CONFIG_ID) += id.o
32 32
33//applet:IF_GROUPS(APPLET_NOEXEC(groups, id, BB_DIR_USR_BIN, BB_SUID_DROP, groups)) 33/* BB_AUDIT SUSv3 compliant. */
34//applet:IF_ID( APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id ))
35 34
36//usage:#define id_trivial_usage 35//usage:#define id_trivial_usage
37//usage: "[OPTIONS] [USER]" 36//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 @@
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8//config:config INSTALL
9//config: bool "install"
10//config: default y
11//config: help
12//config: Copy files and set attributes.
13//config:
14//config:config FEATURE_INSTALL_LONG_OPTIONS
15//config: bool "Enable long options"
16//config: default y
17//config: depends on INSTALL && LONG_OPTS
18//config: help
19//config: Support long options for the install applet.
20
21//applet:IF_INSTALL(APPLET(install, BB_DIR_USR_BIN, BB_SUID_DROP))
22
23//kbuild:lib-$(CONFIG_INSTALL) += install.o
8 24
9/* -v, -b, -c are ignored */ 25/* -v, -b, -c are ignored */
10//usage:#define install_trivial_usage 26//usage:#define install_trivial_usage
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 @@
1/* vi: set sw=4 ts=4: */
2/*
3 * Licensed under GPLv2, see file LICENSE in this source tree.
4 */
5
6/* BB_AUDIT SUSv3 N/A -- Apparently a busybox (obsolete?) extension. */
7
8//usage:#define length_trivial_usage
9//usage: "STRING"
10//usage:#define length_full_usage "\n\n"
11//usage: "Print STRING's length"
12//usage:
13//usage:#define length_example_usage
14//usage: "$ length Hello\n"
15//usage: "5\n"
16
17#include "libbb.h"
18
19/* This is a NOFORK applet. Be very careful! */
20
21int length_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
22int length_main(int argc, char **argv)
23{
24 if ((argc != 2) || (**(++argv) == '-')) {
25 bb_show_usage();
26 }
27
28 printf("%u\n", (unsigned)strlen(*argv));
29
30 return fflush_all();
31}
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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config LN
10//config: bool "ln"
11//config: default y
12//config: help
13//config: ln is used to create hard or soft links between files.
14
15//applet:IF_LN(APPLET_NOEXEC(ln, ln, BB_DIR_BIN, BB_SUID_DROP, ln))
16
17//kbuild:lib-$(CONFIG_LN) += ln.o
9 18
10/* BB_AUDIT SUSv3 compliant */ 19/* BB_AUDIT SUSv3 compliant */
11/* BB_AUDIT GNU options missing: -d, -F, -i, and -v. */ 20/* 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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/logname.html */
12
13/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 9/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
14 * 10 *
15 * SUSv3 specifies the string used is that returned from getlogin(). 11 * SUSv3 specifies the string used is that returned from getlogin().
@@ -19,6 +15,18 @@
19 * correct course of action wrt SUSv3 for a failing getlogin() is 15 * correct course of action wrt SUSv3 for a failing getlogin() is
20 * a diagnostic message and an error return. 16 * a diagnostic message and an error return.
21 */ 17 */
18//config:config LOGNAME
19//config: bool "logname"
20//config: default y
21//config: help
22//config: logname is used to print the current user's login name.
23
24//applet:IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname))
25
26//kbuild:lib-$(CONFIG_LOGNAME) += logname.o
27
28/* BB_AUDIT SUSv3 compliant */
29/* http://www.opengroup.org/onlinepubs/007904975/utilities/logname.html */
22 30
23//usage:#define logname_trivial_usage 31//usage:#define logname_trivial_usage
24//usage: "" 32//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 @@
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7
8/* [date unknown. Perhaps before year 2000] 7/* [date unknown. Perhaps before year 2000]
9 * To achieve a small memory footprint, this version of 'ls' doesn't do any 8 * To achieve a small memory footprint, this version of 'ls' doesn't do any
10 * file sorting, and only has the most essential command line switches 9 * file sorting, and only has the most essential command line switches
@@ -28,6 +27,75 @@
28 * [2009-03] 27 * [2009-03]
29 * ls sorts listing now, and supports almost all options. 28 * ls sorts listing now, and supports almost all options.
30 */ 29 */
30//config:config LS
31//config: bool "ls"
32//config: default y
33//config: help
34//config: ls is used to list the contents of directories.
35//config:
36//config:config FEATURE_LS_FILETYPES
37//config: bool "Enable filetyping options (-p and -F)"
38//config: default y
39//config: depends on LS
40//config: help
41//config: Enable the ls options (-p and -F).
42//config:
43//config:config FEATURE_LS_FOLLOWLINKS
44//config: bool "Enable symlinks dereferencing (-L)"
45//config: default y
46//config: depends on LS
47//config: help
48//config: Enable the ls option (-L).
49//config:
50//config:config FEATURE_LS_RECURSIVE
51//config: bool "Enable recursion (-R)"
52//config: default y
53//config: depends on LS
54//config: help
55//config: Enable the ls option (-R).
56//config:
57//config:config FEATURE_LS_SORTFILES
58//config: bool "Sort the file names"
59//config: default y
60//config: depends on LS
61//config: help
62//config: Allow ls to sort file names alphabetically.
63//config:
64//config:config FEATURE_LS_TIMESTAMPS
65//config: bool "Show file timestamps"
66//config: default y
67//config: depends on LS
68//config: help
69//config: Allow ls to display timestamps for files.
70//config:
71//config:config FEATURE_LS_USERNAME
72//config: bool "Show username/groupnames"
73//config: default y
74//config: depends on LS
75//config: help
76//config: Allow ls to display username/groupname for files.
77//config:
78//config:config FEATURE_LS_COLOR
79//config: bool "Allow use of color to identify file types"
80//config: default y
81//config: depends on LS && LONG_OPTS
82//config: help
83//config: This enables the --color option to ls.
84//config:
85//config:config FEATURE_LS_COLOR_IS_DEFAULT
86//config: bool "Produce colored ls output by default"
87//config: default y
88//config: depends on FEATURE_LS_COLOR
89//config: help
90//config: Saying yes here will turn coloring on by default,
91//config: even if no "--color" option is given to the ls command.
92//config: This is not recommended, since the colors are not
93//config: configurable, and the output may not be legible on
94//config: many output screens.
95
96//applet:IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls))
97
98//kbuild:lib-$(CONFIG_LS) += ls.o
31 99
32//usage:#define ls_trivial_usage 100//usage:#define ls_trivial_usage
33//usage: "[-1AaCxd" 101//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkdir.html */
12
13/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 9/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
14 * 10 *
15 * Fixed broken permission setting when -p was used; especially in 11 * Fixed broken permission setting when -p was used; especially in
16 * conjunction with -m. 12 * conjunction with -m.
17 */ 13 */
18
19/* Nov 28, 2006 Yoshinori Sato <ysato@users.sourceforge.jp>: Add SELinux Support. 14/* Nov 28, 2006 Yoshinori Sato <ysato@users.sourceforge.jp>: Add SELinux Support.
20 */ 15 */
16//config:config MKDIR
17//config: bool "mkdir"
18//config: default y
19//config: help
20//config: mkdir is used to create directories with the specified names.
21//config:
22//config:config FEATURE_MKDIR_LONG_OPTIONS
23//config: bool "Enable long options"
24//config: default y
25//config: depends on MKDIR && LONG_OPTS
26//config: help
27//config: Support long options for the mkdir applet.
28
29//applet:IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir))
30
31//kbuild:lib-$(CONFIG_MKDIR) += mkdir.o
32
33/* BB_AUDIT SUSv3 compliant */
34/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkdir.html */
21 35
22//usage:#define mkdir_trivial_usage 36//usage:#define mkdir_trivial_usage
23//usage: "[OPTIONS] DIRECTORY..." 37//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config MKFIFO
10//config: bool "mkfifo"
11//config: default y
12//config: help
13//config: mkfifo is used to create FIFOs (named pipes).
14//config: The 'mknod' program can also create FIFOs.
15
16//applet:IF_MKFIFO(APPLET_NOEXEC(mkfifo, mkfifo, BB_DIR_USR_BIN, BB_SUID_DROP, mkfifo))
17
18//kbuild:lib-$(CONFIG_MKFIFO) += mkfifo.o
9 19
10/* BB_AUDIT SUSv3 compliant */ 20/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/mkfifo.html */ 21/* 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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config MKNOD
10//config: bool "mknod"
11//config: default y
12//config: help
13//config: mknod is used to create FIFOs or block/character special
14//config: files with the specified names.
15
16//applet:IF_MKNOD(APPLET_NOEXEC(mknod, mknod, BB_DIR_BIN, BB_SUID_DROP, mknod))
17
18//kbuild:lib-$(CONFIG_MKNOD) += mknod.o
9 19
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 20/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11 21
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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 10/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
12 * 11 *
13 * Size reduction and improved error checking. 12 * Size reduction and improved error checking.
14 */ 13 */
15 14//config:config MV
16#include "libbb.h" 15//config: bool "mv"
17#include "libcoreutils/coreutils.h" 16//config: default y
17//config: help
18//config: mv is used to move or rename files or directories.
19//config:
20//config:config FEATURE_MV_LONG_OPTIONS
21//config: bool "Enable long options"
22//config: default y
23//config: depends on MV && LONG_OPTS
24//config: help
25//config: Support long options for the mv applet.
26
27//applet:IF_MV(APPLET(mv, BB_DIR_BIN, BB_SUID_DROP))
28
29//kbuild:lib-$(CONFIG_MV) += mv.o
18 30
19//usage:#define mv_trivial_usage 31//usage:#define mv_trivial_usage
20//usage: "[-fin] SOURCE DEST\n" 32//usage: "[-fin] SOURCE DEST\n"
@@ -28,6 +40,9 @@
28//usage:#define mv_example_usage 40//usage:#define mv_example_usage
29//usage: "$ mv /tmp/foo /bin/bar\n" 41//usage: "$ mv /tmp/foo /bin/bar\n"
30 42
43#include "libbb.h"
44#include "libcoreutils/coreutils.h"
45
31#if ENABLE_FEATURE_MV_LONG_OPTIONS 46#if ENABLE_FEATURE_MV_LONG_OPTIONS
32static const char mv_longopts[] ALIGN1 = 47static const char mv_longopts[] ALIGN1 =
33 "interactive\0" No_argument "i" 48 "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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config NICE
10//config: bool "nice"
11//config: default y
12//config: help
13//config: nice runs a program with modified scheduling priority.
14
15//applet:IF_NICE(APPLET(nice, BB_DIR_BIN, BB_SUID_DROP))
16
17//kbuild:lib-$(CONFIG_NICE) += nice.o
9 18
10//usage:#define nice_trivial_usage 19//usage:#define nice_trivial_usage
11//usage: "[-n ADJUST] [PROG ARGS]" 20//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 @@
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12//config:config NOHUP
13//config: bool "nohup"
14//config: default y
15//config: help
16//config: run a command immune to hangups, with output to a non-tty.
17
18//applet:IF_NOHUP(APPLET(nohup, BB_DIR_USR_BIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_NOHUP) += nohup.o
12 21
13//usage:#define nohup_trivial_usage 22//usage:#define nohup_trivial_usage
14//usage: "PROG ARGS" 23//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 @@
10 * 10 *
11 * Original copyright notice is retained at the end of this file. 11 * Original copyright notice is retained at the end of this file.
12 */ 12 */
13//config:config OD
14//config: bool "od"
15//config: default y
16//config: help
17//config: od is used to dump binary files in octal and other formats.
18
19//applet:IF_OD(APPLET(od, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_OD) += od.o
13 22
14//usage:#if !ENABLE_DESKTOP 23//usage:#if !ENABLE_DESKTOP
15//usage:#define od_trivial_usage 24//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config PRINTENV
11//config: bool "printenv"
12//config: default y
13//config: help
14//config: printenv is used to print all or part of environment.
15
16//applet:IF_PRINTENV(APPLET_NOFORK(printenv, printenv, BB_DIR_BIN, BB_SUID_DROP, printenv))
17
18//kbuild:lib-$(CONFIG_PRINTENV) += printenv.o
10 19
11//usage:#define printenv_trivial_usage 20//usage:#define printenv_trivial_usage
12//usage: "[VARIABLE]..." 21//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 @@
38 38
39/* 19990508 Busy Boxed! Dave Cinege */ 39/* 19990508 Busy Boxed! Dave Cinege */
40 40
41//config:config PRINTF
42//config: bool "printf"
43//config: default y
44//config: help
45//config: printf is used to format and print specified strings.
46//config: It's similar to `echo' except it has more options.
47
48//applet:IF_PRINTF(APPLET_NOFORK(printf, printf, BB_DIR_USR_BIN, BB_SUID_DROP, printf))
49
50//kbuild:lib-$(CONFIG_PRINTF) += printf.o
51
41//usage:#define printf_trivial_usage 52//usage:#define printf_trivial_usage
42//usage: "FORMAT [ARG]..." 53//usage: "FORMAT [ARG]..."
43//usage:#define printf_full_usage "\n\n" 54//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config PWD
10//config: bool "pwd"
11//config: default y
12//config: help
13//config: pwd is used to print the current directory.
14
15//applet:IF_PWD(APPLET_NOFORK(pwd, pwd, BB_DIR_BIN, BB_SUID_DROP, pwd))
16
17//kbuild:lib-$(CONFIG_PWD) += pwd.o
9 18
10//usage:#define pwd_trivial_usage 19//usage:#define pwd_trivial_usage
11//usage: "" 20//usage: ""
@@ -18,8 +27,6 @@
18 27
19#include "libbb.h" 28#include "libbb.h"
20 29
21/* This is a NOFORK applet. Be very careful! */
22
23static int logical_getcwd(void) 30static int logical_getcwd(void)
24{ 31{
25 struct stat st1; 32 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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config READLINK
10//config: bool "readlink"
11//config: default y
12//config: help
13//config: This program reads a symbolic link and returns the name
14//config: of the file it points to
15//config:
16//config:config FEATURE_READLINK_FOLLOW
17//config: bool "Enable canonicalization by following all symlinks (-f)"
18//config: default y
19//config: depends on READLINK
20//config: help
21//config: Enable the readlink option (-f).
22
23//applet:IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP))
24
25//kbuild:lib-$(CONFIG_READLINK) += readlink.o
9 26
10//usage:#define readlink_trivial_usage 27//usage:#define readlink_trivial_usage
11//usage: IF_FEATURE_READLINK_FOLLOW("[-fnv] ") "FILE" 28//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 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2
3/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
4
5/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 2/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
6 * 3 *
7 * Now does proper error checking on output and returns a failure exit code 4 * Now does proper error checking on output and returns a failure exit code
@@ -9,6 +6,18 @@
9 * 6 *
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 8 */
9//config:config REALPATH
10//config: bool "realpath"
11//config: default y
12//config: help
13//config: Return the canonicalized absolute pathname.
14//config: This isn't provided by GNU shellutils, but where else does it belong.
15
16//applet:IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_REALPATH) += realpath.o
19
20/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
12 21
13//usage:#define realpath_trivial_usage 22//usage:#define realpath_trivial_usage
14//usage: "FILE..." 23//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/rm.html */
12
13/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 9/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
14 * 10 *
15 * Size reduction. 11 * Size reduction.
16 */ 12 */
13//config:config RM
14//config: bool "rm"
15//config: default y
16//config: help
17//config: rm is used to remove files or directories.
18
19//applet:IF_RM(APPLET_NOFORK(rm, rm, BB_DIR_BIN, BB_SUID_DROP, rm))
20
21//kbuild:lib-$(CONFIG_RM) += rm.o
22
23/* BB_AUDIT SUSv3 compliant */
24/* http://www.opengroup.org/onlinepubs/007904975/utilities/rm.html */
17 25
18//usage:#define rm_trivial_usage 26//usage:#define rm_trivial_usage
19//usage: "[-irf] FILE..." 27//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config RMDIR
10//config: bool "rmdir"
11//config: default y
12//config: help
13//config: rmdir is used to remove empty directories.
14//config:
15//config:config FEATURE_RMDIR_LONG_OPTIONS
16//config: bool "Enable long options"
17//config: default y
18//config: depends on RMDIR && LONG_OPTS
19//config: help
20//config: Support long options for the rmdir applet, including
21//config: --ignore-fail-on-non-empty for compatibility with GNU rmdir.
22
23//applet:IF_RMDIR(APPLET_NOFORK(rmdir, rmdir, BB_DIR_BIN, BB_SUID_DROP, rmdir))
24
25//kbuild:lib-$(CONFIG_RMDIR) += rmdir.o
9 26
10/* BB_AUDIT SUSv3 compliant */ 27/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/rmdir.html */ 28/* 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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config SEQ
10//config: bool "seq"
11//config: default y
12//config: help
13//config: print a sequence of numbers
14
15//applet:IF_SEQ(APPLET_NOFORK(seq, seq, BB_DIR_USR_BIN, BB_SUID_DROP, seq))
16
17//kbuild:lib-$(CONFIG_SEQ) += seq.o
9 18
10//usage:#define seq_trivial_usage 19//usage:#define seq_trivial_usage
11//usage: "[-w] [-s SEP] [FIRST [INC]] LAST" 20//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* BB_AUDIT SUSv3 compliant */
11/* BB_AUDIT GNU issues -- fancy version matches except args must be ints. */
12/* http://www.opengroup.org/onlinepubs/007904975/utilities/sleep.html */
13
14/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 9/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
15 * 10 *
16 * Rewritten to do proper arg and error checking. 11 * Rewritten to do proper arg and error checking.
17 * Also, added a 'fancy' configuration to accept multiple args with 12 * Also, added a 'fancy' configuration to accept multiple args with
18 * time suffixes for seconds, minutes, hours, and days. 13 * time suffixes for seconds, minutes, hours, and days.
19 */ 14 */
15//config:config SLEEP
16//config: bool "sleep"
17//config: default y
18//config: help
19//config: sleep is used to pause for a specified number of seconds.
20//config: It comes in 3 versions:
21//config: - small: takes one integer parameter
22//config: - fancy: takes multiple integer arguments with suffixes:
23//config: sleep 1d 2h 3m 15s
24//config: - fancy with fractional numbers:
25//config: sleep 2.3s 4.5h sleeps for 16202.3 seconds
26//config: Last one is "the most compatible" with coreutils sleep,
27//config: but it adds around 1k of code.
28//config:
29//config:config FEATURE_FANCY_SLEEP
30//config: bool "Enable multiple arguments and s/m/h/d suffixes"
31//config: default y
32//config: depends on SLEEP
33//config: help
34//config: Allow sleep to pause for specified minutes, hours, and days.
35//config:
36//config:config FEATURE_FLOAT_SLEEP
37//config: bool "Enable fractional arguments"
38//config: default y
39//config: depends on FEATURE_FANCY_SLEEP
40//config: help
41//config: Allow for fractional numeric parameters.
42
43/* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells */
44//applet:IF_SLEEP(APPLET(sleep, BB_DIR_BIN, BB_SUID_DROP))
45
46//kbuild:lib-$(CONFIG_SLEEP) += sleep.o
47
48/* BB_AUDIT SUSv3 compliant */
49/* BB_AUDIT GNU issues -- fancy version matches except args must be ints. */
50/* http://www.opengroup.org/onlinepubs/007904975/utilities/sleep.html */
20 51
21//usage:#define sleep_trivial_usage 52//usage:#define sleep_trivial_usage
22//usage: IF_FEATURE_FANCY_SLEEP("[") "N" IF_FEATURE_FANCY_SLEEP("]...") 53//usage: IF_FEATURE_FANCY_SLEEP("[") "N" IF_FEATURE_FANCY_SLEEP("]...")
@@ -35,9 +66,6 @@
35 66
36#include "libbb.h" 67#include "libbb.h"
37 68
38/* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells */
39
40
41#if ENABLE_FEATURE_FANCY_SLEEP || ENABLE_FEATURE_FLOAT_SLEEP 69#if ENABLE_FEATURE_FANCY_SLEEP || ENABLE_FEATURE_FLOAT_SLEEP
42static const struct suffix_mult sfx[] = { 70static const struct suffix_mult sfx[] = {
43 { "s", 1 }, 71 { "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 @@
11 * See SuS3 sort standard at: 11 * See SuS3 sort standard at:
12 * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html 12 * http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
13 */ 13 */
14//config:config SORT
15//config: bool "sort"
16//config: default y
17//config: help
18//config: sort is used to sort lines of text in specified files.
19//config:
20//config:config FEATURE_SORT_BIG
21//config: bool "Full SuSv3 compliant sort (support -ktcsbdfiozgM)"
22//config: default y
23//config: depends on SORT
24//config: help
25//config: Without this, sort only supports -r, -u, and an integer version
26//config: of -n. Selecting this adds sort keys, floating point support, and
27//config: more. This adds a little over 3k to a nonstatic build on x86.
28//config:
29//config: The SuSv3 sort standard is available at:
30//config: http://www.opengroup.org/onlinepubs/007904975/utilities/sort.html
31
32//applet:IF_SORT(APPLET_NOEXEC(sort, sort, BB_DIR_USR_BIN, BB_SUID_DROP, sort))
33
34//kbuild:lib-$(CONFIG_SORT) += sort.o
14 35
15//usage:#define sort_trivial_usage 36//usage:#define sort_trivial_usage
16//usage: "[-nru" 37//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 @@
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8//config:config SPLIT
9//config: bool "split"
10//config: default y
11//config: help
12//config: split a file into pieces.
13//config:
14//config:config FEATURE_SPLIT_FANCY
15//config: bool "Fancy extensions"
16//config: default y
17//config: depends on SPLIT
18//config: help
19//config: Add support for features not required by SUSv3.
20//config: Supports additional suffixes 'b' for 512 bytes,
21//config: 'g' for 1GiB for the -b option.
22
23//applet:IF_SPLIT(APPLET(split, BB_DIR_USR_BIN, BB_SUID_DROP))
24
25//kbuild:lib-$(CONFIG_SPLIT) += split.o
26
8/* BB_AUDIT: SUSv3 compliant 27/* BB_AUDIT: SUSv3 compliant
9 * SUSv3 requirements: 28 * SUSv3 requirements:
10 * http://www.opengroup.org/onlinepubs/009695399/utilities/split.html 29 * http://www.opengroup.org/onlinepubs/009695399/utilities/split.html
diff --git a/coreutils/stat.c b/coreutils/stat.c
index f608045d7..109b5258c 100644
--- a/coreutils/stat.c
+++ b/coreutils/stat.c
@@ -35,6 +35,9 @@
35//config: Without this, stat will not support the '-f' option to display 35//config: Without this, stat will not support the '-f' option to display
36//config: information about filesystem status. 36//config: information about filesystem status.
37 37
38//applet:IF_STAT(APPLET(stat, BB_DIR_BIN, BB_SUID_DROP))
39
40//kbuild:lib-$(CONFIG_STAT) += stat.o
38 41
39//usage:#define stat_trivial_usage 42//usage:#define stat_trivial_usage
40//usage: "[OPTIONS] FILE..." 43//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 @@
18 David MacKenzie <djm@gnu.ai.mit.edu> 18 David MacKenzie <djm@gnu.ai.mit.edu>
19 19
20 Special for busybox ported by Vladimir Oleynik <dzo@simtreas.ru> 2001 20 Special for busybox ported by Vladimir Oleynik <dzo@simtreas.ru> 2001
21*/
22//config:config STTY
23//config: bool "stty"
24//config: default y
25//config: help
26//config: stty is used to change and print terminal line settings.
27
28//applet:IF_STTY(APPLET(stty, BB_DIR_BIN, BB_SUID_DROP))
21 29
22 */ 30//kbuild:lib-$(CONFIG_STTY) += stty.o
23 31
24//usage:#define stty_trivial_usage 32//usage:#define stty_trivial_usage
25//usage: "[-a|g] [-F DEVICE] [SETTING]..." 33//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 @@
12 * 12 *
13 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15//config:config SUM
16//config: bool "sum"
17//config: default y
18//config: help
19//config: checksum and count the blocks in a file
20
21//applet:IF_SUM(APPLET(sum, BB_DIR_USR_BIN, BB_SUID_DROP))
22
23//kbuild:lib-$(CONFIG_SUM) += sum.o
15 24
16//usage:#define sum_trivial_usage 25//usage:#define sum_trivial_usage
17//usage: "[-rs] [FILE]..." 26//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10
11/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
12//config:config SYNC 10//config:config SYNC
13//config: bool "sync" 11//config: bool "sync"
14//config: default y 12//config: default y
@@ -22,9 +20,12 @@
22//config: sync -d FILE... executes fdatasync() on each FILE. 20//config: sync -d FILE... executes fdatasync() on each FILE.
23//config: sync -f FILE... executes syncfs() on each FILE. 21//config: sync -f FILE... executes syncfs() on each FILE.
24 22
25//kbuild:lib-$(CONFIG_SYNC) += sync.o
26//applet:IF_SYNC(APPLET_NOFORK(sync, sync, BB_DIR_BIN, BB_SUID_DROP, sync)) 23//applet:IF_SYNC(APPLET_NOFORK(sync, sync, BB_DIR_BIN, BB_SUID_DROP, sync))
27 24
25//kbuild:lib-$(CONFIG_SYNC) += sync.o
26
27/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
28
28//usage:#define sync_trivial_usage 29//usage:#define sync_trivial_usage
29//usage: ""IF_FEATURE_SYNC_FANCY("[-df] [FILE]...") 30//usage: ""IF_FEATURE_SYNC_FANCY("[-df] [FILE]...")
30//usage:#define sync_full_usage "\n\n" 31//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 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * tac implementation for busybox 3 * tac implementation for busybox
4 * tac - concatenate and print files in reverse
4 * 5 *
5 * Copyright (C) 2003 Yang Xiaopeng <yxp at hanwang.com.cn> 6 * Copyright (C) 2003 Yang Xiaopeng <yxp at hanwang.com.cn>
6 * Copyright (C) 2007 Natanael Copa <natanael.copa@gmail.com> 7 * Copyright (C) 2007 Natanael Copa <natanael.copa@gmail.com>
7 * Copyright (C) 2007 Tito Ragusa <farmatito@tiscali.it> 8 * Copyright (C) 2007 Tito Ragusa <farmatito@tiscali.it>
8 * 9 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
10 *
11 */ 11 */
12
13/* tac - concatenate and print files in reverse */
14
15/* Based on Yang Xiaopeng's (yxp at hanwang.com.cn) patch 12/* Based on Yang Xiaopeng's (yxp at hanwang.com.cn) patch
16 * http://www.uclibc.org/lists/busybox/2003-July/008813.html 13 * http://www.uclibc.org/lists/busybox/2003-July/008813.html
17 */ 14 */
15//config:config TAC
16//config: bool "tac"
17//config: default y
18//config: help
19//config: tac is used to concatenate and print files in reverse.
20
21//applet:IF_TAC(APPLET_NOEXEC(tac, tac, BB_DIR_USR_BIN, BB_SUID_DROP, tac))
22
23//kbuild:lib-$(CONFIG_TAC) += tac.o
18 24
19//usage:#define tac_trivial_usage 25//usage:#define tac_trivial_usage
20//usage: "[FILE]..." 26//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* BB_AUDIT SUSv3 compliant (need fancy for -c) */
11/* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */
12/* http://www.opengroup.org/onlinepubs/007904975/utilities/tail.html */
13
14/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 9/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
15 * 10 *
16 * Pretty much rewritten to fix numerous bugs and reduce realloc() calls. 11 * Pretty much rewritten to fix numerous bugs and reduce realloc() calls.
@@ -23,9 +18,34 @@
23 * 6) no check for lseek error 18 * 6) no check for lseek error
24 * 7) lseek attempted when count==0 even if arg was +0 (from top) 19 * 7) lseek attempted when count==0 even if arg was +0 (from top)
25 */ 20 */
21//config:config TAIL
22//config: bool "tail"
23//config: default y
24//config: help
25//config: tail is used to print the last specified number of lines
26//config: from files.
27//config:
28//config:config FEATURE_FANCY_TAIL
29//config: bool "Enable extra tail options (-q, -s, -v, and -F)"
30//config: default y
31//config: depends on TAIL
32//config: help
33//config: The options (-q, -s, -v and -F) are provided by GNU tail, but
34//config: are not specific in the SUSv3 standard.
35//config:
36//config: -q Never output headers giving file names
37//config: -s SEC Wait SEC seconds between reads with -f
38//config: -v Always output headers giving file names
39//config: -F Same as -f, but keep retrying
40
41//applet:IF_TAIL(APPLET(tail, BB_DIR_USR_BIN, BB_SUID_DROP))
26 42
27//kbuild:lib-$(CONFIG_TAIL) += tail.o 43//kbuild:lib-$(CONFIG_TAIL) += tail.o
28 44
45/* BB_AUDIT SUSv3 compliant (need fancy for -c) */
46/* BB_AUDIT GNU compatible -c, -q, and -v options in 'fancy' configuration. */
47/* http://www.opengroup.org/onlinepubs/007904975/utilities/tail.html */
48
29//usage:#define tail_trivial_usage 49//usage:#define tail_trivial_usage
30//usage: "[OPTIONS] [FILE]..." 50//usage: "[OPTIONS] [FILE]..."
31//usage:#define tail_full_usage "\n\n" 51//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config TEE
10//config: bool "tee"
11//config: default y
12//config: help
13//config: tee is used to read from standard input and write
14//config: to standard output and files.
15//config:
16//config:config FEATURE_TEE_USE_BLOCK_IO
17//config: bool "Enable block I/O (larger/faster) instead of byte I/O"
18//config: default y
19//config: depends on TEE
20//config: help
21//config: Enable this option for a faster tee, at expense of size.
22
23//applet:IF_TEE(APPLET(tee, BB_DIR_USR_BIN, BB_SUID_DROP))
24
25//kbuild:lib-$(CONFIG_TEE) += tee.o
9 26
10/* BB_AUDIT SUSv3 compliant */ 27/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/tee.html */ 28/* http://www.opengroup.org/onlinepubs/007904975/utilities/tee.html */
diff --git a/coreutils/test.c b/coreutils/test.c
index b8a5d798c..df42590e4 100644
--- a/coreutils/test.c
+++ b/coreutils/test.c
@@ -19,11 +19,6 @@
19 * Original copyright notice states: 19 * Original copyright notice states:
20 * "This program is in the Public Domain." 20 * "This program is in the Public Domain."
21 */ 21 */
22
23//kbuild:lib-$(CONFIG_TEST) += test.o test_ptr_hack.o
24//kbuild:lib-$(CONFIG_ASH) += test.o test_ptr_hack.o
25//kbuild:lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o
26
27//config:config TEST 22//config:config TEST
28//config: bool "test" 23//config: bool "test"
29//config: default y 24//config: default y
@@ -32,13 +27,35 @@
32//config: returning an appropriate exit code. The bash shell 27//config: returning an appropriate exit code. The bash shell
33//config: has test built in, ash can build it in optionally. 28//config: has test built in, ash can build it in optionally.
34//config: 29//config:
30//config:config TEST1
31//config: bool "test as ["
32//config: default y
33//config: help
34//config: Provide test command in the "[ EXPR ]" form
35//config:
36//config:config TEST2
37//config: bool "test as [["
38//config: default y
39//config: help
40//config: Provide test command in the "[[ EXPR ]]" form
41//config:
35//config:config FEATURE_TEST_64 42//config:config FEATURE_TEST_64
36//config: bool "Extend test to 64 bit" 43//config: bool "Extend test to 64 bit"
37//config: default y 44//config: default y
38//config: depends on TEST || ASH_BUILTIN_TEST || HUSH 45//config: depends on TEST || TEST1 || TEST2 || ASH_BUILTIN_TEST || HUSH
39//config: help 46//config: help
40//config: Enable 64-bit support in test. 47//config: Enable 64-bit support in test.
41 48
49//applet:IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
50//applet:IF_TEST1(APPLET_NOFORK([, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
51//applet:IF_TEST2(APPLET_NOFORK([[, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
52
53//kbuild:lib-$(CONFIG_TEST) += test.o test_ptr_hack.o
54//kbuild:lib-$(CONFIG_TEST1) += test.o test_ptr_hack.o
55//kbuild:lib-$(CONFIG_TEST2) += test.o test_ptr_hack.o
56//kbuild:lib-$(CONFIG_ASH_BUILTIN_TEST) += test.o test_ptr_hack.o
57//kbuild:lib-$(CONFIG_HUSH) += test.o test_ptr_hack.o
58
42/* "test --help" is special-cased to ignore --help */ 59/* "test --help" is special-cased to ignore --help */
43//usage:#define test_trivial_usage NOUSAGE_STR 60//usage:#define test_trivial_usage NOUSAGE_STR
44//usage:#define test_full_usage "" 61//usage:#define test_full_usage ""
@@ -839,7 +856,9 @@ int test_main(int argc, char **argv)
839 const char *arg0; 856 const char *arg0;
840 857
841 arg0 = bb_basename(argv[0]); 858 arg0 = bb_basename(argv[0]);
842 if (arg0[0] == '[') { 859 if ((ENABLE_TEST1 || ENABLE_TEST2 || ENABLE_ASH_BUILTIN_TEST || ENABLE_HUSH)
860 && (arg0[0] == '[')
861 ) {
843 --argc; 862 --argc;
844 if (!arg0[1]) { /* "[" ? */ 863 if (!arg0[1]) { /* "[" ? */
845 if (NOT_LONE_CHAR(argv[argc], ']')) { 864 if (NOT_LONE_CHAR(argv[argc], ']')) {
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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* BB_AUDIT SUSv3 _NOT_ compliant -- options -a, -m not supported. */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/touch.html */
12
13/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 9/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
14 * 10 *
15 * Previous version called open() and then utime(). While this will be 11 * Previous version called open() and then utime(). While this will be
16 * be necessary to implement -r and -t, it currently only makes things bigger. 12 * be necessary to implement -r and -t, it currently only makes things bigger.
17 * Also, exiting on a failure was a bug. All args should be processed. 13 * Also, exiting on a failure was a bug. All args should be processed.
18 */ 14 */
19
20#include "libbb.h"
21
22//config:config TOUCH 15//config:config TOUCH
23//config: bool "touch" 16//config: bool "touch"
24//config: default y 17//config: default y
@@ -45,6 +38,9 @@
45 38
46//kbuild:lib-$(CONFIG_TOUCH) += touch.o 39//kbuild:lib-$(CONFIG_TOUCH) += touch.o
47 40
41/* BB_AUDIT SUSv3 _NOT_ compliant -- options -a, -m not supported. */
42/* http://www.opengroup.org/onlinepubs/007904975/utilities/touch.html */
43
48//usage:#define touch_trivial_usage 44//usage:#define touch_trivial_usage
49//usage: "[-c]" IF_FEATURE_TOUCH_SUSV3(" [-d DATE] [-t DATE] [-r FILE]") " FILE..." 45//usage: "[-c]" IF_FEATURE_TOUCH_SUSV3(" [-d DATE] [-t DATE] [-r FILE]") " FILE..."
50//usage:#define touch_full_usage "\n\n" 46//usage:#define touch_full_usage "\n\n"
@@ -66,8 +62,6 @@
66//usage: "$ ls -l /tmp/foo\n" 62//usage: "$ ls -l /tmp/foo\n"
67//usage: "-rw-rw-r-- 1 andersen andersen 0 Apr 15 01:11 /tmp/foo\n" 63//usage: "-rw-rw-r-- 1 andersen andersen 0 Apr 15 01:11 /tmp/foo\n"
68 64
69/* This is a NOFORK applet. Be very careful! */
70
71/* coreutils implements: 65/* coreutils implements:
72 * -a change only the access time 66 * -a change only the access time
73 * -c, --no-create 67 * -c, --no-create
@@ -85,6 +79,8 @@
85 * change the specified time: WORD is access, atime, or use 79 * change the specified time: WORD is access, atime, or use
86 */ 80 */
87 81
82#include "libbb.h"
83
88int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 84int touch_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
89int touch_main(int argc UNUSED_PARAM, char **argv) 85int touch_main(int argc UNUSED_PARAM, char **argv)
90{ 86{
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 @@
18/* http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html 18/* http://www.opengroup.org/onlinepubs/009695399/utilities/tr.html
19 * TODO: graph, print 19 * TODO: graph, print
20 */ 20 */
21
22//kbuild:lib-$(CONFIG_TR) += tr.o
23
24//config:config TR 21//config:config TR
25//config: bool "tr" 22//config: bool "tr"
26//config: default y 23//config: default y
@@ -47,6 +44,10 @@
47//config: useful for cases when no other way of expressing a character 44//config: useful for cases when no other way of expressing a character
48//config: is possible. 45//config: is possible.
49 46
47//applet:IF_TR(APPLET(tr, BB_DIR_USR_BIN, BB_SUID_DROP))
48
49//kbuild:lib-$(CONFIG_TR) += tr.o
50
50//usage:#define tr_trivial_usage 51//usage:#define tr_trivial_usage
51//usage: "[-cds] STRING1 [STRING2]" 52//usage: "[-cds] STRING1 [STRING2]"
52//usage:#define tr_full_usage "\n\n" 53//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config TRUE
10//config: bool "true"
11//config: default y
12//config: help
13//config: true returns an exit code of TRUE (0).
14
15//applet:IF_TRUE(APPLET_NOFORK(true, true, BB_DIR_BIN, BB_SUID_DROP, true))
16
17//kbuild:lib-$(CONFIG_TRUE) += true.o
9 18
10/* BB_AUDIT SUSv3 compliant */ 19/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/true.html */ 20/* 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 @@
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8
9//config:config TRUNCATE 8//config:config TRUNCATE
10//config: bool "truncate" 9//config: bool "truncate"
11//config: default y 10//config: default y
@@ -13,9 +12,10 @@
13//config: truncate truncates files to a given size. If a file does 12//config: truncate truncates files to a given size. If a file does
14//config: not exist, it is created unless told otherwise. 13//config: not exist, it is created unless told otherwise.
15 14
16//kbuild:lib-$(CONFIG_TRUNCATE) += truncate.o
17//applet:IF_TRUNCATE(APPLET_NOFORK(truncate, truncate, BB_DIR_USR_BIN, BB_SUID_DROP, truncate)) 15//applet:IF_TRUNCATE(APPLET_NOFORK(truncate, truncate, BB_DIR_USR_BIN, BB_SUID_DROP, truncate))
18 16
17//kbuild:lib-$(CONFIG_TRUNCATE) += truncate.o
18
19//usage:#define truncate_trivial_usage 19//usage:#define truncate_trivial_usage
20//usage: "[-c] -s SIZE FILE..." 20//usage: "[-c] -s SIZE FILE..."
21//usage:#define truncate_full_usage "\n\n" 21//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config TTY
10//config: bool "tty"
11//config: default y
12//config: help
13//config: tty is used to print the name of the current terminal to
14//config: standard output.
15
16//applet:IF_TTY(APPLET(tty, BB_DIR_USR_BIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_TTY) += tty.o
9 19
10/* BB_AUDIT SUSv4 compliant */ 20/* BB_AUDIT SUSv4 compliant */
11/* http://www.opengroup.org/onlinepubs/9699919799/utilities/tty.html */ 21/* 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 @@
4 * 4 *
5 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 5 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
6 */ 6 */
7
8/* BB_AUDIT SUSv3 compliant */
9/* http://www.opengroup.org/onlinepubs/007904975/utilities/uname.html */
10
11/* Option Example 7/* Option Example
12 * -s, --sysname SunOS 8 * -s, --sysname SunOS
13 * -n, --nodename rocky8 9 * -n, --nodename rocky8
@@ -37,7 +33,6 @@
37 * -a, --all: all of the above, in the order shown. 33 * -a, --all: all of the above, in the order shown.
38 * If -p or -i is not known, don't show them 34 * If -p or -i is not known, don't show them
39 */ 35 */
40
41/* Busyboxed by Erik Andersen 36/* Busyboxed by Erik Andersen
42 * 37 *
43 * Before 2003: Glenn McGrath and Manuel Novoa III 38 * Before 2003: Glenn McGrath and Manuel Novoa III
@@ -47,6 +42,26 @@
47 * Jan 2009: 42 * Jan 2009:
48 * Fix handling of -a to not print "unknown", add -o and -i support. 43 * Fix handling of -a to not print "unknown", add -o and -i support.
49 */ 44 */
45//config:config UNAME
46//config: bool "uname"
47//config: default y
48//config: help
49//config: uname is used to print system information.
50//config:
51//config:config UNAME_OSNAME
52//config: string "Operating system name"
53//config: default "GNU/Linux"
54//config: depends on UNAME
55//config: help
56//config: Sets the operating system name reported by uname -o. The
57//config: default is "GNU/Linux".
58
59//applet:IF_UNAME(APPLET(uname, BB_DIR_BIN, BB_SUID_DROP))
60
61//kbuild:lib-$(CONFIG_UNAME) += uname.o
62
63/* BB_AUDIT SUSv3 compliant */
64/* http://www.opengroup.org/onlinepubs/007904975/utilities/uname.html */
50 65
51//usage:#define uname_trivial_usage 66//usage:#define uname_trivial_usage
52//usage: "[-amnrspvio]" 67//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config UNIQ
10//config: bool "uniq"
11//config: default y
12//config: help
13//config: uniq is used to remove duplicate lines from a sorted file.
14
15//applet:IF_UNIQ(APPLET(uniq, BB_DIR_USR_BIN, BB_SUID_DROP))
16
17//kbuild:lib-$(CONFIG_UNIQ) += uniq.o
9 18
10/* BB_AUDIT SUSv3 compliant */ 19/* BB_AUDIT SUSv3 compliant */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/uniq.html */ 20/* 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 @@
5 * 5 *
6 * Licensed under GPLv2, see LICENSE in this source tree 6 * Licensed under GPLv2, see LICENSE in this source tree
7 */ 7 */
8
9//config:config UNLINK 8//config:config UNLINK
10//config: bool "unlink" 9//config: bool "unlink"
11//config: default y 10//config: default y
12//config: help 11//config: help
13//config: unlink deletes a file by calling unlink() 12//config: unlink deletes a file by calling unlink()
14 13
15//kbuild:lib-$(CONFIG_UNLINK) += unlink.o
16
17//applet:IF_UNLINK(APPLET(unlink, BB_DIR_USR_BIN, BB_SUID_DROP)) 14//applet:IF_UNLINK(APPLET(unlink, BB_DIR_USR_BIN, BB_SUID_DROP))
18 15
16//kbuild:lib-$(CONFIG_UNLINK) += unlink.o
17
19//usage:#define unlink_trivial_usage 18//usage:#define unlink_trivial_usage
20//usage: "FILE" 19//usage: "FILE"
21//usage:#define unlink_full_usage "\n\n" 20//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config USLEEP
10//config: bool "usleep"
11//config: default y
12//config: help
13//config: usleep is used to pause for a specified number of microseconds.
14
15//applet:IF_USLEEP(APPLET_NOFORK(usleep, usleep, BB_DIR_BIN, BB_SUID_DROP, usleep))
16
17//kbuild:lib-$(CONFIG_USLEEP) += usleep.o
9 18
10/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */ 19/* BB_AUDIT SUSv3 N/A -- Apparently a busybox extension. */
11 20
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 @@
10 * Bugs: the spec doesn't mention anything about "`\n`\n" prior to the 10 * Bugs: the spec doesn't mention anything about "`\n`\n" prior to the
11 * "end" line 11 * "end" line
12 */ 12 */
13//config:config UUDECODE
14//config: bool "uudecode"
15//config: default y
16//config: help
17//config: uudecode is used to decode a uuencoded file.
18
19//applet:IF_UUDECODE(APPLET(uudecode, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_UUDECODE) += uudecode.o
13 22
14//usage:#define uudecode_trivial_usage 23//usage:#define uudecode_trivial_usage
15//usage: "[-o OUTFILE] [INFILE]" 24//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config UUENCODE
11//config: bool "uuencode"
12//config: default y
13//config: help
14//config: uuencode is used to uuencode a file.
15
16//applet:IF_UUENCODE(APPLET(uuencode, BB_DIR_USR_BIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_UUENCODE) += uuencode.o
10 19
11//usage:#define uuencode_trivial_usage 20//usage:#define uuencode_trivial_usage
12//usage: "[-m] [FILE] STORED_FILENAME" 21//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* BB_AUDIT SUSv3 compliant. */
11/* http://www.opengroup.org/onlinepubs/007904975/utilities/wc.html */
12
13/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 9/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
14 * 10 *
15 * Rewritten to fix a number of problems and do some size optimizations. 11 * Rewritten to fix a number of problems and do some size optimizations.
@@ -36,6 +32,27 @@
36 * 32 *
37 * for which 'wc -c' should output '0'. 33 * for which 'wc -c' should output '0'.
38 */ 34 */
35//config:config WC
36//config: bool "wc"
37//config: default y
38//config: help
39//config: wc is used to print the number of bytes, words, and lines,
40//config: in specified files.
41//config:
42//config:config FEATURE_WC_LARGE
43//config: bool "Support very large files in wc"
44//config: default y
45//config: depends on WC
46//config: help
47//config: Use "unsigned long long" in wc for counter variables.
48
49//applet:IF_WC(APPLET(wc, BB_DIR_USR_BIN, BB_SUID_DROP))
50
51//kbuild:lib-$(CONFIG_WC) += wc.o
52
53/* BB_AUDIT SUSv3 compliant. */
54/* http://www.opengroup.org/onlinepubs/007904975/utilities/wc.html */
55
39#include "libbb.h" 56#include "libbb.h"
40#include "unicode.h" 57#include "unicode.h"
41 58
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 @@
16 * 16 *
17 *---------------------------------------------------------------------- 17 *----------------------------------------------------------------------
18 */ 18 */
19/* BB_AUDIT SUSv3 _NOT_ compliant -- missing options -b, -d, -l, -m, -p, -q, -r, -s, -t, -T, -u; Missing argument 'file'. */
20
21//config:config WHO 19//config:config WHO
22//config: bool "who" 20//config: bool "who"
23//config: default y 21//config: default y
24//config: depends on FEATURE_UTMP 22//config: depends on FEATURE_UTMP
25//config: help 23//config: help
26//config: who is used to show who is logged on. 24//config: who is used to show who is logged on.
27 25//config:
28//config:config USERS 26//config:config USERS
29//config: bool "users" 27//config: bool "users"
30//config: default y 28//config: default y
@@ -33,11 +31,13 @@
33//config: Print users currently logged on. 31//config: Print users currently logged on.
34 32
35//applet:IF_USERS(APPLET_ODDNAME(users, who, BB_DIR_USR_BIN, BB_SUID_DROP, users)) 33//applet:IF_USERS(APPLET_ODDNAME(users, who, BB_DIR_USR_BIN, BB_SUID_DROP, users))
36//applet:IF_WHO( APPLET( who, BB_DIR_USR_BIN, BB_SUID_DROP)) 34//applet:IF_WHO(APPLET(who, BB_DIR_USR_BIN, BB_SUID_DROP))
37 35
38//kbuild:lib-$(CONFIG_USERS) += who.o 36//kbuild:lib-$(CONFIG_USERS) += who.o
39//kbuild:lib-$(CONFIG_WHO) += who.o 37//kbuild:lib-$(CONFIG_WHO) += who.o
40 38
39/* BB_AUDIT SUSv3 _NOT_ compliant -- missing options -b, -d, -l, -m, -p, -q, -r, -s, -t, -T, -u; Missing argument 'file'. */
40
41//usage:#define users_trivial_usage 41//usage:#define users_trivial_usage
42//usage: "" 42//usage: ""
43//usage:#define users_full_usage "\n\n" 43//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config WHOAMI
10//config: bool "whoami"
11//config: default y
12//config: help
13//config: whoami is used to print the username of the current
14//config: user id (same as id -un).
15
16//applet:IF_WHOAMI(APPLET_NOFORK(whoami, whoami, BB_DIR_USR_BIN, BB_SUID_DROP, whoami))
17
18//kbuild:lib-$(CONFIG_WHOAMI) += whoami.o
9 19
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */ 20/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11 21
@@ -16,8 +26,6 @@
16 26
17#include "libbb.h" 27#include "libbb.h"
18 28
19/* This is a NOFORK applet. Be very careful! */
20
21int whoami_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 29int whoami_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
22int whoami_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM) 30int whoami_main(int argc UNUSED_PARAM, char **argv UNUSED_PARAM)
23{ 31{
diff --git a/coreutils/yes.c b/coreutils/yes.c
index c3d3e8288..ce6a90fc0 100644
--- a/coreutils/yes.c
+++ b/coreutils/yes.c
@@ -6,23 +6,30 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
11
12/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org) 9/* Mar 16, 2003 Manuel Novoa III (mjn3@codepoet.org)
13 * 10 *
14 * Size reductions and removed redundant applet name prefix from error messages. 11 * Size reductions and removed redundant applet name prefix from error messages.
15 */ 12 */
13//config:config YES
14//config: bool "yes"
15//config: default y
16//config: help
17//config: yes is used to repeatedly output a specific string, or
18//config: the default string `y'.
16 19
17#include "libbb.h" 20//applet:IF_YES(APPLET_NOFORK(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes))
18 21
19/* This is a NOFORK applet. Be very careful! */ 22//kbuild:lib-$(CONFIG_YES) += yes.o
23
24/* BB_AUDIT SUSv3 N/A -- Matches GNU behavior. */
20 25
21//usage:#define yes_trivial_usage 26//usage:#define yes_trivial_usage
22//usage: "[STRING]" 27//usage: "[STRING]"
23//usage:#define yes_full_usage "\n\n" 28//usage:#define yes_full_usage "\n\n"
24//usage: "Repeatedly output a line with STRING, or 'y'" 29//usage: "Repeatedly output a line with STRING, or 'y'"
25 30
31#include "libbb.h"
32
26int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 33int yes_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
27int yes_main(int argc UNUSED_PARAM, char **argv) 34int yes_main(int argc UNUSED_PARAM, char **argv)
28{ 35{
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)
658 return (G.instance_list != NULL); 658 return (G.instance_list != NULL);
659 659
660 for (inst = G.instance_list; inst; inst = inst->next) { 660 for (inst = G.instance_list; inst; inst = inst->next) {
661 if (!inst->base_device || !strcmp(base, inst->base_device)) { 661 if (!inst->base_device || strcmp(base, inst->base_device) == 0) {
662 free(base); 662 free(base);
663 return 1; 663 return 1;
664 } 664 }
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 @@
15 15
16//applet:IF_TUNE2FS(APPLET(tune2fs, BB_DIR_SBIN, BB_SUID_DROP)) 16//applet:IF_TUNE2FS(APPLET(tune2fs, BB_DIR_SBIN, BB_SUID_DROP))
17 17
18//TODO alias to "tune2fs -L LABEL": //applet:IF_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, BB_DIR_SBIN, BB_SUID_DROP, e2label))
19
18//kbuild:lib-$(CONFIG_TUNE2FS) += tune2fs.o 20//kbuild:lib-$(CONFIG_TUNE2FS) += tune2fs.o
19 21
20//usage:#define tune2fs_trivial_usage 22//usage:#define tune2fs_trivial_usage
diff --git a/editors/patch.c b/editors/patch.c
index 988021d77..731a8c58a 100644
--- a/editors/patch.c
+++ b/editors/patch.c
@@ -247,7 +247,7 @@ static int apply_one_hunk(void)
247 // Figure out which line of hunk to compare with next. (Skip lines 247 // Figure out which line of hunk to compare with next. (Skip lines
248 // of the hunk we'd be adding.) 248 // of the hunk we'd be adding.)
249 while (plist && *plist->data == "+-"[reverse]) { 249 while (plist && *plist->data == "+-"[reverse]) {
250 if (data && !strcmp(data, plist->data+1)) { 250 if (data && strcmp(data, plist->data+1) == 0) {
251 if (!backwarn) { 251 if (!backwarn) {
252 backwarn = TT.linenum; 252 backwarn = TT.linenum;
253 if (option_mask32 & FLAG_IGNORE) { 253 if (option_mask32 & FLAG_IGNORE) {
@@ -290,12 +290,24 @@ static int apply_one_hunk(void)
290 // out of buffer. 290 // out of buffer.
291 291
292 for (;;) { 292 for (;;) {
293 while (plist && *plist->data == "+-"[reverse]) {
294 if (strcmp(check->data, plist->data+1) == 0
295 && !backwarn
296 ) {
297 backwarn = TT.linenum;
298 if (option_mask32 & FLAG_IGNORE) {
299 dummy_revert = 1;
300 reverse ^= 1;
301 }
302 }
303 plist = plist->next;
304 }
293 if (!plist || strcmp(check->data, plist->data+1)) { 305 if (!plist || strcmp(check->data, plist->data+1)) {
294 // Match failed. Write out first line of buffered data and 306 // Match failed. Write out first line of buffered data and
295 // recheck remaining buffered data for a new match. 307 // recheck remaining buffered data for a new match.
296 308
297 if (PATCH_DEBUG) 309 if (PATCH_DEBUG)
298 fdprintf(2, "NOT: %s\n", plist->data); 310 fdprintf(2, "NOT: %s\n", plist ? plist->data : "EOF");
299 311
300 TT.state = 3; 312 TT.state = 3;
301 check = buf; 313 check = buf;
@@ -480,7 +492,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
480 492
481 // We're deleting oldname if new file is /dev/null (before -p) 493 // We're deleting oldname if new file is /dev/null (before -p)
482 // or if new hunk is empty (zero context) after patching 494 // or if new hunk is empty (zero context) after patching
483 if (!strcmp(name, "/dev/null") || !(reverse ? oldsum : newsum)) { 495 if (strcmp(name, "/dev/null") == 0 || !(reverse ? oldsum : newsum)) {
484 name = reverse ? newname : oldname; 496 name = reverse ? newname : oldname;
485 empty = 1; 497 empty = 1;
486 } 498 }
@@ -516,7 +528,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
516 struct stat statbuf; 528 struct stat statbuf;
517 529
518 // If the old file was null, we're creating a new one. 530 // If the old file was null, we're creating a new one.
519 if (!strcmp(oldname, "/dev/null") || !oldsum) { 531 if (strcmp(oldname, "/dev/null") == 0 || !oldsum) {
520 printf("creating %s\n", name); 532 printf("creating %s\n", name);
521 s = strrchr(name, '/'); 533 s = strrchr(name, '/');
522 if (s) { 534 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)
335 // Figure out which line of hunk to compare with next. (Skip lines 335 // Figure out which line of hunk to compare with next. (Skip lines
336 // of the hunk we'd be adding.) 336 // of the hunk we'd be adding.)
337 while (plist && *plist->data == "+-"[reverse]) { 337 while (plist && *plist->data == "+-"[reverse]) {
338 if (data && !strcmp(data, plist->data+1)) { 338 if (data && strcmp(data, plist->data+1) == 0) {
339 if (!backwarn) { 339 if (!backwarn) {
340 fdprintf(2,"Possibly reversed hunk %d at %ld\n", 340 fdprintf(2,"Possibly reversed hunk %d at %ld\n",
341 TT.hunknum, TT.linenum); 341 TT.hunknum, TT.linenum);
@@ -529,8 +529,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
529 529
530 // We're deleting oldname if new file is /dev/null (before -p) 530 // We're deleting oldname if new file is /dev/null (before -p)
531 // or if new hunk is empty (zero context) after patching 531 // or if new hunk is empty (zero context) after patching
532 if (!strcmp(name, "/dev/null") || !(reverse ? oldsum : newsum)) 532 if (strcmp(name, "/dev/null") == 0 || !(reverse ? oldsum : newsum)) {
533 {
534 name = reverse ? newname : oldname; 533 name = reverse ? newname : oldname;
535 del++; 534 del++;
536 } 535 }
@@ -551,7 +550,7 @@ int patch_main(int argc UNUSED_PARAM, char **argv)
551 // If we've got a file to open, do so. 550 // If we've got a file to open, do so.
552 } else if (!(option_mask32 & FLAG_PATHLEN) || i <= TT.prefix) { 551 } else if (!(option_mask32 & FLAG_PATHLEN) || i <= TT.prefix) {
553 // If the old file was null, we're creating a new one. 552 // If the old file was null, we're creating a new one.
554 if (!strcmp(oldname, "/dev/null") || !oldsum) { 553 if (strcmp(oldname, "/dev/null") == 0 || !oldsum) {
555 printf("creating %s\n", name); 554 printf("creating %s\n", name);
556 s = strrchr(name, '/'); 555 s = strrchr(name, '/');
557 if (s) { 556 if (s) {
diff --git a/editors/sed.c b/editors/sed.c
index 63ca1dc99..86230ea42 100644
--- a/editors/sed.c
+++ b/editors/sed.c
@@ -892,7 +892,10 @@ static sed_cmd_t *branch_to(char *label)
892 sed_cmd_t *sed_cmd; 892 sed_cmd_t *sed_cmd;
893 893
894 for (sed_cmd = G.sed_cmd_head; sed_cmd; sed_cmd = sed_cmd->next) { 894 for (sed_cmd = G.sed_cmd_head; sed_cmd; sed_cmd = sed_cmd->next) {
895 if (sed_cmd->cmd == ':' && sed_cmd->string && !strcmp(sed_cmd->string, label)) { 895 if (sed_cmd->cmd == ':'
896 && sed_cmd->string
897 && strcmp(sed_cmd->string, label) == 0
898 ) {
896 return sed_cmd; 899 return sed_cmd;
897 } 900 }
898 } 901 }
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)
502 502
503ACTF(name) 503ACTF(name)
504{ 504{
505 int r;
505 const char *tmp = bb_basename(fileName); 506 const char *tmp = bb_basename(fileName);
506 if (tmp != fileName && *tmp == '\0') { 507 /* GNU findutils: find DIR/ -name DIR
507 /* "foo/bar/". Oh no... go back to 'b' */ 508 * prints "DIR/" (DIR// prints "DIR//" etc).
508 tmp--; 509 * Need to strip trailing "/".
509 while (tmp != fileName && *--tmp != '/') 510 * Such names can come only from top-level names, but
510 continue; 511 * we can't do this before recursive_action() call,
511 if (*tmp == '/') 512 * since then "find FILE/ -name FILE"
512 tmp++; 513 * would also work (on non-directories), which is wrong.
514 */
515 char *trunc_slash = NULL;
516
517 if (*tmp == '\0') {
518 /* "foo/bar/[//...]" */
519 while (tmp != fileName && tmp[-1] == '/')
520 tmp--;
521 if (tmp == fileName) { /* entire fileName is "//.."? */
522 /* yes, convert "//..." to "/"
523 * Testcases:
524 * find / -maxdepth 1 -name /: prints /
525 * find // -maxdepth 1 -name /: prints //
526 * find / -maxdepth 1 -name //: prints nothing
527 * find // -maxdepth 1 -name //: prints nothing
528 */
529 if (tmp[1])
530 trunc_slash = (char*)tmp + 1;
531 } else {
532 /* no, it's "foo/bar/[//...]", go back to 'b' */
533 trunc_slash = (char*)tmp;
534 while (tmp != fileName && tmp[-1] != '/')
535 tmp--;
536 }
513 } 537 }
538
514 /* Was using FNM_PERIOD flag too, 539 /* Was using FNM_PERIOD flag too,
515 * but somewhere between 4.1.20 and 4.4.0 GNU find stopped using it. 540 * but somewhere between 4.1.20 and 4.4.0 GNU find stopped using it.
516 * find -name '*foo' should match .foo too: 541 * find -name '*foo' should match .foo too:
517 */ 542 */
543 if (trunc_slash) *trunc_slash = '\0';
518#if FNM_CASEFOLD 544#if FNM_CASEFOLD
519 return fnmatch(ap->pattern, tmp, (ap->iname ? FNM_CASEFOLD : 0)) == 0; 545 r = fnmatch(ap->pattern, tmp, (ap->iname ? FNM_CASEFOLD : 0));
520#else 546#else
521 if (ap->iname) 547 if (ap->iname)
522 tmp = strcpy_upcase(alloca(strlen(tmp) + 1), tmp); 548 tmp = strcpy_upcase(alloca(strlen(tmp) + 1), tmp);
523 return fnmatch(ap->pattern, tmp, 0) == 0; 549 r = fnmatch(ap->pattern, tmp, 0);
524#endif 550#endif
551 if (trunc_slash) *trunc_slash = '/';
552 return r == 0;
525} 553}
526 554
527#if ENABLE_FEATURE_FIND_PATH 555#if ENABLE_FEATURE_FIND_PATH
diff --git a/findutils/grep.c b/findutils/grep.c
index 94bcb6002..9f84d529b 100644
--- a/findutils/grep.c
+++ b/findutils/grep.c
@@ -18,45 +18,41 @@
18 * (C) 2006 Jac Goudsmit added -o option 18 * (C) 2006 Jac Goudsmit added -o option
19 */ 19 */
20 20
21//applet:IF_GREP(APPLET(grep, BB_DIR_BIN, BB_SUID_DROP))
22//applet:IF_FEATURE_GREP_EGREP_ALIAS(APPLET_ODDNAME(egrep, grep, BB_DIR_BIN, BB_SUID_DROP, egrep))
23//applet:IF_FEATURE_GREP_FGREP_ALIAS(APPLET_ODDNAME(fgrep, grep, BB_DIR_BIN, BB_SUID_DROP, fgrep))
24
25//kbuild:lib-$(CONFIG_GREP) += grep.o
26
27//config:config GREP 21//config:config GREP
28//config: bool "grep" 22//config: bool "grep"
29//config: default y 23//config: default y
30//config: help 24//config: help
31//config: grep is used to search files for a specified pattern. 25//config: grep is used to search files for a specified pattern.
32//config: 26//config:
33//config:config FEATURE_GREP_EGREP_ALIAS 27//config:config EGREP
34//config: bool "Enable extended regular expressions (egrep & grep -E)" 28//config: bool "egrep"
35//config: default y 29//config: default y
36//config: depends on GREP
37//config: help 30//config: help
38//config: Enabled support for extended regular expressions. Extended 31//config: Alias to "grep -E"
39//config: regular expressions allow for alternation (foo|bar), grouping,
40//config: and various repetition operators.
41//config: 32//config:
42//config:config FEATURE_GREP_FGREP_ALIAS 33//config:config FGREP
43//config: bool "Alias fgrep to grep -F" 34//config: bool "fgrep"
44//config: default y 35//config: default y
45//config: depends on GREP
46//config: help 36//config: help
47//config: fgrep sees the search pattern as a normal string rather than 37//config: Alias to "grep -F"
48//config: regular expressions.
49//config: grep -F always works, this just creates the fgrep alias.
50//config: 38//config:
51//config:config FEATURE_GREP_CONTEXT 39//config:config FEATURE_GREP_CONTEXT
52//config: bool "Enable before and after context flags (-A, -B and -C)" 40//config: bool "Enable before and after context flags (-A, -B and -C)"
53//config: default y 41//config: default y
54//config: depends on GREP 42//config: depends on GREP || EGREP
55//config: help 43//config: help
56//config: Print the specified number of leading (-B) and/or trailing (-A) 44//config: Print the specified number of leading (-B) and/or trailing (-A)
57//config: context surrounding our matching lines. 45//config: context surrounding our matching lines.
58//config: Print the specified number of context lines (-C). 46//config: Print the specified number of context lines (-C).
59 47
48//applet:IF_GREP(APPLET(grep, BB_DIR_BIN, BB_SUID_DROP))
49//applet:IF_EGREP(APPLET_ODDNAME(egrep, grep, BB_DIR_BIN, BB_SUID_DROP, egrep))
50//applet:IF_FGREP(APPLET_ODDNAME(fgrep, grep, BB_DIR_BIN, BB_SUID_DROP, fgrep))
51
52//kbuild:lib-$(CONFIG_GREP) += grep.o
53//kbuild:lib-$(CONFIG_EGREP) += grep.o
54//kbuild:lib-$(CONFIG_FGREP) += grep.o
55
60#include "libbb.h" 56#include "libbb.h"
61#include "common_bufsiz.h" 57#include "common_bufsiz.h"
62#include "xregex.h" 58#include "xregex.h"
@@ -64,9 +60,7 @@
64 60
65/* options */ 61/* options */
66//usage:#define grep_trivial_usage 62//usage:#define grep_trivial_usage
67//usage: "[-HhnlLoqvsriw" 63//usage: "[-HhnlLoqvsriwFE"
68//usage: "F"
69//usage: IF_FEATURE_GREP_EGREP_ALIAS("E")
70//usage: IF_EXTRA_COMPAT("z") 64//usage: IF_EXTRA_COMPAT("z")
71//usage: "] [-m N] " 65//usage: "] [-m N] "
72//usage: IF_FEATURE_GREP_CONTEXT("[-A/B/C N] ") 66//usage: IF_FEATURE_GREP_CONTEXT("[-A/B/C N] ")
@@ -88,9 +82,7 @@
88//usage: "\n -w Match whole words only" 82//usage: "\n -w Match whole words only"
89//usage: "\n -x Match whole lines only" 83//usage: "\n -x Match whole lines only"
90//usage: "\n -F PATTERN is a literal (not regexp)" 84//usage: "\n -F PATTERN is a literal (not regexp)"
91//usage: IF_FEATURE_GREP_EGREP_ALIAS(
92//usage: "\n -E PATTERN is an extended regexp" 85//usage: "\n -E PATTERN is an extended regexp"
93//usage: )
94//usage: IF_EXTRA_COMPAT( 86//usage: IF_EXTRA_COMPAT(
95//usage: "\n -z Input is NUL terminated" 87//usage: "\n -z Input is NUL terminated"
96//usage: ) 88//usage: )
@@ -117,7 +109,7 @@
117#define OPTSTR_GREP \ 109#define OPTSTR_GREP \
118 "lnqvscFiHhe:*f:*Lorm:+wx" \ 110 "lnqvscFiHhe:*f:*Lorm:+wx" \
119 IF_FEATURE_GREP_CONTEXT("A:+B:+C:+") \ 111 IF_FEATURE_GREP_CONTEXT("A:+B:+C:+") \
120 IF_FEATURE_GREP_EGREP_ALIAS("E") \ 112 "E" \
121 IF_EXTRA_COMPAT("z") \ 113 IF_EXTRA_COMPAT("z") \
122 "aI" 114 "aI"
123/* ignored: -a "assume all files to be text" */ 115/* ignored: -a "assume all files to be text" */
@@ -144,7 +136,7 @@ enum {
144 IF_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */ 136 IF_FEATURE_GREP_CONTEXT( OPTBIT_A ,) /* -A NUM: after-match context */
145 IF_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */ 137 IF_FEATURE_GREP_CONTEXT( OPTBIT_B ,) /* -B NUM: before-match context */
146 IF_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */ 138 IF_FEATURE_GREP_CONTEXT( OPTBIT_C ,) /* -C NUM: -A and -B combined */
147 IF_FEATURE_GREP_EGREP_ALIAS(OPTBIT_E ,) /* extended regexp */ 139 OPTBIT_E, /* extended regexp */
148 IF_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */ 140 IF_EXTRA_COMPAT( OPTBIT_z ,) /* input is NUL terminated */
149 OPT_l = 1 << OPTBIT_l, 141 OPT_l = 1 << OPTBIT_l,
150 OPT_n = 1 << OPTBIT_n, 142 OPT_n = 1 << OPTBIT_n,
@@ -167,7 +159,7 @@ enum {
167 OPT_A = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0, 159 OPT_A = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_A)) + 0,
168 OPT_B = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0, 160 OPT_B = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_B)) + 0,
169 OPT_C = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0, 161 OPT_C = IF_FEATURE_GREP_CONTEXT( (1 << OPTBIT_C)) + 0,
170 OPT_E = IF_FEATURE_GREP_EGREP_ALIAS((1 << OPTBIT_E)) + 0, 162 OPT_E = 1 << OPTBIT_E,
171 OPT_z = IF_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0, 163 OPT_z = IF_EXTRA_COMPAT( (1 << OPTBIT_z)) + 0,
172}; 164};
173 165
@@ -752,7 +744,7 @@ int grep_main(int argc UNUSED_PARAM, char **argv)
752 } 744 }
753 } 745 }
754 746
755 if (ENABLE_FEATURE_GREP_FGREP_ALIAS && applet_name[0] == 'f') 747 if (ENABLE_FGREP && applet_name[0] == 'f')
756 option_mask32 |= OPT_F; 748 option_mask32 |= OPT_F;
757 749
758#if !ENABLE_EXTRA_COMPAT 750#if !ENABLE_EXTRA_COMPAT
@@ -760,8 +752,8 @@ int grep_main(int argc UNUSED_PARAM, char **argv)
760 reflags = REG_NOSUB; 752 reflags = REG_NOSUB;
761#endif 753#endif
762 754
763 if (ENABLE_FEATURE_GREP_EGREP_ALIAS 755 if ((ENABLE_EGREP && applet_name[0] == 'e')
764 && (applet_name[0] == 'e' || (option_mask32 & OPT_E)) 756 || (option_mask32 & OPT_E)
765 ) { 757 ) {
766 reflags |= REG_EXTENDED; 758 reflags |= REG_EXTENDED;
767 } 759 }
diff --git a/include/applets.h.sh b/include/applets.h.sh
new file mode 100755
index 000000000..bab4e0d72
--- /dev/null
+++ b/include/applets.h.sh
@@ -0,0 +1,24 @@
1#!/bin/sh
2#
3# This script allows to check whether every applet has a separate option
4# enabling it. Run it after applets.h is generated.
5
6# CONFIG_applet names
7grep ^IF_ applets.h | grep -v IF_FEATURE_ | sed 's/IF_\([A-Z0-9._-]*\)(.*/\1/' \
8| grep -v MODPROBE_SMALL \
9| sed 's/BB_SYSCTL/SYSCTL/' \
10| sed 's/TEST1/[/' \
11| sed 's/TEST2/[[/' \
12| sort | uniq \
13>applets_APP1
14
15# command line applet names
16grep ^IF_ applets.h | sed -e's/ //g' -e's/.*(\([a-z[][^,]*\),.*/\1/' \
17| grep -v '^bash$' \
18| grep -v '^sh$' \
19| tr a-z A-Z \
20| sort | uniq \
21>applets_APP2
22
23diff -u applets_APP1 applets_APP2 >applets_APP.diff
24rm applets_APP1 applets_APP2
diff --git a/include/applets.src.h b/include/applets.src.h
index 248d539c4..2ddf120ad 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -73,269 +73,7 @@ s - suid type:
73 73
74 74
75INSERT 75INSERT
76IF_TEST(APPLET_NOFORK([, test, BB_DIR_USR_BIN, BB_SUID_DROP, test)) 76
77IF_TEST(APPLET_NOFORK([[, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
78IF_ACPID(APPLET(acpid, BB_DIR_SBIN, BB_SUID_DROP))
79IF_ADJTIMEX(APPLET(adjtimex, BB_DIR_SBIN, BB_SUID_DROP))
80IF_ARP(APPLET(arp, BB_DIR_SBIN, BB_SUID_DROP))
81IF_ARPING(APPLET(arping, BB_DIR_USR_SBIN, BB_SUID_DROP))
82IF_BASENAME(APPLET_NOFORK(basename, basename, BB_DIR_USR_BIN, BB_SUID_DROP, basename))
83IF_BBCONFIG(APPLET(bbconfig, BB_DIR_BIN, BB_SUID_DROP))
84IF_BEEP(APPLET(beep, BB_DIR_USR_BIN, BB_SUID_DROP))
85IF_BLKID(APPLET(blkid, BB_DIR_SBIN, BB_SUID_DROP))
86IF_BRCTL(APPLET(brctl, BB_DIR_USR_SBIN, BB_SUID_DROP))
87IF_CAL(APPLET(cal, BB_DIR_USR_BIN, BB_SUID_DROP))
88IF_CAT(APPLET_NOFORK(cat, cat, BB_DIR_BIN, BB_SUID_DROP, cat))
89IF_CATV(APPLET(catv, BB_DIR_BIN, BB_SUID_DROP))
90IF_CHAT(APPLET(chat, BB_DIR_USR_SBIN, BB_SUID_DROP))
91IF_CHCON(APPLET(chcon, BB_DIR_USR_BIN, BB_SUID_DROP))
92IF_CHGRP(APPLET_NOEXEC(chgrp, chgrp, BB_DIR_BIN, BB_SUID_DROP, chgrp))
93IF_CHMOD(APPLET_NOEXEC(chmod, chmod, BB_DIR_BIN, BB_SUID_DROP, chmod))
94IF_CHOWN(APPLET_NOEXEC(chown, chown, BB_DIR_BIN, BB_SUID_DROP, chown))
95IF_CHROOT(APPLET(chroot, BB_DIR_USR_SBIN, BB_SUID_DROP))
96IF_CHRT(APPLET(chrt, BB_DIR_USR_BIN, BB_SUID_DROP))
97IF_CHVT(APPLET(chvt, BB_DIR_USR_BIN, BB_SUID_DROP))
98IF_CKSUM(APPLET_NOEXEC(cksum, cksum, BB_DIR_USR_BIN, BB_SUID_DROP, cksum))
99IF_CLEAR(APPLET(clear, BB_DIR_USR_BIN, BB_SUID_DROP))
100IF_COMM(APPLET(comm, BB_DIR_USR_BIN, BB_SUID_DROP))
101IF_CP(APPLET_NOEXEC(cp, cp, BB_DIR_BIN, BB_SUID_DROP, cp))
102/* Needs to be run by root or be suid root - needs to change /var/spool/cron* files: */
103IF_CRONTAB(APPLET(crontab, BB_DIR_USR_BIN, BB_SUID_REQUIRE))
104IF_CUT(APPLET_NOEXEC(cut, cut, BB_DIR_USR_BIN, BB_SUID_DROP, cut))
105IF_DC(APPLET(dc, BB_DIR_USR_BIN, BB_SUID_DROP))
106IF_DD(APPLET_NOEXEC(dd, dd, BB_DIR_BIN, BB_SUID_DROP, dd))
107IF_DEALLOCVT(APPLET(deallocvt, BB_DIR_USR_BIN, BB_SUID_DROP))
108IF_DEVFSD(APPLET(devfsd, BB_DIR_SBIN, BB_SUID_DROP))
109IF_DEVMEM(APPLET(devmem, BB_DIR_SBIN, BB_SUID_DROP))
110IF_DF(APPLET(df, BB_DIR_BIN, BB_SUID_DROP))
111IF_DHCPRELAY(APPLET(dhcprelay, BB_DIR_USR_SBIN, BB_SUID_DROP))
112IF_DIRNAME(APPLET_NOFORK(dirname, dirname, BB_DIR_USR_BIN, BB_SUID_DROP, dirname))
113IF_DMESG(APPLET(dmesg, BB_DIR_BIN, BB_SUID_DROP))
114IF_DNSD(APPLET(dnsd, BB_DIR_USR_SBIN, BB_SUID_DROP))
115IF_HOSTNAME(APPLET_ODDNAME(dnsdomainname, hostname, BB_DIR_BIN, BB_SUID_DROP, dnsdomainname))
116IF_DOS2UNIX(APPLET_NOEXEC(dos2unix, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, dos2unix))
117IF_DU(APPLET(du, BB_DIR_USR_BIN, BB_SUID_DROP))
118IF_DUMPKMAP(APPLET(dumpkmap, BB_DIR_BIN, BB_SUID_DROP))
119IF_DUMPLEASES(APPLET(dumpleases, BB_DIR_USR_BIN, BB_SUID_DROP))
120//IF_E2FSCK(APPLET(e2fsck, BB_DIR_SBIN, BB_SUID_DROP))
121//IF_E2LABEL(APPLET_ODDNAME(e2label, tune2fs, BB_DIR_SBIN, BB_SUID_DROP, e2label))
122IF_ECHO(APPLET_NOFORK(echo, echo, BB_DIR_BIN, BB_SUID_DROP, echo))
123IF_EJECT(APPLET(eject, BB_DIR_USR_BIN, BB_SUID_DROP))
124IF_ENV(APPLET_NOEXEC(env, env, BB_DIR_USR_BIN, BB_SUID_DROP, env))
125IF_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, BB_DIR_USR_SBIN, BB_SUID_DROP, ether_wake))
126IF_EXPAND(APPLET(expand, BB_DIR_USR_BIN, BB_SUID_DROP))
127IF_EXPR(APPLET(expr, BB_DIR_USR_BIN, BB_SUID_DROP))
128IF_FAKEIDENTD(APPLET(fakeidentd, BB_DIR_USR_SBIN, BB_SUID_DROP))
129IF_FALSE(APPLET_NOFORK(false, false, BB_DIR_BIN, BB_SUID_DROP, false))
130IF_FBSET(APPLET(fbset, BB_DIR_USR_SBIN, BB_SUID_DROP))
131IF_FBSPLASH(APPLET(fbsplash, BB_DIR_SBIN, BB_SUID_DROP))
132IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, BB_DIR_BIN, BB_SUID_DROP, fdflush))
133IF_FDFORMAT(APPLET(fdformat, BB_DIR_USR_SBIN, BB_SUID_DROP))
134IF_FDISK(APPLET(fdisk, BB_DIR_SBIN, BB_SUID_DROP))
135IF_FGCONSOLE(APPLET(fgconsole, BB_DIR_USR_BIN, BB_SUID_DROP))
136/* Benefits from suid root: better access to /dev/BLOCKDEVs: */
137IF_FINDFS(APPLET(findfs, BB_DIR_SBIN, BB_SUID_MAYBE))
138IF_FLASH_ERASEALL(APPLET(flash_eraseall, BB_DIR_USR_SBIN, BB_SUID_DROP))
139IF_FLASH_LOCK(APPLET_ODDNAME(flash_lock, flash_lock_unlock, BB_DIR_USR_SBIN, BB_SUID_DROP, flash_lock))
140IF_FLASH_UNLOCK(APPLET_ODDNAME(flash_unlock, flash_lock_unlock, BB_DIR_USR_SBIN, BB_SUID_DROP, flash_unlock))
141IF_FLASHCP(APPLET(flashcp, BB_DIR_USR_SBIN, BB_SUID_DROP))
142IF_FLOCK(APPLET(flock, BB_DIR_USR_BIN, BB_SUID_DROP))
143IF_FOLD(APPLET_NOEXEC(fold, fold, BB_DIR_USR_BIN, BB_SUID_DROP, fold))
144IF_FREE(APPLET(free, BB_DIR_USR_BIN, BB_SUID_DROP))
145IF_FREERAMDISK(APPLET(freeramdisk, BB_DIR_SBIN, BB_SUID_DROP))
146//IF_E2FSCK(APPLET_ODDNAME(fsck.ext2, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext2))
147//IF_E2FSCK(APPLET_ODDNAME(fsck.ext3, e2fsck, BB_DIR_SBIN, BB_SUID_DROP, fsck_ext3))
148IF_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, BB_DIR_SBIN, BB_SUID_DROP, fsck_minix))
149IF_FSYNC(APPLET_NOFORK(fsync, fsync, BB_DIR_BIN, BB_SUID_DROP, fsync))
150IF_FTPD(APPLET(ftpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
151IF_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpget))
152IF_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpput))
153IF_FUSER(APPLET(fuser, BB_DIR_USR_BIN, BB_SUID_DROP))
154IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
155IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP))
156IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
157IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd))
158IF_HDPARM(APPLET(hdparm, BB_DIR_SBIN, BB_SUID_DROP))
159IF_HEAD(APPLET_NOEXEC(head, head, BB_DIR_USR_BIN, BB_SUID_DROP, head))
160IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump))
161IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP))
162IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
163IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP))
164IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP))
165IF_IFUPDOWN(APPLET_ODDNAME(ifdown, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifdown))
166IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP))
167IF_IFPLUGD(APPLET(ifplugd, BB_DIR_USR_SBIN, BB_SUID_DROP))
168IF_IFUPDOWN(APPLET_ODDNAME(ifup, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifup))
169IF_INETD(APPLET(inetd, BB_DIR_USR_SBIN, BB_SUID_DROP))
170IF_INOTIFYD(APPLET(inotifyd, BB_DIR_SBIN, BB_SUID_DROP))
171IF_INSTALL(APPLET(install, BB_DIR_USR_BIN, BB_SUID_DROP))
172IF_IONICE(APPLET(ionice, BB_DIR_BIN, BB_SUID_DROP))
173#if ENABLE_FEATURE_IP_ADDRESS \
174 || ENABLE_FEATURE_IP_ROUTE \
175 || ENABLE_FEATURE_IP_LINK \
176 || ENABLE_FEATURE_IP_TUNNEL \
177 || ENABLE_FEATURE_IP_RULE
178IF_IP(APPLET(ip, BB_DIR_SBIN, BB_SUID_DROP))
179#endif
180IF_IPADDR(APPLET(ipaddr, BB_DIR_SBIN, BB_SUID_DROP))
181IF_IPCALC(APPLET(ipcalc, BB_DIR_BIN, BB_SUID_DROP))
182IF_IPCRM(APPLET(ipcrm, BB_DIR_USR_BIN, BB_SUID_DROP))
183IF_IPCS(APPLET(ipcs, BB_DIR_USR_BIN, BB_SUID_DROP))
184IF_IPLINK(APPLET(iplink, BB_DIR_SBIN, BB_SUID_DROP))
185IF_IPROUTE(APPLET(iproute, BB_DIR_SBIN, BB_SUID_DROP))
186IF_IPRULE(APPLET(iprule, BB_DIR_SBIN, BB_SUID_DROP))
187IF_IPTUNNEL(APPLET(iptunnel, BB_DIR_SBIN, BB_SUID_DROP))
188IF_KBD_MODE(APPLET(kbd_mode, BB_DIR_BIN, BB_SUID_DROP))
189IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP))
190IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall))
191IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5))
192IF_LAST(APPLET(last, BB_DIR_USR_BIN, BB_SUID_DROP))
193//IF_LENGTH(APPLET_NOFORK(length, length, BB_DIR_USR_BIN, BB_SUID_DROP, length))
194IF_LESS(APPLET(less, BB_DIR_USR_BIN, BB_SUID_DROP))
195IF_LN(APPLET_NOEXEC(ln, ln, BB_DIR_BIN, BB_SUID_DROP, ln))
196IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP))
197IF_LOADFONT(APPLET(loadfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
198IF_LOADKMAP(APPLET(loadkmap, BB_DIR_SBIN, BB_SUID_DROP))
199IF_LOGNAME(APPLET_NOFORK(logname, logname, BB_DIR_USR_BIN, BB_SUID_DROP, logname))
200IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP))
201IF_LS(APPLET_NOEXEC(ls, ls, BB_DIR_BIN, BB_SUID_DROP, ls))
202IF_LSPCI(APPLET(lspci, BB_DIR_USR_BIN, BB_SUID_DROP))
203IF_LSUSB(APPLET(lsusb, BB_DIR_USR_BIN, BB_SUID_DROP))
204IF_MAKEDEVS(APPLET(makedevs, BB_DIR_SBIN, BB_SUID_DROP))
205IF_MAKEMIME(APPLET(makemime, BB_DIR_BIN, BB_SUID_DROP))
206IF_MAN(APPLET(man, BB_DIR_USR_BIN, BB_SUID_DROP))
207IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP))
208IF_MICROCOM(APPLET(microcom, BB_DIR_USR_BIN, BB_SUID_DROP))
209IF_MKDIR(APPLET_NOFORK(mkdir, mkdir, BB_DIR_BIN, BB_SUID_DROP, mkdir))
210IF_MKFS_VFAT(APPLET_ODDNAME(mkdosfs, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat))
211IF_MKFS_EXT2(APPLET_ODDNAME(mke2fs, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2))
212IF_MKFIFO(APPLET_NOEXEC(mkfifo, mkfifo, BB_DIR_USR_BIN, BB_SUID_DROP, mkfifo))
213IF_MKFS_EXT2(APPLET_ODDNAME(mkfs.ext2, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2))
214//IF_MKE2FS(APPLET_ODDNAME(mkfs.ext3, mke2fs, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext3))
215IF_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, BB_DIR_SBIN, BB_SUID_DROP, mkfs_minix))
216IF_MKFS_REISER(APPLET_ODDNAME(mkfs.reiser, mkfs_reiser, BB_DIR_SBIN, BB_SUID_DROP, mkfs_reiser))
217IF_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat))
218IF_MKNOD(APPLET_NOEXEC(mknod, mknod, BB_DIR_BIN, BB_SUID_DROP, mknod))
219IF_MKSWAP(APPLET(mkswap, BB_DIR_SBIN, BB_SUID_DROP))
220IF_MORE(APPLET(more, BB_DIR_BIN, BB_SUID_DROP))
221/* On full-blown systems, requires suid for user mounts.
222 * But it's not unthinkable to have it available in non-suid flavor on some systems,
223 * for viewing mount table.
224 * Therefore we use BB_SUID_MAYBE instead of BB_SUID_REQUIRE: */
225IF_MOUNT(APPLET(mount, BB_DIR_BIN, IF_DESKTOP(BB_SUID_MAYBE) IF_NOT_DESKTOP(BB_SUID_DROP)))
226IF_MOUNTPOINT(APPLET(mountpoint, BB_DIR_BIN, BB_SUID_DROP))
227IF_MT(APPLET(mt, BB_DIR_BIN, BB_SUID_DROP))
228IF_MV(APPLET(mv, BB_DIR_BIN, BB_SUID_DROP))
229IF_NAMEIF(APPLET(nameif, BB_DIR_SBIN, BB_SUID_DROP))
230IF_NC(APPLET(nc, BB_DIR_USR_BIN, BB_SUID_DROP))
231IF_NETSTAT(APPLET(netstat, BB_DIR_BIN, BB_SUID_DROP))
232IF_NICE(APPLET(nice, BB_DIR_BIN, BB_SUID_DROP))
233IF_NOHUP(APPLET(nohup, BB_DIR_USR_BIN, BB_SUID_DROP))
234IF_NSLOOKUP(APPLET(nslookup, BB_DIR_USR_BIN, BB_SUID_DROP))
235IF_NTPD(APPLET(ntpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
236IF_OD(APPLET(od, BB_DIR_USR_BIN, BB_SUID_DROP))
237IF_OPENVT(APPLET(openvt, BB_DIR_USR_BIN, BB_SUID_DROP))
238//IF_PARSE(APPLET(parse, BB_DIR_USR_BIN, BB_SUID_DROP))
239IF_PGREP(APPLET(pgrep, BB_DIR_USR_BIN, BB_SUID_DROP))
240IF_PIDOF(APPLET(pidof, BB_DIR_BIN, BB_SUID_DROP))
241IF_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, BB_SUID_DROP))
242IF_PKILL(APPLET_ODDNAME(pkill, pgrep, BB_DIR_USR_BIN, BB_SUID_DROP, pkill))
243IF_POPMAILDIR(APPLET(popmaildir, BB_DIR_USR_SBIN, BB_SUID_DROP))
244IF_PRINTENV(APPLET_NOFORK(printenv, printenv, BB_DIR_BIN, BB_SUID_DROP, printenv))
245IF_PRINTF(APPLET_NOFORK(printf, printf, BB_DIR_USR_BIN, BB_SUID_DROP, printf))
246IF_PS(APPLET(ps, BB_DIR_BIN, BB_SUID_DROP))
247IF_PSCAN(APPLET(pscan, BB_DIR_USR_BIN, BB_SUID_DROP))
248IF_PWD(APPLET_NOFORK(pwd, pwd, BB_DIR_BIN, BB_SUID_DROP, pwd))
249IF_RAIDAUTORUN(APPLET(raidautorun, BB_DIR_SBIN, BB_SUID_DROP))
250IF_RDATE(APPLET(rdate, BB_DIR_USR_SBIN, BB_SUID_DROP))
251IF_RDEV(APPLET(rdev, BB_DIR_USR_SBIN, BB_SUID_DROP))
252IF_READAHEAD(APPLET(readahead, BB_DIR_USR_SBIN, BB_SUID_DROP))
253IF_READLINK(APPLET(readlink, BB_DIR_USR_BIN, BB_SUID_DROP))
254IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, BB_SUID_DROP))
255IF_REALPATH(APPLET(realpath, BB_DIR_USR_BIN, BB_SUID_DROP))
256IF_REFORMIME(APPLET(reformime, BB_DIR_BIN, BB_SUID_DROP))
257IF_RENICE(APPLET(renice, BB_DIR_USR_BIN, BB_SUID_DROP))
258IF_RESET(APPLET(reset, BB_DIR_USR_BIN, BB_SUID_DROP))
259IF_RESIZE(APPLET(resize, BB_DIR_USR_BIN, BB_SUID_DROP))
260IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon))
261IF_RM(APPLET_NOFORK(rm, rm, BB_DIR_BIN, BB_SUID_DROP, rm))
262IF_RMDIR(APPLET_NOFORK(rmdir, rmdir, BB_DIR_BIN, BB_SUID_DROP, rmdir))
263IF_ROUTE(APPLET(route, BB_DIR_SBIN, BB_SUID_DROP))
264IF_RTCWAKE(APPLET(rtcwake, BB_DIR_USR_SBIN, BB_SUID_DROP))
265IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP))
266IF_RUNLEVEL(APPLET(runlevel, BB_DIR_SBIN, BB_SUID_DROP))
267IF_RX(APPLET(rx, BB_DIR_USR_BIN, BB_SUID_DROP))
268IF_SCRIPT(APPLET(script, BB_DIR_USR_BIN, BB_SUID_DROP))
269IF_SCRIPTREPLAY(APPLET(scriptreplay, BB_DIR_BIN, BB_SUID_DROP))
270IF_SELINUXENABLED(APPLET(selinuxenabled, BB_DIR_USR_SBIN, BB_SUID_DROP))
271IF_SENDMAIL(APPLET(sendmail, BB_DIR_USR_SBIN, BB_SUID_DROP))
272IF_SEQ(APPLET_NOFORK(seq, seq, BB_DIR_USR_BIN, BB_SUID_DROP, seq))
273IF_SESTATUS(APPLET(sestatus, BB_DIR_USR_SBIN, BB_SUID_DROP))
274IF_SETCONSOLE(APPLET(setconsole, BB_DIR_SBIN, BB_SUID_DROP))
275IF_SETENFORCE(APPLET(setenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
276IF_SETFILES(APPLET(setfiles, BB_DIR_SBIN, BB_SUID_DROP))
277IF_SETFONT(APPLET(setfont, BB_DIR_USR_SBIN, BB_SUID_DROP))
278IF_SETKEYCODES(APPLET(setkeycodes, BB_DIR_USR_BIN, BB_SUID_DROP))
279IF_SETLOGCONS(APPLET(setlogcons, BB_DIR_USR_SBIN, BB_SUID_DROP))
280IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
281IF_SETSID(APPLET(setsid, BB_DIR_USR_BIN, BB_SUID_DROP))
282IF_SHOWKEY(APPLET(showkey, BB_DIR_USR_BIN, BB_SUID_DROP))
283IF_SLATTACH(APPLET(slattach, BB_DIR_SBIN, BB_SUID_DROP))
284/* Do not make this applet NOFORK. It breaks ^C-ing of pauses in shells: */
285IF_SLEEP(APPLET(sleep, BB_DIR_BIN, BB_SUID_DROP))
286IF_SORT(APPLET_NOEXEC(sort, sort, BB_DIR_USR_BIN, BB_SUID_DROP, sort))
287IF_SPLIT(APPLET(split, BB_DIR_USR_BIN, BB_SUID_DROP))
288IF_STAT(APPLET(stat, BB_DIR_BIN, BB_SUID_DROP))
289IF_STRINGS(APPLET(strings, BB_DIR_USR_BIN, BB_SUID_DROP))
290IF_STTY(APPLET(stty, BB_DIR_BIN, BB_SUID_DROP))
291IF_SUM(APPLET(sum, BB_DIR_USR_BIN, BB_SUID_DROP))
292IF_SWAPONOFF(APPLET_ODDNAME(swapoff, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapoff))
293IF_SWAPONOFF(APPLET_ODDNAME(swapon, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapon))
294IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP))
295IF_BB_SYSCTL(APPLET(sysctl, BB_DIR_SBIN, BB_SUID_DROP))
296IF_TAC(APPLET_NOEXEC(tac, tac, BB_DIR_USR_BIN, BB_SUID_DROP, tac))
297IF_TAIL(APPLET(tail, BB_DIR_USR_BIN, BB_SUID_DROP))
298/* IF_TC(APPLET(tc, BB_DIR_SBIN, BB_SUID_DROP)) */
299IF_TCPSVD(APPLET_ODDNAME(tcpsvd, tcpudpsvd, BB_DIR_USR_BIN, BB_SUID_DROP, tcpsvd))
300IF_TEE(APPLET(tee, BB_DIR_USR_BIN, BB_SUID_DROP))
301IF_TELNET(APPLET(telnet, BB_DIR_USR_BIN, BB_SUID_DROP))
302IF_TELNETD(APPLET(telnetd, BB_DIR_USR_SBIN, BB_SUID_DROP))
303IF_TEST(APPLET_NOFORK(test, test, BB_DIR_USR_BIN, BB_SUID_DROP, test))
304#if ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT
305IF_TFTP(APPLET(tftp, BB_DIR_USR_BIN, BB_SUID_DROP))
306IF_TFTPD(APPLET(tftpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
307#endif
308IF_TIME(APPLET(time, BB_DIR_USR_BIN, BB_SUID_DROP))
309IF_TIMEOUT(APPLET(timeout, BB_DIR_USR_BIN, BB_SUID_DROP))
310IF_TOP(APPLET(top, BB_DIR_USR_BIN, BB_SUID_DROP))
311IF_TR(APPLET(tr, BB_DIR_USR_BIN, BB_SUID_DROP))
312/* Needs socket(AF_INET, SOCK_RAW, IPPROTO_ICMP), therefore BB_SUID_MAYBE: */
313IF_TRACEROUTE(APPLET(traceroute, BB_DIR_USR_BIN, BB_SUID_MAYBE))
314IF_TRACEROUTE6(APPLET(traceroute6, BB_DIR_USR_BIN, BB_SUID_MAYBE))
315IF_TRUE(APPLET_NOFORK(true, true, BB_DIR_BIN, BB_SUID_DROP, true))
316IF_TTY(APPLET(tty, BB_DIR_USR_BIN, BB_SUID_DROP))
317IF_TTYSIZE(APPLET(ttysize, BB_DIR_USR_BIN, BB_SUID_DROP))
318IF_TUNCTL(APPLET(tunctl, BB_DIR_SBIN, BB_SUID_DROP))
319IF_UDHCPC(APPLET(udhcpc, BB_DIR_SBIN, BB_SUID_DROP))
320IF_UDHCPD(APPLET(udhcpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
321IF_UDPSVD(APPLET_ODDNAME(udpsvd, tcpudpsvd, BB_DIR_USR_BIN, BB_SUID_DROP, udpsvd))
322IF_UMOUNT(APPLET(umount, BB_DIR_BIN, BB_SUID_DROP))
323IF_UNAME(APPLET(uname, BB_DIR_BIN, BB_SUID_DROP))
324IF_UNEXPAND(APPLET_ODDNAME(unexpand, expand, BB_DIR_USR_BIN, BB_SUID_DROP, unexpand))
325IF_UNIQ(APPLET(uniq, BB_DIR_USR_BIN, BB_SUID_DROP))
326IF_UNIX2DOS(APPLET_NOEXEC(unix2dos, dos2unix, BB_DIR_USR_BIN, BB_SUID_DROP, unix2dos))
327IF_UPTIME(APPLET(uptime, BB_DIR_USR_BIN, BB_SUID_DROP))
328IF_USLEEP(APPLET_NOFORK(usleep, usleep, BB_DIR_BIN, BB_SUID_DROP, usleep))
329IF_UUDECODE(APPLET(uudecode, BB_DIR_USR_BIN, BB_SUID_DROP))
330IF_UUENCODE(APPLET(uuencode, BB_DIR_USR_BIN, BB_SUID_DROP))
331IF_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP))
332IF_VOLNAME(APPLET(volname, BB_DIR_USR_BIN, BB_SUID_DROP))
333IF_WATCH(APPLET(watch, BB_DIR_BIN, BB_SUID_DROP))
334IF_WATCHDOG(APPLET(watchdog, BB_DIR_SBIN, BB_SUID_DROP))
335IF_WC(APPLET(wc, BB_DIR_USR_BIN, BB_SUID_DROP))
336IF_WHOAMI(APPLET_NOFORK(whoami, whoami, BB_DIR_USR_BIN, BB_SUID_DROP, whoami))
337IF_YES(APPLET_NOFORK(yes, yes, BB_DIR_USR_BIN, BB_SUID_DROP, yes))
338IF_ZCIP(APPLET(zcip, BB_DIR_SBIN, BB_SUID_DROP))
339 77
340#if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \ 78#if !defined(PROTOTYPES) && !defined(NAME_MAIN) && !defined(MAKE_USAGE) \
341 && !defined(MAKE_LINKS) && !defined(MAKE_SUID) 79 && !defined(MAKE_LINKS) && !defined(MAKE_SUID)
diff --git a/include/libbb.h b/include/libbb.h
index 91702fa6e..a6de5e97b 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -1482,46 +1482,46 @@ unsigned long long bb_makedev(unsigned major, unsigned minor) FAST_FUNC;
1482 * yet doesn't represent any valid Unicode character. 1482 * yet doesn't represent any valid Unicode character.
1483 * Also, -1 is reserved for error indication and we don't use it. */ 1483 * Also, -1 is reserved for error indication and we don't use it. */
1484enum { 1484enum {
1485 KEYCODE_UP = -2, 1485 KEYCODE_UP = -2,
1486 KEYCODE_DOWN = -3, 1486 KEYCODE_DOWN = -3,
1487 KEYCODE_RIGHT = -4, 1487 KEYCODE_RIGHT = -4,
1488 KEYCODE_LEFT = -5, 1488 KEYCODE_LEFT = -5,
1489 KEYCODE_HOME = -6, 1489 KEYCODE_HOME = -6,
1490 KEYCODE_END = -7, 1490 KEYCODE_END = -7,
1491 KEYCODE_INSERT = -8, 1491 KEYCODE_INSERT = -8,
1492 KEYCODE_DELETE = -9, 1492 KEYCODE_DELETE = -9,
1493 KEYCODE_PAGEUP = -10, 1493 KEYCODE_PAGEUP = -10,
1494 KEYCODE_PAGEDOWN = -11, 1494 KEYCODE_PAGEDOWN = -11,
1495 // -12 is reserved for Alt/Ctrl/Shift-TAB 1495 KEYCODE_BACKSPACE = -12, /* Used only if Alt/Ctrl/Shifted */
1496 KEYCODE_D = -13, /* Used only if Alted */
1496#if 0 1497#if 0
1497 KEYCODE_FUN1 = -13, 1498 KEYCODE_FUN1 = ,
1498 KEYCODE_FUN2 = -14, 1499 KEYCODE_FUN2 = ,
1499 KEYCODE_FUN3 = -15, 1500 KEYCODE_FUN3 = ,
1500 KEYCODE_FUN4 = -16, 1501 KEYCODE_FUN4 = ,
1501 KEYCODE_FUN5 = -17, 1502 KEYCODE_FUN5 = ,
1502 KEYCODE_FUN6 = -18, 1503 KEYCODE_FUN6 = ,
1503 KEYCODE_FUN7 = -19, 1504 KEYCODE_FUN7 = ,
1504 KEYCODE_FUN8 = -20, 1505 KEYCODE_FUN8 = ,
1505 KEYCODE_FUN9 = -21, 1506 KEYCODE_FUN9 = ,
1506 KEYCODE_FUN10 = -22, 1507 KEYCODE_FUN10 = ,
1507 KEYCODE_FUN11 = -23, 1508 KEYCODE_FUN11 = ,
1508 KEYCODE_FUN12 = -24, 1509 KEYCODE_FUN12 = ,
1509#endif 1510#endif
1510 /* Be sure that last defined value is small enough 1511 /* ^^^^^ Be sure that last defined value is small enough.
1511 * to not interfere with Alt/Ctrl/Shift bits. 1512 * Current read_key() code allows going up to -32 (0xfff..fffe0).
1512 * So far we do not exceed -31 (0xfff..fffe1), 1513 * This gives three upper bits in LSB to play with:
1513 * which gives us three upper bits in LSB to play with. 1514 * KEYCODE_foo values are 0xfff..fffXX, lowest XX bits are: scavvvvv,
1515 * s=0 if SHIFT, c=0 if CTRL, a=0 if ALT,
1516 * vvvvv bits are the same for same key regardless of "shift bits".
1514 */ 1517 */
1515 //KEYCODE_SHIFT_TAB = (-12) & ~0x80, 1518 //KEYCODE_SHIFT_... = KEYCODE_... & ~0x80,
1516 //KEYCODE_SHIFT_... = KEYCODE_... & ~0x80, 1519 KEYCODE_CTRL_RIGHT = KEYCODE_RIGHT & ~0x40,
1517 //KEYCODE_CTRL_UP = KEYCODE_UP & ~0x40, 1520 KEYCODE_CTRL_LEFT = KEYCODE_LEFT & ~0x40,
1518 //KEYCODE_CTRL_DOWN = KEYCODE_DOWN & ~0x40, 1521 KEYCODE_ALT_RIGHT = KEYCODE_RIGHT & ~0x20,
1519 KEYCODE_CTRL_RIGHT = KEYCODE_RIGHT & ~0x40, 1522 KEYCODE_ALT_LEFT = KEYCODE_LEFT & ~0x20,
1520 KEYCODE_CTRL_LEFT = KEYCODE_LEFT & ~0x40, 1523 KEYCODE_ALT_BACKSPACE = KEYCODE_BACKSPACE & ~0x20,
1521 //KEYCODE_ALT_UP = KEYCODE_UP & ~0x20, 1524 KEYCODE_ALT_D = KEYCODE_D & ~0x20,
1522 //KEYCODE_ALT_DOWN = KEYCODE_DOWN & ~0x20,
1523 KEYCODE_ALT_RIGHT = KEYCODE_RIGHT & ~0x20,
1524 KEYCODE_ALT_LEFT = KEYCODE_LEFT & ~0x20,
1525 1525
1526 KEYCODE_CURSOR_POS = -0x100, /* 0xfff..fff00 */ 1526 KEYCODE_CURSOR_POS = -0x100, /* 0xfff..fff00 */
1527 /* How long is the longest ESC sequence we know? 1527 /* How long is the longest ESC sequence we know?
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 @@
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9 9
10//applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP))
11//applet:IF_HALT(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff))
12//applet:IF_HALT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot))
13
14//kbuild:lib-$(CONFIG_HALT) += halt.o
15
16//config:config HALT 10//config:config HALT
17//config: bool "poweroff, halt, and reboot" 11//config: bool "halt"
12//config: default y
13//config: help
14//config: Stop all processes and halt the system.
15//config:
16//config:config POWEROFF
17//config: bool "poweroff"
18//config: default y 18//config: default y
19//config: help 19//config: help
20//config: Stop all processes and either halt, reboot, or power off the system. 20//config: Stop all processes and power off the system.
21//config:
22//config:config REBOOT
23//config: bool "reboot"
24//config: default y
25//config: help
26//config: Stop all processes and reboot the system.
21//config: 27//config:
22//config:config FEATURE_CALL_TELINIT 28//config:config FEATURE_CALL_TELINIT
23//config: bool "Call telinit on shutdown and reboot" 29//config: bool "Call telinit on shutdown and reboot"
24//config: default y 30//config: default y
25//config: depends on HALT && !INIT 31//config: depends on (HALT || POWEROFF || REBOOT) && !INIT
26//config: help 32//config: help
27//config: Call an external program (normally telinit) to facilitate 33//config: Call an external program (normally telinit) to facilitate
28//config: a switch to a proper runlevel. 34//config: a switch to a proper runlevel.
@@ -39,6 +45,14 @@
39//config: to facilitate proper shutdown, this path is to be used when 45//config: to facilitate proper shutdown, this path is to be used when
40//config: locating telinit executable. 46//config: locating telinit executable.
41 47
48//applet:IF_HALT(APPLET(halt, BB_DIR_SBIN, BB_SUID_DROP))
49//applet:IF_POWEROFF(APPLET_ODDNAME(poweroff, halt, BB_DIR_SBIN, BB_SUID_DROP, poweroff))
50//applet:IF_REBOOT(APPLET_ODDNAME(reboot, halt, BB_DIR_SBIN, BB_SUID_DROP, reboot))
51
52//kbuild:lib-$(CONFIG_HALT) += halt.o
53//kbuild:lib-$(CONFIG_POWEROFF) += halt.o
54//kbuild:lib-$(CONFIG_REBOOT) += halt.o
55
42//usage:#define halt_trivial_usage 56//usage:#define halt_trivial_usage
43//usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]") 57//usage: "[-d DELAY] [-n] [-f]" IF_FEATURE_WTMP(" [-w]")
44//usage:#define halt_full_usage "\n\n" 58//usage:#define halt_full_usage "\n\n"
@@ -109,6 +123,15 @@ int halt_main(int argc UNUSED_PARAM, char **argv)
109 int which, flags, rc; 123 int which, flags, rc;
110 124
111 /* Figure out which applet we're running */ 125 /* Figure out which applet we're running */
126 if (ENABLE_HALT && !ENABLE_POWEROFF && !ENABLE_REBOOT)
127 which = 0;
128 else
129 if (!ENABLE_HALT && ENABLE_POWEROFF && !ENABLE_REBOOT)
130 which = 1;
131 else
132 if (!ENABLE_HALT && !ENABLE_POWEROFF && ENABLE_REBOOT)
133 which = 2;
134 else
112 for (which = 0; "hpr"[which] != applet_name[0]; which++) 135 for (which = 0; "hpr"[which] != applet_name[0]; which++)
113 continue; 136 continue;
114 137
diff --git a/libbb/Config.src b/libbb/Config.src
index 6ba256290..00804e31e 100644
--- a/libbb/Config.src
+++ b/libbb/Config.src
@@ -7,6 +7,30 @@ menu "Busybox Library Tuning"
7 7
8INSERT 8INSERT
9 9
10choice
11 prompt "Buffer allocation policy"
12 default FEATURE_BUFFERS_USE_MALLOC
13 help
14 There are 3 ways BusyBox can handle buffer allocations:
15 - Use malloc. This costs code size for the call to xmalloc.
16 - Put them on stack. For some very small machines with limited stack
17 space, this can be deadly. For most folks, this works just fine.
18 - Put them in BSS. This works beautifully for computers with a real
19 MMU (and OS support), but wastes runtime RAM for uCLinux. This
20 behavior was the only one available for BusyBox versions 0.48 and
21 earlier.
22
23config FEATURE_BUFFERS_USE_MALLOC
24 bool "Allocate with Malloc"
25
26config FEATURE_BUFFERS_GO_ON_STACK
27 bool "Allocate on the Stack"
28
29config FEATURE_BUFFERS_GO_IN_BSS
30 bool "Allocate in the .bss section"
31
32endchoice
33
10config PASSWORD_MINLEN 34config PASSWORD_MINLEN
11 int "Minimum password length" 35 int "Minimum password length"
12 default 6 36 default 6
@@ -153,6 +177,131 @@ config FEATURE_EDITING_ASK_TERMINAL
153 correctly, or want to save on code size (about 400 bytes), 177 correctly, or want to save on code size (about 400 bytes),
154 then do not turn this option on. 178 then do not turn this option on.
155 179
180config LOCALE_SUPPORT
181 bool "Enable locale support (system needs locale for this to work)"
182 default n
183 help
184 Enable this if your system has locale support and you would like
185 busybox to support locale settings.
186
187config UNICODE_SUPPORT
188 bool "Support Unicode"
189 default y
190 help
191 This makes various applets aware that one byte is not
192 one character on screen.
193
194 Busybox aims to eventually work correctly with Unicode displays.
195 Any older encodings are not guaranteed to work.
196 Probably by the time when busybox will be fully Unicode-clean,
197 other encodings will be mainly of historic interest.
198
199config UNICODE_USING_LOCALE
200 bool "Use libc routines for Unicode (else uses internal ones)"
201 default n
202 depends on UNICODE_SUPPORT && LOCALE_SUPPORT
203 help
204 With this option on, Unicode support is implemented using libc
205 routines. Otherwise, internal implementation is used.
206 Internal implementation is smaller.
207
208config FEATURE_CHECK_UNICODE_IN_ENV
209 bool "Check $LC_ALL, $LC_CTYPE and $LANG environment variables"
210 default n
211 depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE
212 help
213 With this option on, Unicode support is activated
214 only if locale-related variables have the value of the form
215 "xxxx.utf8"
216
217 Otherwise, Unicode support will be always enabled and active.
218
219config SUBST_WCHAR
220 int "Character code to substitute unprintable characters with"
221 depends on UNICODE_SUPPORT
222 default 63
223 help
224 Typical values are 63 for '?' (works with any output device),
225 30 for ASCII substitute control code,
226 65533 (0xfffd) for Unicode replacement character.
227
228config LAST_SUPPORTED_WCHAR
229 int "Range of supported Unicode characters"
230 depends on UNICODE_SUPPORT
231 default 767
232 help
233 Any character with Unicode value bigger than this is assumed
234 to be non-printable on output device. Many applets replace
235 such characters with substitution character.
236
237 The idea is that many valid printable Unicode chars
238 nevertheless are not displayed correctly. Think about
239 combining charachers, double-wide hieroglyphs, obscure
240 characters in dozens of ancient scripts...
241 Many terminals, terminal emulators, xterms etc will fail
242 to handle them correctly. Choose the smallest value
243 which suits your needs.
244
245 Typical values are:
246 126 - ASCII only
247 767 (0x2ff) - there are no combining chars in [0..767] range
248 (the range includes Latin 1, Latin Ext. A and B),
249 code is ~700 bytes smaller for this case.
250 4351 (0x10ff) - there are no double-wide chars in [0..4351] range,
251 code is ~300 bytes smaller for this case.
252 12799 (0x31ff) - nearly all non-ideographic characters are
253 available in [0..12799] range, including
254 East Asian scripts like katakana, hiragana, hangul,
255 bopomofo...
256 0 - off, any valid printable Unicode character will be printed.
257
258config UNICODE_COMBINING_WCHARS
259 bool "Allow zero-width Unicode characters on output"
260 default n
261 depends on UNICODE_SUPPORT
262 help
263 With this option off, any Unicode char with width of 0
264 is substituted on output.
265
266config UNICODE_WIDE_WCHARS
267 bool "Allow wide Unicode characters on output"
268 default n
269 depends on UNICODE_SUPPORT
270 help
271 With this option off, any Unicode char with width > 1
272 is substituted on output.
273
274config UNICODE_BIDI_SUPPORT
275 bool "Bidirectional character-aware line input"
276 default n
277 depends on UNICODE_SUPPORT && !UNICODE_USING_LOCALE
278 help
279 With this option on, right-to-left Unicode characters
280 are treated differently on input (e.g. cursor movement).
281
282config UNICODE_NEUTRAL_TABLE
283 bool "In bidi input, support non-ASCII neutral chars too"
284 default n
285 depends on UNICODE_BIDI_SUPPORT
286 help
287 In most cases it's enough to treat only ASCII non-letters
288 (i.e. punctuation, numbers and space) as characters
289 with neutral directionality.
290 With this option on, more extensive (and bigger) table
291 of neutral chars will be used.
292
293config UNICODE_PRESERVE_BROKEN
294 bool "Make it possible to enter sequences of chars which are not Unicode"
295 default n
296 depends on UNICODE_SUPPORT
297 help
298 With this option on, on line-editing input (such as used by shells)
299 invalid UTF-8 bytes are not substituted with the selected
300 substitution character.
301 For example, this means that entering 'l', 's', ' ', 0xff, [Enter]
302 at shell prompt will list file named 0xff (single char name
303 with char value 255), not file named '?'.
304
156config FEATURE_NON_POSIX_CP 305config FEATURE_NON_POSIX_CP
157 bool "Non-POSIX, but safer, copying to special nodes" 306 bool "Non-POSIX, but safer, copying to special nodes"
158 default y 307 default y
@@ -177,6 +326,19 @@ config FEATURE_VERBOSE_CP_MESSAGE
177 cp: cannot stat '/vmlinuz/file': Not a directory 326 cp: cannot stat '/vmlinuz/file': Not a directory
178 This will cost you ~60 bytes. 327 This will cost you ~60 bytes.
179 328
329config FEATURE_USE_SENDFILE
330 bool "Use sendfile system call"
331 default y
332 select PLATFORM_LINUX
333 help
334 When enabled, busybox will use the kernel sendfile() function
335 instead of read/write loops to copy data between file descriptors
336 (for example, cp command does this a lot).
337 If sendfile() doesn't work, copying code falls back to read/write
338 loop. sendfile() was originally implemented for faster I/O
339 from files to sockets, but since Linux 2.6.33 it was extended
340 to work for many more file types.
341
180config FEATURE_COPYBUF_KB 342config FEATURE_COPYBUF_KB
181 int "Copy buffer size, in kilobytes" 343 int "Copy buffer size, in kilobytes"
182 range 1 1024 344 range 1 1024
diff --git a/libbb/appletlib.c b/libbb/appletlib.c
index 4aa40454f..1fe0eb44f 100644
--- a/libbb/appletlib.c
+++ b/libbb/appletlib.c
@@ -821,7 +821,7 @@ static int busybox_main(char **argv)
821 col += len2; 821 col += len2;
822 a += len2 - 1; 822 a += len2 - 1;
823 } 823 }
824 full_write2_str("\n\n"); 824 full_write2_str("\n");
825 return 0; 825 return 0;
826 } 826 }
827 827
@@ -936,20 +936,21 @@ void FAST_FUNC run_applet_no_and_exit(int applet_no, char **argv)
936} 936}
937# endif /* NUM_APPLETS > 0 */ 937# endif /* NUM_APPLETS > 0 */
938 938
939# if ENABLE_BUSYBOX || NUM_APPLETS > 0
939static NORETURN void run_applet_and_exit(const char *name, char **argv) 940static NORETURN void run_applet_and_exit(const char *name, char **argv)
940{ 941{
941# if ENABLE_BUSYBOX 942# if ENABLE_BUSYBOX
942 if (is_prefixed_with(name, "busybox")) 943 if (is_prefixed_with(name, "busybox"))
943 exit(busybox_main(argv)); 944 exit(busybox_main(argv));
944# endif 945# endif
945# if NUM_APPLETS > 0 946# if NUM_APPLETS > 0
946 /* find_applet_by_name() search is more expensive, so goes second */ 947 /* find_applet_by_name() search is more expensive, so goes second */
947 { 948 {
948 int applet = find_applet_by_name(name); 949 int applet = find_applet_by_name(name);
949 if (applet >= 0) 950 if (applet >= 0)
950 run_applet_no_and_exit(applet, argv); 951 run_applet_no_and_exit(applet, argv);
951 } 952 }
952# endif 953# endif
953 954
954 /*bb_error_msg_and_die("applet not found"); - links in printf */ 955 /*bb_error_msg_and_die("applet not found"); - links in printf */
955 full_write2_str(applet_name); 956 full_write2_str(applet_name);
@@ -957,11 +958,11 @@ static NORETURN void run_applet_and_exit(const char *name, char **argv)
957 /* POSIX: "If a command is not found, the exit status shall be 127" */ 958 /* POSIX: "If a command is not found, the exit status shall be 127" */
958 exit(127); 959 exit(127);
959} 960}
961# endif
960 962
961#endif /* !defined(SINGLE_APPLET_MAIN) */ 963#endif /* !defined(SINGLE_APPLET_MAIN) */
962 964
963 965
964
965#if ENABLE_BUILD_LIBBUSYBOX 966#if ENABLE_BUILD_LIBBUSYBOX
966int lbb_main(char **argv) 967int lbb_main(char **argv)
967#else 968#else
@@ -1025,6 +1026,7 @@ int main(int argc UNUSED_PARAM, char **argv)
1025#endif 1026#endif
1026 1027
1027#if defined(SINGLE_APPLET_MAIN) 1028#if defined(SINGLE_APPLET_MAIN)
1029
1028 /* Only one applet is selected in .config */ 1030 /* Only one applet is selected in .config */
1029 if (argv[1] && is_prefixed_with(argv[0], "busybox")) { 1031 if (argv[1] && is_prefixed_with(argv[0], "busybox")) {
1030 /* "busybox <applet> <params>" should still work as expected */ 1032 /* "busybox <applet> <params>" should still work as expected */
@@ -1033,9 +1035,16 @@ int main(int argc UNUSED_PARAM, char **argv)
1033 /* applet_names in this case is just "applet\0\0" */ 1035 /* applet_names in this case is just "applet\0\0" */
1034 lbb_prepare(applet_names IF_FEATURE_INDIVIDUAL(, argv)); 1036 lbb_prepare(applet_names IF_FEATURE_INDIVIDUAL(, argv));
1035 return SINGLE_APPLET_MAIN(argc, argv); 1037 return SINGLE_APPLET_MAIN(argc, argv);
1038
1039#elif !ENABLE_BUSYBOX && NUM_APPLETS == 0
1040
1041 full_write2_str(bb_basename(argv[0]));
1042 full_write2_str(": no applets enabled\n");
1043 exit(127);
1044
1036#else 1045#else
1037 lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv));
1038 1046
1047 lbb_prepare("busybox" IF_FEATURE_INDIVIDUAL(, argv));
1039# if !ENABLE_BUSYBOX 1048# if !ENABLE_BUSYBOX
1040 if (argv[1] && is_prefixed_with(bb_basename(argv[0]), "busybox")) 1049 if (argv[1] && is_prefixed_with(bb_basename(argv[0]), "busybox"))
1041 argv++; 1050 argv++;
@@ -1067,9 +1076,8 @@ int main(int argc UNUSED_PARAM, char **argv)
1067 } 1076 }
1068 } 1077 }
1069 applet_name = bb_basename(applet_name); 1078 applet_name = bb_basename(applet_name);
1070
1071 parse_config_file(); /* ...maybe, if FEATURE_SUID_CONFIG */ 1079 parse_config_file(); /* ...maybe, if FEATURE_SUID_CONFIG */
1072
1073 run_applet_and_exit(applet_name, argv); 1080 run_applet_and_exit(applet_name, argv);
1081
1074#endif 1082#endif
1075} 1083}
diff --git a/libbb/lineedit.c b/libbb/lineedit.c
index 06f708b62..5d9080131 100644
--- a/libbb/lineedit.c
+++ b/libbb/lineedit.c
@@ -13,7 +13,6 @@
13 * 13 *
14 * This code is 'as is' with no warranty. 14 * This code is 'as is' with no warranty.
15 */ 15 */
16
17/* 16/*
18 * Usage and known bugs: 17 * Usage and known bugs:
19 * Terminal key codes are not extensive, more needs to be added. 18 * Terminal key codes are not extensive, more needs to be added.
@@ -23,9 +22,6 @@
23 * Ctrl-E also works as End. 22 * Ctrl-E also works as End.
24 * 23 *
25 * The following readline-like commands are not implemented: 24 * The following readline-like commands are not implemented:
26 * ESC-b -- Move back one word
27 * ESC-f -- Move forward one word
28 * ESC-d -- Delete forward one word
29 * CTL-t -- Transpose two characters 25 * CTL-t -- Transpose two characters
30 * 26 *
31 * lineedit does not know that the terminal escape sequences do not 27 * lineedit does not know that the terminal escape sequences do not
@@ -133,8 +129,7 @@ static const char null_str[] ALIGN1 = "";
133struct lineedit_statics { 129struct lineedit_statics {
134 line_input_t *state; 130 line_input_t *state;
135 131
136 volatile unsigned cmdedit_termw; /* = 80; */ /* actual terminal width */ 132 unsigned cmdedit_termw; /* = 80; */ /* actual terminal width */
137 sighandler_t previous_SIGWINCH_handler;
138 133
139 unsigned cmdedit_x; /* real x (col) terminal position */ 134 unsigned cmdedit_x; /* real x (col) terminal position */
140 unsigned cmdedit_y; /* pseudoreal y (row) terminal position */ 135 unsigned cmdedit_y; /* pseudoreal y (row) terminal position */
@@ -159,15 +154,22 @@ struct lineedit_statics {
159 unsigned num_matches; 154 unsigned num_matches;
160#endif 155#endif
161 156
157 unsigned SIGWINCH_saved;
158 volatile unsigned SIGWINCH_count;
159 volatile smallint ok_to_redraw;
160
162#if ENABLE_FEATURE_EDITING_VI 161#if ENABLE_FEATURE_EDITING_VI
163# define DELBUFSIZ 128 162# define DELBUFSIZ 128
164 CHAR_T *delptr;
165 smallint newdelflag; /* whether delbuf should be reused yet */ 163 smallint newdelflag; /* whether delbuf should be reused yet */
164 CHAR_T *delptr;
166 CHAR_T delbuf[DELBUFSIZ]; /* a place to store deleted characters */ 165 CHAR_T delbuf[DELBUFSIZ]; /* a place to store deleted characters */
167#endif 166#endif
168#if ENABLE_FEATURE_EDITING_ASK_TERMINAL 167#if ENABLE_FEATURE_EDITING_ASK_TERMINAL
169 smallint sent_ESC_br6n; 168 smallint sent_ESC_br6n;
170#endif 169#endif
170
171 /* Largish struct, keeping it last results in smaller code */
172 struct sigaction SIGWINCH_handler;
171}; 173};
172 174
173/* See lineedit_ptr_hack.c */ 175/* See lineedit_ptr_hack.c */
@@ -176,7 +178,6 @@ extern struct lineedit_statics *const lineedit_ptr_to_statics;
176#define S (*lineedit_ptr_to_statics) 178#define S (*lineedit_ptr_to_statics)
177#define state (S.state ) 179#define state (S.state )
178#define cmdedit_termw (S.cmdedit_termw ) 180#define cmdedit_termw (S.cmdedit_termw )
179#define previous_SIGWINCH_handler (S.previous_SIGWINCH_handler)
180#define cmdedit_x (S.cmdedit_x ) 181#define cmdedit_x (S.cmdedit_x )
181#define cmdedit_y (S.cmdedit_y ) 182#define cmdedit_y (S.cmdedit_y )
182#define cmdedit_prmt_len (S.cmdedit_prmt_len) 183#define cmdedit_prmt_len (S.cmdedit_prmt_len)
@@ -474,14 +475,10 @@ static void beep(void)
474 475
475static void put_prompt(void) 476static void put_prompt(void)
476{ 477{
477 unsigned w;
478
479 fputs(cmdedit_prompt, stdout); 478 fputs(cmdedit_prompt, stdout);
480 fflush_all();
481 cursor = 0; 479 cursor = 0;
482 w = cmdedit_termw; /* read volatile var once */ 480 cmdedit_y = cmdedit_prmt_len / cmdedit_termw; /* new quasireal y */
483 cmdedit_y = cmdedit_prmt_len / w; /* new quasireal y */ 481 cmdedit_x = cmdedit_prmt_len % cmdedit_termw;
484 cmdedit_x = cmdedit_prmt_len % w;
485} 482}
486 483
487/* Move back one character */ 484/* Move back one character */
@@ -555,13 +552,11 @@ static void input_backward(unsigned num)
555 put_cur_glyph_and_inc_cursor(); 552 put_cur_glyph_and_inc_cursor();
556 } else { 553 } else {
557 int lines_up; 554 int lines_up;
558 unsigned width;
559 /* num = chars to go back from the beginning of current line: */ 555 /* num = chars to go back from the beginning of current line: */
560 num -= cmdedit_x; 556 num -= cmdedit_x;
561 width = cmdedit_termw; /* read volatile var once */
562 /* num=1...w: one line up, w+1...2w: two, etc: */ 557 /* num=1...w: one line up, w+1...2w: two, etc: */
563 lines_up = 1 + (num - 1) / width; 558 lines_up = 1 + (num - 1) / cmdedit_termw;
564 cmdedit_x = (width * cmdedit_y - num) % width; 559 cmdedit_x = (cmdedit_termw * cmdedit_y - num) % cmdedit_termw;
565 cmdedit_y -= lines_up; 560 cmdedit_y -= lines_up;
566 /* go to 1st column; go up */ 561 /* go to 1st column; go up */
567 printf("\r" ESC"[%uA", lines_up); 562 printf("\r" ESC"[%uA", lines_up);
@@ -2052,28 +2047,29 @@ static void parse_and_put_prompt(const char *prmt_ptr)
2052} 2047}
2053#endif 2048#endif
2054 2049
2055static void cmdedit_setwidth(unsigned w, int redraw_flg) 2050static void cmdedit_setwidth(void)
2056{ 2051{
2057 cmdedit_termw = w; 2052 int new_y;
2058 if (redraw_flg) { 2053
2059 /* new y for current cursor */ 2054 cmdedit_termw = get_terminal_width(STDIN_FILENO);
2060 int new_y = (cursor + cmdedit_prmt_len) / w; 2055 /* new y for current cursor */
2061 /* redraw */ 2056 new_y = (cursor + cmdedit_prmt_len) / cmdedit_termw;
2062 redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), command_len - cursor); 2057 /* redraw */
2063 fflush_all(); 2058 redraw((new_y >= cmdedit_y ? new_y : cmdedit_y), command_len - cursor);
2064 }
2065} 2059}
2066 2060
2067static void win_changed(int nsig) 2061static void win_changed(int nsig UNUSED_PARAM)
2068{ 2062{
2069 int sv_errno = errno; 2063 if (S.ok_to_redraw) {
2070 unsigned width; 2064 /* We are in read_key(), safe to redraw immediately */
2071 2065 int sv_errno = errno;
2072 get_terminal_width_height(0, &width, NULL); 2066 cmdedit_setwidth();
2073//FIXME: cmdedit_setwidth() -> redraw() -> printf() -> KABOOM! (we are in signal handler!) 2067 fflush_all();
2074 cmdedit_setwidth(width, /*redraw_flg:*/ nsig); 2068 errno = sv_errno;
2075 2069 } else {
2076 errno = sv_errno; 2070 /* Signal main loop that redraw is necessary */
2071 S.SIGWINCH_count++;
2072 }
2077} 2073}
2078 2074
2079static int lineedit_read_key(char *read_key_buffer, int timeout) 2075static int lineedit_read_key(char *read_key_buffer, int timeout)
@@ -2084,6 +2080,7 @@ static int lineedit_read_key(char *read_key_buffer, int timeout)
2084 int unicode_idx = 0; 2080 int unicode_idx = 0;
2085#endif 2081#endif
2086 2082
2083 fflush_all();
2087 while (1) { 2084 while (1) {
2088 /* Wait for input. TIMEOUT = -1 makes read_key wait even 2085 /* Wait for input. TIMEOUT = -1 makes read_key wait even
2089 * on nonblocking stdin, TIMEOUT = 50 makes sure we won't 2086 * on nonblocking stdin, TIMEOUT = 50 makes sure we won't
@@ -2092,7 +2089,9 @@ static int lineedit_read_key(char *read_key_buffer, int timeout)
2092 * 2089 *
2093 * Note: read_key sets errno to 0 on success. 2090 * Note: read_key sets errno to 0 on success.
2094 */ 2091 */
2092 S.ok_to_redraw = 1;
2095 ic = read_key(STDIN_FILENO, read_key_buffer, timeout); 2093 ic = read_key(STDIN_FILENO, read_key_buffer, timeout);
2094 S.ok_to_redraw = 0;
2096 if (errno) { 2095 if (errno) {
2097#if ENABLE_UNICODE_SUPPORT 2096#if ENABLE_UNICODE_SUPPORT
2098 if (errno == EAGAIN && unicode_idx != 0) 2097 if (errno == EAGAIN && unicode_idx != 0)
@@ -2223,7 +2222,6 @@ static int32_t reverse_i_search(void)
2223 int h; 2222 int h;
2224 unsigned match_buf_len = strlen(match_buf); 2223 unsigned match_buf_len = strlen(match_buf);
2225 2224
2226 fflush_all();
2227//FIXME: correct timeout? 2225//FIXME: correct timeout?
2228 ic = lineedit_read_key(read_key_buffer, -1); 2226 ic = lineedit_read_key(read_key_buffer, -1);
2229 2227
@@ -2325,6 +2323,7 @@ static int32_t reverse_i_search(void)
2325 * Returns: 2323 * Returns:
2326 * -1 on read errors or EOF, or on bare Ctrl-D, 2324 * -1 on read errors or EOF, or on bare Ctrl-D,
2327 * 0 on ctrl-C (the line entered is still returned in 'command'), 2325 * 0 on ctrl-C (the line entered is still returned in 'command'),
2326 * (in both cases the cursor remains on the input line, '\n' is not printed)
2328 * >0 length of input string, including terminating '\n' 2327 * >0 length of input string, including terminating '\n'
2329 */ 2328 */
2330int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize, int timeout) 2329int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize, int timeout)
@@ -2359,7 +2358,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
2359 * tty is still in "raw mode"). 2358 * tty is still in "raw mode").
2360 */ 2359 */
2361 parse_and_put_prompt(prompt); 2360 parse_and_put_prompt(prompt);
2362 /* fflush_all(); - done by parse_and_put_prompt */ 2361 fflush_all();
2363 if (fgets(command, maxsize, stdin) == NULL) 2362 if (fgets(command, maxsize, stdin) == NULL)
2364 len = -1; /* EOF or error */ 2363 len = -1; /* EOF or error */
2365 else 2364 else
@@ -2435,9 +2434,11 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
2435 ask_terminal(); 2434 ask_terminal();
2436 2435
2437 /* Install window resize handler (NB: after *all* init is complete) */ 2436 /* Install window resize handler (NB: after *all* init is complete) */
2438//FIXME: save entire sigaction! 2437 S.SIGWINCH_handler.sa_handler = win_changed;
2439 previous_SIGWINCH_handler = signal(SIGWINCH, win_changed); 2438 S.SIGWINCH_handler.sa_flags = SA_RESTART;
2440 win_changed(0); /* get initial window size */ 2439 sigaction(SIGWINCH, &S.SIGWINCH_handler, &S.SIGWINCH_handler);
2440
2441 cmdedit_termw = get_terminal_width(STDIN_FILENO);
2441 2442
2442 read_key_buffer[0] = 0; 2443 read_key_buffer[0] = 0;
2443 while (1) { 2444 while (1) {
@@ -2450,8 +2451,14 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
2450 * in one place. 2451 * in one place.
2451 */ 2452 */
2452 int32_t ic, ic_raw; 2453 int32_t ic, ic_raw;
2454 unsigned count;
2455
2456 count = S.SIGWINCH_count;
2457 if (S.SIGWINCH_saved != count) {
2458 S.SIGWINCH_saved = count;
2459 cmdedit_setwidth();
2460 }
2453 2461
2454 fflush_all();
2455 ic = ic_raw = lineedit_read_key(read_key_buffer, timeout); 2462 ic = ic_raw = lineedit_read_key(read_key_buffer, timeout);
2456#if ENABLE_PLATFORM_MINGW32 2463#if ENABLE_PLATFORM_MINGW32
2457 /* scroll to cursor position on any keypress */ 2464 /* scroll to cursor position on any keypress */
@@ -2565,6 +2572,24 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
2565 while (cursor > 0 && !BB_isspace(command_ps[cursor-1])) 2572 while (cursor > 0 && !BB_isspace(command_ps[cursor-1]))
2566 input_backspace(); 2573 input_backspace();
2567 break; 2574 break;
2575 case KEYCODE_ALT_D: {
2576 /* Delete word forward */
2577 int nc, sc = cursor;
2578 ctrl_right();
2579 nc = cursor - sc;
2580 input_backward(nc);
2581 while (--nc >= 0)
2582 input_delete(1);
2583 break;
2584 }
2585 case KEYCODE_ALT_BACKSPACE: {
2586 /* Delete word backward */
2587 int sc = cursor;
2588 ctrl_left();
2589 while (sc-- > cursor)
2590 input_delete(1);
2591 break;
2592 }
2568#if ENABLE_FEATURE_REVERSE_SEARCH 2593#if ENABLE_FEATURE_REVERSE_SEARCH
2569 case CTRL('R'): 2594 case CTRL('R'):
2570 ic = ic_raw = reverse_i_search(); 2595 ic = ic_raw = reverse_i_search();
@@ -2792,7 +2817,6 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
2792 && ic_raw == initial_settings.c_cc[VINTR] 2817 && ic_raw == initial_settings.c_cc[VINTR]
2793 ) { 2818 ) {
2794 /* Ctrl-C (usually) - stop gathering input */ 2819 /* Ctrl-C (usually) - stop gathering input */
2795 goto_new_line();
2796 command_len = 0; 2820 command_len = 0;
2797 break_out = -1; /* "do not append '\n'" */ 2821 break_out = -1; /* "do not append '\n'" */
2798 break; 2822 break;
@@ -2914,7 +2938,7 @@ int FAST_FUNC read_line_input(line_input_t *st, const char *prompt, char *comman
2914 /* restore initial_settings */ 2938 /* restore initial_settings */
2915 tcsetattr_stdin_TCSANOW(&initial_settings); 2939 tcsetattr_stdin_TCSANOW(&initial_settings);
2916 /* restore SIGWINCH handler */ 2940 /* restore SIGWINCH handler */
2917 signal(SIGWINCH, previous_SIGWINCH_handler); 2941 sigaction_set(SIGWINCH, &S.SIGWINCH_handler);
2918 fflush_all(); 2942 fflush_all();
2919 2943
2920 len = command_len; 2944 len = command_len;
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)
18 /* Known escape sequences for cursor and function keys. 18 /* Known escape sequences for cursor and function keys.
19 * See "Xterm Control Sequences" 19 * See "Xterm Control Sequences"
20 * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html 20 * http://invisible-island.net/xterm/ctlseqs/ctlseqs.html
21 * Array should be sorted from shortest to longest.
21 */ 22 */
22 static const char esccmds[] ALIGN1 = { 23 static const char esccmds[] ALIGN1 = {
24 '\x7f' |0x80,KEYCODE_ALT_BACKSPACE,
25 '\b' |0x80,KEYCODE_ALT_BACKSPACE,
26 'd' |0x80,KEYCODE_ALT_D ,
27 /* lineedit mimics bash: Alt-f and Alt-b are forward/backward
28 * word jumps. We cheat here and make them return ALT_LEFT/RIGHT
29 * keycodes. This way, lineedit need no special code to handle them.
30 * If we'll need to distinguish them, introduce new ALT_F/B keycodes,
31 * and update lineedit to react to them.
32 */
33 'f' |0x80,KEYCODE_ALT_RIGHT,
34 'b' |0x80,KEYCODE_ALT_LEFT,
23 'O','A' |0x80,KEYCODE_UP , 35 'O','A' |0x80,KEYCODE_UP ,
24 'O','B' |0x80,KEYCODE_DOWN , 36 'O','B' |0x80,KEYCODE_DOWN ,
25 'O','C' |0x80,KEYCODE_RIGHT , 37 'O','C' |0x80,KEYCODE_RIGHT ,
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)
186 gr = xgetgrnam(argv[1]); /* unknown group: exit */ 186 gr = xgetgrnam(argv[1]); /* unknown group: exit */
187 /* check if user is already in this group */ 187 /* check if user is already in this group */
188 for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) { 188 for (; *(gr->gr_mem) != NULL; (gr->gr_mem)++) {
189 if (!strcmp(argv[0], *(gr->gr_mem))) { 189 if (strcmp(argv[0], *(gr->gr_mem)) == 0) {
190 /* user is already in group: do nothing */ 190 /* user is already in group: do nothing */
191 return EXIT_SUCCESS; 191 return EXIT_SUCCESS;
192 } 192 }
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"
2 2
3INSERT 3INSERT
4 4
5config MAKEMIME
6 bool "makemime"
7 default y
8 help
9 Create MIME-formatted messages.
10
11config FEATURE_MIME_CHARSET 5config FEATURE_MIME_CHARSET
12 string "Default charset" 6 string "Default charset"
13 default "us-ascii" 7 default "us-ascii"
@@ -15,41 +9,4 @@ config FEATURE_MIME_CHARSET
15 help 9 help
16 Default charset of the message. 10 Default charset of the message.
17 11
18config POPMAILDIR
19 bool "popmaildir"
20 default y
21 help
22 Simple yet powerful POP3 mail popper. Delivers content
23 of remote mailboxes to local Maildir.
24
25config FEATURE_POPMAILDIR_DELIVERY
26 bool "Allow message filters and custom delivery program"
27 default y
28 depends on POPMAILDIR
29 help
30 Allow to use a custom program to filter the content
31 of the message before actual delivery (-F "prog [args...]").
32 Allow to use a custom program for message actual delivery
33 (-M "prog [args...]").
34
35config REFORMIME
36 bool "reformime"
37 default y
38 help
39 Parse MIME-formatted messages.
40
41config FEATURE_REFORMIME_COMPAT
42 bool "Accept and ignore options other than -x and -X"
43 default y
44 depends on REFORMIME
45 help
46 Accept (for compatibility only) and ignore options
47 other than -x and -X.
48
49config SENDMAIL
50 bool "sendmail"
51 default y
52 help
53 Barebones sendmail.
54
55endmenu 12endmenu
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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config MAKEMIME
10//config: bool "makemime"
11//config: default y
12//config: help
13//config: Create MIME-formatted messages.
14
15//applet:IF_MAKEMIME(APPLET(makemime, BB_DIR_BIN, BB_SUID_DROP))
9 16
10//kbuild:lib-$(CONFIG_MAKEMIME) += makemime.o mail.o 17//kbuild:lib-$(CONFIG_MAKEMIME) += makemime.o mail.o
11 18
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 @@
9 * 9 *
10 * Licensed under GPLv2, see file LICENSE in this source tree. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12//config:config POPMAILDIR
13//config: bool "popmaildir"
14//config: default y
15//config: help
16//config: Simple yet powerful POP3 mail popper. Delivers content
17//config: of remote mailboxes to local Maildir.
18//config:
19//config:config FEATURE_POPMAILDIR_DELIVERY
20//config: bool "Allow message filters and custom delivery program"
21//config: default y
22//config: depends on POPMAILDIR
23//config: help
24//config: Allow to use a custom program to filter the content
25//config: of the message before actual delivery (-F "prog [args...]").
26//config: Allow to use a custom program for message actual delivery
27//config: (-M "prog [args...]").
28
29//applet:IF_POPMAILDIR(APPLET(popmaildir, BB_DIR_USR_SBIN, BB_SUID_DROP))
12 30
13//kbuild:lib-$(CONFIG_POPMAILDIR) += popmaildir.o mail.o 31//kbuild:lib-$(CONFIG_POPMAILDIR) += popmaildir.o mail.o
14 32
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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config REFORMIME
10//config: bool "reformime"
11//config: default y
12//config: help
13//config: Parse MIME-formatted messages.
14//config:
15//config:config FEATURE_REFORMIME_COMPAT
16//config: bool "Accept and ignore options other than -x and -X"
17//config: default y
18//config: depends on REFORMIME
19//config: help
20//config: Accept (for compatibility only) and ignore options
21//config: other than -x and -X.
22
23//applet:IF_REFORMIME(APPLET(reformime, BB_DIR_BIN, BB_SUID_DROP))
9 24
10//kbuild:lib-$(CONFIG_REFORMIME) += reformime.o mail.o 25//kbuild:lib-$(CONFIG_REFORMIME) += reformime.o mail.o
11 26
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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config SENDMAIL
10//config: bool "sendmail"
11//config: default y
12//config: help
13//config: Barebones sendmail.
14
15//applet:IF_SENDMAIL(APPLET(sendmail, BB_DIR_USR_SBIN, BB_SUID_DROP))
9 16
10//kbuild:lib-$(CONFIG_SENDMAIL) += sendmail.o mail.o 17//kbuild:lib-$(CONFIG_SENDMAIL) += sendmail.o mail.o
11 18
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"
7 7
8INSERT 8INSERT
9 9
10config ADJTIMEX
11 bool "adjtimex"
12 default y
13 select PLATFORM_LINUX
14 help
15 Adjtimex reads and optionally sets adjustment parameters for
16 the Linux clock adjustment algorithm.
17
18config BBCONFIG
19 bool "bbconfig"
20 default n
21 help
22 The bbconfig applet will print the config file with which
23 busybox was built.
24
25config FEATURE_COMPRESS_BBCONFIG
26 bool "Compress bbconfig data"
27 default y
28 depends on BBCONFIG
29 help
30 Store bbconfig data in compressed form, uncompress them on-the-fly
31 before output.
32
33 If you have a really tiny busybox with few applets enabled (and
34 bunzip2 isn't one of them), the overhead of the decompressor might
35 be noticeable. Also, if you run executables directly from ROM
36 and have very little memory, this might not be a win. Otherwise,
37 you probably want this.
38
39config BEEP
40 bool "beep"
41 default y
42 select PLATFORM_LINUX
43 help
44 The beep applets beeps in a given freq/Hz.
45
46config FEATURE_BEEP_FREQ
47 int "default frequency"
48 range 0 2147483647
49 default 4000
50 depends on BEEP
51 help
52 Frequency for default beep.
53
54config FEATURE_BEEP_LENGTH_MS
55 int "default length"
56 range 0 2147483647
57 default 30
58 depends on BEEP
59 help
60 Length in ms for default beep.
61
62config CHAT
63 bool "chat"
64 default y
65 help
66 Simple chat utility.
67
68config FEATURE_CHAT_NOFAIL
69 bool "Enable NOFAIL expect strings"
70 depends on CHAT
71 default y
72 help
73 When enabled expect strings which are started with a dash trigger
74 no-fail mode. That is when expectation is not met within timeout
75 the script is not terminated but sends next SEND string and waits
76 for next EXPECT string. This allows to compose far more flexible
77 scripts.
78
79config FEATURE_CHAT_TTY_HIFI
80 bool "Force STDIN to be a TTY"
81 depends on CHAT
82 default n
83 help
84 Original chat always treats STDIN as a TTY device and sets for it
85 so-called raw mode. This option turns on such behaviour.
86
87config FEATURE_CHAT_IMPLICIT_CR
88 bool "Enable implicit Carriage Return"
89 depends on CHAT
90 default y
91 help
92 When enabled make chat to terminate all SEND strings with a "\r"
93 unless "\c" is met anywhere in the string.
94
95config FEATURE_CHAT_SWALLOW_OPTS
96 bool "Swallow options"
97 depends on CHAT
98 default y
99 help
100 Busybox chat require no options. To make it not fail when used
101 in place of original chat (which has a bunch of options) turn
102 this on.
103
104config FEATURE_CHAT_SEND_ESCAPES
105 bool "Support weird SEND escapes"
106 depends on CHAT
107 default y
108 help
109 Original chat uses some escape sequences in SEND arguments which
110 are not sent to device but rather performs special actions.
111 E.g. "\K" means to send a break sequence to device.
112 "\d" delays execution for a second, "\p" -- for a 1/100 of second.
113 Before turning this option on think twice: do you really need them?
114
115config FEATURE_CHAT_VAR_ABORT_LEN
116 bool "Support variable-length ABORT conditions"
117 depends on CHAT
118 default y
119 help
120 Original chat uses fixed 50-bytes length ABORT conditions. Say N here.
121
122config FEATURE_CHAT_CLR_ABORT
123 bool "Support revoking of ABORT conditions"
124 depends on CHAT
125 default y
126 help
127 Support CLR_ABORT directive.
128
129config CHRT
130 bool "chrt"
131 default y
132 help
133 manipulate real-time attributes of a process.
134 This requires sched_{g,s}etparam support in your libc.
135
136config CRONTAB
137 bool "crontab"
138 default y
139 help
140 Crontab manipulates the crontab for a particular user. Only
141 the superuser may specify a different user and/or crontab directory.
142 Note that Busybox binary must be setuid root for this applet to
143 work properly.
144
145config DC
146 bool "dc"
147 default y
148 help
149 Dc is a reverse-polish desk calculator which supports unlimited
150 precision arithmetic.
151
152config FEATURE_DC_LIBM
153 bool "Enable power and exp functions (requires libm)"
154 default y
155 depends on DC
156 help
157 Enable power and exp functions.
158 NOTE: This will require libm to be present for linking.
159
160config DEVFSD
161 bool "devfsd (obsolete)"
162 default n
163 select PLATFORM_LINUX
164 select FEATURE_SYSLOG
165 help
166 This is deprecated and should NOT be used anymore.
167 Use linux >= 2.6 (optionally with hotplug) and mdev instead!
168 See docs/mdev.txt for detailed instructions on how to use mdev
169 instead.
170
171 Provides compatibility with old device names on a devfs systems.
172 You should set it to true if you have devfs enabled.
173 The following keywords in devsfd.conf are supported:
174 "CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE", "RESTORE",
175 "PERMISSIONS", "EXECUTE", "COPY", "IGNORE",
176 "MKOLDCOMPAT", "MKNEWCOMPAT","RMOLDCOMPAT", "RMNEWCOMPAT".
177
178 But only if they are written UPPERCASE!!!!!!!!
179
180config DEVFSD_MODLOAD
181 bool "Adds support for MODLOAD keyword in devsfd.conf"
182 default y
183 depends on DEVFSD
184 help
185 This actually doesn't work with busybox modutils but needs
186 the external modutils.
187
188config DEVFSD_FG_NP
189 bool "Enables the -fg and -np options"
190 default y
191 depends on DEVFSD
192 help
193 -fg Run the daemon in the foreground.
194 -np Exit after parsing the configuration file.
195 Do not poll for events.
196
197config DEVFSD_VERBOSE
198 bool "Increases logging (and size)"
199 default y
200 depends on DEVFSD
201 help
202 Increases logging to stderr or syslog.
203
204config FEATURE_DEVFS
205 bool "Use devfs names for all devices (obsolete)"
206 default n
207 select PLATFORM_LINUX
208 help
209 This is obsolete and should NOT be used anymore.
210 Use linux >= 2.6 (optionally with hotplug) and mdev instead!
211
212 For legacy systems -- if there is no way around devfsd -- this
213 tells busybox to look for names like /dev/loop/0 instead of
214 /dev/loop0. If your /dev directory has normal names instead of
215 devfs names, you don't want this.
216
217config DEVMEM
218 bool "devmem"
219 default y
220 help
221 devmem is a small program that reads and writes from physical
222 memory using /dev/mem.
223
224config EJECT
225 bool "eject"
226 default y
227 select PLATFORM_LINUX
228 help
229 Used to eject cdroms. (defaults to /dev/cdrom)
230
231config FEATURE_EJECT_SCSI
232 bool "SCSI support"
233 default y
234 depends on EJECT
235 help
236 Add the -s option to eject, this allows to eject SCSI-Devices and
237 usb-storage devices.
238
239config FBSPLASH
240 bool "fbsplash"
241 default y
242 select PLATFORM_LINUX
243 help
244 Shows splash image and progress bar on framebuffer device.
245 Can be used during boot phase of an embedded device. ~2kb.
246 Usage:
247 - use kernel option 'vga=xxx' or otherwise enable fb device.
248 - put somewhere fbsplash.cfg file and an image in .ppm format.
249 - $ setsid fbsplash [params] &
250 -c: hide cursor
251 -d /dev/fbN: framebuffer device (if not /dev/fb0)
252 -s path_to_image_file (can be "-" for stdin)
253 -i path_to_cfg_file (can be "-" for stdin)
254 -f path_to_fifo (can be "-" for stdin)
255 - if you want to run it only in presence of kernel parameter:
256 grep -q "fbsplash=on" </proc/cmdline && setsid fbsplash [params] &
257 - commands for fifo:
258 "NN" (ASCII decimal number) - percentage to show on progress bar
259 "exit" - well you guessed it
260
261config FLASHCP
262 bool "flashcp"
263 default n # doesn't build on Ubuntu 8.04
264 help
265 The flashcp binary, inspired by mtd-utils as of git head 5eceb74f7.
266 This utility is used to copy images into a MTD device.
267
268config FLASH_LOCK
269 bool "flash_lock"
270 default n # doesn't build on Ubuntu 8.04
271 help
272 The flash_lock binary from mtd-utils as of git head 5ec0c10d0. This
273 utility locks part or all of the flash device.
274
275config FLASH_UNLOCK
276 bool "flash_unlock"
277 default n # doesn't build on Ubuntu 8.04
278 help
279 The flash_unlock binary from mtd-utils as of git head 5ec0c10d0. This
280 utility unlocks part or all of the flash device.
281
282config FLASH_ERASEALL
283 bool "flash_eraseall"
284 default n # doesn't build on Ubuntu 8.04
285 help
286 The flash_eraseall binary from mtd-utils as of git head c4c6a59eb.
287 This utility is used to erase the whole MTD device.
288
289config IONICE
290 bool "ionice"
291 default y
292 select PLATFORM_LINUX
293 help
294 Set/set program io scheduling class and priority
295 Requires kernel >= 2.6.13
296
297config INOTIFYD
298 bool "inotifyd"
299 default n # doesn't build on Knoppix 5
300 help
301 Simple inotify daemon. Reports filesystem changes. Requires
302 kernel >= 2.6.13
303
304config LAST
305 bool "last"
306 default y
307 depends on FEATURE_WTMP
308 help
309 'last' displays a list of the last users that logged into the system.
310
311config FEATURE_LAST_FANCY
312 bool "Turn on output of extra information"
313 default y
314 depends on LAST
315 help
316 'last' displays detailed information about the last users that
317 logged into the system (mimics sysvinit last). +900 bytes.
318
319config HDPARM
320 bool "hdparm"
321 default y
322 select PLATFORM_LINUX
323 help
324 Get/Set hard drive parameters. Primarily intended for ATA
325 drives. Adds about 13k (or around 30k if you enable the
326 FEATURE_HDPARM_GET_IDENTITY option)....
327
328config FEATURE_HDPARM_GET_IDENTITY
329 bool "Support obtaining detailed information directly from drives"
330 default y
331 depends on HDPARM
332 help
333 Enables the -I and -i options to obtain detailed information
334 directly from drives about their capabilities and supported ATA
335 feature set. If no device name is specified, hdparm will read
336 identify data from stdin. Enabling this option will add about 16k...
337
338config FEATURE_HDPARM_HDIO_SCAN_HWIF
339 bool "Register an IDE interface (DANGEROUS)"
340 default y
341 depends on HDPARM
342 help
343 Enables the 'hdparm -R' option to register an IDE interface.
344 This is dangerous stuff, so you should probably say N.
345
346config FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
347 bool "Un-register an IDE interface (DANGEROUS)"
348 default y
349 depends on HDPARM
350 help
351 Enables the 'hdparm -U' option to un-register an IDE interface.
352 This is dangerous stuff, so you should probably say N.
353
354config FEATURE_HDPARM_HDIO_DRIVE_RESET
355 bool "Perform device reset (DANGEROUS)"
356 default y
357 depends on HDPARM
358 help
359 Enables the 'hdparm -w' option to perform a device reset.
360 This is dangerous stuff, so you should probably say N.
361
362config FEATURE_HDPARM_HDIO_TRISTATE_HWIF
363 bool "Tristate device for hotswap (DANGEROUS)"
364 default y
365 depends on HDPARM
366 help
367 Enables the 'hdparm -x' option to tristate device for hotswap,
368 and the '-b' option to get/set bus state. This is dangerous
369 stuff, so you should probably say N.
370
371config FEATURE_HDPARM_HDIO_GETSET_DMA
372 bool "Get/set using_dma flag"
373 default y
374 depends on HDPARM
375 help
376 Enables the 'hdparm -d' option to get/set using_dma flag.
377
378config MAKEDEVS
379 bool "makedevs"
380 default y
381 help
382 'makedevs' is a utility used to create a batch of devices with
383 one command.
384
385 There are two choices for command line behaviour, the interface
386 as used by LEAF/Linux Router Project, or a device table file.
387
388 'leaf' is traditionally what busybox follows, it allows multiple
389 devices of a particluar type to be created per command.
390 e.g. /dev/hda[0-9]
391 Device properties are passed as command line arguments.
392
393 'table' reads device properties from a file or stdin, allowing
394 a batch of unrelated devices to be made with one command.
395 User/group names are allowed as an alternative to uid/gid.
396
397choice
398 prompt "Choose makedevs behaviour"
399 depends on MAKEDEVS
400 default FEATURE_MAKEDEVS_TABLE
401
402config FEATURE_MAKEDEVS_LEAF
403 bool "leaf"
404
405config FEATURE_MAKEDEVS_TABLE
406 bool "table"
407
408endchoice
409
410config MAN
411 bool "man"
412 default y
413 help
414 Format and display manual pages.
415
416config MICROCOM
417 bool "microcom"
418 default y
419 help
420 The poor man's minicom utility for chatting with serial port devices.
421
422config MOUNTPOINT
423 bool "mountpoint"
424 default y
425 help
426 mountpoint checks if the directory is a mountpoint.
427
428config MT
429 bool "mt"
430 default y
431 help
432 mt is used to control tape devices. You can use the mt utility
433 to advance or rewind a tape past a specified number of archive
434 files on the tape.
435
436config RAIDAUTORUN
437 bool "raidautorun"
438 default y
439 select PLATFORM_LINUX
440 help
441 raidautorun tells the kernel md driver to
442 search and start RAID arrays.
443
444config READAHEAD
445 bool "readahead"
446 default y
447 depends on LFS
448 select PLATFORM_LINUX
449 help
450 Preload the files listed on the command line into RAM cache so that
451 subsequent reads on these files will not block on disk I/O.
452
453 This applet just calls the readahead(2) system call on each file.
454 It is mainly useful in system startup scripts to preload files
455 or executables before they are used. When used at the right time
456 (in particular when a CPU bound process is running) it can
457 significantly speed up system startup.
458
459 As readahead(2) blocks until each file has been read, it is best to
460 run this applet as a background job.
461
462config RUNLEVEL
463 bool "runlevel"
464 default y
465 depends on FEATURE_UTMP
466 help
467 find the current and previous system runlevel.
468
469 This applet uses utmp but does not rely on busybox supporing
470 utmp on purpose. It is used by e.g. emdebian via /etc/init.d/rc.
471
472config RX
473 bool "rx"
474 default y
475 select PLATFORM_LINUX
476 help
477 Receive files using the Xmodem protocol.
478
479config SETSID
480 bool "setsid"
481 default y
482 help
483 setsid runs a program in a new session
484
485config STRINGS
486 bool "strings"
487 default y
488 help
489 strings prints the printable character sequences for each file
490 specified.
491
492config TIME
493 bool "time"
494 default y
495 help
496 The time command runs the specified program with the given arguments.
497 When the command finishes, time writes a message to standard output
498 giving timing statistics about this program run.
499
500config TIMEOUT
501 bool "timeout"
502 default y
503 help
504 Runs a program and watches it. If it does not terminate in
505 specified number of seconds, it is sent a signal.
506
507config TTYSIZE
508 bool "ttysize"
509 default y
510 help
511 A replacement for "stty size". Unlike stty, can report only width,
512 only height, or both, in any order. It also does not complain on
513 error, but returns default 80x24.
514 Usage in shell scripts: width=`ttysize w`.
515
516config VOLNAME
517 bool "volname"
518 default y
519 help
520 Prints a CD-ROM volume name.
521
522config WATCHDOG
523 bool "watchdog"
524 default y
525 select PLATFORM_LINUX
526 help
527 The watchdog utility is used with hardware or software watchdog
528 device drivers. It opens the specified watchdog device special file
529 and periodically writes a magic character to the device. If the
530 watchdog applet ever fails to write the magic character within a
531 certain amount of time, the watchdog device assumes the system has
532 hung, and will cause the hardware to reboot.
533
534endmenu 10endmenu
diff --git a/miscutils/Kbuild.src b/miscutils/Kbuild.src
index 503f54904..6b4fb7470 100644
--- a/miscutils/Kbuild.src
+++ b/miscutils/Kbuild.src
@@ -7,45 +7,3 @@
7lib-y:= 7lib-y:=
8 8
9INSERT 9INSERT
10lib-$(CONFIG_ADJTIMEX) += adjtimex.o
11lib-$(CONFIG_BBCONFIG) += bbconfig.o
12lib-$(CONFIG_BEEP) += beep.o
13lib-$(CONFIG_CHAT) += chat.o
14lib-$(CONFIG_CHRT) += chrt.o
15lib-$(CONFIG_CRONTAB) += crontab.o
16lib-$(CONFIG_DC) += dc.o
17lib-$(CONFIG_DEVFSD) += devfsd.o
18lib-$(CONFIG_DEVMEM) += devmem.o
19lib-$(CONFIG_EJECT) += eject.o
20lib-$(CONFIG_FBSPLASH) += fbsplash.o
21lib-$(CONFIG_FLASHCP) += flashcp.o
22lib-$(CONFIG_FLASH_ERASEALL) += flash_eraseall.o
23lib-$(CONFIG_FLASH_LOCK) += flash_lock_unlock.o
24lib-$(CONFIG_FLASH_UNLOCK) += flash_lock_unlock.o
25lib-$(CONFIG_IONICE) += ionice.o
26lib-$(CONFIG_HDPARM) += hdparm.o
27lib-$(CONFIG_INOTIFYD) += inotifyd.o
28
29ifeq ($(CONFIG_FEATURE_LAST_FANCY),y)
30lib-$(CONFIG_FEATURE_LAST_FANCY) += last_fancy.o
31else
32lib-$(CONFIG_LAST) += last.o
33endif
34
35lib-$(CONFIG_LESS) += less.o
36lib-$(CONFIG_MAKEDEVS) += makedevs.o
37lib-$(CONFIG_MAN) += man.o
38lib-$(CONFIG_MICROCOM) += microcom.o
39lib-$(CONFIG_MOUNTPOINT) += mountpoint.o
40lib-$(CONFIG_MT) += mt.o
41lib-$(CONFIG_RAIDAUTORUN) += raidautorun.o
42lib-$(CONFIG_READAHEAD) += readahead.o
43lib-$(CONFIG_RUNLEVEL) += runlevel.o
44lib-$(CONFIG_RX) += rx.o
45lib-$(CONFIG_SETSID) += setsid.o
46lib-$(CONFIG_STRINGS) += strings.o
47lib-$(CONFIG_TIME) += time.o
48lib-$(CONFIG_TIMEOUT) += timeout.o
49lib-$(CONFIG_TTYSIZE) += ttysize.o
50lib-$(CONFIG_VOLNAME) += volname.o
51lib-$(CONFIG_WATCHDOG) += watchdog.o
diff --git a/miscutils/adjtimex.c b/miscutils/adjtimex.c
index 058aa9a5c..6355cc1ef 100644
--- a/miscutils/adjtimex.c
+++ b/miscutils/adjtimex.c
@@ -10,6 +10,17 @@
10 * 10 *
11 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 11 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
12 */ 12 */
13//config:config ADJTIMEX
14//config: bool "adjtimex"
15//config: default y
16//config: select PLATFORM_LINUX
17//config: help
18//config: Adjtimex reads and optionally sets adjustment parameters for
19//config: the Linux clock adjustment algorithm.
20
21//applet:IF_ADJTIMEX(APPLET(adjtimex, BB_DIR_SBIN, BB_SUID_DROP))
22
23//kbuild:lib-$(CONFIG_ADJTIMEX) += adjtimex.o
13 24
14//usage:#define adjtimex_trivial_usage 25//usage:#define adjtimex_trivial_usage
15//usage: "[-q] [-o OFF] [-f FREQ] [-p TCONST] [-t TICK]" 26//usage: "[-q] [-o OFF] [-f FREQ] [-p TCONST] [-t TICK]"
diff --git a/miscutils/bbconfig.c b/miscutils/bbconfig.c
index b252779f5..5320c6966 100644
--- a/miscutils/bbconfig.c
+++ b/miscutils/bbconfig.c
@@ -1,6 +1,30 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* This file was released into the public domain by Paul Fox. 2/* This file was released into the public domain by Paul Fox.
3 */ 3 */
4//config:config BBCONFIG
5//config: bool "bbconfig"
6//config: default n
7//config: help
8//config: The bbconfig applet will print the config file with which
9//config: busybox was built.
10//config:
11//config:config FEATURE_COMPRESS_BBCONFIG
12//config: bool "Compress bbconfig data"
13//config: default y
14//config: depends on BBCONFIG
15//config: help
16//config: Store bbconfig data in compressed form, uncompress them on-the-fly
17//config: before output.
18//config:
19//config: If you have a really tiny busybox with few applets enabled (and
20//config: bunzip2 isn't one of them), the overhead of the decompressor might
21//config: be noticeable. Also, if you run executables directly from ROM
22//config: and have very little memory, this might not be a win. Otherwise,
23//config: you probably want this.
24
25//applet:IF_BBCONFIG(APPLET(bbconfig, BB_DIR_BIN, BB_SUID_DROP))
26
27//kbuild:lib-$(CONFIG_BBCONFIG) += bbconfig.o
4 28
5//usage:#define bbconfig_trivial_usage 29//usage:#define bbconfig_trivial_usage
6//usage: "" 30//usage: ""
diff --git a/miscutils/beep.c b/miscutils/beep.c
index 18b160cc4..14802b543 100644
--- a/miscutils/beep.c
+++ b/miscutils/beep.c
@@ -7,6 +7,32 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 */ 9 */
10//config:config BEEP
11//config: bool "beep"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: The beep applets beeps in a given freq/Hz.
16//config:
17//config:config FEATURE_BEEP_FREQ
18//config: int "default frequency"
19//config: range 0 2147483647
20//config: default 4000
21//config: depends on BEEP
22//config: help
23//config: Frequency for default beep.
24//config:
25//config:config FEATURE_BEEP_LENGTH_MS
26//config: int "default length"
27//config: range 0 2147483647
28//config: default 30
29//config: depends on BEEP
30//config: help
31//config: Length in ms for default beep.
32
33//applet:IF_BEEP(APPLET(beep, BB_DIR_USR_BIN, BB_SUID_DROP))
34
35//kbuild:lib-$(CONFIG_BEEP) += beep.o
10 36
11//usage:#define beep_trivial_usage 37//usage:#define beep_trivial_usage
12//usage: "-f FREQ -l LEN -d DELAY -r COUNT -n" 38//usage: "-f FREQ -l LEN -d DELAY -r COUNT -n"
diff --git a/miscutils/chat.c b/miscutils/chat.c
index 6b429f2a6..dc85f82fb 100644
--- a/miscutils/chat.c
+++ b/miscutils/chat.c
@@ -7,6 +7,76 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config CHAT
11//config: bool "chat"
12//config: default y
13//config: help
14//config: Simple chat utility.
15//config:
16//config:config FEATURE_CHAT_NOFAIL
17//config: bool "Enable NOFAIL expect strings"
18//config: depends on CHAT
19//config: default y
20//config: help
21//config: When enabled expect strings which are started with a dash trigger
22//config: no-fail mode. That is when expectation is not met within timeout
23//config: the script is not terminated but sends next SEND string and waits
24//config: for next EXPECT string. This allows to compose far more flexible
25//config: scripts.
26//config:
27//config:config FEATURE_CHAT_TTY_HIFI
28//config: bool "Force STDIN to be a TTY"
29//config: depends on CHAT
30//config: default n
31//config: help
32//config: Original chat always treats STDIN as a TTY device and sets for it
33//config: so-called raw mode. This option turns on such behaviour.
34//config:
35//config:config FEATURE_CHAT_IMPLICIT_CR
36//config: bool "Enable implicit Carriage Return"
37//config: depends on CHAT
38//config: default y
39//config: help
40//config: When enabled make chat to terminate all SEND strings with a "\r"
41//config: unless "\c" is met anywhere in the string.
42//config:
43//config:config FEATURE_CHAT_SWALLOW_OPTS
44//config: bool "Swallow options"
45//config: depends on CHAT
46//config: default y
47//config: help
48//config: Busybox chat require no options. To make it not fail when used
49//config: in place of original chat (which has a bunch of options) turn
50//config: this on.
51//config:
52//config:config FEATURE_CHAT_SEND_ESCAPES
53//config: bool "Support weird SEND escapes"
54//config: depends on CHAT
55//config: default y
56//config: help
57//config: Original chat uses some escape sequences in SEND arguments which
58//config: are not sent to device but rather performs special actions.
59//config: E.g. "\K" means to send a break sequence to device.
60//config: "\d" delays execution for a second, "\p" -- for a 1/100 of second.
61//config: Before turning this option on think twice: do you really need them?
62//config:
63//config:config FEATURE_CHAT_VAR_ABORT_LEN
64//config: bool "Support variable-length ABORT conditions"
65//config: depends on CHAT
66//config: default y
67//config: help
68//config: Original chat uses fixed 50-bytes length ABORT conditions. Say N here.
69//config:
70//config:config FEATURE_CHAT_CLR_ABORT
71//config: bool "Support revoking of ABORT conditions"
72//config: depends on CHAT
73//config: default y
74//config: help
75//config: Support CLR_ABORT directive.
76
77//applet:IF_CHAT(APPLET(chat, BB_DIR_USR_SBIN, BB_SUID_DROP))
78
79//kbuild:lib-$(CONFIG_CHAT) += chat.o
10 80
11//usage:#define chat_trivial_usage 81//usage:#define chat_trivial_usage
12//usage: "EXPECT [SEND [EXPECT [SEND...]]]" 82//usage: "EXPECT [SEND [EXPECT [SEND...]]]"
diff --git a/miscutils/chrt.c b/miscutils/chrt.c
index f2f559fd7..1604a6890 100644
--- a/miscutils/chrt.c
+++ b/miscutils/chrt.c
@@ -5,6 +5,16 @@
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8//config:config CHRT
9//config: bool "chrt"
10//config: default y
11//config: help
12//config: manipulate real-time attributes of a process.
13//config: This requires sched_{g,s}etparam support in your libc.
14
15//applet:IF_CHRT(APPLET(chrt, BB_DIR_USR_BIN, BB_SUID_DROP))
16
17//kbuild:lib-$(CONFIG_CHRT) += chrt.o
8 18
9//usage:#define chrt_trivial_usage 19//usage:#define chrt_trivial_usage
10//usage: "[-prfom] [PRIO] [PID | PROG ARGS]" 20//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 @@
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12
13//applet:IF_CONSPY(APPLET(conspy, BB_DIR_BIN, BB_SUID_DROP))
14
15//kbuild:lib-$(CONFIG_CONSPY) += conspy.o
16
17//config:config CONSPY 12//config:config CONSPY
18//config: bool "conspy" 13//config: bool "conspy"
19//config: default y 14//config: default y
@@ -24,6 +19,10 @@
24//config: or conspy -nd NUM screenshot of console num 19//config: or conspy -nd NUM screenshot of console num
25//config: or conspy -cs NUM poor man's GNU screen like 20//config: or conspy -cs NUM poor man's GNU screen like
26 21
22//applet:IF_CONSPY(APPLET(conspy, BB_DIR_BIN, BB_SUID_DROP))
23
24//kbuild:lib-$(CONFIG_CONSPY) += conspy.o
25
27//usage:#define conspy_trivial_usage 26//usage:#define conspy_trivial_usage
28//usage: "[-vcsndfFQ] [-x COL] [-y LINE] [CONSOLE_NO]" 27//usage: "[-vcsndfFQ] [-x COL] [-y LINE] [CONSOLE_NO]"
29//usage:#define conspy_full_usage "\n\n" 28//usage:#define conspy_full_usage "\n\n"
diff --git a/miscutils/crontab.c b/miscutils/crontab.c
index 85c6623b2..bcd424578 100644
--- a/miscutils/crontab.c
+++ b/miscutils/crontab.c
@@ -9,6 +9,19 @@
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12//config:config CRONTAB
13//config: bool "crontab"
14//config: default y
15//config: help
16//config: Crontab manipulates the crontab for a particular user. Only
17//config: the superuser may specify a different user and/or crontab directory.
18//config: Note that Busybox binary must be setuid root for this applet to
19//config: work properly.
20
21/* Needs to be run by root or be suid root - needs to change /var/spool/cron* files: */
22//applet:IF_CRONTAB(APPLET(crontab, BB_DIR_USR_BIN, BB_SUID_REQUIRE))
23
24//kbuild:lib-$(CONFIG_CRONTAB) += crontab.o
12 25
13//usage:#define crontab_trivial_usage 26//usage:#define crontab_trivial_usage
14//usage: "[-c DIR] [-u USER] [-ler]|[FILE]" 27//usage: "[-c DIR] [-u USER] [-ler]|[FILE]"
diff --git a/miscutils/dc.c b/miscutils/dc.c
index 4d92bc3d0..7986fef5f 100644
--- a/miscutils/dc.c
+++ b/miscutils/dc.c
@@ -2,10 +2,24 @@
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5 5//config:config DC
6#include "libbb.h" 6//config: bool "dc"
7#include "common_bufsiz.h" 7//config: default y
8#include <math.h> 8//config: help
9//config: Dc is a reverse-polish desk calculator which supports unlimited
10//config: precision arithmetic.
11//config:
12//config:config FEATURE_DC_LIBM
13//config: bool "Enable power and exp functions (requires libm)"
14//config: default y
15//config: depends on DC
16//config: help
17//config: Enable power and exp functions.
18//config: NOTE: This will require libm to be present for linking.
19
20//applet:IF_DC(APPLET(dc, BB_DIR_USR_BIN, BB_SUID_DROP))
21
22//kbuild:lib-$(CONFIG_DC) += dc.o
9 23
10//usage:#define dc_trivial_usage 24//usage:#define dc_trivial_usage
11//usage: "EXPRESSION..." 25//usage: "EXPRESSION..."
@@ -30,6 +44,10 @@
30//usage: "$ echo 72 9 div 8 mul p | dc\n" 44//usage: "$ echo 72 9 div 8 mul p | dc\n"
31//usage: "64\n" 45//usage: "64\n"
32 46
47#include "libbb.h"
48#include "common_bufsiz.h"
49#include <math.h>
50
33#if 0 51#if 0
34typedef unsigned data_t; 52typedef unsigned data_t;
35#define DATA_FMT "" 53#define DATA_FMT ""
diff --git a/miscutils/devfsd.c b/miscutils/devfsd.c
index 6217918da..99bdc72b8 100644
--- a/miscutils/devfsd.c
+++ b/miscutils/devfsd.c
@@ -53,6 +53,66 @@
53 The postal address is: 53 The postal address is:
54 Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia. 54 Richard Gooch, c/o ATNF, P. O. Box 76, Epping, N.S.W., 2121, Australia.
55*/ 55*/
56//config:config DEVFSD
57//config: bool "devfsd (obsolete)"
58//config: default n
59//config: select PLATFORM_LINUX
60//config: select FEATURE_SYSLOG
61//config: help
62//config: This is deprecated and should NOT be used anymore.
63//config: Use linux >= 2.6 (optionally with hotplug) and mdev instead!
64//config: See docs/mdev.txt for detailed instructions on how to use mdev
65//config: instead.
66//config:
67//config: Provides compatibility with old device names on a devfs systems.
68//config: You should set it to true if you have devfs enabled.
69//config: The following keywords in devsfd.conf are supported:
70//config: "CLEAR_CONFIG", "INCLUDE", "OPTIONAL_INCLUDE", "RESTORE",
71//config: "PERMISSIONS", "EXECUTE", "COPY", "IGNORE",
72//config: "MKOLDCOMPAT", "MKNEWCOMPAT","RMOLDCOMPAT", "RMNEWCOMPAT".
73//config:
74//config: But only if they are written UPPERCASE!!!!!!!!
75//config:
76//config:config DEVFSD_MODLOAD
77//config: bool "Adds support for MODLOAD keyword in devsfd.conf"
78//config: default y
79//config: depends on DEVFSD
80//config: help
81//config: This actually doesn't work with busybox modutils but needs
82//config: the external modutils.
83//config:
84//config:config DEVFSD_FG_NP
85//config: bool "Enables the -fg and -np options"
86//config: default y
87//config: depends on DEVFSD
88//config: help
89//config: -fg Run the daemon in the foreground.
90//config: -np Exit after parsing the configuration file.
91//config: Do not poll for events.
92//config:
93//config:config DEVFSD_VERBOSE
94//config: bool "Increases logging (and size)"
95//config: default y
96//config: depends on DEVFSD
97//config: help
98//config: Increases logging to stderr or syslog.
99//config:
100//config:config FEATURE_DEVFS
101//config: bool "Use devfs names for all devices (obsolete)"
102//config: default n
103//config: select PLATFORM_LINUX
104//config: help
105//config: This is obsolete and should NOT be used anymore.
106//config: Use linux >= 2.6 (optionally with hotplug) and mdev instead!
107//config:
108//config: For legacy systems -- if there is no way around devfsd -- this
109//config: tells busybox to look for names like /dev/loop/0 instead of
110//config: /dev/loop0. If your /dev directory has normal names instead of
111//config: devfs names, you don't want this.
112
113//applet:IF_DEVFSD(APPLET(devfsd, BB_DIR_SBIN, BB_SUID_DROP))
114
115//kbuild:lib-$(CONFIG_DEVFSD) += devfsd.o
56 116
57//usage:#define devfsd_trivial_usage 117//usage:#define devfsd_trivial_usage
58//usage: "mntpnt [-v]" IF_DEVFSD_FG_NP("[-fg][-np]") 118//usage: "mntpnt [-v]" IF_DEVFSD_FG_NP("[-fg][-np]")
diff --git a/miscutils/devmem.c b/miscutils/devmem.c
index 786a21bee..aeb32b13a 100644
--- a/miscutils/devmem.c
+++ b/miscutils/devmem.c
@@ -3,6 +3,16 @@
3 * Copyright (C) 2000, Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl) 3 * Copyright (C) 2000, Jan-Derk Bakker (J.D.Bakker@its.tudelft.nl)
4 * Copyright (C) 2008, BusyBox Team. -solar 4/26/08 4 * Copyright (C) 2008, BusyBox Team. -solar 4/26/08
5 */ 5 */
6//config:config DEVMEM
7//config: bool "devmem"
8//config: default y
9//config: help
10//config: devmem is a small program that reads and writes from physical
11//config: memory using /dev/mem.
12
13//applet:IF_DEVMEM(APPLET(devmem, BB_DIR_SBIN, BB_SUID_DROP))
14
15//kbuild:lib-$(CONFIG_DEVMEM) += devmem.o
6 16
7//usage:#define devmem_trivial_usage 17//usage:#define devmem_trivial_usage
8//usage: "ADDRESS [WIDTH [VALUE]]" 18//usage: "ADDRESS [WIDTH [VALUE]]"
diff --git a/miscutils/eject.c b/miscutils/eject.c
index 16ae250ff..667932f6c 100644
--- a/miscutils/eject.c
+++ b/miscutils/eject.c
@@ -12,6 +12,24 @@
12 * This is a simple hack of eject based on something Erik posted in #uclibc. 12 * This is a simple hack of eject based on something Erik posted in #uclibc.
13 * Most of the dirty work blatantly ripped off from cat.c =) 13 * Most of the dirty work blatantly ripped off from cat.c =)
14 */ 14 */
15//config:config EJECT
16//config: bool "eject"
17//config: default y
18//config: select PLATFORM_LINUX
19//config: help
20//config: Used to eject cdroms. (defaults to /dev/cdrom)
21//config:
22//config:config FEATURE_EJECT_SCSI
23//config: bool "SCSI support"
24//config: default y
25//config: depends on EJECT
26//config: help
27//config: Add the -s option to eject, this allows to eject SCSI-Devices and
28//config: usb-storage devices.
29
30//applet:IF_EJECT(APPLET(eject, BB_DIR_USR_BIN, BB_SUID_DROP))
31
32//kbuild:lib-$(CONFIG_EJECT) += eject.o
15 33
16//usage:#define eject_trivial_usage 34//usage:#define eject_trivial_usage
17//usage: "[-t] [-T] [DEVICE]" 35//usage: "[-t] [-T] [DEVICE]"
diff --git a/miscutils/fbsplash.c b/miscutils/fbsplash.c
index 3ddf8a242..fc6c9b953 100644
--- a/miscutils/fbsplash.c
+++ b/miscutils/fbsplash.c
@@ -20,6 +20,31 @@
20 * "NN" (ASCII decimal number) - percentage to show on progress bar. 20 * "NN" (ASCII decimal number) - percentage to show on progress bar.
21 * "exit" (or just close fifo) - well you guessed it. 21 * "exit" (or just close fifo) - well you guessed it.
22 */ 22 */
23//config:config FBSPLASH
24//config: bool "fbsplash"
25//config: default y
26//config: select PLATFORM_LINUX
27//config: help
28//config: Shows splash image and progress bar on framebuffer device.
29//config: Can be used during boot phase of an embedded device. ~2kb.
30//config: Usage:
31//config: - use kernel option 'vga=xxx' or otherwise enable fb device.
32//config: - put somewhere fbsplash.cfg file and an image in .ppm format.
33//config: - $ setsid fbsplash [params] &
34//config: -c: hide cursor
35//config: -d /dev/fbN: framebuffer device (if not /dev/fb0)
36//config: -s path_to_image_file (can be "-" for stdin)
37//config: -i path_to_cfg_file (can be "-" for stdin)
38//config: -f path_to_fifo (can be "-" for stdin)
39//config: - if you want to run it only in presence of kernel parameter:
40//config: grep -q "fbsplash=on" </proc/cmdline && setsid fbsplash [params] &
41//config: - commands for fifo:
42//config: "NN" (ASCII decimal number) - percentage to show on progress bar
43//config: "exit" - well you guessed it
44
45//applet:IF_FBSPLASH(APPLET(fbsplash, BB_DIR_SBIN, BB_SUID_DROP))
46
47//kbuild:lib-$(CONFIG_FBSPLASH) += fbsplash.o
23 48
24//usage:#define fbsplash_trivial_usage 49//usage:#define fbsplash_trivial_usage
25//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]" 50//usage: "-s IMGFILE [-c] [-d DEV] [-i INIFILE] [-f CMD]"
diff --git a/miscutils/flash_eraseall.c b/miscutils/flash_eraseall.c
index d95d214d9..2a9bd6cfe 100644
--- a/miscutils/flash_eraseall.c
+++ b/miscutils/flash_eraseall.c
@@ -9,6 +9,16 @@
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12//config:config FLASH_ERASEALL
13//config: bool "flash_eraseall"
14//config: default n # doesn't build on Ubuntu 8.04
15//config: help
16//config: The flash_eraseall binary from mtd-utils as of git head c4c6a59eb.
17//config: This utility is used to erase the whole MTD device.
18
19//applet:IF_FLASH_ERASEALL(APPLET(flash_eraseall, BB_DIR_USR_SBIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_FLASH_ERASEALL) += flash_eraseall.o
12 22
13//usage:#define flash_eraseall_trivial_usage 23//usage:#define flash_eraseall_trivial_usage
14//usage: "[-jNq] MTD_DEVICE" 24//usage: "[-jNq] MTD_DEVICE"
diff --git a/miscutils/flash_lock_unlock.c b/miscutils/flash_lock_unlock.c
index 1fefd95f9..2f698641f 100644
--- a/miscutils/flash_lock_unlock.c
+++ b/miscutils/flash_lock_unlock.c
@@ -3,6 +3,25 @@
3 * 3 *
4 * Licensed under GPLv2, see file LICENSE in this source tree. 4 * Licensed under GPLv2, see file LICENSE in this source tree.
5 */ 5 */
6//config:config FLASH_LOCK
7//config: bool "flash_lock"
8//config: default n # doesn't build on Ubuntu 8.04
9//config: help
10//config: The flash_lock binary from mtd-utils as of git head 5ec0c10d0. This
11//config: utility locks part or all of the flash device.
12//config:
13//config:config FLASH_UNLOCK
14//config: bool "flash_unlock"
15//config: default n # doesn't build on Ubuntu 8.04
16//config: help
17//config: The flash_unlock binary from mtd-utils as of git head 5ec0c10d0. This
18//config: utility unlocks part or all of the flash device.
19
20//applet:IF_FLASH_LOCK(APPLET_ODDNAME(flash_lock, flash_lock_unlock, BB_DIR_USR_SBIN, BB_SUID_DROP, flash_lock))
21//applet:IF_FLASH_UNLOCK(APPLET_ODDNAME(flash_unlock, flash_lock_unlock, BB_DIR_USR_SBIN, BB_SUID_DROP, flash_unlock))
22
23//kbuild:lib-$(CONFIG_FLASH_LOCK) += flash_lock_unlock.o
24//kbuild:lib-$(CONFIG_FLASH_UNLOCK) += flash_lock_unlock.o
6 25
7//usage:#define flash_lock_trivial_usage 26//usage:#define flash_lock_trivial_usage
8//usage: "MTD_DEVICE OFFSET SECTORS" 27//usage: "MTD_DEVICE OFFSET SECTORS"
diff --git a/miscutils/flashcp.c b/miscutils/flashcp.c
index 9bc588d14..4bbc67727 100644
--- a/miscutils/flashcp.c
+++ b/miscutils/flashcp.c
@@ -6,6 +6,16 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config FLASHCP
10//config: bool "flashcp"
11//config: default n # doesn't build on Ubuntu 8.04
12//config: help
13//config: The flashcp binary, inspired by mtd-utils as of git head 5eceb74f7.
14//config: This utility is used to copy images into a MTD device.
15
16//applet:IF_FLASHCP(APPLET(flashcp, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_FLASHCP) += flashcp.o
9 19
10//usage:#define flashcp_trivial_usage 20//usage:#define flashcp_trivial_usage
11//usage: "-v FILE MTD_DEVICE" 21//usage: "-v FILE MTD_DEVICE"
diff --git a/miscutils/hdparm.c b/miscutils/hdparm.c
index b4c5876d4..e43a0dec2 100644
--- a/miscutils/hdparm.c
+++ b/miscutils/hdparm.c
@@ -11,6 +11,68 @@
11 * hdparm.c - Command line interface to get/set hard disk parameters 11 * hdparm.c - Command line interface to get/set hard disk parameters
12 * - by Mark Lord (C) 1994-2002 -- freely distributable 12 * - by Mark Lord (C) 1994-2002 -- freely distributable
13 */ 13 */
14//config:config HDPARM
15//config: bool "hdparm"
16//config: default y
17//config: select PLATFORM_LINUX
18//config: help
19//config: Get/Set hard drive parameters. Primarily intended for ATA
20//config: drives. Adds about 13k (or around 30k if you enable the
21//config: FEATURE_HDPARM_GET_IDENTITY option)....
22//config:
23//config:config FEATURE_HDPARM_GET_IDENTITY
24//config: bool "Support obtaining detailed information directly from drives"
25//config: default y
26//config: depends on HDPARM
27//config: help
28//config: Enables the -I and -i options to obtain detailed information
29//config: directly from drives about their capabilities and supported ATA
30//config: feature set. If no device name is specified, hdparm will read
31//config: identify data from stdin. Enabling this option will add about 16k...
32//config:
33//config:config FEATURE_HDPARM_HDIO_SCAN_HWIF
34//config: bool "Register an IDE interface (DANGEROUS)"
35//config: default y
36//config: depends on HDPARM
37//config: help
38//config: Enables the 'hdparm -R' option to register an IDE interface.
39//config: This is dangerous stuff, so you should probably say N.
40//config:
41//config:config FEATURE_HDPARM_HDIO_UNREGISTER_HWIF
42//config: bool "Un-register an IDE interface (DANGEROUS)"
43//config: default y
44//config: depends on HDPARM
45//config: help
46//config: Enables the 'hdparm -U' option to un-register an IDE interface.
47//config: This is dangerous stuff, so you should probably say N.
48//config:
49//config:config FEATURE_HDPARM_HDIO_DRIVE_RESET
50//config: bool "Perform device reset (DANGEROUS)"
51//config: default y
52//config: depends on HDPARM
53//config: help
54//config: Enables the 'hdparm -w' option to perform a device reset.
55//config: This is dangerous stuff, so you should probably say N.
56//config:
57//config:config FEATURE_HDPARM_HDIO_TRISTATE_HWIF
58//config: bool "Tristate device for hotswap (DANGEROUS)"
59//config: default y
60//config: depends on HDPARM
61//config: help
62//config: Enables the 'hdparm -x' option to tristate device for hotswap,
63//config: and the '-b' option to get/set bus state. This is dangerous
64//config: stuff, so you should probably say N.
65//config:
66//config:config FEATURE_HDPARM_HDIO_GETSET_DMA
67//config: bool "Get/set using_dma flag"
68//config: default y
69//config: depends on HDPARM
70//config: help
71//config: Enables the 'hdparm -d' option to get/set using_dma flag.
72
73//applet:IF_HDPARM(APPLET(hdparm, BB_DIR_SBIN, BB_SUID_DROP))
74
75//kbuild:lib-$(CONFIG_HDPARM) += hdparm.o
14 76
15//usage:#define hdparm_trivial_usage 77//usage:#define hdparm_trivial_usage
16//usage: "[OPTIONS] [DEVICE]" 78//usage: "[OPTIONS] [DEVICE]"
diff --git a/miscutils/inotifyd.c b/miscutils/inotifyd.c
index 52db08ada..601df6465 100644
--- a/miscutils/inotifyd.c
+++ b/miscutils/inotifyd.c
@@ -26,6 +26,16 @@
26 * 26 *
27 * See below for mask names explanation. 27 * See below for mask names explanation.
28 */ 28 */
29//config:config INOTIFYD
30//config: bool "inotifyd"
31//config: default n # doesn't build on Knoppix 5
32//config: help
33//config: Simple inotify daemon. Reports filesystem changes. Requires
34//config: kernel >= 2.6.13
35
36//applet:IF_INOTIFYD(APPLET(inotifyd, BB_DIR_SBIN, BB_SUID_DROP))
37
38//kbuild:lib-$(CONFIG_INOTIFYD) += inotifyd.o
29 39
30//usage:#define inotifyd_trivial_usage 40//usage:#define inotifyd_trivial_usage
31//usage: "PROG FILE1[:MASK]..." 41//usage: "PROG FILE1[:MASK]..."
diff --git a/miscutils/ionice.c b/miscutils/ionice.c
index 5fcb653a8..c54b3a6e1 100644
--- a/miscutils/ionice.c
+++ b/miscutils/ionice.c
@@ -6,6 +6,17 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config IONICE
10//config: bool "ionice"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: Set/set program io scheduling class and priority
15//config: Requires kernel >= 2.6.13
16
17//applet:IF_IONICE(APPLET(ionice, BB_DIR_BIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_IONICE) += ionice.o
9 20
10//usage:#define ionice_trivial_usage 21//usage:#define ionice_trivial_usage
11//usage: "[-c 1-3] [-n 0-7] [-p PID] [PROG]" 22//usage: "[-c 1-3] [-n 0-7] [-p PID] [PROG]"
diff --git a/miscutils/last.c b/miscutils/last.c
index f8f34371a..67c1343f1 100644
--- a/miscutils/last.c
+++ b/miscutils/last.c
@@ -6,6 +6,28 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config LAST
10//config: bool "last"
11//config: default y
12//config: depends on FEATURE_WTMP
13//config: help
14//config: 'last' displays a list of the last users that logged into the system.
15//config:
16//config:config FEATURE_LAST_FANCY
17//config: bool "Turn on output of extra information"
18//config: default y
19//config: depends on LAST
20//config: help
21//config: 'last' displays detailed information about the last users that
22//config: logged into the system (mimics sysvinit last). +900 bytes.
23
24//applet:IF_LAST(APPLET(last, BB_DIR_USR_BIN, BB_SUID_DROP))
25
26//kbuild:ifeq ($(CONFIG_FEATURE_LAST_FANCY),y)
27//kbuild:lib-$(CONFIG_FEATURE_LAST_FANCY) += last_fancy.o
28//kbuild:else
29//kbuild:lib-$(CONFIG_LAST) += last.o
30//kbuild:endif
9 31
10//usage:#define last_trivial_usage 32//usage:#define last_trivial_usage
11//usage: ""IF_FEATURE_LAST_FANCY("[-HW] [-f FILE]") 33//usage: ""IF_FEATURE_LAST_FANCY("[-HW] [-f FILE]")
diff --git a/miscutils/less.c b/miscutils/less.c
index 8ba687872..8f9b329ba 100644
--- a/miscutils/less.c
+++ b/miscutils/less.c
@@ -105,6 +105,10 @@
105//config: help 105//config: help
106//config: Enables "-N" command. 106//config: Enables "-N" command.
107 107
108//applet:IF_LESS(APPLET(less, BB_DIR_USR_BIN, BB_SUID_DROP))
109
110//kbuild:lib-$(CONFIG_LESS) += less.o
111
108//usage:#define less_trivial_usage 112//usage:#define less_trivial_usage
109//usage: "[-E" IF_FEATURE_LESS_REGEXP("I")IF_FEATURE_LESS_FLAGS("Mm") 113//usage: "[-E" IF_FEATURE_LESS_REGEXP("I")IF_FEATURE_LESS_FLAGS("Mm")
110//usage: "N" IF_FEATURE_LESS_TRUNCATE("S") "h~] [FILE]..." 114//usage: "N" IF_FEATURE_LESS_TRUNCATE("S") "h~] [FILE]..."
diff --git a/miscutils/makedevs.c b/miscutils/makedevs.c
index c945a1352..9e7ca340f 100644
--- a/miscutils/makedevs.c
+++ b/miscutils/makedevs.c
@@ -6,6 +6,41 @@
6 * Make ranges of device files quickly. 6 * Make ranges of device files quickly.
7 * known bugs: can't deal with alpha ranges 7 * known bugs: can't deal with alpha ranges
8 */ 8 */
9//config:config MAKEDEVS
10//config: bool "makedevs"
11//config: default y
12//config: help
13//config: 'makedevs' is a utility used to create a batch of devices with
14//config: one command.
15//config:
16//config: There are two choices for command line behaviour, the interface
17//config: as used by LEAF/Linux Router Project, or a device table file.
18//config:
19//config: 'leaf' is traditionally what busybox follows, it allows multiple
20//config: devices of a particluar type to be created per command.
21//config: e.g. /dev/hda[0-9]
22//config: Device properties are passed as command line arguments.
23//config:
24//config: 'table' reads device properties from a file or stdin, allowing
25//config: a batch of unrelated devices to be made with one command.
26//config: User/group names are allowed as an alternative to uid/gid.
27//config:
28//config:choice
29//config: prompt "Choose makedevs behaviour"
30//config: depends on MAKEDEVS
31//config: default FEATURE_MAKEDEVS_TABLE
32//config:
33//config:config FEATURE_MAKEDEVS_LEAF
34//config: bool "leaf"
35//config:
36//config:config FEATURE_MAKEDEVS_TABLE
37//config: bool "table"
38//config:
39//config:endchoice
40
41//applet:IF_MAKEDEVS(APPLET(makedevs, BB_DIR_SBIN, BB_SUID_DROP))
42
43//kbuild:lib-$(CONFIG_MAKEDEVS) += makedevs.o
9 44
10//usage:#if ENABLE_FEATURE_MAKEDEVS_LEAF 45//usage:#if ENABLE_FEATURE_MAKEDEVS_LEAF
11//usage:#define makedevs_trivial_usage 46//usage:#define makedevs_trivial_usage
@@ -122,8 +157,11 @@ int makedevs_main(int argc, char **argv)
122 157
123 /* if mode != S_IFCHR and != S_IFBLK, 158 /* if mode != S_IFCHR and != S_IFBLK,
124 * third param in mknod() ignored */ 159 * third param in mknod() ignored */
125 if (mknod(nodname, mode, makedev(Smajor, Sminor))) 160 if (mknod(nodname, mode, makedev(Smajor, Sminor)) != 0
161 && errno != EEXIST
162 ) {
126 bb_perror_msg("can't create '%s'", nodname); 163 bb_perror_msg("can't create '%s'", nodname);
164 }
127 165
128 /*if (nodname == basedev)*/ /* ex. /dev/hda - to /dev/hda1 ... */ 166 /*if (nodname == basedev)*/ /* ex. /dev/hda - to /dev/hda1 ... */
129 nodname = buf; 167 nodname = buf;
@@ -244,7 +282,9 @@ int makedevs_main(int argc UNUSED_PARAM, char **argv)
244 for (i = start; i <= start + count; i++) { 282 for (i = start; i <= start + count; i++) {
245 sprintf(full_name_inc, count ? "%s%u" : "%s", full_name, i); 283 sprintf(full_name_inc, count ? "%s%u" : "%s", full_name, i);
246 rdev = makedev(major, minor + (i - start) * increment); 284 rdev = makedev(major, minor + (i - start) * increment);
247 if (mknod(full_name_inc, mode, rdev) < 0) { 285 if (mknod(full_name_inc, mode, rdev) != 0
286 && errno != EEXIST
287 ) {
248 bb_perror_msg("line %d: can't create node %s", linenum, full_name_inc); 288 bb_perror_msg("line %d: can't create node %s", linenum, full_name_inc);
249 ret = EXIT_FAILURE; 289 ret = EXIT_FAILURE;
250 } else if (chown(full_name_inc, uid, gid) < 0) { 290 } else if (chown(full_name_inc, uid, gid) < 0) {
diff --git a/miscutils/man.c b/miscutils/man.c
index a8c2d4047..741980961 100644
--- a/miscutils/man.c
+++ b/miscutils/man.c
@@ -2,6 +2,15 @@
2 * Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com> 2 * Copyright (C) 2008 Denys Vlasenko <vda.linux@googlemail.com>
3 * Licensed under GPLv2, see file LICENSE in this source tree. 3 * Licensed under GPLv2, see file LICENSE in this source tree.
4 */ 4 */
5//config:config MAN
6//config: bool "man"
7//config: default y
8//config: help
9//config: Format and display manual pages.
10
11//applet:IF_MAN(APPLET(man, BB_DIR_USR_BIN, BB_SUID_DROP))
12
13//kbuild:lib-$(CONFIG_MAN) += man.o
5 14
6//usage:#define man_trivial_usage 15//usage:#define man_trivial_usage
7//usage: "[-aw] [MANPAGE]..." 16//usage: "[-aw] [MANPAGE]..."
diff --git a/miscutils/microcom.c b/miscutils/microcom.c
index dfc9771d8..04605d883 100644
--- a/miscutils/microcom.c
+++ b/miscutils/microcom.c
@@ -7,6 +7,15 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config MICROCOM
11//config: bool "microcom"
12//config: default y
13//config: help
14//config: The poor man's minicom utility for chatting with serial port devices.
15
16//applet:IF_MICROCOM(APPLET(microcom, BB_DIR_USR_BIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_MICROCOM) += microcom.o
10 19
11//usage:#define microcom_trivial_usage 20//usage:#define microcom_trivial_usage
12//usage: "[-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY" 21//usage: "[-d DELAY] [-t TIMEOUT] [-s SPEED] [-X] TTY"
diff --git a/miscutils/mountpoint.c b/miscutils/mountpoint.c
index 7041f7c59..8b9e1d779 100644
--- a/miscutils/mountpoint.c
+++ b/miscutils/mountpoint.c
@@ -8,6 +8,15 @@
8 * 8 *
9 * Based on sysvinit's mountpoint 9 * Based on sysvinit's mountpoint
10 */ 10 */
11//config:config MOUNTPOINT
12//config: bool "mountpoint"
13//config: default y
14//config: help
15//config: mountpoint checks if the directory is a mountpoint.
16
17//applet:IF_MOUNTPOINT(APPLET(mountpoint, BB_DIR_BIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_MOUNTPOINT) += mountpoint.o
11 20
12//usage:#define mountpoint_trivial_usage 21//usage:#define mountpoint_trivial_usage
13//usage: "[-q] <[-dn] DIR | -x DEVICE>" 22//usage: "[-q] <[-dn] DIR | -x DEVICE>"
diff --git a/miscutils/mt.c b/miscutils/mt.c
index 20afd3a50..6b3169675 100644
--- a/miscutils/mt.c
+++ b/miscutils/mt.c
@@ -2,6 +2,17 @@
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5//config:config MT
6//config: bool "mt"
7//config: default y
8//config: help
9//config: mt is used to control tape devices. You can use the mt utility
10//config: to advance or rewind a tape past a specified number of archive
11//config: files on the tape.
12
13//applet:IF_MT(APPLET(mt, BB_DIR_BIN, BB_SUID_DROP))
14
15//kbuild:lib-$(CONFIG_MT) += mt.o
5 16
6//usage:#define mt_trivial_usage 17//usage:#define mt_trivial_usage
7//usage: "[-f device] opcode value" 18//usage: "[-f device] opcode value"
diff --git a/miscutils/raidautorun.c b/miscutils/raidautorun.c
index b72d89058..c6d8e6235 100644
--- a/miscutils/raidautorun.c
+++ b/miscutils/raidautorun.c
@@ -7,6 +7,17 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 */ 9 */
10//config:config RAIDAUTORUN
11//config: bool "raidautorun"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: raidautorun tells the kernel md driver to
16//config: search and start RAID arrays.
17
18//applet:IF_RAIDAUTORUN(APPLET(raidautorun, BB_DIR_SBIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_RAIDAUTORUN) += raidautorun.o
10 21
11//usage:#define raidautorun_trivial_usage 22//usage:#define raidautorun_trivial_usage
12//usage: "DEVICE" 23//usage: "DEVICE"
diff --git a/miscutils/readahead.c b/miscutils/readahead.c
index e22aaa468..b8e9b257f 100644
--- a/miscutils/readahead.c
+++ b/miscutils/readahead.c
@@ -9,6 +9,27 @@
9 * 9 *
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12//config:config READAHEAD
13//config: bool "readahead"
14//config: default y
15//config: depends on LFS
16//config: select PLATFORM_LINUX
17//config: help
18//config: Preload the files listed on the command line into RAM cache so that
19//config: subsequent reads on these files will not block on disk I/O.
20//config:
21//config: This applet just calls the readahead(2) system call on each file.
22//config: It is mainly useful in system startup scripts to preload files
23//config: or executables before they are used. When used at the right time
24//config: (in particular when a CPU bound process is running) it can
25//config: significantly speed up system startup.
26//config:
27//config: As readahead(2) blocks until each file has been read, it is best to
28//config: run this applet as a background job.
29
30//applet:IF_READAHEAD(APPLET(readahead, BB_DIR_USR_SBIN, BB_SUID_DROP))
31
32//kbuild:lib-$(CONFIG_READAHEAD) += readahead.o
12 33
13//usage:#define readahead_trivial_usage 34//usage:#define readahead_trivial_usage
14//usage: "[FILE]..." 35//usage: "[FILE]..."
diff --git a/miscutils/runlevel.c b/miscutils/runlevel.c
index 8558db862..b6412a6ea 100644
--- a/miscutils/runlevel.c
+++ b/miscutils/runlevel.c
@@ -11,6 +11,19 @@
11 * 11 *
12 * initially busyboxified by Bernhard Reutner-Fischer 12 * initially busyboxified by Bernhard Reutner-Fischer
13 */ 13 */
14//config:config RUNLEVEL
15//config: bool "runlevel"
16//config: default y
17//config: depends on FEATURE_UTMP
18//config: help
19//config: find the current and previous system runlevel.
20//config:
21//config: This applet uses utmp but does not rely on busybox supporing
22//config: utmp on purpose. It is used by e.g. emdebian via /etc/init.d/rc.
23
24//applet:IF_RUNLEVEL(APPLET(runlevel, BB_DIR_SBIN, BB_SUID_DROP))
25
26//kbuild:lib-$(CONFIG_RUNLEVEL) += runlevel.o
14 27
15//usage:#define runlevel_trivial_usage 28//usage:#define runlevel_trivial_usage
16//usage: "[FILE]" 29//usage: "[FILE]"
diff --git a/miscutils/rx.c b/miscutils/rx.c
index 1dffb593a..660f66a89 100644
--- a/miscutils/rx.c
+++ b/miscutils/rx.c
@@ -14,6 +14,16 @@
14 * 14 *
15 * This was originally written for blob and then adapted for busybox. 15 * This was originally written for blob and then adapted for busybox.
16 */ 16 */
17//config:config RX
18//config: bool "rx"
19//config: default y
20//config: select PLATFORM_LINUX
21//config: help
22//config: Receive files using the Xmodem protocol.
23
24//applet:IF_RX(APPLET(rx, BB_DIR_USR_BIN, BB_SUID_DROP))
25
26//kbuild:lib-$(CONFIG_RX) += rx.o
17 27
18//usage:#define rx_trivial_usage 28//usage:#define rx_trivial_usage
19//usage: "FILE" 29//usage: "FILE"
@@ -101,7 +111,7 @@ static int receive(/*int read_fd, */int file_fd)
101 && blockBuf[blockLength - 3] == PAD 111 && blockBuf[blockLength - 3] == PAD
102 ) { 112 ) {
103 while (blockLength 113 while (blockLength
104 && blockBuf[blockLength - 1] == PAD 114 && blockBuf[blockLength - 1] == PAD
105 ) { 115 ) {
106 blockLength--; 116 blockLength--;
107 } 117 }
diff --git a/miscutils/setsid.c b/miscutils/setsid.c
index 9bddc2fcf..143a8f8fa 100644
--- a/miscutils/setsid.c
+++ b/miscutils/setsid.c
@@ -13,6 +13,15 @@
13 * 2004-11-12 Paul Fox 13 * 2004-11-12 Paul Fox
14 * - busyboxed 14 * - busyboxed
15 */ 15 */
16//config:config SETSID
17//config: bool "setsid"
18//config: default y
19//config: help
20//config: setsid runs a program in a new session
21
22//applet:IF_SETSID(APPLET(setsid, BB_DIR_USR_BIN, BB_SUID_DROP))
23
24//kbuild:lib-$(CONFIG_SETSID) += setsid.o
16 25
17//usage:#define setsid_trivial_usage 26//usage:#define setsid_trivial_usage
18//usage: "[-c] PROG ARGS" 27//usage: "[-c] PROG ARGS"
diff --git a/miscutils/strings.c b/miscutils/strings.c
index ee6649625..4d9bfe690 100644
--- a/miscutils/strings.c
+++ b/miscutils/strings.c
@@ -6,6 +6,16 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config STRINGS
10//config: bool "strings"
11//config: default y
12//config: help
13//config: strings prints the printable character sequences for each file
14//config: specified.
15
16//applet:IF_STRINGS(APPLET(strings, BB_DIR_USR_BIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_STRINGS) += strings.o
9 19
10//usage:#define strings_trivial_usage 20//usage:#define strings_trivial_usage
11//usage: "[-fo] [-t o/d/x] [-n LEN] [FILE]..." 21//usage: "[-fo] [-t o/d/x] [-n LEN] [FILE]..."
diff --git a/miscutils/time.c b/miscutils/time.c
index 19b0b44c9..a73a837d8 100644
--- a/miscutils/time.c
+++ b/miscutils/time.c
@@ -8,6 +8,17 @@
8 Heavily modified by David MacKenzie <djm@gnu.ai.mit.edu>. 8 Heavily modified by David MacKenzie <djm@gnu.ai.mit.edu>.
9 Heavily modified for busybox by Erik Andersen <andersen@codepoet.org> 9 Heavily modified for busybox by Erik Andersen <andersen@codepoet.org>
10*/ 10*/
11//config:config TIME
12//config: bool "time"
13//config: default y
14//config: help
15//config: The time command runs the specified program with the given arguments.
16//config: When the command finishes, time writes a message to standard output
17//config: giving timing statistics about this program run.
18
19//applet:IF_TIME(APPLET(time, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_TIME) += time.o
11 22
12//usage:#define time_trivial_usage 23//usage:#define time_trivial_usage
13//usage: "[-v] PROG ARGS" 24//usage: "[-v] PROG ARGS"
diff --git a/miscutils/timeout.c b/miscutils/timeout.c
index 8df9ff0fd..f29dc8a9c 100644
--- a/miscutils/timeout.c
+++ b/miscutils/timeout.c
@@ -27,6 +27,16 @@
27 * splitszf 12-05-2006 by Roberto A. Foglietta 27 * splitszf 12-05-2006 by Roberto A. Foglietta
28 * rewrite 14-11-2008 vda 28 * rewrite 14-11-2008 vda
29 */ 29 */
30//config:config TIMEOUT
31//config: bool "timeout"
32//config: default y
33//config: help
34//config: Runs a program and watches it. If it does not terminate in
35//config: specified number of seconds, it is sent a signal.
36
37//applet:IF_TIMEOUT(APPLET(timeout, BB_DIR_USR_BIN, BB_SUID_DROP))
38
39//kbuild:lib-$(CONFIG_TIMEOUT) += timeout.o
30 40
31//usage:#define timeout_trivial_usage 41//usage:#define timeout_trivial_usage
32//usage: "[-t SECS] [-s SIG] PROG ARGS" 42//usage: "[-t SECS] [-s SIG] PROG ARGS"
diff --git a/miscutils/ttysize.c b/miscutils/ttysize.c
index d2d48d0a9..135ce8535 100644
--- a/miscutils/ttysize.c
+++ b/miscutils/ttysize.c
@@ -9,6 +9,18 @@
9 * 9 *
10 * Licensed under GPLv2, see file LICENSE in this source tree. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12//config:config TTYSIZE
13//config: bool "ttysize"
14//config: default y
15//config: help
16//config: A replacement for "stty size". Unlike stty, can report only width,
17//config: only height, or both, in any order. It also does not complain on
18//config: error, but returns default 80x24.
19//config: Usage in shell scripts: width=`ttysize w`.
20
21//applet:IF_TTYSIZE(APPLET(ttysize, BB_DIR_USR_BIN, BB_SUID_DROP))
22
23//kbuild:lib-$(CONFIG_TTYSIZE) += ttysize.o
12 24
13//usage:#define ttysize_trivial_usage 25//usage:#define ttysize_trivial_usage
14//usage: "[w] [h]" 26//usage: "[w] [h]"
diff --git a/miscutils/volname.c b/miscutils/volname.c
index b50e79573..6d1addbb5 100644
--- a/miscutils/volname.c
+++ b/miscutils/volname.c
@@ -27,6 +27,15 @@
27 * mods from distributed source (eject-2.0.13) are by 27 * mods from distributed source (eject-2.0.13) are by
28 * Matthew Stoltenberg <d3matt@gmail.com> 28 * Matthew Stoltenberg <d3matt@gmail.com>
29 */ 29 */
30//config:config VOLNAME
31//config: bool "volname"
32//config: default y
33//config: help
34//config: Prints a CD-ROM volume name.
35
36//applet:IF_VOLNAME(APPLET(volname, BB_DIR_USR_BIN, BB_SUID_DROP))
37
38//kbuild:lib-$(CONFIG_VOLNAME) += volname.o
30 39
31//usage:#define volname_trivial_usage 40//usage:#define volname_trivial_usage
32//usage: "[DEVICE]" 41//usage: "[DEVICE]"
diff --git a/miscutils/watchdog.c b/miscutils/watchdog.c
index d3a76edf0..07ae64e52 100644
--- a/miscutils/watchdog.c
+++ b/miscutils/watchdog.c
@@ -8,6 +8,21 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11//config:config WATCHDOG
12//config: bool "watchdog"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: The watchdog utility is used with hardware or software watchdog
17//config: device drivers. It opens the specified watchdog device special file
18//config: and periodically writes a magic character to the device. If the
19//config: watchdog applet ever fails to write the magic character within a
20//config: certain amount of time, the watchdog device assumes the system has
21//config: hung, and will cause the hardware to reboot.
22
23//applet:IF_WATCHDOG(APPLET(watchdog, BB_DIR_SBIN, BB_SUID_DROP))
24
25//kbuild:lib-$(CONFIG_WATCHDOG) += watchdog.o
11 26
12//usage:#define watchdog_trivial_usage 27//usage:#define watchdog_trivial_usage
13//usage: "[-t N[ms]] [-T N[ms]] [-F] DEV" 28//usage: "[-t N[ms]] [-T N[ms]] [-F] DEV"
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"
7 7
8INSERT 8INSERT
9 9
10config MODPROBE_SMALL
11 bool "Simplified modutils"
12 default y
13 select PLATFORM_LINUX
14 help
15 Simplified modutils.
16
17 With this option modprobe does not require modules.dep file
18 and does not use /etc/modules.conf file.
19 It scans module files in /lib/modules/`uname -r` and
20 determines dependencies and module alias names on the fly.
21 This may make module loading slower, most notably
22 when one needs to load module by alias (this requires
23 scanning through module _bodies_).
24
25 At the first attempt to load a module by alias modprobe
26 will try to generate modules.dep.bb file in order to speed up
27 future loads by alias. Failure to do so (read-only /lib/modules,
28 etc) is not reported, and future modprobes will be slow too.
29
30 NB: modules.dep.bb file format is not compatible
31 with modules.dep file as created/used by standard module tools.
32
33 Additional module parameters can be stored in
34 /etc/modules/$module_name files.
35
36 Apart from modprobe, other utilities are also provided:
37 - insmod is an alias to modprobe
38 - rmmod is an alias to modprobe -r
39 - depmod generates modules.dep.bb
40
41config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE
42 bool "Accept module options on modprobe command line"
43 default y
44 depends on MODPROBE_SMALL
45 select PLATFORM_LINUX
46 help
47 Allow insmod and modprobe take module options from command line.
48
49config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED
50 bool "Skip loading of already loaded modules"
51 default y
52 depends on MODPROBE_SMALL
53 help
54 Check if the module is already loaded.
55
56config INSMOD
57 bool "insmod"
58 default n
59 depends on !MODPROBE_SMALL
60 select PLATFORM_LINUX
61 help
62 insmod is used to load specified modules in the running kernel.
63
64config RMMOD
65 bool "rmmod"
66 default n
67 depends on !MODPROBE_SMALL
68 select PLATFORM_LINUX
69 help
70 rmmod is used to unload specified modules from the kernel.
71
72config LSMOD
73 bool "lsmod"
74 default n
75 depends on !MODPROBE_SMALL
76 select PLATFORM_LINUX
77 help
78 lsmod is used to display a list of loaded modules.
79
80config FEATURE_LSMOD_PRETTY_2_6_OUTPUT
81 bool "Pretty output"
82 default n
83 depends on LSMOD
84 select PLATFORM_LINUX
85 help
86 This option makes output format of lsmod adjusted to
87 the format of module-init-tools for Linux kernel 2.6.
88 Increases size somewhat.
89
90config MODPROBE
91 bool "modprobe"
92 default n
93 depends on !MODPROBE_SMALL
94 select PLATFORM_LINUX
95 help
96 Handle the loading of modules, and their dependencies on a high
97 level.
98
99config FEATURE_MODPROBE_BLACKLIST
100 bool "Blacklist support"
101 default n
102 depends on MODPROBE
103 select PLATFORM_LINUX
104 help
105 Say 'y' here to enable support for the 'blacklist' command in
106 modprobe.conf. This prevents the alias resolver to resolve
107 blacklisted modules. This is useful if you want to prevent your
108 hardware autodetection scripts to load modules like evdev, frame
109 buffer drivers etc.
110
111config DEPMOD
112 bool "depmod"
113 default n
114 depends on !MODPROBE_SMALL
115 select PLATFORM_LINUX
116 help
117 depmod generates modules.dep (and potentially modules.alias
118 and modules.symbols) that contain dependency information
119 for modprobe.
120
121comment "Options common to multiple modutils" 10comment "Options common to multiple modutils"
122 11
123config FEATURE_2_4_MODULES 12config 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 @@
7lib-y:= 7lib-y:=
8 8
9INSERT 9INSERT
10lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o
11lib-$(CONFIG_DEPMOD) += depmod.o modutils.o
12lib-$(CONFIG_INSMOD) += insmod.o modutils.o
13lib-$(CONFIG_LSMOD) += lsmod.o modutils.o
14lib-$(CONFIG_MODPROBE) += modprobe.o modutils.o
15lib-$(CONFIG_RMMOD) += rmmod.o modutils.o
16lib-$(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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config DEPMOD
11//config: bool "depmod"
12//config: default n
13//config: depends on !MODPROBE_SMALL
14//config: select PLATFORM_LINUX
15//config: help
16//config: depmod generates modules.dep (and potentially modules.alias
17//config: and modules.symbols) that contain dependency information
18//config: for modprobe.
10 19
11//applet:IF_DEPMOD(APPLET(depmod, BB_DIR_SBIN, BB_SUID_DROP)) 20//applet:IF_DEPMOD(APPLET(depmod, BB_DIR_SBIN, BB_SUID_DROP))
12 21
22//kbuild:lib-$(CONFIG_DEPMOD) += depmod.o modutils.o
23
13#include "libbb.h" 24#include "libbb.h"
14#include "modutils.h" 25#include "modutils.h"
15#include <sys/utsname.h> /* uname() */ 26#include <sys/utsname.h> /* 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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config INSMOD
10//config: bool "insmod"
11//config: default n
12//config: depends on !MODPROBE_SMALL
13//config: select PLATFORM_LINUX
14//config: help
15//config: insmod is used to load specified modules in the running kernel.
9 16
10//applet:IF_INSMOD(APPLET(insmod, BB_DIR_SBIN, BB_SUID_DROP)) 17//applet:IF_INSMOD(APPLET(insmod, BB_DIR_SBIN, BB_SUID_DROP))
11 18
19//kbuild:lib-$(CONFIG_INSMOD) += insmod.o modutils.o
20
12#include "libbb.h" 21#include "libbb.h"
13#include "modutils.h" 22#include "modutils.h"
14 23
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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config LSMOD
11//config: bool "lsmod"
12//config: default n
13//config: depends on !MODPROBE_SMALL
14//config: select PLATFORM_LINUX
15//config: help
16//config: lsmod is used to display a list of loaded modules.
17//config:
18//config:config FEATURE_LSMOD_PRETTY_2_6_OUTPUT
19//config: bool "Pretty output"
20//config: default n
21//config: depends on LSMOD
22//config: select PLATFORM_LINUX
23//config: help
24//config: This option makes output format of lsmod adjusted to
25//config: the format of module-init-tools for Linux kernel 2.6.
26//config: Increases size somewhat.
10 27
11//applet:IF_LSMOD(APPLET(lsmod, BB_DIR_SBIN, BB_SUID_DROP)) 28//applet:IF_LSMOD(APPLET(lsmod, BB_DIR_SBIN, BB_SUID_DROP))
12 29
30//kbuild:lib-$(CONFIG_LSMOD) += lsmod.o modutils.o
31
13//usage:#if !ENABLE_MODPROBE_SMALL 32//usage:#if !ENABLE_MODPROBE_SMALL
14//usage:#define lsmod_trivial_usage 33//usage:#define lsmod_trivial_usage
15//usage: "" 34//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 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config MODPROBE_SMALL
11//config: bool "Simplified modutils"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: Simplified modutils.
16//config:
17//config: With this option modprobe does not require modules.dep file
18//config: and does not use /etc/modules.conf file.
19//config: It scans module files in /lib/modules/`uname -r` and
20//config: determines dependencies and module alias names on the fly.
21//config: This may make module loading slower, most notably
22//config: when one needs to load module by alias (this requires
23//config: scanning through module _bodies_).
24//config:
25//config: At the first attempt to load a module by alias modprobe
26//config: will try to generate modules.dep.bb file in order to speed up
27//config: future loads by alias. Failure to do so (read-only /lib/modules,
28//config: etc) is not reported, and future modprobes will be slow too.
29//config:
30//config: NB: modules.dep.bb file format is not compatible
31//config: with modules.dep file as created/used by standard module tools.
32//config:
33//config: Additional module parameters can be stored in
34//config: /etc/modules/$module_name files.
35//config:
36//config: Apart from modprobe, other utilities are also provided:
37//config: - insmod is an alias to modprobe
38//config: - rmmod is an alias to modprobe -r
39//config: - depmod generates modules.dep.bb
40//config:
41//config:config FEATURE_MODPROBE_SMALL_OPTIONS_ON_CMDLINE
42//config: bool "Accept module options on modprobe command line"
43//config: default y
44//config: depends on MODPROBE_SMALL
45//config: select PLATFORM_LINUX
46//config: help
47//config: Allow insmod and modprobe take module options from command line.
48//config:
49//config:config FEATURE_MODPROBE_SMALL_CHECK_ALREADY_LOADED
50//config: bool "Skip loading of already loaded modules"
51//config: default y
52//config: depends on MODPROBE_SMALL
53//config: help
54//config: Check if the module is already loaded.
10 55
11//applet:IF_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP)) 56//applet:IF_MODPROBE_SMALL(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP))
12//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, depmod)) 57//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(depmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, depmod))
@@ -14,6 +59,8 @@
14//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, lsmod)) 59//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(lsmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, lsmod))
15//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, rmmod)) 60//applet:IF_MODPROBE_SMALL(APPLET_ODDNAME(rmmod, modprobe, BB_DIR_SBIN, BB_SUID_DROP, rmmod))
16 61
62//kbuild:lib-$(CONFIG_MODPROBE_SMALL) += modprobe-small.o
63
17#include "libbb.h" 64#include "libbb.h"
18/* After libbb.h, since it needs sys/types.h on some systems */ 65/* After libbb.h, since it needs sys/types.h on some systems */
19#include <sys/utsname.h> /* uname() */ 66#include <sys/utsname.h> /* 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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config MODPROBE
11//config: bool "modprobe"
12//config: default n
13//config: depends on !MODPROBE_SMALL
14//config: select PLATFORM_LINUX
15//config: help
16//config: Handle the loading of modules, and their dependencies on a high
17//config: level.
18//config:
19//config:config FEATURE_MODPROBE_BLACKLIST
20//config: bool "Blacklist support"
21//config: default n
22//config: depends on MODPROBE
23//config: select PLATFORM_LINUX
24//config: help
25//config: Say 'y' here to enable support for the 'blacklist' command in
26//config: modprobe.conf. This prevents the alias resolver to resolve
27//config: blacklisted modules. This is useful if you want to prevent your
28//config: hardware autodetection scripts to load modules like evdev, frame
29//config: buffer drivers etc.
10 30
11//applet:IF_MODPROBE(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP)) 31//applet:IF_MODPROBE(APPLET(modprobe, BB_DIR_SBIN, BB_SUID_DROP))
12 32
33//kbuild:lib-$(CONFIG_MODPROBE) += modprobe.o modutils.o
34
13#include "libbb.h" 35#include "libbb.h"
14#include "modutils.h" 36#include "modutils.h"
15#include <sys/utsname.h> 37#include <sys/utsname.h>
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 @@
58 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 58 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
59 */ 59 */
60 60
61//kbuild:lib-$(CONFIG_FEATURE_2_4_MODULES) += modutils-24.o
62
61#include "libbb.h" 63#include "libbb.h"
62#include "modutils.h" 64#include "modutils.h"
63#include <sys/utsname.h> 65#include <sys/utsname.h>
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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config RMMOD
11//config: bool "rmmod"
12//config: default n
13//config: depends on !MODPROBE_SMALL
14//config: select PLATFORM_LINUX
15//config: help
16//config: rmmod is used to unload specified modules from the kernel.
10 17
11//applet:IF_RMMOD(APPLET(rmmod, BB_DIR_SBIN, BB_SUID_DROP)) 18//applet:IF_RMMOD(APPLET(rmmod, BB_DIR_SBIN, BB_SUID_DROP))
12 19
20//kbuild:lib-$(CONFIG_RMMOD) += rmmod.o modutils.o
21
13//usage:#if !ENABLE_MODPROBE_SMALL 22//usage:#if !ENABLE_MODPROBE_SMALL
14//usage:#define rmmod_trivial_usage 23//usage:#define rmmod_trivial_usage
15//usage: "[-wfa] [MODULE]..." 24//usage: "[-wfa] [MODULE]..."
diff --git a/networking/Config.src b/networking/Config.src
index eb0536a7c..527bdd15d 100644
--- a/networking/Config.src
+++ b/networking/Config.src
@@ -5,8 +5,6 @@
5 5
6menu "Networking Utilities" 6menu "Networking Utilities"
7 7
8INSERT
9
10config FEATURE_IPV6 8config FEATURE_IPV6
11 bool "Enable IPv6 support" 9 bool "Enable IPv6 support"
12 default y 10 default y
@@ -48,891 +46,7 @@ config VERBOSE_RESOLUTION_ERRORS
48 "can't resolve 'hostname.com'" and want to know more. 46 "can't resolve 'hostname.com'" and want to know more.
49 This may increase size of your executable a bit. 47 This may increase size of your executable a bit.
50 48
51config ARP 49INSERT
52 bool "arp"
53 default y
54 select PLATFORM_LINUX
55 help
56 Manipulate the system ARP cache.
57
58config ARPING
59 bool "arping"
60 default y
61 select PLATFORM_LINUX
62 help
63 Ping hosts by ARP packets.
64
65config BRCTL
66 bool "brctl"
67 default y
68 select PLATFORM_LINUX
69 help
70 Manage ethernet bridges.
71 Supports addbr/delbr and addif/delif.
72
73config FEATURE_BRCTL_FANCY
74 bool "Fancy options"
75 default y
76 depends on BRCTL
77 help
78 Add support for extended option like:
79 setageing, setfd, sethello, setmaxage,
80 setpathcost, setportprio, setbridgeprio,
81 stp
82 This adds about 600 bytes.
83
84config FEATURE_BRCTL_SHOW
85 bool "Support show"
86 default y
87 depends on BRCTL && FEATURE_BRCTL_FANCY
88 help
89 Add support for option which prints the current config:
90 show
91
92config DNSD
93 bool "dnsd"
94 default y
95 help
96 Small and static DNS server daemon.
97
98config ETHER_WAKE
99 bool "ether-wake"
100 default y
101 select PLATFORM_LINUX
102 help
103 Send a magic packet to wake up sleeping machines.
104
105config FAKEIDENTD
106 bool "fakeidentd"
107 default y
108 select FEATURE_SYSLOG
109 help
110 fakeidentd listens on the ident port and returns a predefined
111 fake value on any query.
112
113config FTPD
114 bool "ftpd"
115 default y
116 help
117 simple FTP daemon. You have to run it via inetd.
118
119config FEATURE_FTP_WRITE
120 bool "Enable upload commands"
121 default y
122 depends on FTPD
123 help
124 Enable all kinds of FTP upload commands (-w option)
125
126config FEATURE_FTPD_ACCEPT_BROKEN_LIST
127 bool "Enable workaround for RFC-violating clients"
128 default y
129 depends on FTPD
130 help
131 Some ftp clients (among them KDE's Konqueror) issue illegal
132 "LIST -l" requests. This option works around such problems.
133 It might prevent you from listing files starting with "-" and
134 it increases the code size by ~40 bytes.
135 Most other ftp servers seem to behave similar to this.
136
137config FEATURE_FTP_AUTHENTICATION
138 bool "Enable authentication"
139 default y
140 depends on FTPD
141 help
142 Enable basic system login as seen in telnet etc.
143
144config FTPGET
145 bool "ftpget"
146 default y
147 help
148 Retrieve a remote file via FTP.
149
150config FTPPUT
151 bool "ftpput"
152 default y
153 help
154 Store a remote file via FTP.
155
156config FEATURE_FTPGETPUT_LONG_OPTIONS
157 bool "Enable long options in ftpget/ftpput"
158 default y
159 depends on LONG_OPTS && (FTPGET || FTPPUT)
160 help
161 Support long options for the ftpget/ftpput applet.
162
163config HOSTNAME
164 bool "hostname"
165 default y
166 help
167 Show or set the system's host name.
168
169config HTTPD
170 bool "httpd"
171 default y
172 help
173 Serve web pages via an HTTP server.
174
175config FEATURE_HTTPD_RANGES
176 bool "Support 'Ranges:' header"
177 default y
178 depends on HTTPD
179 help
180 Makes httpd emit "Accept-Ranges: bytes" header and understand
181 "Range: bytes=NNN-[MMM]" header. Allows for resuming interrupted
182 downloads, seeking in multimedia players etc.
183
184config FEATURE_HTTPD_SETUID
185 bool "Enable -u <user> option"
186 default y
187 depends on HTTPD
188 help
189 This option allows the server to run as a specific user
190 rather than defaulting to the user that starts the server.
191 Use of this option requires special privileges to change to a
192 different user.
193
194config FEATURE_HTTPD_BASIC_AUTH
195 bool "Enable Basic http Authentication"
196 default y
197 depends on HTTPD
198 help
199 Utilizes password settings from /etc/httpd.conf for basic
200 authentication on a per url basis.
201 Example for httpd.conf file:
202 /adm:toor:PaSsWd
203
204config FEATURE_HTTPD_AUTH_MD5
205 bool "Support MD5 crypted passwords for http Authentication"
206 default y
207 depends on FEATURE_HTTPD_BASIC_AUTH
208 help
209 Enables encrypted passwords, and wildcard user/passwords
210 in httpd.conf file.
211 User '*' means 'any system user name is ok',
212 password of '*' means 'use system password for this user'
213 Examples:
214 /adm:toor:$1$P/eKnWXS$aI1aPGxT.dJD5SzqAKWrF0
215 /adm:root:*
216 /wiki:*:*
217
218config FEATURE_HTTPD_CGI
219 bool "Support Common Gateway Interface (CGI)"
220 default y
221 depends on HTTPD
222 help
223 This option allows scripts and executables to be invoked
224 when specific URLs are requested.
225
226config FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
227 bool "Support for running scripts through an interpreter"
228 default y
229 depends on FEATURE_HTTPD_CGI
230 help
231 This option enables support for running scripts through an
232 interpreter. Turn this on if you want PHP scripts to work
233 properly. You need to supply an additional line in your
234 httpd.conf file:
235 *.php:/path/to/your/php
236
237config FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
238 bool "Set REMOTE_PORT environment variable for CGI"
239 default y
240 depends on FEATURE_HTTPD_CGI
241 help
242 Use of this option can assist scripts in generating
243 references that contain a unique port number.
244
245config FEATURE_HTTPD_ENCODE_URL_STR
246 bool "Enable -e option (useful for CGIs written as shell scripts)"
247 default y
248 depends on HTTPD
249 help
250 This option allows html encoding of arbitrary strings for display
251 by the browser. Output goes to stdout.
252 For example, httpd -e "<Hello World>" produces
253 "&#60Hello&#32World&#62".
254
255config FEATURE_HTTPD_ERROR_PAGES
256 bool "Support for custom error pages"
257 default y
258 depends on HTTPD
259 help
260 This option allows you to define custom error pages in
261 the configuration file instead of the default HTTP status
262 error pages. For instance, if you add the line:
263 E404:/path/e404.html
264 in the config file, the server will respond the specified
265 '/path/e404.html' file instead of the terse '404 NOT FOUND'
266 message.
267
268config FEATURE_HTTPD_PROXY
269 bool "Support for reverse proxy"
270 default y
271 depends on HTTPD
272 help
273 This option allows you to define URLs that will be forwarded
274 to another HTTP server. To setup add the following line to the
275 configuration file
276 P:/url/:http://hostname[:port]/new/path/
277 Then a request to /url/myfile will be forwarded to
278 http://hostname[:port]/new/path/myfile.
279
280config FEATURE_HTTPD_GZIP
281 bool "Support for GZIP content encoding"
282 default y
283 depends on HTTPD
284 help
285 Makes httpd send files using GZIP content encoding if the
286 client supports it and a pre-compressed <file>.gz exists.
287
288config IFCONFIG
289 bool "ifconfig"
290 default y
291 select PLATFORM_LINUX
292 help
293 Ifconfig is used to configure the kernel-resident network interfaces.
294
295config FEATURE_IFCONFIG_STATUS
296 bool "Enable status reporting output (+7k)"
297 default y
298 depends on IFCONFIG
299 help
300 If ifconfig is called with no arguments it will display the status
301 of the currently active interfaces.
302
303config FEATURE_IFCONFIG_SLIP
304 bool "Enable slip-specific options \"keepalive\" and \"outfill\""
305 default y
306 depends on IFCONFIG
307 help
308 Allow "keepalive" and "outfill" support for SLIP. If you're not
309 planning on using serial lines, leave this unchecked.
310
311config FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
312 bool "Enable options \"mem_start\", \"io_addr\", and \"irq\""
313 default y
314 depends on IFCONFIG
315 help
316 Allow the start address for shared memory, start address for I/O,
317 and/or the interrupt line used by the specified device.
318
319config FEATURE_IFCONFIG_HW
320 bool "Enable option \"hw\" (ether only)"
321 default y
322 depends on IFCONFIG
323 help
324 Set the hardware address of this interface, if the device driver
325 supports this operation. Currently, we only support the 'ether'
326 class.
327
328config FEATURE_IFCONFIG_BROADCAST_PLUS
329 bool "Set the broadcast automatically"
330 default y
331 depends on IFCONFIG
332 help
333 Setting this will make ifconfig attempt to find the broadcast
334 automatically if the value '+' is used.
335
336config IFENSLAVE
337 bool "ifenslave"
338 default y
339 select PLATFORM_LINUX
340 help
341 Userspace application to bind several interfaces
342 to a logical interface (use with kernel bonding driver).
343
344config IFPLUGD
345 bool "ifplugd"
346 default y
347 select PLATFORM_LINUX
348 help
349 Network interface plug detection daemon.
350
351config IFUPDOWN
352 bool "ifupdown"
353 default y
354 help
355 Activate or deactivate the specified interfaces. This applet makes
356 use of either "ifconfig" and "route" or the "ip" command to actually
357 configure network interfaces. Therefore, you will probably also want
358 to enable either IFCONFIG and ROUTE, or enable
359 FEATURE_IFUPDOWN_IP and the various IP options. Of
360 course you could use non-busybox versions of these programs, so
361 against my better judgement (since this will surely result in plenty
362 of support questions on the mailing list), I do not force you to
363 enable these additional options. It is up to you to supply either
364 "ifconfig", "route" and "run-parts" or the "ip" command, either
365 via busybox or via standalone utilities.
366
367config IFUPDOWN_IFSTATE_PATH
368 string "Absolute path to ifstate file"
369 default "/var/run/ifstate"
370 depends on IFUPDOWN
371 help
372 ifupdown keeps state information in a file called ifstate.
373 Typically it is located in /var/run/ifstate, however
374 some distributions tend to put it in other places
375 (debian, for example, uses /etc/network/run/ifstate).
376 This config option defines location of ifstate.
377
378config FEATURE_IFUPDOWN_IP
379 bool "Use ip applet"
380 default y
381 depends on IFUPDOWN
382 help
383 Use the iproute "ip" command to implement "ifup" and "ifdown", rather
384 than the default of using the older 'ifconfig' and 'route' utilities.
385
386config FEATURE_IFUPDOWN_IP_BUILTIN
387 bool "Use busybox ip applet"
388 default y
389 depends on FEATURE_IFUPDOWN_IP
390 select PLATFORM_LINUX
391 select IP
392 select FEATURE_IP_ADDRESS
393 select FEATURE_IP_LINK
394 select FEATURE_IP_ROUTE
395 help
396 Use the busybox iproute "ip" applet to implement "ifupdown".
397
398 If left disabled, you must install the full-blown iproute2
399 utility or the "ifup" and "ifdown" applets will not work.
400
401config FEATURE_IFUPDOWN_IFCONFIG_BUILTIN
402 bool "Use busybox ifconfig and route applets"
403 default n
404 depends on IFUPDOWN && !FEATURE_IFUPDOWN_IP
405 select IFCONFIG
406 select ROUTE
407 help
408 Use the busybox iproute "ifconfig" and "route" applets to
409 implement the "ifup" and "ifdown" utilities.
410
411 If left disabled, you must install the full-blown ifconfig
412 and route utilities, or the "ifup" and "ifdown" applets will not
413 work.
414
415config FEATURE_IFUPDOWN_IPV4
416 bool "Support for IPv4"
417 default y
418 depends on IFUPDOWN
419 help
420 If you want ifup/ifdown to talk IPv4, leave this on.
421
422config FEATURE_IFUPDOWN_IPV6
423 bool "Support for IPv6"
424 default y
425 depends on IFUPDOWN && FEATURE_IPV6
426 help
427 If you need support for IPv6, turn this option on.
428
429### UNUSED
430###config FEATURE_IFUPDOWN_IPX
431### bool "Support for IPX"
432### default y
433### depends on IFUPDOWN
434### help
435### If this option is selected you can use busybox to work with IPX
436### networks.
437
438config FEATURE_IFUPDOWN_MAPPING
439 bool "Enable mapping support"
440 default y
441 depends on IFUPDOWN
442 help
443 This enables support for the "mapping" stanza, unless you have
444 a weird network setup you don't need it.
445
446config FEATURE_IFUPDOWN_EXTERNAL_DHCP
447 bool "Support for external dhcp clients"
448 default n
449 depends on IFUPDOWN
450 help
451 This enables support for the external dhcp clients. Clients are
452 tried in the following order: dhcpcd, dhclient, pump and udhcpc.
453 Otherwise, if udhcpc applet is enabled, it is used.
454 Otherwise, ifup/ifdown will have no support for DHCP.
455
456config INETD
457 bool "inetd"
458 default y
459 select FEATURE_SYSLOG
460 help
461 Internet superserver daemon
462
463config FEATURE_INETD_SUPPORT_BUILTIN_ECHO
464 bool "Support echo service"
465 default y
466 depends on INETD
467 help
468 Echo received data internal inetd service
469
470config FEATURE_INETD_SUPPORT_BUILTIN_DISCARD
471 bool "Support discard service"
472 default y
473 depends on INETD
474 help
475 Internet /dev/null internal inetd service
476
477config FEATURE_INETD_SUPPORT_BUILTIN_TIME
478 bool "Support time service"
479 default y
480 depends on INETD
481 help
482 Return 32 bit time since 1900 internal inetd service
483
484config FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME
485 bool "Support daytime service"
486 default y
487 depends on INETD
488 help
489 Return human-readable time internal inetd service
490
491config FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN
492 bool "Support chargen service"
493 default y
494 depends on INETD
495 help
496 Familiar character generator internal inetd service
497
498config FEATURE_INETD_RPC
499 bool "Support RPC services"
500 default n # very rarely used, and needs Sun RPC support in libc
501 depends on INETD
502 select FEATURE_HAVE_RPC
503 help
504 Support Sun-RPC based services
505
506config IP
507 bool "ip"
508 default y
509 select PLATFORM_LINUX
510 help
511 The "ip" applet is a TCP/IP interface configuration and routing
512 utility. You generally don't need "ip" to use busybox with
513 TCP/IP.
514
515config FEATURE_IP_ADDRESS
516 bool "ip address"
517 default y
518 depends on IP
519 help
520 Address manipulation support for the "ip" applet.
521
522config FEATURE_IP_LINK
523 bool "ip link"
524 default y
525 depends on IP
526 help
527 Configure network devices with "ip".
528
529config FEATURE_IP_ROUTE
530 bool "ip route"
531 default y
532 depends on IP
533 help
534 Add support for routing table management to "ip".
535
536config FEATURE_IP_ROUTE_DIR
537 string "ip route configuration directory"
538 default "/etc/iproute2"
539 depends on FEATURE_IP_ROUTE
540 help
541 Location of the "ip" applet routing configuration.
542
543config FEATURE_IP_TUNNEL
544 bool "ip tunnel"
545 default y
546 depends on IP
547 help
548 Add support for tunneling commands to "ip".
549
550config FEATURE_IP_RULE
551 bool "ip rule"
552 default y
553 depends on IP
554 help
555 Add support for rule commands to "ip".
556
557config FEATURE_IP_NEIGH
558 bool "ip neighbor"
559 default y
560 depends on IP
561 help
562 Add support for neighbor commands to "ip".
563
564config FEATURE_IP_SHORT_FORMS
565 bool "Support short forms of ip commands"
566 default y
567 depends on IP
568 help
569 Also support short-form of ip <OBJECT> commands:
570 ip addr -> ipaddr
571 ip link -> iplink
572 ip route -> iproute
573 ip tunnel -> iptunnel
574 ip rule -> iprule
575 ip neigh -> ipneigh
576
577 Say N unless you desparately need the short form of the ip
578 object commands.
579
580config FEATURE_IP_RARE_PROTOCOLS
581 bool "Support displaying rarely used link types"
582 default n
583 depends on IP
584 help
585 If you are not going to use links of type "frad", "econet",
586 "bif" etc, you probably don't need to enable this.
587 Ethernet, wireless, infrared, ppp/slip, ip tunnelling
588 link types are supported without this option selected.
589
590config IPADDR
591 bool
592 default y
593 depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ADDRESS
594
595config IPLINK
596 bool
597 default y
598 depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_LINK
599
600config IPROUTE
601 bool
602 default y
603 depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ROUTE
604
605config IPTUNNEL
606 bool
607 default y
608 depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_TUNNEL
609
610config IPRULE
611 bool
612 default y
613 depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_RULE
614
615config IPNEIGH
616 bool
617 default y
618 depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_NEIGH
619
620config IPCALC
621 bool "ipcalc"
622 default y
623 help
624 ipcalc takes an IP address and netmask and calculates the
625 resulting broadcast, network, and host range.
626
627config FEATURE_IPCALC_FANCY
628 bool "Fancy IPCALC, more options, adds 1 kbyte"
629 default y
630 depends on IPCALC
631 help
632 Adds the options hostname, prefix and silent to the output of
633 "ipcalc".
634
635config FEATURE_IPCALC_LONG_OPTIONS
636 bool "Enable long options"
637 default y
638 depends on IPCALC && LONG_OPTS
639 help
640 Support long options for the ipcalc applet.
641
642config NETSTAT
643 bool "netstat"
644 default y
645 select PLATFORM_LINUX
646 help
647 netstat prints information about the Linux networking subsystem.
648
649config FEATURE_NETSTAT_WIDE
650 bool "Enable wide netstat output"
651 default y
652 depends on NETSTAT
653 help
654 Add support for wide columns. Useful when displaying IPv6 addresses
655 (-W option).
656
657config FEATURE_NETSTAT_PRG
658 bool "Enable PID/Program name output"
659 default y
660 depends on NETSTAT
661 help
662 Add support for -p flag to print out PID and program name.
663 +700 bytes of code.
664
665config NSLOOKUP
666 bool "nslookup"
667 default y
668 help
669 nslookup is a tool to query Internet name servers.
670
671config NTPD
672 bool "ntpd"
673 default y
674 select PLATFORM_LINUX
675 help
676 The NTP client/server daemon.
677
678config FEATURE_NTPD_SERVER
679 bool "Make ntpd usable as a NTP server"
680 default y
681 depends on NTPD
682 help
683 Make ntpd usable as a NTP server. If you disable this option
684 ntpd will be usable only as a NTP client.
685
686config FEATURE_NTPD_CONF
687 bool "Make ntpd understand /etc/ntp.conf"
688 default y
689 depends on NTPD
690 help
691 Make ntpd look in /etc/ntp.conf for peers. Only "server address"
692 is supported.
693
694config PSCAN
695 bool "pscan"
696 default y
697 help
698 Simple network port scanner.
699
700config ROUTE
701 bool "route"
702 default y
703 select PLATFORM_LINUX
704 help
705 Route displays or manipulates the kernel's IP routing tables.
706
707config SLATTACH
708 bool "slattach"
709 default y
710 select PLATFORM_LINUX
711 help
712 slattach is a small utility to attach network interfaces to serial
713 lines.
714
715#config TC
716# bool "tc"
717# default y
718# help
719# show / manipulate traffic control settings
720#
721#config FEATURE_TC_INGRESS
722# def_bool n
723# depends on TC
724
725config TCPSVD
726 bool "tcpsvd"
727 default y
728 help
729 tcpsvd listens on a TCP port and runs a program for each new
730 connection.
731
732config TELNET
733 bool "telnet"
734 default y
735 help
736 Telnet is an interface to the TELNET protocol, but is also commonly
737 used to test other simple protocols.
738
739config FEATURE_TELNET_TTYPE
740 bool "Pass TERM type to remote host"
741 default y
742 depends on TELNET
743 help
744 Setting this option will forward the TERM environment variable to the
745 remote host you are connecting to. This is useful to make sure that
746 things like ANSI colors and other control sequences behave.
747
748config FEATURE_TELNET_AUTOLOGIN
749 bool "Pass USER type to remote host"
750 default y
751 depends on TELNET
752 help
753 Setting this option will forward the USER environment variable to the
754 remote host you are connecting to. This is useful when you need to
755 log into a machine without telling the username (autologin). This
756 option enables `-a' and `-l USER' arguments.
757
758config TELNETD
759 bool "telnetd"
760 default y
761 select FEATURE_SYSLOG
762 help
763 A daemon for the TELNET protocol, allowing you to log onto the host
764 running the daemon. Please keep in mind that the TELNET protocol
765 sends passwords in plain text. If you can't afford the space for an
766 SSH daemon and you trust your network, you may say 'y' here. As a
767 more secure alternative, you should seriously consider installing the
768 very small Dropbear SSH daemon instead:
769 http://matt.ucc.asn.au/dropbear/dropbear.html
770
771 Note that for busybox telnetd to work you need several things:
772 First of all, your kernel needs:
773 CONFIG_UNIX98_PTYS=y
774
775 Next, you need a /dev/pts directory on your root filesystem:
776
777 $ ls -ld /dev/pts
778 drwxr-xr-x 2 root root 0 Sep 23 13:21 /dev/pts/
779
780 Next you need the pseudo terminal master multiplexer /dev/ptmx:
781
782 $ ls -la /dev/ptmx
783 crw-rw-rw- 1 root tty 5, 2 Sep 23 13:55 /dev/ptmx
784
785 Any /dev/ttyp[0-9]* files you may have can be removed.
786 Next, you need to mount the devpts filesystem on /dev/pts using:
787
788 mount -t devpts devpts /dev/pts
789
790 You need to be sure that busybox has LOGIN and
791 FEATURE_SUID enabled. And finally, you should make
792 certain that Busybox has been installed setuid root:
793
794 chown root.root /bin/busybox
795 chmod 4755 /bin/busybox
796
797 with all that done, telnetd _should_ work....
798
799
800config FEATURE_TELNETD_STANDALONE
801 bool "Support standalone telnetd (not inetd only)"
802 default y
803 depends on TELNETD
804 help
805 Selecting this will make telnetd able to run standalone.
806
807config FEATURE_TELNETD_INETD_WAIT
808 bool "Support -w SEC option (inetd wait mode)"
809 default y
810 depends on FEATURE_TELNETD_STANDALONE
811 help
812 This option allows you to run telnetd in "inet wait" mode.
813 Example inetd.conf line (note "wait", not usual "nowait"):
814
815 telnet stream tcp wait root /bin/telnetd telnetd -w10
816
817 In this example, inetd passes _listening_ socket_ as fd 0
818 to telnetd when connection appears.
819 telnetd will wait for connections until all existing
820 connections are closed, and no new connections
821 appear during 10 seconds. Then it exits, and inetd continues
822 to listen for new connections.
823
824 This option is rarely used. "tcp nowait" is much more usual
825 way of running tcp services, including telnetd.
826 You most probably want to say N here.
827
828config TFTP
829 bool "tftp"
830 default y
831 help
832 This enables the Trivial File Transfer Protocol client program. TFTP
833 is usually used for simple, small transfers such as a root image
834 for a network-enabled bootloader.
835
836config TFTPD
837 bool "tftpd"
838 default y
839 help
840 This enables the Trivial File Transfer Protocol server program.
841 It expects that stdin is a datagram socket and a packet
842 is already pending on it. It will exit after one transfer.
843 In other words: it should be run from inetd in nowait mode,
844 or from udpsvd. Example: "udpsvd -E 0 69 tftpd DIR"
845
846comment "Common options for tftp/tftpd"
847 depends on TFTP || TFTPD
848
849config FEATURE_TFTP_GET
850 bool "Enable 'tftp get' and/or tftpd upload code"
851 default y
852 depends on TFTP || TFTPD
853 help
854 Add support for the GET command within the TFTP client. This allows
855 a client to retrieve a file from a TFTP server.
856 Also enable upload support in tftpd, if tftpd is selected.
857
858 Note: this option does _not_ make tftpd capable of download
859 (the usual operation people need from it)!
860
861config FEATURE_TFTP_PUT
862 bool "Enable 'tftp put' and/or tftpd download code"
863 default y
864 depends on TFTP || TFTPD
865 help
866 Add support for the PUT command within the TFTP client. This allows
867 a client to transfer a file to a TFTP server.
868 Also enable download support in tftpd, if tftpd is selected.
869
870config FEATURE_TFTP_BLOCKSIZE
871 bool "Enable 'blksize' and 'tsize' protocol options"
872 default y
873 depends on TFTP || TFTPD
874 help
875 Allow tftp to specify block size, and tftpd to understand
876 "blksize" and "tsize" options.
877
878config FEATURE_TFTP_PROGRESS_BAR
879 bool "Enable tftp progress meter"
880 default y
881 depends on TFTP && FEATURE_TFTP_BLOCKSIZE
882 help
883 Show progress bar.
884
885config TFTP_DEBUG
886 bool "Enable debug"
887 default n
888 depends on TFTP || TFTPD
889 help
890 Make tftp[d] print debugging messages on stderr.
891 This is useful if you are diagnosing a bug in tftp[d].
892
893config TRACEROUTE
894 bool "traceroute"
895 default y
896 select PLATFORM_LINUX
897 help
898 Utility to trace the route of IP packets.
899
900config TRACEROUTE6
901 bool "traceroute6"
902 default y
903 depends on FEATURE_IPV6 && TRACEROUTE
904 help
905 Utility to trace the route of IPv6 packets.
906
907config FEATURE_TRACEROUTE_VERBOSE
908 bool "Enable verbose output"
909 default y
910 depends on TRACEROUTE
911 help
912 Add some verbosity to traceroute. This includes among other things
913 hostnames and ICMP response types.
914
915config FEATURE_TRACEROUTE_USE_ICMP
916 bool "Enable -I option (use ICMP instead of UDP)"
917 default y
918 depends on TRACEROUTE
919 help
920 Add option -I to use ICMP ECHO instead of UDP datagrams.
921
922config TUNCTL
923 bool "tunctl"
924 default y
925 select PLATFORM_LINUX
926 help
927 tunctl creates or deletes tun devices.
928
929config FEATURE_TUNCTL_UG
930 bool "Support owner:group assignment"
931 default y
932 depends on TUNCTL
933 help
934 Allow to specify owner and group of newly created interface.
935 340 bytes of pure bloat. Say no here.
936 50
937source networking/udhcp/Config.in 51source networking/udhcp/Config.in
938 52
@@ -945,31 +59,4 @@ config IFUPDOWN_UDHCPC_CMD_OPTIONS
945 Intended to alter options not available in /etc/network/interfaces. 59 Intended to alter options not available in /etc/network/interfaces.
946 (IE: --syslog --background etc...) 60 (IE: --syslog --background etc...)
947 61
948config UDPSVD
949 bool "udpsvd"
950 default y
951 help
952 udpsvd listens on an UDP port and runs a program for each new
953 connection.
954
955config VCONFIG
956 bool "vconfig"
957 default y
958 select PLATFORM_LINUX
959 help
960 Creates, removes, and configures VLAN interfaces
961
962config ZCIP
963 bool "zcip"
964 default y
965 select PLATFORM_LINUX
966 select FEATURE_SYSLOG
967 help
968 ZCIP provides ZeroConf IPv4 address selection, according to RFC 3927.
969 It's a daemon that allocates and defends a dynamically assigned
970 address on the 169.254/16 network, requiring no system administrator.
971
972 See http://www.zeroconf.org for further details, and "zcip.script"
973 in the busybox examples.
974
975endmenu 62endmenu
diff --git a/networking/Kbuild.src b/networking/Kbuild.src
index 79f54824b..6b4fb7470 100644
--- a/networking/Kbuild.src
+++ b/networking/Kbuild.src
@@ -7,41 +7,3 @@
7lib-y:= 7lib-y:=
8 8
9INSERT 9INSERT
10lib-$(CONFIG_ARP) += arp.o interface.o
11lib-$(CONFIG_ARPING) += arping.o
12lib-$(CONFIG_BRCTL) += brctl.o
13lib-$(CONFIG_DNSD) += dnsd.o
14lib-$(CONFIG_ETHER_WAKE) += ether-wake.o
15lib-$(CONFIG_FAKEIDENTD) += isrv_identd.o isrv.o
16lib-$(CONFIG_FTPD) += ftpd.o
17lib-$(CONFIG_FTPGET) += ftpgetput.o
18lib-$(CONFIG_FTPPUT) += ftpgetput.o
19lib-$(CONFIG_HOSTNAME) += hostname.o
20lib-$(CONFIG_HTTPD) += httpd.o
21lib-$(CONFIG_IFCONFIG) += ifconfig.o interface.o
22lib-$(CONFIG_IFENSLAVE) += ifenslave.o interface.o
23lib-$(CONFIG_IFPLUGD) += ifplugd.o
24lib-$(CONFIG_IFUPDOWN) += ifupdown.o
25lib-$(CONFIG_INETD) += inetd.o
26lib-$(CONFIG_IP) += ip.o
27lib-$(CONFIG_IPCALC) += ipcalc.o
28lib-$(CONFIG_NAMEIF) += nameif.o
29lib-$(CONFIG_NC) += nc.o
30lib-$(CONFIG_NETSTAT) += netstat.o
31lib-$(CONFIG_NSLOOKUP) += nslookup.o
32lib-$(CONFIG_NTPD) += ntpd.o
33lib-$(CONFIG_PSCAN) += pscan.o
34lib-$(CONFIG_ROUTE) += route.o
35lib-$(CONFIG_SLATTACH) += slattach.o
36lib-$(CONFIG_TC) += tc.o
37lib-$(CONFIG_TELNET) += telnet.o
38lib-$(CONFIG_TELNETD) += telnetd.o
39lib-$(CONFIG_TFTP) += tftp.o
40lib-$(CONFIG_TFTPD) += tftp.o
41lib-$(CONFIG_TRACEROUTE) += traceroute.o
42lib-$(CONFIG_TUNCTL) += tunctl.o
43lib-$(CONFIG_VCONFIG) += vconfig.o
44lib-$(CONFIG_ZCIP) += zcip.o
45
46lib-$(CONFIG_TCPSVD) += tcpudp.o tcpudp_perhost.o
47lib-$(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 @@
12 * 12 *
13 * modified for getopt32 by Arne Bernin <arne [at] alamut.de> 13 * modified for getopt32 by Arne Bernin <arne [at] alamut.de>
14 */ 14 */
15//config:config ARP
16//config: bool "arp"
17//config: default y
18//config: select PLATFORM_LINUX
19//config: help
20//config: Manipulate the system ARP cache.
21
22//applet:IF_ARP(APPLET(arp, BB_DIR_SBIN, BB_SUID_DROP))
23
24//kbuild:lib-$(CONFIG_ARP) += arp.o interface.o
15 25
16//usage:#define arp_trivial_usage 26//usage:#define arp_trivial_usage
17//usage: "\n[-vn] [-H HWTYPE] [-i IF] -a [HOSTNAME]" 27//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 @@
5 * Author: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru> 5 * Author: Alexey Kuznetsov <kuznet@ms2.inr.ac.ru>
6 * Busybox port: Nick Fedchik <nick@fedchik.org.ua> 6 * Busybox port: Nick Fedchik <nick@fedchik.org.ua>
7 */ 7 */
8//config:config ARPING
9//config: bool "arping"
10//config: default y
11//config: select PLATFORM_LINUX
12//config: help
13//config: Ping hosts by ARP packets.
14//config:
15
16//applet:IF_ARPING(APPLET(arping, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_ARPING) += arping.o
8 19
9//usage:#define arping_trivial_usage 20//usage:#define arping_trivial_usage
10//usage: "[-fqbDUA] [-c CNT] [-w TIMEOUT] [-I IFACE] [-s SRC_IP] DST_IP" 21//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 @@
12/* This applet currently uses only the ioctl interface and no sysfs at all. 12/* This applet currently uses only the ioctl interface and no sysfs at all.
13 * At the time of this writing this was considered a feature. 13 * At the time of this writing this was considered a feature.
14 */ 14 */
15//config:config BRCTL
16//config: bool "brctl"
17//config: default y
18//config: select PLATFORM_LINUX
19//config: help
20//config: Manage ethernet bridges.
21//config: Supports addbr/delbr and addif/delif.
22//config:
23//config:config FEATURE_BRCTL_FANCY
24//config: bool "Fancy options"
25//config: default y
26//config: depends on BRCTL
27//config: help
28//config: Add support for extended option like:
29//config: setageing, setfd, sethello, setmaxage,
30//config: setpathcost, setportprio, setbridgeprio,
31//config: stp
32//config: This adds about 600 bytes.
33//config:
34//config:config FEATURE_BRCTL_SHOW
35//config: bool "Support show"
36//config: default y
37//config: depends on BRCTL && FEATURE_BRCTL_FANCY
38//config: help
39//config: Add support for option which prints the current config:
40//config: show
41
42//applet:IF_BRCTL(APPLET(brctl, BB_DIR_USR_SBIN, BB_SUID_DROP))
43
44//kbuild:lib-$(CONFIG_BRCTL) += brctl.o
15 45
16//usage:#define brctl_trivial_usage 46//usage:#define brctl_trivial_usage
17//usage: "COMMAND [BRIDGE [INTERFACE]]" 47//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 @@
16 * Some bugfix and minor changes was applied by Roberto A. Foglietta who made 16 * Some bugfix and minor changes was applied by Roberto A. Foglietta who made
17 * the first porting of oao' scdns to busybox also. 17 * the first porting of oao' scdns to busybox also.
18 */ 18 */
19//config:config DNSD
20//config: bool "dnsd"
21//config: default y
22//config: help
23//config: Small and static DNS server daemon.
24
25//applet:IF_DNSD(APPLET(dnsd, BB_DIR_USR_SBIN, BB_SUID_DROP))
26
27//kbuild:lib-$(CONFIG_DNSD) += dnsd.o
19 28
20//usage:#define dnsd_trivial_usage 29//usage:#define dnsd_trivial_usage
21//usage: "[-dvs] [-c CONFFILE] [-t TTL_SEC] [-p PORT] [-i ADDR]" 30//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 @@
63 * doing so only works with adapters configured for unicast+broadcast Rx 63 * doing so only works with adapters configured for unicast+broadcast Rx
64 * filter. That configuration consumes more power. 64 * filter. That configuration consumes more power.
65 */ 65 */
66//config:config ETHER_WAKE
67//config: bool "ether-wake"
68//config: default y
69//config: select PLATFORM_LINUX
70//config: help
71//config: Send a magic packet to wake up sleeping machines.
72
73//applet:IF_ETHER_WAKE(APPLET_ODDNAME(ether-wake, ether_wake, BB_DIR_USR_SBIN, BB_SUID_DROP, ether_wake))
74
75//kbuild:lib-$(CONFIG_ETHER_WAKE) += ether-wake.o
66 76
67//usage:#define ether_wake_trivial_usage 77//usage:#define ether_wake_trivial_usage
68//usage: "[-b] [-i IFACE] [-p aa:bb:cc:dd[:ee:ff]/a.b.c.d] MAC" 78//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..bcd60a2ad 100644
--- a/networking/ftpd.c
+++ b/networking/ftpd.c
@@ -11,6 +11,40 @@
11 * 11 *
12 * You have to run this daemon via inetd. 12 * You have to run this daemon via inetd.
13 */ 13 */
14//config:config FTPD
15//config: bool "ftpd"
16//config: default y
17//config: help
18//config: simple FTP daemon. You have to run it via inetd.
19//config:
20//config:config FEATURE_FTPD_WRITE
21//config: bool "Enable upload commands"
22//config: default y
23//config: depends on FTPD
24//config: help
25//config: Enable all kinds of FTP upload commands (-w option)
26//config:
27//config:config FEATURE_FTPD_ACCEPT_BROKEN_LIST
28//config: bool "Enable workaround for RFC-violating clients"
29//config: default y
30//config: depends on FTPD
31//config: help
32//config: Some ftp clients (among them KDE's Konqueror) issue illegal
33//config: "LIST -l" requests. This option works around such problems.
34//config: It might prevent you from listing files starting with "-" and
35//config: it increases the code size by ~40 bytes.
36//config: Most other ftp servers seem to behave similar to this.
37//config:
38//config:config FEATURE_FTPD_AUTHENTICATION
39//config: bool "Enable authentication"
40//config: default y
41//config: depends on FTPD
42//config: help
43//config: Enable basic system login as seen in telnet etc.
44
45//applet:IF_FTPD(APPLET(ftpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
46
47//kbuild:lib-$(CONFIG_FTPD) += ftpd.o
14 48
15//usage:#define ftpd_trivial_usage 49//usage:#define ftpd_trivial_usage
16//usage: "[-wvS] [-t N] [-T N] [DIR]" 50//usage: "[-wvS] [-t N] [-T N] [DIR]"
@@ -117,7 +151,7 @@ struct globals {
117 len_and_sockaddr *port_addr; 151 len_and_sockaddr *port_addr;
118 char *ftp_cmd; 152 char *ftp_cmd;
119 char *ftp_arg; 153 char *ftp_arg;
120#if ENABLE_FEATURE_FTP_WRITE 154#if ENABLE_FEATURE_FTPD_WRITE
121 char *rnfr_filename; 155 char *rnfr_filename;
122#endif 156#endif
123 /* We need these aligned to uint32_t */ 157 /* We need these aligned to uint32_t */
@@ -831,7 +865,7 @@ handle_size_or_mdtm(int need_size)
831 865
832/* Upload commands */ 866/* Upload commands */
833 867
834#if ENABLE_FEATURE_FTP_WRITE 868#if ENABLE_FEATURE_FTPD_WRITE
835static void 869static void
836handle_mkd(void) 870handle_mkd(void)
837{ 871{
@@ -974,7 +1008,7 @@ handle_stou(void)
974 G.restart_pos = 0; 1008 G.restart_pos = 0;
975 handle_upload_common(0, 1); 1009 handle_upload_common(0, 1);
976} 1010}
977#endif /* ENABLE_FEATURE_FTP_WRITE */ 1011#endif /* ENABLE_FEATURE_FTPD_WRITE */
978 1012
979static uint32_t 1013static uint32_t
980cmdio_get_cmd_and_arg(void) 1014cmdio_get_cmd_and_arg(void)
@@ -1108,7 +1142,7 @@ enum {
1108#endif 1142#endif
1109 OPT_v = (1 << ((!BB_MMU) * 3 + 0)), 1143 OPT_v = (1 << ((!BB_MMU) * 3 + 0)),
1110 OPT_S = (1 << ((!BB_MMU) * 3 + 1)), 1144 OPT_S = (1 << ((!BB_MMU) * 3 + 1)),
1111 OPT_w = (1 << ((!BB_MMU) * 3 + 2)) * ENABLE_FEATURE_FTP_WRITE, 1145 OPT_w = (1 << ((!BB_MMU) * 3 + 2)) * ENABLE_FEATURE_FTPD_WRITE,
1112}; 1146};
1113 1147
1114int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 1148int ftpd_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
@@ -1118,7 +1152,7 @@ int ftpd_main(int argc, char **argv)
1118int ftpd_main(int argc UNUSED_PARAM, char **argv) 1152int ftpd_main(int argc UNUSED_PARAM, char **argv)
1119#endif 1153#endif
1120{ 1154{
1121#if ENABLE_FEATURE_FTP_AUTHENTICATION 1155#if ENABLE_FEATURE_FTPD_AUTHENTICATION
1122 struct passwd *pw = NULL; 1156 struct passwd *pw = NULL;
1123#endif 1157#endif
1124 unsigned abs_timeout; 1158 unsigned abs_timeout;
@@ -1132,9 +1166,9 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv)
1132 G.timeout = 2 * 60; 1166 G.timeout = 2 * 60;
1133 opt_complementary = "vv:SS"; 1167 opt_complementary = "vv:SS";
1134#if BB_MMU 1168#if BB_MMU
1135 opts = getopt32(argv, "vS" IF_FEATURE_FTP_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S); 1169 opts = getopt32(argv, "vS" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
1136#else 1170#else
1137 opts = getopt32(argv, "l1AvS" IF_FEATURE_FTP_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S); 1171 opts = getopt32(argv, "l1AvS" IF_FEATURE_FTPD_WRITE("w") "t:+T:+", &G.timeout, &abs_timeout, &G.verbose, &verbose_S);
1138 if (opts & (OPT_l|OPT_1)) { 1172 if (opts & (OPT_l|OPT_1)) {
1139 /* Our secret backdoor to ls */ 1173 /* Our secret backdoor to ls */
1140/* TODO: pass --group-directories-first? would be nice, but ls doesn't do that yet */ 1174/* TODO: pass --group-directories-first? would be nice, but ls doesn't do that yet */
@@ -1197,7 +1231,7 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv)
1197 WRITE_OK(FTP_GREET); 1231 WRITE_OK(FTP_GREET);
1198 signal(SIGALRM, timeout_handler); 1232 signal(SIGALRM, timeout_handler);
1199 1233
1200#if ENABLE_FEATURE_FTP_AUTHENTICATION 1234#if ENABLE_FEATURE_FTPD_AUTHENTICATION
1201 while (1) { 1235 while (1) {
1202 uint32_t cmdval = cmdio_get_cmd_and_arg(); 1236 uint32_t cmdval = cmdio_get_cmd_and_arg();
1203 if (cmdval == const_USER) { 1237 if (cmdval == const_USER) {
@@ -1247,7 +1281,7 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv)
1247 xchdir(basedir); 1281 xchdir(basedir);
1248 } 1282 }
1249 1283
1250#if ENABLE_FEATURE_FTP_AUTHENTICATION 1284#if ENABLE_FEATURE_FTPD_AUTHENTICATION
1251 change_identity(pw); 1285 change_identity(pw);
1252#endif 1286#endif
1253 1287
@@ -1354,7 +1388,7 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv)
1354 handle_port(); 1388 handle_port();
1355 else if (cmdval == const_REST) 1389 else if (cmdval == const_REST)
1356 handle_rest(); 1390 handle_rest();
1357#if ENABLE_FEATURE_FTP_WRITE 1391#if ENABLE_FEATURE_FTPD_WRITE
1358 else if (opts & OPT_w) { 1392 else if (opts & OPT_w) {
1359 if (cmdval == const_STOR) 1393 if (cmdval == const_STOR)
1360 handle_stor(); 1394 handle_stor();
@@ -1394,7 +1428,7 @@ int ftpd_main(int argc UNUSED_PARAM, char **argv)
1394 * (doesn't necessarily mean "we must support them") 1428 * (doesn't necessarily mean "we must support them")
1395 * foo 1.2.3: XXXX - comment 1429 * foo 1.2.3: XXXX - comment
1396 */ 1430 */
1397#if ENABLE_FEATURE_FTP_WRITE 1431#if ENABLE_FEATURE_FTPD_WRITE
1398 bad_cmd: 1432 bad_cmd:
1399#endif 1433#endif
1400 cmdio_write_raw(STR(FTP_BADCMD)" Unknown command\r\n"); 1434 cmdio_write_raw(STR(FTP_BADCMD)" Unknown command\r\n");
diff --git a/networking/ftpgetput.c b/networking/ftpgetput.c
index 0bfe388a8..0b06f85b4 100644
--- a/networking/ftpgetput.c
+++ b/networking/ftpgetput.c
@@ -12,6 +12,30 @@
12 * 12 *
13 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 13 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
14 */ 14 */
15//config:config FTPGET
16//config: bool "ftpget"
17//config: default y
18//config: help
19//config: Retrieve a remote file via FTP.
20//config:
21//config:config FTPPUT
22//config: bool "ftpput"
23//config: default y
24//config: help
25//config: Store a remote file via FTP.
26//config:
27//config:config FEATURE_FTPGETPUT_LONG_OPTIONS
28//config: bool "Enable long options in ftpget/ftpput"
29//config: default y
30//config: depends on LONG_OPTS && (FTPGET || FTPPUT)
31//config: help
32//config: Support long options for the ftpget/ftpput applet.
33
34//applet:IF_FTPGET(APPLET_ODDNAME(ftpget, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpget))
35//applet:IF_FTPPUT(APPLET_ODDNAME(ftpput, ftpgetput, BB_DIR_USR_BIN, BB_SUID_DROP, ftpput))
36
37//kbuild:lib-$(CONFIG_FTPGET) += ftpgetput.o
38//kbuild:lib-$(CONFIG_FTPPUT) += ftpgetput.o
15 39
16//usage:#define ftpget_trivial_usage 40//usage:#define ftpget_trivial_usage
17//usage: "[OPTIONS] HOST [LOCAL_FILE] REMOTE_FILE" 41//usage: "[OPTIONS] HOST [LOCAL_FILE] REMOTE_FILE"
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 @@
10 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 10 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
11 */ 11 */
12 12
13//config:config HOSTNAME
14//config: bool "hostname"
15//config: default y
16//config: help
17//config: Show or set the system's host name.
18//config:
19//config:config DNSDOMAINNAME
20//config: bool "dnsdomainname"
21//config: default y
22//config: help
23//config: Alias to "hostname -d".
24
25//applet:IF_DNSDOMAINNAME(APPLET_ODDNAME(dnsdomainname, hostname, BB_DIR_BIN, BB_SUID_DROP, dnsdomainname))
26//applet:IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP))
27
28//kbuild: lib-$(CONFIG_HOSTNAME) += hostname.o
29//kbuild: lib-$(CONFIG_DNSDOMAINNAME) += hostname.o
30
13//usage:#define hostname_trivial_usage 31//usage:#define hostname_trivial_usage
14//usage: "[OPTIONS] [HOSTNAME | -F FILE]" 32//usage: "[OPTIONS] [HOSTNAME | -F FILE]"
15//usage:#define hostname_full_usage "\n\n" 33//usage:#define hostname_full_usage "\n\n"
@@ -131,8 +149,12 @@ int hostname_main(int argc UNUSED_PARAM, char **argv)
131 opts = getopt32(argv, "dfisF:v", &hostname_str); 149 opts = getopt32(argv, "dfisF:v", &hostname_str);
132 argv += optind; 150 argv += optind;
133 buf = safe_gethostname(); 151 buf = safe_gethostname();
134 if (applet_name[0] == 'd') /* dnsdomainname? */ 152 if (ENABLE_DNSDOMAINNAME) {
135 opts = OPT_d; 153 if (!ENABLE_HOSTNAME || applet_name[0] == 'd') {
154 /* dnsdomainname */
155 opts = OPT_d;
156 }
157 }
136 158
137 if (opts & OPT_dfi) { 159 if (opts & OPT_dfi) {
138 /* Cases when we need full hostname (or its part) */ 160 /* Cases when we need full hostname (or its part) */
diff --git a/networking/httpd.c b/networking/httpd.c
index abe83a458..d301d598d 100644
--- a/networking/httpd.c
+++ b/networking/httpd.c
@@ -98,6 +98,128 @@
98 * 98 *
99 */ 99 */
100 /* TODO: use TCP_CORK, parse_config() */ 100 /* TODO: use TCP_CORK, parse_config() */
101//config:config HTTPD
102//config: bool "httpd"
103//config: default y
104//config: help
105//config: Serve web pages via an HTTP server.
106//config:
107//config:config FEATURE_HTTPD_RANGES
108//config: bool "Support 'Ranges:' header"
109//config: default y
110//config: depends on HTTPD
111//config: help
112//config: Makes httpd emit "Accept-Ranges: bytes" header and understand
113//config: "Range: bytes=NNN-[MMM]" header. Allows for resuming interrupted
114//config: downloads, seeking in multimedia players etc.
115//config:
116//config:config FEATURE_HTTPD_SETUID
117//config: bool "Enable -u <user> option"
118//config: default y
119//config: depends on HTTPD
120//config: help
121//config: This option allows the server to run as a specific user
122//config: rather than defaulting to the user that starts the server.
123//config: Use of this option requires special privileges to change to a
124//config: different user.
125//config:
126//config:config FEATURE_HTTPD_BASIC_AUTH
127//config: bool "Enable Basic http Authentication"
128//config: default y
129//config: depends on HTTPD
130//config: help
131//config: Utilizes password settings from /etc/httpd.conf for basic
132//config: authentication on a per url basis.
133//config: Example for httpd.conf file:
134//config: /adm:toor:PaSsWd
135//config:
136//config:config FEATURE_HTTPD_AUTH_MD5
137//config: bool "Support MD5 crypted passwords for http Authentication"
138//config: default y
139//config: depends on FEATURE_HTTPD_BASIC_AUTH
140//config: help
141//config: Enables encrypted passwords, and wildcard user/passwords
142//config: in httpd.conf file.
143//config: User '*' means 'any system user name is ok',
144//config: password of '*' means 'use system password for this user'
145//config: Examples:
146//config: /adm:toor:$1$P/eKnWXS$aI1aPGxT.dJD5SzqAKWrF0
147//config: /adm:root:*
148//config: /wiki:*:*
149//config:
150//config:config FEATURE_HTTPD_CGI
151//config: bool "Support Common Gateway Interface (CGI)"
152//config: default y
153//config: depends on HTTPD
154//config: help
155//config: This option allows scripts and executables to be invoked
156//config: when specific URLs are requested.
157//config:
158//config:config FEATURE_HTTPD_CONFIG_WITH_SCRIPT_INTERPR
159//config: bool "Support for running scripts through an interpreter"
160//config: default y
161//config: depends on FEATURE_HTTPD_CGI
162//config: help
163//config: This option enables support for running scripts through an
164//config: interpreter. Turn this on if you want PHP scripts to work
165//config: properly. You need to supply an additional line in your
166//config: httpd.conf file:
167//config: *.php:/path/to/your/php
168//config:
169//config:config FEATURE_HTTPD_SET_REMOTE_PORT_TO_ENV
170//config: bool "Set REMOTE_PORT environment variable for CGI"
171//config: default y
172//config: depends on FEATURE_HTTPD_CGI
173//config: help
174//config: Use of this option can assist scripts in generating
175//config: references that contain a unique port number.
176//config:
177//config:config FEATURE_HTTPD_ENCODE_URL_STR
178//config: bool "Enable -e option (useful for CGIs written as shell scripts)"
179//config: default y
180//config: depends on HTTPD
181//config: help
182//config: This option allows html encoding of arbitrary strings for display
183//config: by the browser. Output goes to stdout.
184//config: For example, httpd -e "<Hello World>" produces
185//config: "&#60Hello&#32World&#62".
186//config:
187//config:config FEATURE_HTTPD_ERROR_PAGES
188//config: bool "Support for custom error pages"
189//config: default y
190//config: depends on HTTPD
191//config: help
192//config: This option allows you to define custom error pages in
193//config: the configuration file instead of the default HTTP status
194//config: error pages. For instance, if you add the line:
195//config: E404:/path/e404.html
196//config: in the config file, the server will respond the specified
197//config: '/path/e404.html' file instead of the terse '404 NOT FOUND'
198//config: message.
199//config:
200//config:config FEATURE_HTTPD_PROXY
201//config: bool "Support for reverse proxy"
202//config: default y
203//config: depends on HTTPD
204//config: help
205//config: This option allows you to define URLs that will be forwarded
206//config: to another HTTP server. To setup add the following line to the
207//config: configuration file
208//config: P:/url/:http://hostname[:port]/new/path/
209//config: Then a request to /url/myfile will be forwarded to
210//config: http://hostname[:port]/new/path/myfile.
211//config:
212//config:config FEATURE_HTTPD_GZIP
213//config: bool "Support for GZIP content encoding"
214//config: default y
215//config: depends on HTTPD
216//config: help
217//config: Makes httpd send files using GZIP content encoding if the
218//config: client supports it and a pre-compressed <file>.gz exists.
219
220//applet:IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
221
222//kbuild:lib-$(CONFIG_HTTPD) += httpd.o
101 223
102//usage:#define httpd_trivial_usage 224//usage:#define httpd_trivial_usage
103//usage: "[-ifv[v]]" 225//usage: "[-ifv[v]]"
@@ -926,16 +1048,16 @@ static void log_and_exit(void)
926static void send_headers(int responseNum) 1048static void send_headers(int responseNum)
927{ 1049{
928 static const char RFC1123FMT[] ALIGN1 = "%a, %d %b %Y %H:%M:%S GMT"; 1050 static const char RFC1123FMT[] ALIGN1 = "%a, %d %b %Y %H:%M:%S GMT";
1051 /* Fixed size 29-byte string. Example: Sun, 06 Nov 1994 08:49:37 GMT */
1052 char date_str[40]; /* using a bit larger buffer to paranoia reasons */
929 1053
930 const char *responseString = ""; 1054 const char *responseString = "";
931 const char *infoString = NULL; 1055 const char *infoString = NULL;
932 const char *mime_type;
933#if ENABLE_FEATURE_HTTPD_ERROR_PAGES 1056#if ENABLE_FEATURE_HTTPD_ERROR_PAGES
934 const char *error_page = NULL; 1057 const char *error_page = NULL;
935#endif 1058#endif
936 unsigned i; 1059 unsigned i;
937 time_t timer = time(NULL); 1060 time_t timer = time(NULL);
938 char tmp_str[80];
939 int len; 1061 int len;
940 1062
941 for (i = 0; i < ARRAY_SIZE(http_response_type); i++) { 1063 for (i = 0; i < ARRAY_SIZE(http_response_type); i++) {
@@ -948,25 +1070,33 @@ static void send_headers(int responseNum)
948 break; 1070 break;
949 } 1071 }
950 } 1072 }
951 /* error message is HTML */
952 mime_type = responseNum == HTTP_OK ?
953 found_mime_type : "text/html";
954 1073
955 if (verbose) 1074 if (verbose)
956 bb_error_msg("response:%u", responseNum); 1075 bb_error_msg("response:%u", responseNum);
957 1076
958 /* emit the current date */ 1077 /* We use sprintf, not snprintf (it's less code).
959 strftime(tmp_str, sizeof(tmp_str), RFC1123FMT, gmtime(&timer)); 1078 * iobuf[] is several kbytes long and all headers we generate
1079 * always fit into those kbytes.
1080 */
1081
1082 strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime(&timer));
960 len = sprintf(iobuf, 1083 len = sprintf(iobuf,
961 "HTTP/1.0 %d %s\r\nContent-type: %s\r\n" 1084 "HTTP/1.0 %d %s\r\n"
962 "Date: %s\r\nConnection: close\r\n", 1085 "Content-type: %s\r\n"
963 responseNum, responseString, mime_type, tmp_str); 1086 "Date: %s\r\n"
1087 "Connection: close\r\n",
1088 responseNum, responseString,
1089 /* if it's error message, then it's HTML */
1090 (responseNum == HTTP_OK ? found_mime_type : "text/html"),
1091 date_str
1092 );
964 1093
965#if ENABLE_FEATURE_HTTPD_BASIC_AUTH 1094#if ENABLE_FEATURE_HTTPD_BASIC_AUTH
966 if (responseNum == HTTP_UNAUTHORIZED) { 1095 if (responseNum == HTTP_UNAUTHORIZED) {
967 len += sprintf(iobuf + len, 1096 len += sprintf(iobuf + len,
968 "WWW-Authenticate: Basic realm=\"%s\"\r\n", 1097 "WWW-Authenticate: Basic realm=\"%.999s\"\r\n",
969 g_realm); 1098 g_realm /* %.999s protects from overflowing iobuf[] */
1099 );
970 } 1100 }
971#endif 1101#endif
972 if (responseNum == HTTP_MOVED_TEMPORARILY) { 1102 if (responseNum == HTTP_MOVED_TEMPORARILY) {
@@ -981,7 +1111,8 @@ static void send_headers(int responseNum)
981 "Location: %s/%s%s\r\n", 1111 "Location: %s/%s%s\r\n",
982 found_moved_temporarily, 1112 found_moved_temporarily,
983 (g_query ? "?" : ""), 1113 (g_query ? "?" : ""),
984 (g_query ? g_query : "")); 1114 (g_query ? g_query : "")
1115 );
985 if (len > IOBUF_SIZE-3) 1116 if (len > IOBUF_SIZE-3)
986 len = IOBUF_SIZE-3; 1117 len = IOBUF_SIZE-3;
987 } 1118 }
@@ -1002,13 +1133,15 @@ static void send_headers(int responseNum)
1002#endif 1133#endif
1003 1134
1004 if (file_size != -1) { /* file */ 1135 if (file_size != -1) { /* file */
1005 strftime(tmp_str, sizeof(tmp_str), RFC1123FMT, gmtime(&last_mod)); 1136 strftime(date_str, sizeof(date_str), RFC1123FMT, gmtime(&last_mod));
1006#if ENABLE_FEATURE_HTTPD_RANGES 1137#if ENABLE_FEATURE_HTTPD_RANGES
1007 if (responseNum == HTTP_PARTIAL_CONTENT) { 1138 if (responseNum == HTTP_PARTIAL_CONTENT) {
1008 len += sprintf(iobuf + len, "Content-Range: bytes %"OFF_FMT"u-%"OFF_FMT"u/%"OFF_FMT"u\r\n", 1139 len += sprintf(iobuf + len,
1140 "Content-Range: bytes %"OFF_FMT"u-%"OFF_FMT"u/%"OFF_FMT"u\r\n",
1009 range_start, 1141 range_start,
1010 range_end, 1142 range_end,
1011 file_size); 1143 file_size
1144 );
1012 file_size = range_end - range_start + 1; 1145 file_size = range_end - range_start + 1;
1013 } 1146 }
1014#endif 1147#endif
@@ -1016,8 +1149,9 @@ static void send_headers(int responseNum)
1016#if ENABLE_FEATURE_HTTPD_RANGES 1149#if ENABLE_FEATURE_HTTPD_RANGES
1017 "Accept-Ranges: bytes\r\n" 1150 "Accept-Ranges: bytes\r\n"
1018#endif 1151#endif
1019 "Last-Modified: %s\r\n%s %"OFF_FMT"u\r\n", 1152 "Last-Modified: %s\r\n"
1020 tmp_str, 1153 "%s %"OFF_FMT"u\r\n",
1154 date_str,
1021 content_gzip ? "Transfer-length:" : "Content-length:", 1155 content_gzip ? "Transfer-length:" : "Content-length:",
1022 file_size 1156 file_size
1023 ); 1157 );
@@ -1031,9 +1165,13 @@ static void send_headers(int responseNum)
1031 if (infoString) { 1165 if (infoString) {
1032 len += sprintf(iobuf + len, 1166 len += sprintf(iobuf + len,
1033 "<HTML><HEAD><TITLE>%d %s</TITLE></HEAD>\n" 1167 "<HTML><HEAD><TITLE>%d %s</TITLE></HEAD>\n"
1034 "<BODY><H1>%d %s</H1>\n%s\n</BODY></HTML>\n", 1168 "<BODY><H1>%d %s</H1>\n"
1169 "%s\n"
1170 "</BODY></HTML>\n",
1035 responseNum, responseString, 1171 responseNum, responseString,
1036 responseNum, responseString, infoString); 1172 responseNum, responseString,
1173 infoString
1174 );
1037 } 1175 }
1038 if (DEBUG) { 1176 if (DEBUG) {
1039 iobuf[len] = '\0'; 1177 iobuf[len] = '\0';
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 @@
25 * 2002-04-20 25 * 2002-04-20
26 * IPV6 support added by Bart Visscher <magick@linux-fan.com> 26 * IPV6 support added by Bart Visscher <magick@linux-fan.com>
27 */ 27 */
28//config:config IFCONFIG
29//config: bool "ifconfig"
30//config: default y
31//config: select PLATFORM_LINUX
32//config: help
33//config: Ifconfig is used to configure the kernel-resident network interfaces.
34//config:
35//config:config FEATURE_IFCONFIG_STATUS
36//config: bool "Enable status reporting output (+7k)"
37//config: default y
38//config: depends on IFCONFIG
39//config: help
40//config: If ifconfig is called with no arguments it will display the status
41//config: of the currently active interfaces.
42//config:
43//config:config FEATURE_IFCONFIG_SLIP
44//config: bool "Enable slip-specific options \"keepalive\" and \"outfill\""
45//config: default y
46//config: depends on IFCONFIG
47//config: help
48//config: Allow "keepalive" and "outfill" support for SLIP. If you're not
49//config: planning on using serial lines, leave this unchecked.
50//config:
51//config:config FEATURE_IFCONFIG_MEMSTART_IOADDR_IRQ
52//config: bool "Enable options \"mem_start\", \"io_addr\", and \"irq\""
53//config: default y
54//config: depends on IFCONFIG
55//config: help
56//config: Allow the start address for shared memory, start address for I/O,
57//config: and/or the interrupt line used by the specified device.
58//config:
59//config:config FEATURE_IFCONFIG_HW
60//config: bool "Enable option \"hw\" (ether only)"
61//config: default y
62//config: depends on IFCONFIG
63//config: help
64//config: Set the hardware address of this interface, if the device driver
65//config: supports this operation. Currently, we only support the 'ether'
66//config: class.
67//config:
68//config:config FEATURE_IFCONFIG_BROADCAST_PLUS
69//config: bool "Set the broadcast automatically"
70//config: default y
71//config: depends on IFCONFIG
72//config: help
73//config: Setting this will make ifconfig attempt to find the broadcast
74//config: automatically if the value '+' is used.
75
76//applet:IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP))
77
78//kbuild:lib-$(CONFIG_IFCONFIG) += ifconfig.o interface.o
28 79
29//usage:#define ifconfig_trivial_usage 80//usage:#define ifconfig_trivial_usage
30//usage: IF_FEATURE_IFCONFIG_STATUS("[-a]") " interface [address]" 81//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 @@
97 * - Code cleanup and style changes 97 * - Code cleanup and style changes
98 * set version to 1.1.0 98 * set version to 1.1.0
99 */ 99 */
100//config:config IFENSLAVE
101//config: bool "ifenslave"
102//config: default y
103//config: select PLATFORM_LINUX
104//config: help
105//config: Userspace application to bind several interfaces
106//config: to a logical interface (use with kernel bonding driver).
107
108//applet:IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP))
109
110//kbuild:lib-$(CONFIG_IFENSLAVE) += ifenslave.o interface.o
100 111
101//usage:#define ifenslave_trivial_usage 112//usage:#define ifenslave_trivial_usage
102//usage: "[-cdf] MASTER_IFACE SLAVE_IFACE..." 113//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config IFPLUGD
10//config: bool "ifplugd"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: Network interface plug detection daemon.
15
16//applet:IF_IFPLUGD(APPLET(ifplugd, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_IFPLUGD) += ifplugd.o
9 19
10//usage:#define ifplugd_trivial_usage 20//usage:#define ifplugd_trivial_usage
11//usage: "[OPTIONS]" 21//usage: "[OPTIONS]"
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 @@
1/* vi: set sw=4 ts=4: */ 1/* vi: set sw=4 ts=4: */
2/* 2/*
3 * ifupdown for busybox 3 * ifup/ifdown for busybox
4 * Copyright (c) 2002 Glenn McGrath 4 * Copyright (c) 2002 Glenn McGrath
5 * Copyright (c) 2003-2004 Erik Andersen <andersen@codepoet.org> 5 * Copyright (c) 2003-2004 Erik Andersen <andersen@codepoet.org>
6 * 6 *
@@ -17,10 +17,127 @@
17 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 17 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
18 */ 18 */
19 19
20//config:config IFUP
21//config: bool "ifup"
22//config: default y
23//config: help
24//config: Activate the specified interfaces. This applet makes use
25//config: of either "ifconfig" and "route" or the "ip" command to actually
26//config: configure network interfaces. Therefore, you will probably also want
27//config: to enable either IFCONFIG and ROUTE, or enable
28//config: FEATURE_IFUPDOWN_IP and the various IP options. Of
29//config: course you could use non-busybox versions of these programs, so
30//config: against my better judgement (since this will surely result in plenty
31//config: of support questions on the mailing list), I do not force you to
32//config: enable these additional options. It is up to you to supply either
33//config: "ifconfig", "route" and "run-parts" or the "ip" command, either
34//config: via busybox or via standalone utilities.
35//config:
36//config:config IFDOWN
37//config: bool "ifdown"
38//config: default y
39//config: help
40//config: Deactivate the specified interfaces.
41//config:
42//config:config IFUPDOWN_IFSTATE_PATH
43//config: string "Absolute path to ifstate file"
44//config: default "/var/run/ifstate"
45//config: depends on IFUP || IFDOWN
46//config: help
47//config: ifupdown keeps state information in a file called ifstate.
48//config: Typically it is located in /var/run/ifstate, however
49//config: some distributions tend to put it in other places
50//config: (debian, for example, uses /etc/network/run/ifstate).
51//config: This config option defines location of ifstate.
52//config:
53//config:config FEATURE_IFUPDOWN_IP
54//config: bool "Use ip applet"
55//config: default y
56//config: depends on IFUP || IFDOWN
57//config: help
58//config: Use the iproute "ip" command to implement "ifup" and "ifdown", rather
59//config: than the default of using the older 'ifconfig' and 'route' utilities.
60//config:
61//config:config FEATURE_IFUPDOWN_IP_BUILTIN
62//config: bool "Use busybox ip applet"
63//config: default y
64//config: depends on FEATURE_IFUPDOWN_IP
65//config: select PLATFORM_LINUX
66//config: select IP
67//config: select FEATURE_IP_ADDRESS
68//config: select FEATURE_IP_LINK
69//config: select FEATURE_IP_ROUTE
70//config: help
71//config: Use the busybox iproute "ip" applet to implement "ifupdown".
72//config:
73//config: If left disabled, you must install the full-blown iproute2
74//config: utility or the "ifup" and "ifdown" applets will not work.
75//config:
76//config:config FEATURE_IFUPDOWN_IFCONFIG_BUILTIN
77//config: bool "Use busybox ifconfig and route applets"
78//config: default n
79//config: depends on (IFUP || IFDOWN) && !FEATURE_IFUPDOWN_IP
80//config: select IFCONFIG
81//config: select ROUTE
82//config: help
83//config: Use the busybox iproute "ifconfig" and "route" applets to
84//config: implement the "ifup" and "ifdown" utilities.
85//config:
86//config: If left disabled, you must install the full-blown ifconfig
87//config: and route utilities, or the "ifup" and "ifdown" applets will not
88//config: work.
89//config:
90//config:config FEATURE_IFUPDOWN_IPV4
91//config: bool "Support for IPv4"
92//config: default y
93//config: depends on IFUP || IFDOWN
94//config: help
95//config: If you want ifup/ifdown to talk IPv4, leave this on.
96//config:
97//config:config FEATURE_IFUPDOWN_IPV6
98//config: bool "Support for IPv6"
99//config: default y
100//config: depends on (IFUP || IFDOWN) && FEATURE_IPV6
101//config: help
102//config: If you need support for IPv6, turn this option on.
103//config:
104//UNUSED:
105////////:config FEATURE_IFUPDOWN_IPX
106////////: bool "Support for IPX"
107////////: default y
108////////: depends on IFUP || IFDOWN
109////////: help
110////////: If this option is selected you can use busybox to work with IPX
111////////: networks.
112//config:
113//config:config FEATURE_IFUPDOWN_MAPPING
114//config: bool "Enable mapping support"
115//config: default y
116//config: depends on IFUP || IFDOWN
117//config: help
118//config: This enables support for the "mapping" stanza, unless you have
119//config: a weird network setup you don't need it.
120//config:
121//config:config FEATURE_IFUPDOWN_EXTERNAL_DHCP
122//config: bool "Support for external dhcp clients"
123//config: default n
124//config: depends on IFUP || IFDOWN
125//config: help
126//config: This enables support for the external dhcp clients. Clients are
127//config: tried in the following order: dhcpcd, dhclient, pump and udhcpc.
128//config: Otherwise, if udhcpc applet is enabled, it is used.
129//config: Otherwise, ifup/ifdown will have no support for DHCP.
130
131//applet:IF_IFUP(APPLET_ODDNAME(ifup, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifup))
132//applet:IF_IFDOWN(APPLET_ODDNAME(ifdown, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifdown))
133
134//kbuild:lib-$(CONFIG_IFUP) += ifupdown.o
135//kbuild:lib-$(CONFIG_IFDOWN) += ifupdown.o
136
20//usage:#define ifup_trivial_usage 137//usage:#define ifup_trivial_usage
21//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." 138//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..."
22//usage:#define ifup_full_usage "\n\n" 139//usage:#define ifup_full_usage "\n\n"
23//usage: " -a De/configure all interfaces automatically" 140//usage: " -a Configure all interfaces"
24//usage: "\n -i FILE Use FILE instead of /etc/network/interfaces" 141//usage: "\n -i FILE Use FILE instead of /etc/network/interfaces"
25//usage: "\n -n Print out what would happen, but don't do it" 142//usage: "\n -n Print out what would happen, but don't do it"
26//usage: IF_FEATURE_IFUPDOWN_MAPPING( 143//usage: IF_FEATURE_IFUPDOWN_MAPPING(
@@ -28,12 +145,12 @@
28//usage: "\n -m Don't run any mappings" 145//usage: "\n -m Don't run any mappings"
29//usage: ) 146//usage: )
30//usage: "\n -v Print out what would happen before doing it" 147//usage: "\n -v Print out what would happen before doing it"
31//usage: "\n -f Force de/configuration" 148//usage: "\n -f Force configuration"
32//usage: 149//usage:
33//usage:#define ifdown_trivial_usage 150//usage:#define ifdown_trivial_usage
34//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..." 151//usage: "[-an"IF_FEATURE_IFUPDOWN_MAPPING("m")"vf] [-i FILE] IFACE..."
35//usage:#define ifdown_full_usage "\n\n" 152//usage:#define ifdown_full_usage "\n\n"
36//usage: " -a De/configure all interfaces automatically" 153//usage: " -a Deconfigure all interfaces"
37//usage: "\n -i FILE Use FILE for interface definitions" 154//usage: "\n -i FILE Use FILE for interface definitions"
38//usage: "\n -n Print out what would happen, but don't do it" 155//usage: "\n -n Print out what would happen, but don't do it"
39//usage: IF_FEATURE_IFUPDOWN_MAPPING( 156//usage: IF_FEATURE_IFUPDOWN_MAPPING(
@@ -41,7 +158,7 @@
41//usage: "\n -m Don't run any mappings" 158//usage: "\n -m Don't run any mappings"
42//usage: ) 159//usage: )
43//usage: "\n -v Print out what would happen before doing it" 160//usage: "\n -v Print out what would happen before doing it"
44//usage: "\n -f Force de/configuration" 161//usage: "\n -f Force deconfiguration"
45 162
46#include "libbb.h" 163#include "libbb.h"
47#include "common_bufsiz.h" 164#include "common_bufsiz.h"
@@ -1248,7 +1365,6 @@ static FILE *open_new_state_file(void)
1248 return xfdopen_for_write(fd); 1365 return xfdopen_for_write(fd);
1249} 1366}
1250 1367
1251
1252int ifupdown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 1368int ifupdown_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1253int ifupdown_main(int argc UNUSED_PARAM, char **argv) 1369int ifupdown_main(int argc UNUSED_PARAM, char **argv)
1254{ 1370{
@@ -1263,10 +1379,13 @@ int ifupdown_main(int argc UNUSED_PARAM, char **argv)
1263 G.startup_PATH = getenv("PATH"); 1379 G.startup_PATH = getenv("PATH");
1264 G.shell = xstrdup(get_shell_name()); 1380 G.shell = xstrdup(get_shell_name());
1265 1381
1266 cmds = iface_down; 1382 if (ENABLE_IFUP
1267 if (applet_name[2] == 'u') { 1383 && (!ENABLE_IFDOWN || applet_name[2] == 'u')
1384 ) {
1268 /* ifup command */ 1385 /* ifup command */
1269 cmds = iface_up; 1386 cmds = iface_up;
1387 } else {
1388 cmds = iface_down;
1270 } 1389 }
1271 1390
1272 getopt32(argv, OPTION_STR, &interfaces); 1391 getopt32(argv, OPTION_STR, &interfaces);
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 @@
153 * setgid(specified group) 153 * setgid(specified group)
154 * setuid() 154 * setuid()
155 */ 155 */
156//config:config INETD
157//config: bool "inetd"
158//config: default y
159//config: select FEATURE_SYSLOG
160//config: help
161//config: Internet superserver daemon
162//config:
163//config:config FEATURE_INETD_SUPPORT_BUILTIN_ECHO
164//config: bool "Support echo service"
165//config: default y
166//config: depends on INETD
167//config: help
168//config: Echo received data internal inetd service
169//config:
170//config:config FEATURE_INETD_SUPPORT_BUILTIN_DISCARD
171//config: bool "Support discard service"
172//config: default y
173//config: depends on INETD
174//config: help
175//config: Internet /dev/null internal inetd service
176//config:
177//config:config FEATURE_INETD_SUPPORT_BUILTIN_TIME
178//config: bool "Support time service"
179//config: default y
180//config: depends on INETD
181//config: help
182//config: Return 32 bit time since 1900 internal inetd service
183//config:
184//config:config FEATURE_INETD_SUPPORT_BUILTIN_DAYTIME
185//config: bool "Support daytime service"
186//config: default y
187//config: depends on INETD
188//config: help
189//config: Return human-readable time internal inetd service
190//config:
191//config:config FEATURE_INETD_SUPPORT_BUILTIN_CHARGEN
192//config: bool "Support chargen service"
193//config: default y
194//config: depends on INETD
195//config: help
196//config: Familiar character generator internal inetd service
197//config:
198//config:config FEATURE_INETD_RPC
199//config: bool "Support RPC services"
200//config: default n # very rarely used, and needs Sun RPC support in libc
201//config: depends on INETD
202//config: select FEATURE_HAVE_RPC
203//config: help
204//config: Support Sun-RPC based services
205
206//applet:IF_INETD(APPLET(inetd, BB_DIR_USR_SBIN, BB_SUID_DROP))
207
208//kbuild:lib-$(CONFIG_INETD) += inetd.o
156 209
157//usage:#define inetd_trivial_usage 210//usage:#define inetd_trivial_usage
158//usage: "[-fe] [-q N] [-R N] [CONFFILE]" 211//usage: "[-fe] [-q N] [-R N] [CONFFILE]"
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)
264 264
265 afp = aftypes; 265 afp = aftypes;
266 while (*afp != NULL) { 266 while (*afp != NULL) {
267 if (!strcmp((*afp)->name, name)) 267 if (strcmp((*afp)->name, name) == 0)
268 return (*afp); 268 return (*afp);
269 afp++; 269 afp++;
270 } 270 }
@@ -572,7 +572,7 @@ static int if_readlist_proc(char *target)
572 ife = add_interface(name); 572 ife = add_interface(name);
573 get_dev_fields(s, ife, procnetdev_vsn); 573 get_dev_fields(s, ife, procnetdev_vsn);
574 ife->statistics_valid = 1; 574 ife->statistics_valid = 1;
575 if (target && !strcmp(target, name)) 575 if (target && strcmp(target, name) == 0)
576 break; 576 break;
577 } 577 }
578 if (ferror(fh)) { 578 if (ferror(fh)) {
@@ -781,7 +781,7 @@ const struct hwtype* FAST_FUNC get_hwtype(const char *name)
781 781
782 hwp = hwtypes; 782 hwp = hwtypes;
783 while (*hwp != NULL) { 783 while (*hwp != NULL) {
784 if (!strcmp((*hwp)->name, name)) 784 if (strcmp((*hwp)->name, name) == 0)
785 return (*hwp); 785 return (*hwp);
786 hwp++; 786 hwp++;
787 } 787 }
@@ -877,7 +877,7 @@ static void ife_print6(struct interface *ptr)
877 addr6p[5], addr6p[6], addr6p[7], &if_idx, &plen, &scope, 877 addr6p[5], addr6p[6], addr6p[7], &if_idx, &plen, &scope,
878 &dad_status, devname) != EOF 878 &dad_status, devname) != EOF
879 ) { 879 ) {
880 if (!strcmp(devname, ptr->name)) { 880 if (strcmp(devname, ptr->name) == 0) {
881 sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s", 881 sprintf(addr6, "%s:%s:%s:%s:%s:%s:%s:%s",
882 addr6p[0], addr6p[1], addr6p[2], addr6p[3], 882 addr6p[0], addr6p[1], addr6p[2], addr6p[3],
883 addr6p[4], addr6p[5], addr6p[6], addr6p[7]); 883 addr6p[4], addr6p[5], addr6p[6], addr6p[7]);
diff --git a/networking/ip.c b/networking/ip.c
index ddfe74e9c..c3607b74f 100644
--- a/networking/ip.c
+++ b/networking/ip.c
@@ -8,6 +8,131 @@
8 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses 8 * Rani Assaf <rani@magic.metawire.com> 980929: resolve addresses
9 * Bernhard Reutner-Fischer rewrote to use index_in_substr_array 9 * Bernhard Reutner-Fischer rewrote to use index_in_substr_array
10 */ 10 */
11//config:config IP
12//config: bool "ip"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: The "ip" applet is a TCP/IP interface configuration and routing
17//config: utility. You generally don't need "ip" to use busybox with
18//config: TCP/IP.
19//config:
20//config:config FEATURE_IP_ADDRESS
21//config: bool "ip address"
22//config: default y
23//config: depends on IP
24//config: help
25//config: Address manipulation support for the "ip" applet.
26//config:
27//config:config FEATURE_IP_LINK
28//config: bool "ip link"
29//config: default y
30//config: depends on IP
31//config: help
32//config: Configure network devices with "ip".
33//config:
34//config:config FEATURE_IP_ROUTE
35//config: bool "ip route"
36//config: default y
37//config: depends on IP
38//config: help
39//config: Add support for routing table management to "ip".
40//config:
41//config:config FEATURE_IP_ROUTE_DIR
42//config: string "ip route configuration directory"
43//config: default "/etc/iproute2"
44//config: depends on FEATURE_IP_ROUTE
45//config: help
46//config: Location of the "ip" applet routing configuration.
47//config:
48//config:config FEATURE_IP_TUNNEL
49//config: bool "ip tunnel"
50//config: default y
51//config: depends on IP
52//config: help
53//config: Add support for tunneling commands to "ip".
54//config:
55//config:config FEATURE_IP_RULE
56//config: bool "ip rule"
57//config: default y
58//config: depends on IP
59//config: help
60//config: Add support for rule commands to "ip".
61//config:
62//config:config FEATURE_IP_NEIGH
63//config: bool "ip neighbor"
64//config: default y
65//config: depends on IP
66//config: help
67//config: Add support for neighbor commands to "ip".
68//config:
69//config:config FEATURE_IP_SHORT_FORMS
70//config: bool "Support short forms of ip commands"
71//config: default y
72//config: depends on IP
73//config: help
74//config: Also support short-form of ip <OBJECT> commands:
75//config: ip addr -> ipaddr
76//config: ip link -> iplink
77//config: ip route -> iproute
78//config: ip tunnel -> iptunnel
79//config: ip rule -> iprule
80//config: ip neigh -> ipneigh
81//config:
82//config: Say N unless you desparately need the short form of the ip
83//config: object commands.
84//config:
85//config:config FEATURE_IP_RARE_PROTOCOLS
86//config: bool "Support displaying rarely used link types"
87//config: default n
88//config: depends on IP
89//config: help
90//config: If you are not going to use links of type "frad", "econet",
91//config: "bif" etc, you probably don't need to enable this.
92//config: Ethernet, wireless, infrared, ppp/slip, ip tunnelling
93//config: link types are supported without this option selected.
94//config:
95//config:config IPADDR
96//config: bool
97//config: default y
98//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ADDRESS
99//config:
100//config:config IPLINK
101//config: bool
102//config: default y
103//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_LINK
104//config:
105//config:config IPROUTE
106//config: bool
107//config: default y
108//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_ROUTE
109//config:
110//config:config IPTUNNEL
111//config: bool
112//config: default y
113//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_TUNNEL
114//config:
115//config:config IPRULE
116//config: bool
117//config: default y
118//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_RULE
119//config:
120//config:config IPNEIGH
121//config: bool
122//config: default y
123//config: depends on FEATURE_IP_SHORT_FORMS && FEATURE_IP_NEIGH
124
125//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
126//applet:IF_IP(APPLET(ip, BB_DIR_SBIN, BB_SUID_DROP))
127//applet:#endif
128//applet:IF_IPADDR(APPLET(ipaddr, BB_DIR_SBIN, BB_SUID_DROP))
129//applet:IF_IPLINK(APPLET(iplink, BB_DIR_SBIN, BB_SUID_DROP))
130//applet:IF_IPROUTE(APPLET(iproute, BB_DIR_SBIN, BB_SUID_DROP))
131//applet:IF_IPRULE(APPLET(iprule, BB_DIR_SBIN, BB_SUID_DROP))
132//applet:IF_IPTUNNEL(APPLET(iptunnel, BB_DIR_SBIN, BB_SUID_DROP))
133//applet:IF_IPNEIGH(APPLET(ipneigh, BB_DIR_SBIN, BB_SUID_DROP))
134
135//kbuild:lib-$(CONFIG_IP) += ip.o
11 136
12/* would need to make the " | " optional depending on more than one selected: */ 137/* would need to make the " | " optional depending on more than one selected: */
13//usage:#define ip_trivial_usage 138//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 @@
11 * 11 *
12 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 12 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
13 */ 13 */
14//config:config IPCALC
15//config: bool "ipcalc"
16//config: default y
17//config: help
18//config: ipcalc takes an IP address and netmask and calculates the
19//config: resulting broadcast, network, and host range.
20//config:
21//config:config FEATURE_IPCALC_FANCY
22//config: bool "Fancy IPCALC, more options, adds 1 kbyte"
23//config: default y
24//config: depends on IPCALC
25//config: help
26//config: Adds the options hostname, prefix and silent to the output of
27//config: "ipcalc".
28//config:
29//config:config FEATURE_IPCALC_LONG_OPTIONS
30//config: bool "Enable long options"
31//config: default y
32//config: depends on IPCALC && LONG_OPTS
33//config: help
34//config: Support long options for the ipcalc applet.
35
36//applet:IF_IPCALC(APPLET(ipcalc, BB_DIR_BIN, BB_SUID_DROP))
37
38//kbuild:lib-$(CONFIG_IPCALC) += ipcalc.o
14 39
15//usage:#define ipcalc_trivial_usage 40//usage:#define ipcalc_trivial_usage
16//usage: "[OPTIONS] ADDRESS" 41//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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config FAKEIDENTD
10//config: bool "fakeidentd"
11//config: default y
12//config: select FEATURE_SYSLOG
13//config: help
14//config: fakeidentd listens on the ident port and returns a predefined
15//config: fake value on any query.
16
17//applet:IF_FAKEIDENTD(APPLET(fakeidentd, BB_DIR_USR_SBIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_FAKEIDENTD) += isrv_identd.o isrv.o
9 20
10//usage:#define fakeidentd_trivial_usage 21//usage:#define fakeidentd_trivial_usage
11//usage: "[-fiw] [-b ADDR] [STRING]" 22//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 @@
40//config: new_interface_name mac=00:80:C8:38:91:B5 40//config: new_interface_name mac=00:80:C8:38:91:B5
41//config: new_interface_name 00:80:C8:38:91:B5 41//config: new_interface_name 00:80:C8:38:91:B5
42 42
43//applet:IF_NAMEIF(APPLET(nameif, BB_DIR_SBIN, BB_SUID_DROP))
44
45//kbuild:lib-$(CONFIG_NAMEIF) += nameif.o
46
43//usage:#define nameif_trivial_usage 47//usage:#define nameif_trivial_usage
44//usage: IF_NOT_FEATURE_NAMEIF_EXTENDED( 48//usage: IF_NOT_FEATURE_NAMEIF_EXTENDED(
45//usage: "[-s] [-c FILE] [IFNAME HWADDR]..." 49//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10#include "libbb.h"
11#include "common_bufsiz.h"
12
13//config:config NC 9//config:config NC
14//config: bool "nc" 10//config: bool "nc"
15//config: default y 11//config: default y
@@ -43,6 +39,12 @@
43//config: -s ADDR, -n, -u, -v, -o FILE, -z options, but loses 39//config: -s ADDR, -n, -u, -v, -o FILE, -z options, but loses
44//config: busybox-specific extensions: -f FILE. 40//config: busybox-specific extensions: -f FILE.
45 41
42//applet:IF_NC(APPLET(nc, BB_DIR_USR_BIN, BB_SUID_DROP))
43
44//kbuild:lib-$(CONFIG_NC) += nc.o
45
46#include "libbb.h"
47#include "common_bufsiz.h"
46#if ENABLE_NC_110_COMPAT 48#if ENABLE_NC_110_COMPAT
47# include "nc_bloaty.c" 49# include "nc_bloaty.c"
48#else 50#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 @@
13 * 13 *
14 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 14 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
15 */ 15 */
16//config:config NETSTAT
17//config: bool "netstat"
18//config: default y
19//config: select PLATFORM_LINUX
20//config: help
21//config: netstat prints information about the Linux networking subsystem.
22//config:
23//config:config FEATURE_NETSTAT_WIDE
24//config: bool "Enable wide netstat output"
25//config: default y
26//config: depends on NETSTAT
27//config: help
28//config: Add support for wide columns. Useful when displaying IPv6 addresses
29//config: (-W option).
30//config:
31//config:config FEATURE_NETSTAT_PRG
32//config: bool "Enable PID/Program name output"
33//config: default y
34//config: depends on NETSTAT
35//config: help
36//config: Add support for -p flag to print out PID and program name.
37//config: +700 bytes of code.
38
39//applet:IF_NETSTAT(APPLET(netstat, BB_DIR_BIN, BB_SUID_DROP))
40
41//kbuild:lib-$(CONFIG_NETSTAT) += netstat.o
16 42
17#include "libbb.h" 43#include "libbb.h"
18#include "inet_common.h" 44#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 @@
10 * 10 *
11 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 11 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
12 */ 12 */
13//config:config NSLOOKUP
14//config: bool "nslookup"
15//config: default y
16//config: help
17//config: nslookup is a tool to query Internet name servers.
18
19//applet:IF_NSLOOKUP(APPLET(nslookup, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_NSLOOKUP) += nslookup.o
13 22
14//usage:#define nslookup_trivial_usage 23//usage:#define nslookup_trivial_usage
15//usage: "[HOST] [SERVER]" 24//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 @@
40 * purpose. It is provided "as is" without express or implied warranty. 40 * purpose. It is provided "as is" without express or implied warranty.
41 *********************************************************************** 41 ***********************************************************************
42 */ 42 */
43//config:config NTPD
44//config: bool "ntpd"
45//config: default y
46//config: select PLATFORM_LINUX
47//config: help
48//config: The NTP client/server daemon.
49//config:
50//config:config FEATURE_NTPD_SERVER
51//config: bool "Make ntpd usable as a NTP server"
52//config: default y
53//config: depends on NTPD
54//config: help
55//config: Make ntpd usable as a NTP server. If you disable this option
56//config: ntpd will be usable only as a NTP client.
57//config:
58//config:config FEATURE_NTPD_CONF
59//config: bool "Make ntpd understand /etc/ntp.conf"
60//config: default y
61//config: depends on NTPD
62//config: help
63//config: Make ntpd look in /etc/ntp.conf for peers. Only "server address"
64//config: is supported.
65
66//applet:IF_NTPD(APPLET(ntpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
67
68//kbuild:lib-$(CONFIG_NTPD) += ntpd.o
43 69
44//usage:#define ntpd_trivial_usage 70//usage:#define ntpd_trivial_usage
45//usage: "[-dnqNw"IF_FEATURE_NTPD_SERVER("l -I IFACE")"] [-S PROG] [-p PEER]..." 71//usage: "[-dnqNw"IF_FEATURE_NTPD_SERVER("l -I IFACE")"] [-S PROG] [-p PEER]..."
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 @@
57//config:config PING6 57//config:config PING6
58//config: bool "ping6" 58//config: bool "ping6"
59//config: default y 59//config: default y
60//config: depends on FEATURE_IPV6 && PING 60//config: depends on FEATURE_IPV6
61//config: help 61//config: help
62//config: This will give you a ping that can talk IPv6. 62//config: This will give you a ping that can talk IPv6.
63//config: 63//config:
64//config:config FEATURE_FANCY_PING 64//config:config FEATURE_FANCY_PING
65//config: bool "Enable fancy ping output" 65//config: bool "Enable fancy ping output"
66//config: default y 66//config: default y
67//config: depends on PING 67//config: depends on PING || PING6
68//config: help 68//config: help
69//config: Make the output from the ping applet include statistics, and at the 69//config: Make the output from the ping applet include statistics, and at the
70//config: same time provide full support for ICMP packets. 70//config: same time provide full support for ICMP packets.
@@ -907,15 +907,17 @@ static int common_ping_main(int opt, char **argv)
907#endif /* FEATURE_FANCY_PING */ 907#endif /* FEATURE_FANCY_PING */
908 908
909 909
910#if ENABLE_PING
910int ping_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 911int ping_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
911int ping_main(int argc UNUSED_PARAM, char **argv) 912int ping_main(int argc UNUSED_PARAM, char **argv)
912{ 913{
913#if !ENABLE_FEATURE_FANCY_PING 914# if !ENABLE_FEATURE_FANCY_PING
914 return common_ping_main(AF_UNSPEC, argv); 915 return common_ping_main(AF_UNSPEC, argv);
915#else 916# else
916 return common_ping_main(0, argv); 917 return common_ping_main(0, argv);
917#endif 918# endif
918} 919}
920#endif
919 921
920#if ENABLE_PING6 922#if ENABLE_PING6
921int ping6_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 923int ping6_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
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 @@
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8//config:config PSCAN
9//config: bool "pscan"
10//config: default y
11//config: help
12//config: Simple network port scanner.
13
14//applet:IF_PSCAN(APPLET(pscan, BB_DIR_USR_BIN, BB_SUID_DROP))
15
16//kbuild:lib-$(CONFIG_PSCAN) += pscan.o
8 17
9//usage:#define pscan_trivial_usage 18//usage:#define pscan_trivial_usage
10//usage: "[-cb] [-p MIN_PORT] [-P MAX_PORT] [-t TIMEOUT] [-T MIN_RTT] HOST" 19//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 @@
24 * Rewritten to fix several bugs, add additional error checking, and 24 * Rewritten to fix several bugs, add additional error checking, and
25 * remove ridiculous amounts of bloat. 25 * remove ridiculous amounts of bloat.
26 */ 26 */
27//config:config ROUTE
28//config: bool "route"
29//config: default y
30//config: select PLATFORM_LINUX
31//config: help
32//config: Route displays or manipulates the kernel's IP routing tables.
33
34//applet:IF_ROUTE(APPLET(route, BB_DIR_SBIN, BB_SUID_DROP))
35
36//kbuild:lib-$(CONFIG_ROUTE) += route.o
27 37
28//usage:#define route_trivial_usage 38//usage:#define route_trivial_usage
29//usage: "[{add|del|delete}]" 39//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 @@
12 * 12 *
13 * - The -F options allows disabling of RTS/CTS flow control. 13 * - The -F options allows disabling of RTS/CTS flow control.
14 */ 14 */
15//config:config SLATTACH
16//config: bool "slattach"
17//config: default y
18//config: select PLATFORM_LINUX
19//config: help
20//config: slattach is a small utility to attach network interfaces to serial
21//config: lines.
22
23//applet:IF_SLATTACH(APPLET(slattach, BB_DIR_SBIN, BB_SUID_DROP))
24
25//kbuild:lib-$(CONFIG_SLATTACH) += slattach.o
15 26
16//usage:#define slattach_trivial_usage 27//usage:#define slattach_trivial_usage
17//usage: "[-cehmLF] [-s SPEED] [-p PROTOCOL] DEVICE" 28//usage: "[-cehmLF] [-s SPEED] [-p PROTOCOL] DEVICE"
diff --git a/networking/tc.c b/networking/tc.c
index d0bcbdeaa..25875aa3e 100644
--- a/networking/tc.c
+++ b/networking/tc.c
@@ -7,6 +7,22 @@
7 * Bernhard Reutner-Fischer adjusted for busybox 7 * Bernhard Reutner-Fischer adjusted for busybox
8 */ 8 */
9 9
10/* Was disabled in 2008 by Bernhard, not known why.
11--//config:#config TC
12--//config:# bool "tc"
13--//config:# default y
14--//config:# help
15--//config:# Show / manipulate traffic control settings
16--//config:#
17--//config:#config FEATURE_TC_INGRESS
18--//config:# default y
19--//config:# depends on TC
20--
21--//applet:IF_TC(APPLET(tc, BB_DIR_SBIN, BB_SUID_DROP))
22--
23--//kbuild:lib-$(CONFIG_TC) += tc.o
24*/
25
10//usage:#define tc_trivial_usage 26//usage:#define tc_trivial_usage
11/* //usage: "[OPTIONS] OBJECT CMD [dev STRING]" */ 27/* //usage: "[OPTIONS] OBJECT CMD [dev STRING]" */
12//usage: "OBJECT CMD [dev STRING]" 28//usage: "OBJECT CMD [dev STRING]"
@@ -100,7 +116,7 @@ static int get_qdisc_handle(uint32_t *h, const char *str) {
100 char *p; 116 char *p;
101 117
102 maj = TC_H_UNSPEC; 118 maj = TC_H_UNSPEC;
103 if (!strcmp(str, "none")) 119 if (strcmp(str, "none") == 0)
104 goto ok; 120 goto ok;
105 maj = strtoul(str, &p, 16); 121 maj = strtoul(str, &p, 16);
106 if (p == str) 122 if (p == str)
@@ -119,10 +135,10 @@ static int get_tc_classid(uint32_t *h, const char *str) {
119 char *p; 135 char *p;
120 136
121 maj = TC_H_ROOT; 137 maj = TC_H_ROOT;
122 if (!strcmp(str, "root")) 138 if (strcmp(str, "root") == 0)
123 goto ok; 139 goto ok;
124 maj = TC_H_UNSPEC; 140 maj = TC_H_UNSPEC;
125 if (!strcmp(str, "none")) 141 if (strcmp(str, "none") == 0)
126 goto ok; 142 goto ok;
127 maj = strtoul(str, &p, 16); 143 maj = strtoul(str, &p, 16);
128 if (p == str) { 144 if (p == str) {
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 @@
28 * with wrong source IP... 28 * with wrong source IP...
29 * - don't know how to retrieve ORIGDST for udp. 29 * - don't know how to retrieve ORIGDST for udp.
30 */ 30 */
31//config:config TCPSVD
32//config: bool "tcpsvd"
33//config: default y
34//config: help
35//config: tcpsvd listens on a TCP port and runs a program for each new
36//config: connection.
37//config:
38//config:config UDPSVD
39//config: bool "udpsvd"
40//config: default y
41//config: help
42//config: udpsvd listens on an UDP port and runs a program for each new
43//config: connection.
44
45//applet:IF_TCPSVD(APPLET_ODDNAME(tcpsvd, tcpudpsvd, BB_DIR_USR_BIN, BB_SUID_DROP, tcpsvd))
46//applet:IF_UDPSVD(APPLET_ODDNAME(udpsvd, tcpudpsvd, BB_DIR_USR_BIN, BB_SUID_DROP, udpsvd))
47
48//kbuild:lib-$(CONFIG_TCPSVD) += tcpudp.o tcpudp_perhost.o
49//kbuild:lib-$(CONFIG_UDPSVD) += tcpudp.o tcpudp_perhost.o
31 50
32//usage:#define tcpsvd_trivial_usage 51//usage:#define tcpsvd_trivial_usage
33//usage: "[-hEv] [-c N] [-C N[:MSG]] [-b N] [-u USER] [-l NAME] IP PORT PROG" 52//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 @@
20 * by Fernando Silveira <swrh@gmx.net> 20 * by Fernando Silveira <swrh@gmx.net>
21 * 21 *
22 */ 22 */
23//config:config TELNET
24//config: bool "telnet"
25//config: default y
26//config: help
27//config: Telnet is an interface to the TELNET protocol, but is also commonly
28//config: used to test other simple protocols.
29//config:
30//config:config FEATURE_TELNET_TTYPE
31//config: bool "Pass TERM type to remote host"
32//config: default y
33//config: depends on TELNET
34//config: help
35//config: Setting this option will forward the TERM environment variable to the
36//config: remote host you are connecting to. This is useful to make sure that
37//config: things like ANSI colors and other control sequences behave.
38//config:
39//config:config FEATURE_TELNET_AUTOLOGIN
40//config: bool "Pass USER type to remote host"
41//config: default y
42//config: depends on TELNET
43//config: help
44//config: Setting this option will forward the USER environment variable to the
45//config: remote host you are connecting to. This is useful when you need to
46//config: log into a machine without telling the username (autologin). This
47//config: option enables `-a' and `-l USER' arguments.
48
49//applet:IF_TELNET(APPLET(telnet, BB_DIR_USR_BIN, BB_SUID_DROP))
50
51//kbuild:lib-$(CONFIG_TELNET) += telnet.o
23 52
24//usage:#if ENABLE_FEATURE_TELNET_AUTOLOGIN 53//usage:#if ENABLE_FEATURE_TELNET_AUTOLOGIN
25//usage:#define telnet_trivial_usage 54//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 @@
20 * Vladimir Oleynik <dzo@simtreas.ru> 2001 20 * Vladimir Oleynik <dzo@simtreas.ru> 2001
21 * Set process group corrections, initial busybox port 21 * Set process group corrections, initial busybox port
22 */ 22 */
23//config:config TELNETD
24//config: bool "telnetd"
25//config: default y
26//config: select FEATURE_SYSLOG
27//config: help
28//config: A daemon for the TELNET protocol, allowing you to log onto the host
29//config: running the daemon. Please keep in mind that the TELNET protocol
30//config: sends passwords in plain text. If you can't afford the space for an
31//config: SSH daemon and you trust your network, you may say 'y' here. As a
32//config: more secure alternative, you should seriously consider installing the
33//config: very small Dropbear SSH daemon instead:
34//config: http://matt.ucc.asn.au/dropbear/dropbear.html
35//config:
36//config: Note that for busybox telnetd to work you need several things:
37//config: First of all, your kernel needs:
38//config: CONFIG_UNIX98_PTYS=y
39//config:
40//config: Next, you need a /dev/pts directory on your root filesystem:
41//config:
42//config: $ ls -ld /dev/pts
43//config: drwxr-xr-x 2 root root 0 Sep 23 13:21 /dev/pts/
44//config:
45//config: Next you need the pseudo terminal master multiplexer /dev/ptmx:
46//config:
47//config: $ ls -la /dev/ptmx
48//config: crw-rw-rw- 1 root tty 5, 2 Sep 23 13:55 /dev/ptmx
49//config:
50//config: Any /dev/ttyp[0-9]* files you may have can be removed.
51//config: Next, you need to mount the devpts filesystem on /dev/pts using:
52//config:
53//config: mount -t devpts devpts /dev/pts
54//config:
55//config: You need to be sure that busybox has LOGIN and
56//config: FEATURE_SUID enabled. And finally, you should make
57//config: certain that Busybox has been installed setuid root:
58//config:
59//config: chown root.root /bin/busybox
60//config: chmod 4755 /bin/busybox
61//config:
62//config: with all that done, telnetd _should_ work....
63//config:
64//config:config FEATURE_TELNETD_STANDALONE
65//config: bool "Support standalone telnetd (not inetd only)"
66//config: default y
67//config: depends on TELNETD
68//config: help
69//config: Selecting this will make telnetd able to run standalone.
70//config:
71//config:config FEATURE_TELNETD_INETD_WAIT
72//config: bool "Support -w SEC option (inetd wait mode)"
73//config: default y
74//config: depends on FEATURE_TELNETD_STANDALONE
75//config: help
76//config: This option allows you to run telnetd in "inet wait" mode.
77//config: Example inetd.conf line (note "wait", not usual "nowait"):
78//config:
79//config: telnet stream tcp wait root /bin/telnetd telnetd -w10
80//config:
81//config: In this example, inetd passes _listening_ socket_ as fd 0
82//config: to telnetd when connection appears.
83//config: telnetd will wait for connections until all existing
84//config: connections are closed, and no new connections
85//config: appear during 10 seconds. Then it exits, and inetd continues
86//config: to listen for new connections.
87//config:
88//config: This option is rarely used. "tcp nowait" is much more usual
89//config: way of running tcp services, including telnetd.
90//config: You most probably want to say N here.
91
92//applet:IF_TELNETD(APPLET(telnetd, BB_DIR_USR_SBIN, BB_SUID_DROP))
93
94//kbuild:lib-$(CONFIG_TELNETD) += telnetd.o
23 95
24//usage:#define telnetd_trivial_usage 96//usage:#define telnetd_trivial_usage
25//usage: "[OPTIONS]" 97//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 @@
18 * 18 *
19 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 19 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
20 */ 20 */
21//config:config TFTP
22//config: bool "tftp"
23//config: default y
24//config: help
25//config: This enables the Trivial File Transfer Protocol client program. TFTP
26//config: is usually used for simple, small transfers such as a root image
27//config: for a network-enabled bootloader.
28//config:
29//config:config TFTPD
30//config: bool "tftpd"
31//config: default y
32//config: help
33//config: This enables the Trivial File Transfer Protocol server program.
34//config: It expects that stdin is a datagram socket and a packet
35//config: is already pending on it. It will exit after one transfer.
36//config: In other words: it should be run from inetd in nowait mode,
37//config: or from udpsvd. Example: "udpsvd -E 0 69 tftpd DIR"
38//config:
39//config:comment "Common options for tftp/tftpd"
40//config: depends on TFTP || TFTPD
41//config:
42//config:config FEATURE_TFTP_GET
43//config: bool "Enable 'tftp get' and/or tftpd upload code"
44//config: default y
45//config: depends on TFTP || TFTPD
46//config: help
47//config: Add support for the GET command within the TFTP client. This allows
48//config: a client to retrieve a file from a TFTP server.
49//config: Also enable upload support in tftpd, if tftpd is selected.
50//config:
51//config: Note: this option does _not_ make tftpd capable of download
52//config: (the usual operation people need from it)!
53//config:
54//config:config FEATURE_TFTP_PUT
55//config: bool "Enable 'tftp put' and/or tftpd download code"
56//config: default y
57//config: depends on TFTP || TFTPD
58//config: help
59//config: Add support for the PUT command within the TFTP client. This allows
60//config: a client to transfer a file to a TFTP server.
61//config: Also enable download support in tftpd, if tftpd is selected.
62//config:
63//config:config FEATURE_TFTP_BLOCKSIZE
64//config: bool "Enable 'blksize' and 'tsize' protocol options"
65//config: default y
66//config: depends on TFTP || TFTPD
67//config: help
68//config: Allow tftp to specify block size, and tftpd to understand
69//config: "blksize" and "tsize" options.
70//config:
71//config:config FEATURE_TFTP_PROGRESS_BAR
72//config: bool "Enable tftp progress meter"
73//config: default y
74//config: depends on TFTP && FEATURE_TFTP_BLOCKSIZE
75//config: help
76//config: Show progress bar.
77//config:
78//config:config TFTP_DEBUG
79//config: bool "Enable debug"
80//config: default n
81//config: depends on TFTP || TFTPD
82//config: help
83//config: Make tftp[d] print debugging messages on stderr.
84//config: This is useful if you are diagnosing a bug in tftp[d].
85
86//applet:#if ENABLE_FEATURE_TFTP_GET || ENABLE_FEATURE_TFTP_PUT
87//applet:IF_TFTP(APPLET(tftp, BB_DIR_USR_BIN, BB_SUID_DROP))
88//applet:IF_TFTPD(APPLET(tftpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
89//applet:#endif
90
91//kbuild:lib-$(CONFIG_TFTP) += tftp.o
92//kbuild:lib-$(CONFIG_TFTPD) += tftp.o
21 93
22//usage:#define tftp_trivial_usage 94//usage:#define tftp_trivial_usage
23//usage: "[OPTIONS] HOST [PORT]" 95//usage: "[OPTIONS] HOST [PORT]"
diff --git a/networking/traceroute.c b/networking/traceroute.c
index b9a9ca4bb..a463b0faa 100644
--- a/networking/traceroute.c
+++ b/networking/traceroute.c
@@ -209,6 +209,41 @@
209 * -- Van Jacobson (van@ee.lbl.gov) 209 * -- Van Jacobson (van@ee.lbl.gov)
210 * Tue Dec 20 03:50:13 PST 1988 210 * Tue Dec 20 03:50:13 PST 1988
211 */ 211 */
212//config:config TRACEROUTE
213//config: bool "traceroute"
214//config: default y
215//config: select PLATFORM_LINUX
216//config: help
217//config: Utility to trace the route of IP packets.
218//config:
219//config:config TRACEROUTE6
220//config: bool "traceroute6"
221//config: default y
222//config: depends on FEATURE_IPV6
223//config: help
224//config: Utility to trace the route of IPv6 packets.
225//config:
226//config:config FEATURE_TRACEROUTE_VERBOSE
227//config: bool "Enable verbose output"
228//config: default y
229//config: depends on TRACEROUTE || TRACEROUTE6
230//config: help
231//config: Add some verbosity to traceroute. This includes among other things
232//config: hostnames and ICMP response types.
233//config:
234//config:config FEATURE_TRACEROUTE_USE_ICMP
235//config: bool "Enable -I option (use ICMP instead of UDP)"
236//config: default y
237//config: depends on TRACEROUTE || TRACEROUTE6
238//config: help
239//config: Add option -I to use ICMP ECHO instead of UDP datagrams.
240
241/* Needs socket(AF_INET, SOCK_RAW, IPPROTO_ICMP), therefore BB_SUID_MAYBE: */
242//applet:IF_TRACEROUTE(APPLET(traceroute, BB_DIR_USR_BIN, BB_SUID_MAYBE))
243//applet:IF_TRACEROUTE6(APPLET(traceroute6, BB_DIR_USR_BIN, BB_SUID_MAYBE))
244
245//kbuild:lib-$(CONFIG_TRACEROUTE) += traceroute.o
246//kbuild:lib-$(CONFIG_TRACEROUTE6) += traceroute.o
212 247
213//usage:#define traceroute_trivial_usage 248//usage:#define traceroute_trivial_usage
214//usage: "[-"IF_TRACEROUTE6("46")"FIlnrv] [-f 1ST_TTL] [-m MAXTTL] [-q PROBES] [-p PORT]\n" 249//usage: "[-"IF_TRACEROUTE6("46")"FIlnrv] [-f 1ST_TTL] [-m MAXTTL] [-q PROBES] [-p PORT]\n"
@@ -1170,11 +1205,13 @@ common_traceroute_main(int op, char **argv)
1170 return 0; 1205 return 0;
1171} 1206}
1172 1207
1208#if ENABLE_TRACEROUTE
1173int traceroute_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 1209int traceroute_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
1174int traceroute_main(int argc UNUSED_PARAM, char **argv) 1210int traceroute_main(int argc UNUSED_PARAM, char **argv)
1175{ 1211{
1176 return common_traceroute_main(0, argv); 1212 return common_traceroute_main(0, argv);
1177} 1213}
1214#endif
1178 1215
1179#if ENABLE_TRACEROUTE6 1216#if ENABLE_TRACEROUTE6
1180int traceroute6_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE; 1217int traceroute6_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
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 @@
9 * 9 *
10 * Licensed under GPLv2, see file LICENSE in this source tree. 10 * Licensed under GPLv2, see file LICENSE in this source tree.
11 */ 11 */
12//config:config TUNCTL
13//config: bool "tunctl"
14//config: default y
15//config: select PLATFORM_LINUX
16//config: help
17//config: tunctl creates or deletes tun devices.
18//config:
19//config:config FEATURE_TUNCTL_UG
20//config: bool "Support owner:group assignment"
21//config: default y
22//config: depends on TUNCTL
23//config: help
24//config: Allow to specify owner and group of newly created interface.
25//config: 340 bytes of pure bloat. Say no here.
26
27//applet:IF_TUNCTL(APPLET(tunctl, BB_DIR_SBIN, BB_SUID_DROP))
28
29//kbuild:lib-$(CONFIG_TUNCTL) += tunctl.o
12 30
13//usage:#define tunctl_trivial_usage 31//usage:#define tunctl_trivial_usage
14//usage: "[-f device] ([-t name] | -d name)" IF_FEATURE_TUNCTL_UG(" [-u owner] [-g group] [-b]") 32//usage: "[-f device] ([-t name] | -d name)" IF_FEATURE_TUNCTL_UG(" [-u owner] [-g group] [-b]")
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 @@
18 * along with this program; if not, write to the Free Software 18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
20 */ 20 */
21//applet:IF_UDHCPC(APPLET(udhcpc, BB_DIR_SBIN, BB_SUID_DROP))
22
23//kbuild:lib-$(CONFIG_UDHCPC) += common.o packet.o signalpipe.o socket.o
24//kbuild:lib-$(CONFIG_UDHCPC) += dhcpc.o
25//kbuild:lib-$(CONFIG_FEATURE_UDHCPC_ARPING) += arpping.o
26//kbuild:lib-$(CONFIG_FEATURE_UDHCP_RFC3397) += domain_codec.o
27
21#include <syslog.h> 28#include <syslog.h>
22/* Override ENABLE_FEATURE_PIDFILE - ifupdown needs our pidfile to always exist */ 29/* Override ENABLE_FEATURE_PIDFILE - ifupdown needs our pidfile to always exist */
23#define WANT_PIDFILE 1 30#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 @@
20 * along with this program; if not, write to the Free Software 20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 */ 22 */
23//applet:IF_UDHCPD(APPLET(udhcpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
24
25//kbuild:lib-$(CONFIG_UDHCPD) += common.o packet.o signalpipe.o socket.o
26//kbuild:lib-$(CONFIG_UDHCPD) += dhcpd.o arpping.o
27//kbuild:lib-$(CONFIG_FEATURE_UDHCP_RFC3397) += domain_codec.o
23 28
24//usage:#define udhcpd_trivial_usage 29//usage:#define udhcpd_trivial_usage
25//usage: "[-fS] [-I ADDR]" IF_FEATURE_UDHCP_PORT(" [-P N]") " [CONFFILE]" 30//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 @@
9 * Netbeat AG 9 * Netbeat AG
10 * Upstream has GPL v2 or later 10 * Upstream has GPL v2 or later
11 */ 11 */
12//applet:IF_DHCPRELAY(APPLET(dhcprelay, BB_DIR_USR_SBIN, BB_SUID_DROP))
13
14//kbuild:lib-$(CONFIG_DHCPRELAY) += dhcprelay.o
12 15
13//usage:#define dhcprelay_trivial_usage 16//usage:#define dhcprelay_trivial_usage
14//usage: "CLIENT_IFACE[,CLIENT_IFACE2]... SERVER_IFACE [SERVER_IP]" 17//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 @@
2/* 2/*
3 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 3 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
4 */ 4 */
5//applet:IF_DUMPLEASES(APPLET(dumpleases, BB_DIR_USR_BIN, BB_SUID_DROP))
6
7//kbuild:lib-$(CONFIG_DUMPLEASES) += dumpleases.o
5 8
6//usage:#define dumpleases_trivial_usage 9//usage:#define dumpleases_trivial_usage
7//usage: "[-r|-a] [-d] [-f LEASEFILE]" 10//usage: "[-r|-a] [-d] [-f LEASEFILE]"
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 @@
9 9
10/* BB_AUDIT SUSv3 N/A */ 10/* BB_AUDIT SUSv3 N/A */
11 11
12//config:config VCONFIG
13//config: bool "vconfig"
14//config: default y
15//config: select PLATFORM_LINUX
16//config: help
17//config: Creates, removes, and configures VLAN interfaces
18
19//applet:IF_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_VCONFIG) += vconfig.o
22
12//usage:#define vconfig_trivial_usage 23//usage:#define vconfig_trivial_usage
13//usage: "COMMAND [OPTIONS]" 24//usage: "COMMAND [OPTIONS]"
14//usage:#define vconfig_full_usage "\n\n" 25//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 @@
14 * routed at the IP level, though various proxies or bridges can 14 * routed at the IP level, though various proxies or bridges can
15 * certainly be used. Its naming is built over multicast DNS. 15 * certainly be used. Its naming is built over multicast DNS.
16 */ 16 */
17//config:config ZCIP
18//config: bool "zcip"
19//config: default y
20//config: select PLATFORM_LINUX
21//config: select FEATURE_SYSLOG
22//config: help
23//config: ZCIP provides ZeroConf IPv4 address selection, according to RFC 3927.
24//config: It's a daemon that allocates and defends a dynamically assigned
25//config: address on the 169.254/16 network, requiring no system administrator.
26//config:
27//config: See http://www.zeroconf.org for further details, and "zcip.script"
28//config: in the busybox examples.
29
30//applet:IF_ZCIP(APPLET(zcip, BB_DIR_SBIN, BB_SUID_DROP))
31
32//kbuild:lib-$(CONFIG_ZCIP) += zcip.o
17 33
18//#define DEBUG 34//#define DEBUG
19 35
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"
7 7
8INSERT 8INSERT
9 9
10config FREE
11 bool "free"
12 default y
13 select PLATFORM_LINUX #sysinfo()
14 help
15 free displays the total amount of free and used physical and swap
16 memory in the system, as well as the buffers used by the kernel.
17 The shared memory column should be ignored; it is obsolete.
18
19config FUSER
20 bool "fuser"
21 default y
22 help
23 fuser lists all PIDs (Process IDs) that currently have a given
24 file open. fuser can also list all PIDs that have a given network
25 (TCP or UDP) port open.
26
27config KILL
28 bool "kill"
29 default y
30 help
31 The command kill sends the specified signal to the specified
32 process or process group. If no signal is specified, the TERM
33 signal is sent.
34
35config KILLALL
36 bool "killall"
37 default y
38 depends on KILL
39 help
40 killall sends a signal to all processes running any of the
41 specified commands. If no signal name is specified, SIGTERM is
42 sent.
43
44config KILLALL5
45 bool "killall5"
46 default y
47 depends on KILL
48
49config PGREP
50 bool "pgrep"
51 default y
52 help
53 Look for processes by name.
54
55config PIDOF
56 bool "pidof"
57 default y
58 help
59 Pidof finds the process id's (pids) of the named programs. It prints
60 those id's on the standard output.
61
62config FEATURE_PIDOF_SINGLE
63 bool "Enable argument for single shot (-s)"
64 default y
65 depends on PIDOF
66 help
67 Support argument '-s' for returning only the first pid found.
68
69config FEATURE_PIDOF_OMIT
70 bool "Enable argument for omitting pids (-o)"
71 default y
72 depends on PIDOF
73 help
74 Support argument '-o' for omitting the given pids in output.
75 The special pid %PPID can be used to name the parent process
76 of the pidof, in other words the calling shell or shell script.
77
78config PKILL
79 bool "pkill"
80 default y
81 help
82 Send signals to processes by name.
83
84config PS
85 bool "ps"
86 default y
87 help
88 ps gives a snapshot of the current processes.
89
90config FEATURE_PS_WIDE
91 bool "Enable wide output option (-w)"
92 default y
93 depends on PS && !DESKTOP
94 help
95 Support argument 'w' for wide output.
96 If given once, 132 chars are printed, and if given more
97 than once, the length is unlimited.
98
99config FEATURE_PS_LONG
100 bool "Enable long output option (-l)"
101 default y
102 depends on PS && !DESKTOP
103 help
104 Support argument 'l' for long output.
105 Adds fields PPID, RSS, START, TIME & TTY
106
107config FEATURE_PS_TIME
108 bool "Enable time and elapsed time output"
109 default y
110 depends on PS && DESKTOP
111 select PLATFORM_LINUX
112 help
113 Support -o time and -o etime output specifiers.
114
115config FEATURE_PS_ADDITIONAL_COLUMNS
116 bool "Enable additional ps columns"
117 default y
118 depends on PS && DESKTOP
119 help
120 Support -o rgroup, -o ruser, -o nice output specifiers.
121
122config FEATURE_PS_UNUSUAL_SYSTEMS
123 bool "Support Linux prior to 2.4.0 and non-ELF systems"
124 default n
125 depends on FEATURE_PS_TIME
126 help
127 Include support for measuring HZ on old kernels and non-ELF systems
128 (if you are on Linux 2.4.0+ and use ELF, you don't need this)
129
130config RENICE
131 bool "renice"
132 default y
133 help
134 Renice alters the scheduling priority of one or more running
135 processes.
136
137config BB_SYSCTL
138 bool "sysctl"
139 default y
140 help
141 Configure kernel parameters at runtime.
142
143config FEATURE_SHOW_THREADS 10config FEATURE_SHOW_THREADS
144 bool "Support for showing threads in ps/pstree/top" 11 bool "Support for showing threads in ps/pstree/top"
145 default y 12 default y
@@ -148,11 +15,4 @@ config FEATURE_SHOW_THREADS
148 Enables the ps -T option, showing of threads in pstree, 15 Enables the ps -T option, showing of threads in pstree,
149 and 'h' command in top. 16 and 'h' command in top.
150 17
151config WATCH
152 bool "watch"
153 default y
154 help
155 watch is used to execute a program periodically, showing
156 output to the screen.
157
158endmenu 18endmenu
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 @@
7lib-y:= 7lib-y:=
8 8
9INSERT 9INSERT
10lib-$(CONFIG_FREE) += free.o 10
11lib-$(CONFIG_FUSER) += fuser.o 11lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash
12lib-$(CONFIG_KILL) += kill.o
13lib-$(CONFIG_ASH) += kill.o # used for built-in kill by ash
14lib-$(CONFIG_PGREP) += pgrep.o
15lib-$(CONFIG_PKILL) += pgrep.o
16lib-$(CONFIG_PIDOF) += pidof.o
17lib-$(CONFIG_PS) += ps.o
18lib-$(CONFIG_RENICE) += renice.o
19lib-$(CONFIG_BB_SYSCTL) += sysctl.o
20lib-$(CONFIG_TOP) += top.o
21lib-$(CONFIG_UPTIME) += uptime.o
22lib-$(CONFIG_WATCH) += watch.o
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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config FREE
10//config: bool "free"
11//config: default y
12//config: select PLATFORM_LINUX #sysinfo()
13//config: help
14//config: free displays the total amount of free and used physical and swap
15//config: memory in the system, as well as the buffers used by the kernel.
16//config: The shared memory column should be ignored; it is obsolete.
9 17
10/* getopt not needed */ 18//applet:IF_FREE(APPLET(free, BB_DIR_USR_BIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_FREE) += free.o
11 21
12//usage:#define free_trivial_usage 22//usage:#define free_trivial_usage
13//usage: "" IF_DESKTOP("[-b/k/m/g]") 23//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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config FUSER
10//config: bool "fuser"
11//config: default y
12//config: help
13//config: fuser lists all PIDs (Process IDs) that currently have a given
14//config: file open. fuser can also list all PIDs that have a given network
15//config: (TCP or UDP) port open.
16
17//applet:IF_FUSER(APPLET(fuser, BB_DIR_USR_BIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_FUSER) += fuser.o
9 20
10//usage:#define fuser_trivial_usage 21//usage:#define fuser_trivial_usage
11//usage: "[OPTIONS] FILE or PORT/PROTO" 22//usage: "[OPTIONS] FILE or PORT/PROTO"
diff --git a/procps/kill.c b/procps/kill.c
index c5c7a8d72..57a33bcaa 100644
--- a/procps/kill.c
+++ b/procps/kill.c
@@ -7,6 +7,38 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config KILL
11//config: bool "kill"
12//config: default y
13//config: help
14//config: The command kill sends the specified signal to the specified
15//config: process or process group. If no signal is specified, the TERM
16//config: signal is sent.
17//config:
18//config:config KILLALL
19//config: bool "killall"
20//config: default y
21//config: help
22//config: killall sends a signal to all processes running any of the
23//config: specified commands. If no signal name is specified, SIGTERM is
24//config: sent.
25//config:
26//config:config KILLALL5
27//config: bool "killall5"
28//config: default y
29//config: help
30//config: The SystemV killall command. killall5 sends a signal
31//config: to all processes except kernel threads and the processes
32//config: in its own session, so it won't kill the shell that is running
33//config: the script it was called from.
34
35//applet:IF_KILL(APPLET(kill, BB_DIR_BIN, BB_SUID_DROP))
36//applet:IF_KILLALL(APPLET_ODDNAME(killall, kill, BB_DIR_USR_BIN, BB_SUID_DROP, killall))
37//applet:IF_KILLALL5(APPLET_ODDNAME(killall5, kill, BB_DIR_USR_SBIN, BB_SUID_DROP, killall5))
38
39//kbuild:lib-$(CONFIG_KILL) += kill.o
40//kbuild:lib-$(CONFIG_KILLALL) += kill.o
41//kbuild:lib-$(CONFIG_KILLALL5) += kill.o
10 42
11//usage:#define kill_trivial_usage 43//usage:#define kill_trivial_usage
12//usage: "[-l] [-SIG] PID..." 44//usage: "[-l] [-SIG] PID..."
@@ -65,17 +97,23 @@ int kill_main(int argc UNUSED_PARAM, char **argv)
65 char *arg; 97 char *arg;
66 pid_t pid; 98 pid_t pid;
67 int signo = SIGTERM, errors = 0, quiet = 0; 99 int signo = SIGTERM, errors = 0, quiet = 0;
68#if !ENABLE_KILLALL && !ENABLE_KILLALL5 100#if ENABLE_KILL && !ENABLE_KILLALL && !ENABLE_KILLALL5
69#define killall 0 101# define killall 0
70#define killall5 0 102# define killall5 0
103#elif !ENABLE_KILL && ENABLE_KILLALL && !ENABLE_KILLALL5
104# define killall 1
105# define killall5 0
106#elif !ENABLE_KILL && !ENABLE_KILLALL && ENABLE_KILLALL5
107# define killall 0
108# define killall5 1
71#else 109#else
72/* How to determine who we are? find 3rd char from the end: 110/* How to determine who we are? find 3rd char from the end:
73 * kill, killall, killall5 111 * kill, killall, killall5
74 * ^i ^a ^l - it's unique 112 * ^i ^a ^l - it's unique
75 * (checking from the start is complicated by /bin/kill... case) */ 113 * (checking from the start is complicated by /bin/kill... case) */
76 const char char3 = argv[0][strlen(argv[0]) - 3]; 114 const char char3 = argv[0][strlen(argv[0]) - 3];
77#define killall (ENABLE_KILLALL && char3 == 'a') 115# define killall (ENABLE_KILLALL && char3 == 'a')
78#define killall5 (ENABLE_KILLALL5 && char3 == 'l') 116# define killall5 (ENABLE_KILLALL5 && char3 == 'l')
79#endif 117#endif
80 118
81 /* Parse any options */ 119 /* Parse any options */
diff --git a/procps/pgrep.c b/procps/pgrep.c
index 1c594cf96..ac82b5156 100644
--- a/procps/pgrep.c
+++ b/procps/pgrep.c
@@ -6,6 +6,23 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config PGREP
10//config: bool "pgrep"
11//config: default y
12//config: help
13//config: Look for processes by name.
14//config:
15//config:config PKILL
16//config: bool "pkill"
17//config: default y
18//config: help
19//config: Send signals to processes by name.
20
21//applet:IF_PGREP(APPLET(pgrep, BB_DIR_USR_BIN, BB_SUID_DROP))
22//applet:IF_PKILL(APPLET_ODDNAME(pkill, pgrep, BB_DIR_USR_BIN, BB_SUID_DROP, pkill))
23
24//kbuild:lib-$(CONFIG_PGREP) += pgrep.o
25//kbuild:lib-$(CONFIG_PKILL) += pgrep.o
9 26
10//usage:#define pgrep_trivial_usage 27//usage:#define pgrep_trivial_usage
11//usage: "[-flnovx] [-s SID|-P PPID|PATTERN]" 28//usage: "[-flnovx] [-s SID|-P PPID|PATTERN]"
@@ -151,7 +168,7 @@ int pgrep_main(int argc UNUSED_PARAM, char **argv)
151 168
152 if (ppid2match >= 0 && ppid2match != proc->ppid) 169 if (ppid2match >= 0 && ppid2match != proc->ppid)
153 continue; 170 continue;
154 if (sid2match >= 0 && sid2match != proc->sid) 171 if (sid2match >= 0 && sid2match != proc->sid)
155 continue; 172 continue;
156 173
157 /* NB: OPT_INVERT is always 0 or 1 */ 174 /* NB: OPT_INVERT is always 0 or 1 */
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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config PIDOF
10//config: bool "pidof"
11//config: default y
12//config: help
13//config: Pidof finds the process id's (pids) of the named programs. It prints
14//config: those id's on the standard output.
15//config:
16//config:config FEATURE_PIDOF_SINGLE
17//config: bool "Enable argument for single shot (-s)"
18//config: default y
19//config: depends on PIDOF
20//config: help
21//config: Support argument '-s' for returning only the first pid found.
22//config:
23//config:config FEATURE_PIDOF_OMIT
24//config: bool "Enable argument for omitting pids (-o)"
25//config: default y
26//config: depends on PIDOF
27//config: help
28//config: Support argument '-o' for omitting the given pids in output.
29//config: The special pid %PPID can be used to name the parent process
30//config: of the pidof, in other words the calling shell or shell script.
31
32//applet:IF_PIDOF(APPLET(pidof, BB_DIR_BIN, BB_SUID_DROP))
33
34//kbuild:lib-$(CONFIG_PIDOF) += pidof.o
9 35
10//usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT) 36//usage:#if (ENABLE_FEATURE_PIDOF_SINGLE || ENABLE_FEATURE_PIDOF_OMIT)
11//usage:#define pidof_trivial_usage 37//usage:#define pidof_trivial_usage
diff --git a/procps/ps.c b/procps/ps.c
index c9d33daf4..902811f31 100644
--- a/procps/ps.c
+++ b/procps/ps.c
@@ -8,6 +8,55 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11//config:config PS
12//config: bool "ps"
13//config: default y
14//config: help
15//config: ps gives a snapshot of the current processes.
16//config:
17//config:config FEATURE_PS_WIDE
18//config: bool "Enable wide output option (-w)"
19//config: default y
20//config: depends on PS && !DESKTOP
21//config: help
22//config: Support argument 'w' for wide output.
23//config: If given once, 132 chars are printed, and if given more
24//config: than once, the length is unlimited.
25//config:
26//config:config FEATURE_PS_LONG
27//config: bool "Enable long output option (-l)"
28//config: default y
29//config: depends on PS && !DESKTOP
30//config: help
31//config: Support argument 'l' for long output.
32//config: Adds fields PPID, RSS, START, TIME & TTY
33//config:
34//config:config FEATURE_PS_TIME
35//config: bool "Enable time and elapsed time output"
36//config: default y
37//config: depends on PS && DESKTOP
38//config: select PLATFORM_LINUX
39//config: help
40//config: Support -o time and -o etime output specifiers.
41//config:
42//config:config FEATURE_PS_ADDITIONAL_COLUMNS
43//config: bool "Enable additional ps columns"
44//config: default y
45//config: depends on PS && DESKTOP
46//config: help
47//config: Support -o rgroup, -o ruser, -o nice output specifiers.
48//config:
49//config:config FEATURE_PS_UNUSUAL_SYSTEMS
50//config: bool "Support Linux prior to 2.4.0 and non-ELF systems"
51//config: default n
52//config: depends on FEATURE_PS_TIME
53//config: help
54//config: Include support for measuring HZ on old kernels and non-ELF systems
55//config: (if you are on Linux 2.4.0+ and use ELF, you don't need this)
56
57//applet:IF_PS(APPLET(ps, BB_DIR_BIN, BB_SUID_DROP))
58
59//kbuild:lib-$(CONFIG_PS) += ps.o
11 60
12//usage:#if ENABLE_DESKTOP 61//usage:#if ENABLE_DESKTOP
13//usage: 62//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 @@
18 * options -p, -g, and -u are treated as mode switches for the 18 * options -p, -g, and -u are treated as mode switches for the
19 * following IDs (if any). Multiple switches are allowed. 19 * following IDs (if any). Multiple switches are allowed.
20 */ 20 */
21//config:config RENICE
22//config: bool "renice"
23//config: default y
24//config: help
25//config: Renice alters the scheduling priority of one or more running
26//config: processes.
27
28//applet:IF_RENICE(APPLET(renice, BB_DIR_USR_BIN, BB_SUID_DROP))
29
30//kbuild:lib-$(CONFIG_RENICE) += renice.o
21 31
22//usage:#define renice_trivial_usage 32//usage:#define renice_trivial_usage
23//usage: "[-n] PRIORITY [[-p | -g | -u] ID...]..." 33//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 @@
10 * v1.01 - added -p <preload> to preload values from a file 10 * v1.01 - added -p <preload> to preload values from a file
11 * v1.01.1 - busybox applet aware by <solar@gentoo.org> 11 * v1.01.1 - busybox applet aware by <solar@gentoo.org>
12 */ 12 */
13//config:config BB_SYSCTL
14//config: bool "sysctl"
15//config: default y
16//config: help
17//config: Configure kernel parameters at runtime.
18
19//applet:IF_BB_SYSCTL(APPLET(sysctl, BB_DIR_SBIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_BB_SYSCTL) += sysctl.o
13 22
14//usage:#define sysctl_trivial_usage 23//usage:#define sysctl_trivial_usage
15//usage: "[OPTIONS] [KEY[=VALUE]]..." 24//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 @@
49 * cp stat meminfo loadavg proc 49 * cp stat meminfo loadavg proc
50 * chroot . ./top -bn1 >top1.out 50 * chroot . ./top -bn1 >top1.out
51 */ 51 */
52
53//config:config TOP 52//config:config TOP
54//config: bool "top" 53//config: bool "top"
55//config: default y 54//config: default y
@@ -104,6 +103,10 @@
104//config: help 103//config: help
105//config: Enable 's' in top (gives lots of memory info). 104//config: Enable 's' in top (gives lots of memory info).
106 105
106//applet:IF_TOP(APPLET(top, BB_DIR_USR_BIN, BB_SUID_DROP))
107
108//kbuild:lib-$(CONFIG_TOP) += top.o
109
107#include "libbb.h" 110#include "libbb.h"
108#include "common_bufsiz.h" 111#include "common_bufsiz.h"
109 112
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 @@
11 * 11 *
12 * Added FEATURE_UPTIME_UTMP_SUPPORT flag. 12 * Added FEATURE_UPTIME_UTMP_SUPPORT flag.
13 */ 13 */
14
15/* getopt not needed */
16
17//config:config UPTIME 14//config:config UPTIME
18//config: bool "uptime" 15//config: bool "uptime"
19//config: default y 16//config: default y
@@ -30,6 +27,10 @@
30//config: help 27//config: help
31//config: Makes uptime display the number of users currently logged on. 28//config: Makes uptime display the number of users currently logged on.
32 29
30//applet:IF_UPTIME(APPLET(uptime, BB_DIR_USR_BIN, BB_SUID_DROP))
31
32//kbuild:lib-$(CONFIG_UPTIME) += uptime.o
33
33//usage:#define uptime_trivial_usage 34//usage:#define uptime_trivial_usage
34//usage: "" 35//usage: ""
35//usage:#define uptime_full_usage "\n\n" 36//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 @@
11/* BB_AUDIT SUSv3 N/A */ 11/* BB_AUDIT SUSv3 N/A */
12/* BB_AUDIT GNU defects -- only option -n is supported. */ 12/* BB_AUDIT GNU defects -- only option -n is supported. */
13 13
14//config:config WATCH
15//config: bool "watch"
16//config: default y
17//config: help
18//config: watch is used to execute a program periodically, showing
19//config: output to the screen.
20
21//applet:IF_WATCH(APPLET(watch, BB_DIR_BIN, BB_SUID_DROP))
22
23//kbuild:lib-$(CONFIG_WATCH) += watch.o
24
14//usage:#define watch_trivial_usage 25//usage:#define watch_trivial_usage
15//usage: "[-n SEC] [-t] PROG ARGS" 26//usage: "[-n SEC] [-t] PROG ARGS"
16//usage:#define watch_full_usage "\n\n" 27//usage:#define watch_full_usage "\n\n"
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 {
210#define INIT_G() do { setup_common_bufsiz(); } while (0) 210#define INIT_G() do { setup_common_bufsiz(); } while (0)
211 211
212 212
213#define str_equal(s,t) (!strcmp((s), (t))) 213#define str_equal(s,t) (strcmp((s), (t)) == 0)
214 214
215 215
216static void fatal_cannot(const char *m1) NORETURN; 216static void fatal_cannot(const char *m1) NORETURN;
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"
8 8
9INSERT 9INSERT
10 10
11config CHCON
12 bool "chcon"
13 default n
14 depends on SELINUX
15 help
16 Enable support to change the security context of file.
17
18config FEATURE_CHCON_LONG_OPTIONS
19 bool "Enable long options"
20 default y
21 depends on CHCON && LONG_OPTS
22 help
23 Support long options for the chcon applet.
24
25config GETENFORCE
26 bool "getenforce"
27 default n
28 depends on SELINUX
29 help
30 Enable support to get the current mode of SELinux.
31
32config GETSEBOOL
33 bool "getsebool"
34 default n
35 depends on SELINUX
36 help
37 Enable support to get SELinux boolean values.
38
39config LOAD_POLICY
40 bool "load_policy"
41 default n
42 depends on SELINUX
43 help
44 Enable support to load SELinux policy.
45
46config MATCHPATHCON
47 bool "matchpathcon"
48 default n
49 depends on SELINUX
50 help
51 Enable support to get default security context of the
52 specified path from the file contexts configuration.
53
54config RESTORECON
55 bool "restorecon"
56 default n
57 depends on SELINUX
58 help
59 Enable support to relabel files. The feature is almost
60 the same as setfiles, but usage is a little different.
61
62config RUNCON
63 bool "runcon"
64 default n
65 depends on SELINUX
66 help
67 Enable support to run command in specified security context.
68
69config FEATURE_RUNCON_LONG_OPTIONS
70 bool "Enable long options"
71 default y
72 depends on RUNCON && LONG_OPTS
73 help
74 Support long options for the runcon applet.
75
76config SELINUXENABLED
77 bool "selinuxenabled"
78 default n
79 depends on SELINUX
80 help
81 Enable support for this command to be used within shell scripts
82 to determine if selinux is enabled.
83
84config SETENFORCE
85 bool "setenforce"
86 default n
87 depends on SELINUX
88 help
89 Enable support to modify the mode SELinux is running in.
90
91config SETFILES
92 bool "setfiles"
93 default n
94 depends on SELINUX
95 help
96 Enable support to modify to relabel files.
97 Notice: If you built libselinux with -D_FILE_OFFSET_BITS=64,
98 (It is default in libselinux's Makefile), you _must_ enable
99 CONFIG_LFS.
100
101config FEATURE_SETFILES_CHECK_OPTION
102 bool "Enable check option"
103 default n
104 depends on SETFILES
105 help
106 Support "-c" option (check the validity of the contexts against
107 the specified binary policy) for setfiles. Requires libsepol.
108
109config SETSEBOOL
110 bool "setsebool"
111 default n
112 depends on SELINUX
113 help
114 Enable support for change boolean.
115 semanage and -P option is not supported yet.
116
117config SESTATUS
118 bool "sestatus"
119 default n
120 depends on SELINUX
121 help
122 Displays the status of SELinux.
123
124endmenu 11endmenu
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 @@
8lib-y:= 8lib-y:=
9 9
10INSERT 10INSERT
11lib-$(CONFIG_CHCON) += chcon.o
12lib-$(CONFIG_GETENFORCE) += getenforce.o
13lib-$(CONFIG_GETSEBOOL) += getsebool.o
14lib-$(CONFIG_LOAD_POLICY) += load_policy.o
15lib-$(CONFIG_MATCHPATHCON) += matchpathcon.o
16lib-$(CONFIG_RUNCON) += runcon.o
17lib-$(CONFIG_SELINUXENABLED) += selinuxenabled.o
18lib-$(CONFIG_SETENFORCE) += setenforce.o
19lib-$(CONFIG_SETFILES) += setfiles.o
20lib-$(CONFIG_RESTORECON) += setfiles.o
21lib-$(CONFIG_SETSEBOOL) += setsebool.o
22lib-$(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 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config CHCON
11//config: bool "chcon"
12//config: default n
13//config: depends on SELINUX
14//config: help
15//config: Enable support to change the security context of file.
16//config:
17//config:config FEATURE_CHCON_LONG_OPTIONS
18//config: bool "Enable long options"
19//config: default y
20//config: depends on CHCON && LONG_OPTS
21//config: help
22//config: Support long options for the chcon applet.
23
24//applet:IF_CHCON(APPLET(chcon, BB_DIR_USR_BIN, BB_SUID_DROP))
25
26//kbuild:lib-$(CONFIG_CHCON) += chcon.o
10 27
11//usage:#define chcon_trivial_usage 28//usage:#define chcon_trivial_usage
12//usage: "[OPTIONS] CONTEXT FILE..." 29//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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config GETENFORCE
10//config: bool "getenforce"
11//config: default n
12//config: depends on SELINUX
13//config: help
14//config: Enable support to get the current mode of SELinux.
15
16//applet:IF_GETENFORCE(APPLET(getenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_GETENFORCE) += getenforce.o
9 19
10//usage:#define getenforce_trivial_usage NOUSAGE_STR 20//usage:#define getenforce_trivial_usage NOUSAGE_STR
11//usage:#define getenforce_full_usage "" 21//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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config GETSEBOOL
10//config: bool "getsebool"
11//config: default n
12//config: depends on SELINUX
13//config: help
14//config: Enable support to get SELinux boolean values.
15
16//applet:IF_GETSEBOOL(APPLET(getsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_GETSEBOOL) += getsebool.o
9 19
10//usage:#define getsebool_trivial_usage 20//usage:#define getsebool_trivial_usage
11//usage: "-a or getsebool boolean..." 21//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 @@
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this source tree. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7//config:config LOAD_POLICY
8//config: bool "load_policy"
9//config: default n
10//config: depends on SELINUX
11//config: help
12//config: Enable support to load SELinux policy.
13
14//applet:IF_LOAD_POLICY(APPLET(load_policy, BB_DIR_USR_SBIN, BB_SUID_DROP))
15
16//kbuild:lib-$(CONFIG_LOAD_POLICY) += load_policy.o
7 17
8//usage:#define load_policy_trivial_usage NOUSAGE_STR 18//usage:#define load_policy_trivial_usage NOUSAGE_STR
9//usage:#define load_policy_full_usage "" 19//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 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8//config:config MATCHPATHCON
9//config: bool "matchpathcon"
10//config: default n
11//config: depends on SELINUX
12//config: help
13//config: Enable support to get default security context of the
14//config: specified path from the file contexts configuration.
15
16//applet:IF_MATCHPATHCON(APPLET(matchpathcon, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_MATCHPATHCON) += matchpathcon.o
8 19
9//usage:#define matchpathcon_trivial_usage 20//usage:#define matchpathcon_trivial_usage
10//usage: "[-n] [-N] [-f file_contexts_file] [-p prefix] [-V]" 21//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 @@
28 * 28 *
29 * Licensed under GPLv2, see file LICENSE in this source tree. 29 * Licensed under GPLv2, see file LICENSE in this source tree.
30 */ 30 */
31//config:config RUNCON
32//config: bool "runcon"
33//config: default n
34//config: depends on SELINUX
35//config: help
36//config: Enable support to run command in specified security context.
37//config:
38//config:config FEATURE_RUNCON_LONG_OPTIONS
39//config: bool "Enable long options"
40//config: default y
41//config: depends on RUNCON && LONG_OPTS
42//config: help
43//config: Support long options for the runcon applet.
44
45//applet:IF_RUNCON(APPLET(runcon, BB_DIR_USR_BIN, BB_SUID_DROP))
46
47//kbuild:lib-$(CONFIG_RUNCON) += runcon.o
31 48
32//usage:#define runcon_trivial_usage 49//usage:#define runcon_trivial_usage
33//usage: "[-c] [-u USER] [-r ROLE] [-t TYPE] [-l RANGE] PROG ARGS\n" 50//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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config SELINUXENABLED
10//config: bool "selinuxenabled"
11//config: default n
12//config: depends on SELINUX
13//config: help
14//config: Enable support for this command to be used within shell scripts
15//config: to determine if selinux is enabled.
16
17//applet:IF_SELINUXENABLED(APPLET(selinuxenabled, BB_DIR_USR_SBIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_SELINUXENABLED) += selinuxenabled.o
9 20
10//usage:#define selinuxenabled_trivial_usage NOUSAGE_STR 21//usage:#define selinuxenabled_trivial_usage NOUSAGE_STR
11//usage:#define selinuxenabled_full_usage "" 22//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 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config SESTATUS
11//config: bool "sestatus"
12//config: default n
13//config: depends on SELINUX
14//config: help
15//config: Displays the status of SELinux.
16
17//applet:IF_SESTATUS(APPLET(sestatus, BB_DIR_USR_SBIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_SESTATUS) += sestatus.o
10 20
11//usage:#define sestatus_trivial_usage 21//usage:#define sestatus_trivial_usage
12//usage: "[-vb]" 22//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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config SETENFORCE
10//config: bool "setenforce"
11//config: default n
12//config: depends on SELINUX
13//config: help
14//config: Enable support to modify the mode SELinux is running in.
15
16//applet:IF_SETENFORCE(APPLET(setenforce, BB_DIR_USR_SBIN, BB_SUID_DROP))
17
18//kbuild:lib-$(CONFIG_SETENFORCE) += setenforce.o
9 19
10//usage:#define setenforce_trivial_usage 20//usage:#define setenforce_trivial_usage
11//usage: "[Enforcing | Permissive | 1 | 0]" 21//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 @@
3 policycoreutils was released under GPL 2. 3 policycoreutils was released under GPL 2.
4 Port to BusyBox (c) 2007 by Yuichi Nakamura <ynakam@hitachisoft.jp> 4 Port to BusyBox (c) 2007 by Yuichi Nakamura <ynakam@hitachisoft.jp>
5*/ 5*/
6//config:config SETFILES
7//config: bool "setfiles"
8//config: default n
9//config: depends on SELINUX
10//config: help
11//config: Enable support to modify to relabel files.
12//config: Notice: If you built libselinux with -D_FILE_OFFSET_BITS=64,
13//config: (It is default in libselinux's Makefile), you _must_ enable
14//config: CONFIG_LFS.
15//config:
16//config:config FEATURE_SETFILES_CHECK_OPTION
17//config: bool "Enable check option"
18//config: default n
19//config: depends on SETFILES
20//config: help
21//config: Support "-c" option (check the validity of the contexts against
22//config: the specified binary policy) for setfiles. Requires libsepol.
23//config:
24//config:config RESTORECON
25//config: bool "restorecon"
26//config: default n
27//config: depends on SELINUX
28//config: help
29//config: Enable support to relabel files. The feature is almost
30//config: the same as setfiles, but usage is a little different.
31
32//applet:IF_SETFILES(APPLET(setfiles, BB_DIR_SBIN, BB_SUID_DROP))
33//applet:IF_RESTORECON(APPLET_ODDNAME(restorecon, setfiles, BB_DIR_SBIN, BB_SUID_DROP, restorecon))
34
35//kbuild:lib-$(CONFIG_SETFILES) += setfiles.o
36//kbuild:lib-$(CONFIG_RESTORECON) += setfiles.o
6 37
7//usage:#define setfiles_trivial_usage 38//usage:#define setfiles_trivial_usage
8//usage: "[-dnpqsvW] [-e DIR]... [-o FILE] [-r alt_root_path]" 39//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 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config SETSEBOOL
11//config: bool "setsebool"
12//config: default n
13//config: depends on SELINUX
14//config: help
15//config: Enable support for change boolean.
16//config: semanage and -P option is not supported yet.
17
18//applet:IF_SETSEBOOL(APPLET(setsebool, BB_DIR_USR_SBIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_SETSEBOOL) += setsebool.o
10 21
11//usage:#define setsebool_trivial_usage 22//usage:#define setsebool_trivial_usage
12//usage: "boolean value" 23//usage: "boolean value"
diff --git a/shell/ash.c b/shell/ash.c
index d0ccfe982..2e7f68c05 100644
--- a/shell/ash.c
+++ b/shell/ash.c
@@ -9724,9 +9724,9 @@ static const struct builtincmd builtintab[] = {
9724 { BUILTIN_SPEC_REG ":" , truecmd }, 9724 { BUILTIN_SPEC_REG ":" , truecmd },
9725#if ENABLE_ASH_BUILTIN_TEST 9725#if ENABLE_ASH_BUILTIN_TEST
9726 { BUILTIN_REGULAR "[" , testcmd }, 9726 { BUILTIN_REGULAR "[" , testcmd },
9727#if ENABLE_ASH_BASH_COMPAT 9727# if ENABLE_ASH_BASH_COMPAT
9728 { BUILTIN_REGULAR "[[" , testcmd }, 9728 { BUILTIN_REGULAR "[[" , testcmd },
9729#endif 9729# endif
9730#endif 9730#endif
9731#if ENABLE_ASH_ALIAS 9731#if ENABLE_ASH_ALIAS
9732 { BUILTIN_REG_ASSG "alias" , aliascmd }, 9732 { BUILTIN_REG_ASSG "alias" , aliascmd },
@@ -10334,13 +10334,16 @@ preadfd(void)
10334 reinit_unicode_for_ash(); 10334 reinit_unicode_for_ash();
10335 nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout); 10335 nr = read_line_input(line_input_state, cmdedit_prompt, buf, IBUFSIZ, timeout);
10336 if (nr == 0) { 10336 if (nr == 0) {
10337 /* Ctrl+C pressed */ 10337 /* ^C pressed, "convert" to SIGINT */
10338 write(STDOUT_FILENO, "^C", 2);
10338 if (trap[SIGINT]) { 10339 if (trap[SIGINT]) {
10339 buf[0] = '\n'; 10340 buf[0] = '\n';
10340 buf[1] = '\0'; 10341 buf[1] = '\0';
10341 raise(SIGINT); 10342 raise(SIGINT);
10342 return 1; 10343 return 1;
10343 } 10344 }
10345 exitstatus = 128 + SIGINT;
10346 bb_putchar('\n');
10344 goto retry; 10347 goto retry;
10345 } 10348 }
10346 if (nr < 0) { 10349 if (nr < 0) {
diff --git a/shell/hush.c b/shell/hush.c
index 2f07f4ac1..bcd4dffee 100644
--- a/shell/hush.c
+++ b/shell/hush.c
@@ -1746,6 +1746,7 @@ static int check_and_run_traps(void)
1746 argv[2] = NULL; 1746 argv[2] = NULL;
1747 save_rcode = G.last_exitcode; 1747 save_rcode = G.last_exitcode;
1748 builtin_eval(argv); 1748 builtin_eval(argv);
1749//FIXME: shouldn't it be set to 128 + sig instead?
1749 G.last_exitcode = save_rcode; 1750 G.last_exitcode = save_rcode;
1750 last_sig = sig; 1751 last_sig = sig;
1751 } /* else: "" trap, ignoring signal */ 1752 } /* else: "" trap, ignoring signal */
@@ -1755,8 +1756,6 @@ static int check_and_run_traps(void)
1755 switch (sig) { 1756 switch (sig) {
1756 case SIGINT: 1757 case SIGINT:
1757 debug_printf_exec("%s: sig:%d default SIGINT handler\n", __func__, sig); 1758 debug_printf_exec("%s: sig:%d default SIGINT handler\n", __func__, sig);
1758 /* Builtin was ^C'ed, make it look prettier: */
1759 bb_putchar('\n');
1760 G.flag_SIGINT = 1; 1759 G.flag_SIGINT = 1;
1761 last_sig = sig; 1760 last_sig = sig;
1762 break; 1761 break;
@@ -2192,18 +2191,30 @@ static int get_user_input(struct in_str *i)
2192 2191
2193 prompt_str = setup_prompt_string(i->promptmode); 2192 prompt_str = setup_prompt_string(i->promptmode);
2194# if ENABLE_FEATURE_EDITING 2193# if ENABLE_FEATURE_EDITING
2195 do { 2194 for (;;) {
2196 reinit_unicode_for_hush(); 2195 reinit_unicode_for_hush();
2197 G.flag_SIGINT = 0; 2196 if (G.flag_SIGINT) {
2197 /* There was ^C'ed, make it look prettier: */
2198 bb_putchar('\n');
2199 G.flag_SIGINT = 0;
2200 }
2198 /* buglet: SIGINT will not make new prompt to appear _at once_, 2201 /* buglet: SIGINT will not make new prompt to appear _at once_,
2199 * only after <Enter>. (^C will work) */ 2202 * only after <Enter>. (^C works immediately) */
2200 r = read_line_input(G.line_input_state, prompt_str, 2203 r = read_line_input(G.line_input_state, prompt_str,
2201 G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1, 2204 G.user_input_buf, CONFIG_FEATURE_EDITING_MAX_LEN-1,
2202 /*timeout*/ -1 2205 /*timeout*/ -1
2203 ); 2206 );
2204 /* catch *SIGINT* etc (^C is handled by read_line_input) */ 2207 /* read_line_input intercepts ^C, "convert" it to SIGINT */
2208 if (r == 0) {
2209 write(STDOUT_FILENO, "^C", 2);
2210 raise(SIGINT);
2211 }
2205 check_and_run_traps(); 2212 check_and_run_traps();
2206 } while (r == 0 || G.flag_SIGINT); /* repeat if ^C or SIGINT */ 2213 if (r != 0 && !G.flag_SIGINT)
2214 break;
2215 /* ^C or SIGINT: repeat */
2216 G.last_exitcode = 128 + SIGINT;
2217 }
2207 if (r < 0) { 2218 if (r < 0) {
2208 /* EOF/error detected */ 2219 /* EOF/error detected */
2209 i->p = NULL; 2220 i->p = NULL;
@@ -2213,7 +2224,7 @@ static int get_user_input(struct in_str *i)
2213 i->p = G.user_input_buf; 2224 i->p = G.user_input_buf;
2214 return (unsigned char)*i->p++; 2225 return (unsigned char)*i->p++;
2215# else 2226# else
2216 do { 2227 for (;;) {
2217 G.flag_SIGINT = 0; 2228 G.flag_SIGINT = 0;
2218 if (i->last_char == '\0' || i->last_char == '\n') { 2229 if (i->last_char == '\0' || i->last_char == '\n') {
2219 /* Why check_and_run_traps here? Try this interactively: 2230 /* Why check_and_run_traps here? Try this interactively:
@@ -2225,8 +2236,18 @@ static int get_user_input(struct in_str *i)
2225 fputs(prompt_str, stdout); 2236 fputs(prompt_str, stdout);
2226 } 2237 }
2227 fflush_all(); 2238 fflush_all();
2239//FIXME: here ^C or SIGINT will have effect only after <Enter>
2228 r = fgetc(i->file); 2240 r = fgetc(i->file);
2229 } while (G.flag_SIGINT || r == '\0'); 2241 /* In !ENABLE_FEATURE_EDITING we don't use read_line_input,
2242 * no ^C masking happens during fgetc, no special code for ^C:
2243 * it generates SIGINT as usual.
2244 */
2245 check_and_run_traps();
2246 if (G.flag_SIGINT)
2247 G.last_exitcode = 128 + SIGINT;
2248 if (r != '\0')
2249 break;
2250 }
2230 return r; 2251 return r;
2231# endif 2252# endif
2232} 2253}
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" \
41 "1\n" \ 41 "1\n" \
42 "" "" 42 "" ""
43SKIP= 43SKIP=
44optional FEATURE_FIND_MAXDEPTH
45testing "find / -maxdepth 0 -name /" \
46 "find / -maxdepth 0 -name /" \
47 "/\n" \
48 "" ""
49testing "find // -maxdepth 0 -name /" \
50 "find // -maxdepth 0 -name /" \
51 "//\n" \
52 "" ""
53testing "find / -maxdepth 0 -name //" \
54 "find / -maxdepth 0 -name //" \
55 "" \
56 "" ""
57testing "find // -maxdepth 0 -name //" \
58 "find // -maxdepth 0 -name //" \
59 "" \
60 "" ""
61SKIP=
62
63testing "find ./// -name ." \
64 "find ./// -name ." \
65 ".///\n" \
66 "" ""
67testing "find ./// -name .///" \
68 "find ./// -name .///" \
69 "" \
70 "" ""
44 71
45# testing "description" "command" "result" "infile" "stdin" 72# testing "description" "command" "result" "infile" "stdin"
46 73
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 \$?" \
96testing "grep -x -F (partial match 2)" "grep -x -F foo input ; echo \$?" \ 96testing "grep -x -F (partial match 2)" "grep -x -F foo input ; echo \$?" \
97 "1\n" "bar foo\n" "" 97 "1\n" "bar foo\n" ""
98 98
99optional FEATURE_GREP_EGREP_ALIAS 99optional EGREP
100testing "grep -E supports extended regexps" "grep -E fo+" "foo\n" "" \ 100testing "grep -E supports extended regexps" "grep -E fo+" "foo\n" "" \
101 "b\ar\nfoo\nbaz" 101 "b\ar\nfoo\nbaz"
102testing "grep is also egrep" "egrep foo" "foo\n" "" "foo\nbar\n" 102testing "grep is also egrep" "egrep foo" "foo\n" "" "foo\nbar\n"
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
242 zxc 242 zxc
243" 243"
244 244
245testing "patch internal buffering bug?" \
246 'patch -p1 2>&1; echo $?; cat input' \
247"\
248patching file input
2490
250foo
251
252
253
254
255
256
2571
2582
2593
260
261bar
262" \
263"\
264foo
265
266
267
268
269
270
271
272bar
273" \
274"\
275--- a/input.orig
276+++ b/input
277@@ -5,5 +5,8 @@ foo
278
279
280
281+1
282+2
283+3
284
285 bar
286--
2872.9.2
288" \
289
245rm input.orig 2>/dev/null 290rm input.orig 2>/dev/null
246 291
247exit $FAILCOUNT 292exit $FAILCOUNT
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=
299" 299"
300SKIP= 300SKIP=
301 301
302optional UNICODE_SUPPORT
303testing "Pax-encoded UTF8 names and symlinks" '\
304tar xvf ../tar.utf8.tar.bz2 2>&1; echo $?
305export LANG=en_US.UTF-8
306ls -l etc/ssl/certs/* | sed "s:.*etc/:etc/:"
307unset LANG
308rm -rf etc usr
309' "\
310etc/ssl/certs/3b2716e5.0
311etc/ssl/certs/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
312etc/ssl/certs/f80cc7f6.0
313usr/share/ca-certificates/mozilla/EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.crt
3140
315etc/ssl/certs/3b2716e5.0 -> EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
316etc/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
317etc/ssl/certs/f80cc7f6.0 -> EBG_Elektronik_Sertifika_Hizmet_Sağlayıcısı.pem
318" \
319"" ""
320SKIP=
321
302 322
303cd .. && rm -rf tar.tempdir || exit 1 323cd .. && rm -rf tar.tempdir || exit 1
304 324
diff --git a/testsuite/tar.utf8.tar.bz2 b/testsuite/tar.utf8.tar.bz2
new file mode 100644
index 000000000..0398e1aea
--- /dev/null
+++ b/testsuite/tar.utf8.tar.bz2
Binary files differ
diff --git a/util-linux/Config.src b/util-linux/Config.src
index 922cabdb8..3c522f948 100644
--- a/util-linux/Config.src
+++ b/util-linux/Config.src
@@ -7,553 +7,6 @@ menu "Linux System Utilities"
7 7
8INSERT 8INSERT
9 9
10config ACPID
11 bool "acpid"
12 default y
13 select PLATFORM_LINUX
14 help
15 acpid listens to ACPI events coming either in textual form from
16 /proc/acpi/event (though it is marked deprecated it is still widely
17 used and _is_ a standard) or in binary form from specified evdevs
18 (just use /dev/input/event*).
19
20 It parses the event to retrieve ACTION and a possible PARAMETER.
21 It then spawns /etc/acpi/<ACTION>[/<PARAMETER>] either via run-parts
22 (if the resulting path is a directory) or directly as an executable.
23
24 N.B. acpid relies on run-parts so have the latter installed.
25
26config FEATURE_ACPID_COMPAT
27 bool "Accept and ignore redundant options"
28 default y
29 depends on ACPID
30 help
31 Accept and ignore compatibility options -g -m -s -S -v.
32
33config BLKID
34 bool "blkid"
35 default y
36 select PLATFORM_LINUX
37 select VOLUMEID
38 help
39 Lists labels and UUIDs of all filesystems.
40 WARNING:
41 With all submodules selected, it will add ~8k to busybox.
42
43config FEATURE_BLKID_TYPE
44 bool "Print filesystem type"
45 default n
46 depends on BLKID
47 help
48 Show TYPE="filesystem type"
49
50config DMESG
51 bool "dmesg"
52 default y
53 select PLATFORM_LINUX
54 help
55 dmesg is used to examine or control the kernel ring buffer. When the
56 Linux kernel prints messages to the system log, they are stored in
57 the kernel ring buffer. You can use dmesg to print the kernel's ring
58 buffer, clear the kernel ring buffer, change the size of the kernel
59 ring buffer, and change the priority level at which kernel messages
60 are also logged to the system console. Enable this option if you
61 wish to enable the 'dmesg' utility.
62
63config FEATURE_DMESG_PRETTY
64 bool "Pretty dmesg output"
65 default y
66 depends on DMESG
67 help
68 If you wish to scrub the syslog level from the output, say 'Y' here.
69 The syslog level is a string prefixed to every line with the form
70 "<#>".
71
72 With this option you will see:
73 # dmesg
74 Linux version 2.6.17.4 .....
75 BIOS-provided physical RAM map:
76 BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
77
78 Without this option you will see:
79 # dmesg
80 <5>Linux version 2.6.17.4 .....
81 <6>BIOS-provided physical RAM map:
82 <6> BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
83
84config FBSET
85 bool "fbset"
86 default y
87 select PLATFORM_LINUX
88 help
89 fbset is used to show or change the settings of a Linux frame buffer
90 device. The frame buffer device provides a simple and unique
91 interface to access a graphics display. Enable this option
92 if you wish to enable the 'fbset' utility.
93
94config FEATURE_FBSET_FANCY
95 bool "Turn on extra fbset options"
96 default y
97 depends on FBSET
98 help
99 This option enables extended fbset options, allowing one to set the
100 framebuffer size, color depth, etc. interface to access a graphics
101 display. Enable this option if you wish to enable extended fbset
102 options.
103
104config FEATURE_FBSET_READMODE
105 bool "Turn on fbset readmode support"
106 default y
107 depends on FBSET
108 help
109 This option allows fbset to read the video mode database stored by
110 default as /etc/fb.modes, which can be used to set frame buffer
111 device to pre-defined video modes.
112
113config FDFLUSH
114 bool "fdflush"
115 default y
116 select PLATFORM_LINUX
117 help
118 fdflush is only needed when changing media on slightly-broken
119 removable media drives. It is used to make Linux believe that a
120 hardware disk-change switch has been actuated, which causes Linux to
121 forget anything it has cached from the previous media. If you have
122 such a slightly-broken drive, you will need to run fdflush every time
123 you change a disk. Most people have working hardware and can safely
124 leave this disabled.
125
126config FDFORMAT
127 bool "fdformat"
128 default y
129 select PLATFORM_LINUX
130 help
131 fdformat is used to low-level format a floppy disk.
132
133config FDISK
134 bool "fdisk"
135 default y
136 select PLATFORM_LINUX
137 help
138 The fdisk utility is used to divide hard disks into one or more
139 logical disks, which are generally called partitions. This utility
140 can be used to list and edit the set of partitions or BSD style
141 'disk slices' that are defined on a hard drive.
142
143config FDISK_SUPPORT_LARGE_DISKS
144 bool "Support over 4GB disks"
145 default y
146 depends on FDISK
147 depends on !LFS # with LFS no special code is needed
148 help
149 Enable this option to support large disks > 4GB.
150
151config FEATURE_FDISK_WRITABLE
152 bool "Write support"
153 default y
154 depends on FDISK
155 help
156 Enabling this option allows you to create or change a partition table
157 and write those changes out to disk. If you leave this option
158 disabled, you will only be able to view the partition table.
159
160config FEATURE_AIX_LABEL
161 bool "Support AIX disklabels"
162 default n
163 depends on FDISK && FEATURE_FDISK_WRITABLE
164 help
165 Enabling this option allows you to create or change AIX disklabels.
166 Most people can safely leave this option disabled.
167
168config FEATURE_SGI_LABEL
169 bool "Support SGI disklabels"
170 default n
171 depends on FDISK && FEATURE_FDISK_WRITABLE
172 help
173 Enabling this option allows you to create or change SGI disklabels.
174 Most people can safely leave this option disabled.
175
176config FEATURE_SUN_LABEL
177 bool "Support SUN disklabels"
178 default n
179 depends on FDISK && FEATURE_FDISK_WRITABLE
180 help
181 Enabling this option allows you to create or change SUN disklabels.
182 Most people can safely leave this option disabled.
183
184config FEATURE_OSF_LABEL
185 bool "Support BSD disklabels"
186 default n
187 depends on FDISK && FEATURE_FDISK_WRITABLE
188 help
189 Enabling this option allows you to create or change BSD disklabels
190 and define and edit BSD disk slices.
191
192config FEATURE_GPT_LABEL
193 bool "Support GPT disklabels"
194 default n
195 depends on FDISK && FEATURE_FDISK_WRITABLE
196 help
197 Enabling this option allows you to view GUID Partition Table
198 disklabels.
199
200config FEATURE_FDISK_ADVANCED
201 bool "Support expert mode"
202 default y
203 depends on FDISK && FEATURE_FDISK_WRITABLE
204 help
205 Enabling this option allows you to do terribly unsafe things like
206 define arbitrary drive geometry, move the beginning of data in a
207 partition, and similarly evil things. Unless you have a very good
208 reason you would be wise to leave this disabled.
209
210config FINDFS
211 bool "findfs"
212 default y
213 select PLATFORM_LINUX
214 select VOLUMEID
215 help
216 Prints the name of a filesystem with given label or UUID.
217 WARNING:
218 With all submodules selected, it will add ~8k to busybox.
219
220config FLOCK
221 bool "flock"
222 default y
223 help
224 Manage locks from shell scripts
225
226config FREERAMDISK
227 bool "freeramdisk"
228 default y
229 select PLATFORM_LINUX
230 help
231 Linux allows you to create ramdisks. This utility allows you to
232 delete them and completely free all memory that was used for the
233 ramdisk. For example, if you boot Linux into a ramdisk and later
234 pivot_root, you may want to free the memory that is allocated to the
235 ramdisk. If you have no use for freeing memory from a ramdisk, leave
236 this disabled.
237
238config FSCK_MINIX
239 bool "fsck_minix"
240 default y
241 help
242 The minix filesystem is a nice, small, compact, read-write filesystem
243 with little overhead. It is not a journaling filesystem however and
244 can experience corruption if it is not properly unmounted or if the
245 power goes off in the middle of a write. This utility allows you to
246 check for and attempt to repair any corruption that occurs to a minix
247 filesystem.
248
249config MKFS_EXT2
250 bool "mkfs_ext2"
251 default y
252 select PLATFORM_LINUX
253 help
254 Utility to create EXT2 filesystems.
255
256config MKFS_MINIX
257 bool "mkfs_minix"
258 default y
259 select PLATFORM_LINUX
260 help
261 The minix filesystem is a nice, small, compact, read-write filesystem
262 with little overhead. If you wish to be able to create minix
263 filesystems this utility will do the job for you.
264
265config FEATURE_MINIX2
266 bool "Support Minix fs v2 (fsck_minix/mkfs_minix)"
267 default y
268 depends on FSCK_MINIX || MKFS_MINIX
269 help
270 If you wish to be able to create version 2 minix filesystems, enable
271 this. If you enabled 'mkfs_minix' then you almost certainly want to
272 be using the version 2 filesystem support.
273
274config MKFS_REISER
275 bool "mkfs_reiser"
276 default n
277 select PLATFORM_LINUX
278 help
279 Utility to create ReiserFS filesystems.
280 Note: this applet needs a lot of testing and polishing.
281
282config MKFS_VFAT
283 bool "mkfs_vfat"
284 default y
285 select PLATFORM_LINUX
286 help
287 Utility to create FAT32 filesystems.
288
289config GETOPT
290 bool "getopt"
291 default y
292 help
293 The getopt utility is used to break up (parse) options in command
294 lines to make it easy to write complex shell scripts that also check
295 for legal (and illegal) options. If you want to write horribly
296 complex shell scripts, or use some horribly complex shell script
297 written by others, this utility may be for you. Most people will
298 wisely leave this disabled.
299
300config FEATURE_GETOPT_LONG
301 bool "Support option -l"
302 default y if LONG_OPTS
303 depends on GETOPT
304 help
305 Enable support for long options (option -l).
306
307config HEXDUMP
308 bool "hexdump"
309 default y
310 help
311 The hexdump utility is used to display binary data in a readable
312 way that is comparable to the output from most hex editors.
313
314config FEATURE_HEXDUMP_REVERSE
315 bool "Support -R, reverse of 'hexdump -Cv'"
316 default y
317 depends on HEXDUMP
318 help
319 The hexdump utility is used to display binary data in an ascii
320 readable way. This option creates binary data from an ascii input.
321 NB: this option is non-standard. It's unwise to use it in scripts
322 aimed to be portable.
323
324config HD
325 bool "hd"
326 default y
327 depends on HEXDUMP
328 help
329 hd is an alias to hexdump -C.
330
331config HWCLOCK
332 bool "hwclock"
333 default y
334 select PLATFORM_LINUX
335 help
336 The hwclock utility is used to read and set the hardware clock
337 on a system. This is primarily used to set the current time on
338 shutdown in the hardware clock, so the hardware will keep the
339 correct time when Linux is _not_ running.
340
341config FEATURE_HWCLOCK_LONG_OPTIONS
342 bool "Support long options (--hctosys,...)"
343 default y
344 depends on HWCLOCK && LONG_OPTS
345 help
346 By default, the hwclock utility only uses short options. If you
347 are overly fond of its long options, such as --hctosys, --utc, etc)
348 then enable this option.
349
350config FEATURE_HWCLOCK_ADJTIME_FHS
351 bool "Use FHS /var/lib/hwclock/adjtime"
352 default n # util-linux-ng in Fedora 13 still uses /etc/adjtime
353 depends on HWCLOCK
354 help
355 Starting with FHS 2.3, the adjtime state file is supposed to exist
356 at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish
357 to use the FHS behavior, answer Y here, otherwise answer N for the
358 classic /etc/adjtime path.
359
360 pathname.com/fhs/pub/fhs-2.3.html#VARLIBHWCLOCKSTATEDIRECTORYFORHWCLO
361
362config IPCRM
363 bool "ipcrm"
364 default y
365 help
366 The ipcrm utility allows the removal of System V interprocess
367 communication (IPC) objects and the associated data structures
368 from the system.
369
370config IPCS
371 bool "ipcs"
372 default y
373 select PLATFORM_LINUX
374 help
375 The ipcs utility is used to provide information on the currently
376 allocated System V interprocess (IPC) objects in the system.
377
378config LOSETUP
379 bool "losetup"
380 default y
381 select PLATFORM_LINUX
382 help
383 losetup is used to associate or detach a loop device with a regular
384 file or block device, and to query the status of a loop device. This
385 version does not currently support enabling data encryption.
386
387config LSPCI
388 bool "lspci"
389 default y
390 #select PLATFORM_LINUX
391 help
392 lspci is a utility for displaying information about PCI buses in the
393 system and devices connected to them.
394
395 This version uses sysfs (/sys/bus/pci/devices) only.
396
397config LSUSB
398 bool "lsusb"
399 default y
400 #select PLATFORM_LINUX
401 help
402 lsusb is a utility for displaying information about USB buses in the
403 system and devices connected to them.
404
405 This version uses sysfs (/sys/bus/usb/devices) only.
406
407config MKSWAP
408 bool "mkswap"
409 default y
410 help
411 The mkswap utility is used to configure a file or disk partition as
412 Linux swap space. This allows Linux to use the entire file or
413 partition as if it were additional RAM, which can greatly increase
414 the capability of low-memory machines. This additional memory is
415 much slower than real RAM, but can be very helpful at preventing your
416 applications being killed by the Linux out of memory (OOM) killer.
417 Once you have created swap space using 'mkswap' you need to enable
418 the swap space using the 'swapon' utility.
419
420config FEATURE_MKSWAP_UUID
421 bool "UUID support"
422 default y
423 depends on MKSWAP
424 help
425 Generate swap spaces with universally unique identifiers.
426
427config MORE
428 bool "more"
429 default y
430 help
431 more is a simple utility which allows you to read text one screen
432 sized page at a time. If you want to read text that is larger than
433 the screen, and you are using anything faster than a 300 baud modem,
434 you will probably find this utility very helpful. If you don't have
435 any need to reading text files, you can leave this disabled.
436
437config PIVOT_ROOT
438 bool "pivot_root"
439 default y
440 select PLATFORM_LINUX
441 help
442 The pivot_root utility swaps the mount points for the root filesystem
443 with some other mounted filesystem. This allows you to do all sorts
444 of wild and crazy things with your Linux system and is far more
445 powerful than 'chroot'.
446
447 Note: This is for initrd in linux 2.4. Under initramfs (introduced
448 in linux 2.6) use switch_root instead.
449
450config RDATE
451 bool "rdate"
452 default y
453 help
454 The rdate utility allows you to synchronize the date and time of your
455 system clock with the date and time of a remote networked system using
456 the RFC868 protocol, which is built into the inetd daemon on most
457 systems.
458
459config RDEV
460 bool "rdev"
461 default y
462 help
463 Print the device node associated with the filesystem mounted at '/'.
464
465config READPROFILE
466 bool "readprofile"
467 default y
468 #select PLATFORM_LINUX
469 help
470 This allows you to parse /proc/profile for basic profiling.
471
472config RTCWAKE
473 bool "rtcwake"
474 default y
475 select PLATFORM_LINUX
476 help
477 Enter a system sleep state until specified wakeup time.
478
479config SCRIPT
480 bool "script"
481 default y
482 help
483 The script makes typescript of terminal session.
484
485config SCRIPTREPLAY
486 bool "scriptreplay"
487 default y
488 help
489 This program replays a typescript, using timing information
490 given by script -t.
491
492config SWAPONOFF
493 bool "swaponoff"
494 default y
495 select PLATFORM_LINUX
496 help
497 This option enables both the 'swapon' and the 'swapoff' utilities.
498 Once you have created some swap space using 'mkswap', you also need
499 to enable your swap space with the 'swapon' utility. The 'swapoff'
500 utility is used, typically at system shutdown, to disable any swap
501 space. If you are not using any swap space, you can leave this
502 option disabled.
503
504config FEATURE_SWAPON_DISCARD
505 bool "Support discard option -d"
506 default y
507 depends on SWAPONOFF
508 help
509 Enable support for discarding swap area blocks at swapon and/or as
510 the kernel frees them. This option enables both the -d option on
511 'swapon' and the 'discard' option for swap entries in /etc/fstab.
512
513config FEATURE_SWAPON_PRI
514 bool "Support priority option -p"
515 default y
516 depends on SWAPONOFF
517 help
518 Enable support for setting swap device priority in swapon.
519
520config SWITCH_ROOT
521 bool "switch_root"
522 default y
523 select PLATFORM_LINUX
524 help
525 The switch_root utility is used from initramfs to select a new
526 root device. Under initramfs, you have to use this instead of
527 pivot_root. (Stop reading here if you don't care why.)
528
529 Booting with initramfs extracts a gzipped cpio archive into rootfs
530 (which is a variant of ramfs/tmpfs). Because rootfs can't be moved
531 or unmounted*, pivot_root will not work from initramfs. Instead,
532 switch_root deletes everything out of rootfs (including itself),
533 does a mount --move that overmounts rootfs with the new root, and
534 then execs the specified init program.
535
536 * Because the Linux kernel uses rootfs internally as the starting
537 and ending point for searching through the kernel's doubly linked
538 list of active mount points. That's why.
539
540config UMOUNT
541 bool "umount"
542 default y
543 select PLATFORM_LINUX
544 help
545 When you want to remove a mounted filesystem from its current mount
546 point, for example when you are shutting down the system, the
547 'umount' utility is the tool to use. If you enabled the 'mount'
548 utility, you almost certainly also want to enable 'umount'.
549
550config FEATURE_UMOUNT_ALL
551 bool "Support option -a"
552 default y
553 depends on UMOUNT
554 help
555 Support -a option to unmount all currently mounted filesystems.
556
557comment "Common options for mount/umount" 10comment "Common options for mount/umount"
558 depends on MOUNT || UMOUNT 11 depends on MOUNT || UMOUNT
559 12
diff --git a/util-linux/Kbuild.src b/util-linux/Kbuild.src
index 0b87c52ac..6b4fb7470 100644
--- a/util-linux/Kbuild.src
+++ b/util-linux/Kbuild.src
@@ -7,39 +7,3 @@
7lib-y:= 7lib-y:=
8 8
9INSERT 9INSERT
10lib-$(CONFIG_ACPID) += acpid.o
11lib-$(CONFIG_BLKID) += blkid.o
12lib-$(CONFIG_DMESG) += dmesg.o
13lib-$(CONFIG_FBSET) += fbset.o
14lib-$(CONFIG_FDFLUSH) += freeramdisk.o
15lib-$(CONFIG_FDFORMAT) += fdformat.o
16lib-$(CONFIG_FDISK) += fdisk.o
17lib-$(CONFIG_FINDFS) += findfs.o
18lib-$(CONFIG_FLOCK) += flock.o
19lib-$(CONFIG_FREERAMDISK) += freeramdisk.o
20lib-$(CONFIG_FSCK_MINIX) += fsck_minix.o
21lib-$(CONFIG_GETOPT) += getopt.o
22lib-$(CONFIG_HEXDUMP) += hexdump.o
23lib-$(CONFIG_HWCLOCK) += hwclock.o
24lib-$(CONFIG_IPCRM) += ipcrm.o
25lib-$(CONFIG_IPCS) += ipcs.o
26lib-$(CONFIG_LOSETUP) += losetup.o
27lib-$(CONFIG_LSPCI) += lspci.o
28lib-$(CONFIG_LSUSB) += lsusb.o
29lib-$(CONFIG_MKFS_EXT2) += mkfs_ext2.o
30lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o
31lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o
32lib-$(CONFIG_MKFS_VFAT) += mkfs_vfat.o
33lib-$(CONFIG_MKSWAP) += mkswap.o
34lib-$(CONFIG_MORE) += more.o
35lib-$(CONFIG_MOUNT) += mount.o
36lib-$(CONFIG_PIVOT_ROOT) += pivot_root.o
37lib-$(CONFIG_RDATE) += rdate.o
38lib-$(CONFIG_RDEV) += rdev.o
39lib-$(CONFIG_READPROFILE) += readprofile.o
40lib-$(CONFIG_RTCWAKE) += rtcwake.o
41lib-$(CONFIG_SCRIPT) += script.o
42lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o
43lib-$(CONFIG_SWAPONOFF) += swaponoff.o
44lib-$(CONFIG_SWITCH_ROOT) += switch_root.o
45lib-$(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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config ACPID
10//config: bool "acpid"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: acpid listens to ACPI events coming either in textual form from
15//config: /proc/acpi/event (though it is marked deprecated it is still widely
16//config: used and _is_ a standard) or in binary form from specified evdevs
17//config: (just use /dev/input/event*).
18//config:
19//config: It parses the event to retrieve ACTION and a possible PARAMETER.
20//config: It then spawns /etc/acpi/<ACTION>[/<PARAMETER>] either via run-parts
21//config: (if the resulting path is a directory) or directly as an executable.
22//config:
23//config: N.B. acpid relies on run-parts so have the latter installed.
24//config:
25//config:config FEATURE_ACPID_COMPAT
26//config: bool "Accept and ignore redundant options"
27//config: default y
28//config: depends on ACPID
29//config: help
30//config: Accept and ignore compatibility options -g -m -s -S -v.
31
32//applet:IF_ACPID(APPLET(acpid, BB_DIR_SBIN, BB_SUID_DROP))
33
34//kbuild:lib-$(CONFIG_ACPID) += acpid.o
9 35
10//usage:#define acpid_trivial_usage 36//usage:#define acpid_trivial_usage
11//usage: "[-df] [-c CONFDIR] [-l LOGFILE] [-a ACTIONFILE] [-M MAPFILE] [-e PROC_EVENT_FILE] [-p PIDFILE]" 37//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 @@
5 * 5 *
6 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 6 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
7 */ 7 */
8
9//config:config BLKDISCARD 8//config:config BLKDISCARD
10//config: bool "blkdiscard" 9//config: bool "blkdiscard"
11//config: default y 10//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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config BLKID
10//config: bool "blkid"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: select VOLUMEID
14//config: help
15//config: Lists labels and UUIDs of all filesystems.
16//config: WARNING:
17//config: With all submodules selected, it will add ~8k to busybox.
18//config:
19//config:config FEATURE_BLKID_TYPE
20//config: bool "Print filesystem type"
21//config: default n
22//config: depends on BLKID
23//config: help
24//config: Show TYPE="filesystem type"
25
26//applet:IF_BLKID(APPLET(blkid, BB_DIR_SBIN, BB_SUID_DROP))
27
28//kbuild:lib-$(CONFIG_BLKID) += blkid.o
9 29
10//usage:#define blkid_trivial_usage 30//usage:#define blkid_trivial_usage
11//usage: "[BLOCKDEV]..." 31//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 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8
9//applet:IF_BLOCKDEV(APPLET(blockdev, BB_DIR_SBIN, BB_SUID_DROP))
10
11//kbuild:lib-$(CONFIG_BLOCKDEV) += blockdev.o
12
13//config:config BLOCKDEV 8//config:config BLOCKDEV
14//config: bool "blockdev" 9//config: bool "blockdev"
15//config: default y 10//config: default y
16//config: help 11//config: help
17//config: Performs some ioctls with block devices. 12//config: Performs some ioctls with block devices.
18 13
14//applet:IF_BLOCKDEV(APPLET(blockdev, BB_DIR_SBIN, BB_SUID_DROP))
15
16//kbuild:lib-$(CONFIG_BLOCKDEV) += blockdev.o
17
19//usage:#define blockdev_trivial_usage 18//usage:#define blockdev_trivial_usage
20//usage: "OPTION BLOCKDEV" 19//usage: "OPTION BLOCKDEV"
21//usage:#define blockdev_full_usage "\n\n" 20//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 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11//config:config DMESG
12//config: bool "dmesg"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: dmesg is used to examine or control the kernel ring buffer. When the
17//config: Linux kernel prints messages to the system log, they are stored in
18//config: the kernel ring buffer. You can use dmesg to print the kernel's ring
19//config: buffer, clear the kernel ring buffer, change the size of the kernel
20//config: ring buffer, and change the priority level at which kernel messages
21//config: are also logged to the system console. Enable this option if you
22//config: wish to enable the 'dmesg' utility.
23//config:
24//config:config FEATURE_DMESG_PRETTY
25//config: bool "Pretty dmesg output"
26//config: default y
27//config: depends on DMESG
28//config: help
29//config: If you wish to scrub the syslog level from the output, say 'Y' here.
30//config: The syslog level is a string prefixed to every line with the form
31//config: "<#>".
32//config:
33//config: With this option you will see:
34//config: # dmesg
35//config: Linux version 2.6.17.4 .....
36//config: BIOS-provided physical RAM map:
37//config: BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
38//config:
39//config: Without this option you will see:
40//config: # dmesg
41//config: <5>Linux version 2.6.17.4 .....
42//config: <6>BIOS-provided physical RAM map:
43//config: <6> BIOS-e820: 0000000000000000 - 000000000009f000 (usable)
44
45//applet:IF_DMESG(APPLET(dmesg, BB_DIR_BIN, BB_SUID_DROP))
46
47//kbuild:lib-$(CONFIG_DMESG) += dmesg.o
11 48
12//usage:#define dmesg_trivial_usage 49//usage:#define dmesg_trivial_usage
13//usage: "[-c] [-n LEVEL] [-s SIZE]" 50//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 @@
16//config: fatattr lists or changes the file attributes on a fat file system. 16//config: fatattr lists or changes the file attributes on a fat file system.
17 17
18//applet:IF_FATATTR(APPLET(fatattr, BB_DIR_BIN, BB_SUID_DROP)) 18//applet:IF_FATATTR(APPLET(fatattr, BB_DIR_BIN, BB_SUID_DROP))
19
19//kbuild:lib-$(CONFIG_FATATTR) += fatattr.o 20//kbuild:lib-$(CONFIG_FATATTR) += fatattr.o
20 21
21//usage:#define fatattr_trivial_usage 22//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 @@
11 * the GPL, and is (c) 1995-1999 by: 11 * the GPL, and is (c) 1995-1999 by:
12 * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be) 12 * Geert Uytterhoeven (Geert.Uytterhoeven@cs.kuleuven.ac.be)
13 */ 13 */
14//config:config FBSET
15//config: bool "fbset"
16//config: default y
17//config: select PLATFORM_LINUX
18//config: help
19//config: fbset is used to show or change the settings of a Linux frame buffer
20//config: device. The frame buffer device provides a simple and unique
21//config: interface to access a graphics display. Enable this option
22//config: if you wish to enable the 'fbset' utility.
23//config:
24//config:config FEATURE_FBSET_FANCY
25//config: bool "Turn on extra fbset options"
26//config: default y
27//config: depends on FBSET
28//config: help
29//config: This option enables extended fbset options, allowing one to set the
30//config: framebuffer size, color depth, etc. interface to access a graphics
31//config: display. Enable this option if you wish to enable extended fbset
32//config: options.
33//config:
34//config:config FEATURE_FBSET_READMODE
35//config: bool "Turn on fbset readmode support"
36//config: default y
37//config: depends on FBSET
38//config: help
39//config: This option allows fbset to read the video mode database stored by
40//config: default as /etc/fb.modes, which can be used to set frame buffer
41//config: device to pre-defined video modes.
42
43//applet:IF_FBSET(APPLET(fbset, BB_DIR_USR_SBIN, BB_SUID_DROP))
44
45//kbuild:lib-$(CONFIG_FBSET) += fbset.o
14 46
15//usage:#define fbset_trivial_usage 47//usage:#define fbset_trivial_usage
16//usage: "[OPTIONS] [MODE]" 48//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 @@
4 * 4 *
5 * Licensed under GPLv2, see file LICENSE in this source tree. 5 * Licensed under GPLv2, see file LICENSE in this source tree.
6 */ 6 */
7//config:config FDFORMAT
8//config: bool "fdformat"
9//config: default y
10//config: select PLATFORM_LINUX
11//config: help
12//config: fdformat is used to low-level format a floppy disk.
13
14//applet:IF_FDFORMAT(APPLET(fdformat, BB_DIR_USR_SBIN, BB_SUID_DROP))
15
16//kbuild:lib-$(CONFIG_FDFORMAT) += fdformat.o
7 17
8//usage:#define fdformat_trivial_usage 18//usage:#define fdformat_trivial_usage
9//usage: "[-n] DEVICE" 19//usage: "[-n] DEVICE"
diff --git a/util-linux/fdisk.c b/util-linux/fdisk.c
index 32a66d03d..b988e65a9 100644
--- a/util-linux/fdisk.c
+++ b/util-linux/fdisk.c
@@ -6,6 +6,86 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config FDISK
10//config: bool "fdisk"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: The fdisk utility is used to divide hard disks into one or more
15//config: logical disks, which are generally called partitions. This utility
16//config: can be used to list and edit the set of partitions or BSD style
17//config: 'disk slices' that are defined on a hard drive.
18//config:
19//config:config FDISK_SUPPORT_LARGE_DISKS
20//config: bool "Support over 4GB disks"
21//config: default y
22//config: depends on FDISK
23//config: depends on !LFS # with LFS no special code is needed
24//config: help
25//config: Enable this option to support large disks > 4GB.
26//config:
27//config:config FEATURE_FDISK_WRITABLE
28//config: bool "Write support"
29//config: default y
30//config: depends on FDISK
31//config: help
32//config: Enabling this option allows you to create or change a partition table
33//config: and write those changes out to disk. If you leave this option
34//config: disabled, you will only be able to view the partition table.
35//config:
36//config:config FEATURE_AIX_LABEL
37//config: bool "Support AIX disklabels"
38//config: default n
39//config: depends on FDISK && FEATURE_FDISK_WRITABLE
40//config: help
41//config: Enabling this option allows you to create or change AIX disklabels.
42//config: Most people can safely leave this option disabled.
43//config:
44//config:config FEATURE_SGI_LABEL
45//config: bool "Support SGI disklabels"
46//config: default n
47//config: depends on FDISK && FEATURE_FDISK_WRITABLE
48//config: help
49//config: Enabling this option allows you to create or change SGI disklabels.
50//config: Most people can safely leave this option disabled.
51//config:
52//config:config FEATURE_SUN_LABEL
53//config: bool "Support SUN disklabels"
54//config: default n
55//config: depends on FDISK && FEATURE_FDISK_WRITABLE
56//config: help
57//config: Enabling this option allows you to create or change SUN disklabels.
58//config: Most people can safely leave this option disabled.
59//config:
60//config:config FEATURE_OSF_LABEL
61//config: bool "Support BSD disklabels"
62//config: default n
63//config: depends on FDISK && FEATURE_FDISK_WRITABLE
64//config: help
65//config: Enabling this option allows you to create or change BSD disklabels
66//config: and define and edit BSD disk slices.
67//config:
68//config:config FEATURE_GPT_LABEL
69//config: bool "Support GPT disklabels"
70//config: default n
71//config: depends on FDISK && FEATURE_FDISK_WRITABLE
72//config: help
73//config: Enabling this option allows you to view GUID Partition Table
74//config: disklabels.
75//config:
76//config:config FEATURE_FDISK_ADVANCED
77//config: bool "Support expert mode"
78//config: default y
79//config: depends on FDISK && FEATURE_FDISK_WRITABLE
80//config: help
81//config: Enabling this option allows you to do terribly unsafe things like
82//config: define arbitrary drive geometry, move the beginning of data in a
83//config: partition, and similarly evil things. Unless you have a very good
84//config: reason you would be wise to leave this disabled.
85
86//applet:IF_FDISK(APPLET(fdisk, BB_DIR_SBIN, BB_SUID_DROP))
87
88//kbuild:lib-$(CONFIG_FDISK) += fdisk.o
9 89
10/* Looks like someone forgot to add this to config system */ 90/* Looks like someone forgot to add this to config system */
11//usage:#ifndef ENABLE_FEATURE_FDISK_BLKSIZE 91//usage:#ifndef ENABLE_FEATURE_FDISK_BLKSIZE
@@ -41,6 +121,7 @@
41# define BLKGETSIZE64 _IOR(0x12,114,size_t) 121# define BLKGETSIZE64 _IOR(0x12,114,size_t)
42#endif 122#endif
43#include "libbb.h" 123#include "libbb.h"
124#include "unicode.h"
44 125
45#if BB_LITTLE_ENDIAN 126#if BB_LITTLE_ENDIAN
46# define inline_if_little_endian ALWAYS_INLINE 127# define inline_if_little_endian ALWAYS_INLINE
diff --git a/util-linux/fdisk_gpt.c b/util-linux/fdisk_gpt.c
index 715e227ca..45d2aa6e7 100644
--- a/util-linux/fdisk_gpt.c
+++ b/util-linux/fdisk_gpt.c
@@ -36,14 +36,13 @@ typedef struct {
36 uint64_t lba_start; 36 uint64_t lba_start;
37 uint64_t lba_end; 37 uint64_t lba_end;
38 uint64_t flags; 38 uint64_t flags;
39 uint16_t name[36]; 39 uint16_t name36[36];
40} gpt_partition; 40} gpt_partition;
41 41
42static gpt_header *gpt_hdr; 42static gpt_header *gpt_hdr;
43 43
44static char *part_array; 44static char *part_array;
45static unsigned int n_parts; 45static unsigned int n_parts;
46static unsigned int part_array_len;
47static unsigned int part_entry_len; 46static unsigned int part_entry_len;
48 47
49static inline gpt_partition * 48static inline gpt_partition *
@@ -73,18 +72,34 @@ gpt_print_guid(uint8_t *buf)
73 buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]); 72 buf[10], buf[11], buf[12], buf[13], buf[14], buf[15]);
74} 73}
75 74
76/* TODO: real unicode support */
77static void 75static void
78gpt_print_wide(uint16_t *s, int max_len) 76gpt_print_wide36(uint16_t *s)
79{ 77{
78#if ENABLE_UNICODE_SUPPORT
79 char buf[37 * 4];
80 wchar_t wc[37];
80 int i = 0; 81 int i = 0;
81 82 while (i < ARRAY_SIZE(wc)-1) {
82 while (i < max_len) { 83 if (s[i] == 0)
83 if (*s == 0) 84 break;
84 return; 85 wc[i] = s[i];
85 fputc(*s, stdout); 86 i++;
86 s++; 87 }
88 wc[i] = 0;
89 if (wcstombs(buf, wc, sizeof(buf)) <= sizeof(buf)-1)
90 fputs(printable_string(NULL, buf), stdout);
91#else
92 char buf[37];
93 int i = 0;
94 while (i < ARRAY_SIZE(buf)-1) {
95 if (s[i] == 0)
96 break;
97 buf[i] = (0x20 <= s[i] && s[i] < 0x7f) ? s[i] : '?';
98 i++;
87 } 99 }
100 buf[i] = '\0';
101 fputs(buf, stdout);
102#endif
88} 103}
89 104
90static void 105static void
@@ -106,19 +121,28 @@ gpt_list_table(int xtra UNUSED_PARAM)
106 (unsigned long long)SWAP_LE64(gpt_hdr->first_usable_lba), 121 (unsigned long long)SWAP_LE64(gpt_hdr->first_usable_lba),
107 (unsigned long long)SWAP_LE64(gpt_hdr->last_usable_lba)); 122 (unsigned long long)SWAP_LE64(gpt_hdr->last_usable_lba));
108 123
109 puts("Number Start (sector) End (sector) Size Code Name"); 124/* "GPT fdisk" has a concept of 16-bit extension of the original MBR 8-bit type codes,
125 * which it displays here: its output columns are ... Size Code Name
126 * They are their own invention and are not stored on disk.
127 * Looks like they use them to support "hybrid" GPT: for example, they have
128 * AddType(0x8307, "69DAD710-2CE4-4E3C-B16C-21A1D49ABED3", "Linux ARM32 root (/)");
129 * and then (code>>8) matches what you need to put into MBR's type field for such a partition.
130 * To print those codes, we'd need a GUID lookup table. Lets just drop the "Code" column instead:
131 */
132 puts("Number Start (sector) End (sector) Size Name");
133 // 123456 123456789012345 123456789012345 12345 abc
110 for (i = 0; i < n_parts; i++) { 134 for (i = 0; i < n_parts; i++) {
111 gpt_partition *p = gpt_part(i); 135 gpt_partition *p = gpt_part(i);
112 if (p->lba_start) { 136 if (p->lba_start) {
113 smart_ulltoa5((1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start)) * sector_size, 137 smart_ulltoa5((1 + SWAP_LE64(p->lba_end) - SWAP_LE64(p->lba_start)) * sector_size,
114 numstr6, " KMGTPEZY")[0] = '\0'; 138 numstr6, " KMGTPEZY")[0] = '\0';
115 printf("%4u %15llu %15llu %11s %04x ", 139 printf("%6u %15llu %15llu %s ",
116 i + 1, 140 i + 1,
117 (unsigned long long)SWAP_LE64(p->lba_start), 141 (unsigned long long)SWAP_LE64(p->lba_start),
118 (unsigned long long)SWAP_LE64(p->lba_end), 142 (unsigned long long)SWAP_LE64(p->lba_end),
119 numstr6, 143 numstr6
120 0x0700 /* FIXME */); 144 );
121 gpt_print_wide(p->name, 18); 145 gpt_print_wide36(p->name36);
122 bb_putchar('\n'); 146 bb_putchar('\n');
123 } 147 }
124 } 148 }
@@ -127,6 +151,7 @@ gpt_list_table(int xtra UNUSED_PARAM)
127static int 151static int
128check_gpt_label(void) 152check_gpt_label(void)
129{ 153{
154 unsigned part_array_len;
130 struct partition *first = pt_offset(MBRbuffer, 0); 155 struct partition *first = pt_offset(MBRbuffer, 0);
131 struct pte pe; 156 struct pte pe;
132 uint32_t crc; 157 uint32_t crc;
@@ -150,6 +175,7 @@ check_gpt_label(void)
150 return 0; 175 return 0;
151 } 176 }
152 177
178 init_unicode();
153 if (!global_crc32_table) { 179 if (!global_crc32_table) {
154 global_crc32_table = crc32_filltable(NULL, 0); 180 global_crc32_table = crc32_filltable(NULL, 0);
155 } 181 }
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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config FINDFS
11//config: bool "findfs"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: select VOLUMEID
15//config: help
16//config: Prints the name of a filesystem with given label or UUID.
17//config: WARNING:
18//config: With all submodules selected, it will add ~8k to busybox.
19
20/* Benefits from suid root: better access to /dev/BLOCKDEVs: */
21//applet:IF_FINDFS(APPLET(findfs, BB_DIR_SBIN, BB_SUID_MAYBE))
22
23//kbuild:lib-$(CONFIG_FINDFS) += findfs.o
10 24
11//usage:#define findfs_trivial_usage 25//usage:#define findfs_trivial_usage
12//usage: "LABEL=label or UUID=uuid" 26//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 @@
3 * 3 *
4 * This is free software, licensed under the GNU General Public License v2. 4 * This is free software, licensed under the GNU General Public License v2.
5 */ 5 */
6//config:config FLOCK
7//config: bool "flock"
8//config: default y
9//config: help
10//config: Manage locks from shell scripts
11
12//applet:IF_FLOCK(APPLET(flock, BB_DIR_USR_BIN, BB_SUID_DROP))
13
14//kbuild:lib-$(CONFIG_FLOCK) += flock.o
6 15
7//usage:#define flock_trivial_usage 16//usage:#define flock_trivial_usage
8//usage: "[-sxun] FD|{FILE [-c] PROG ARGS}" 17//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 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11//config:config FDFLUSH
12//config: bool "fdflush"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: fdflush is only needed when changing media on slightly-broken
17//config: removable media drives. It is used to make Linux believe that a
18//config: hardware disk-change switch has been actuated, which causes Linux to
19//config: forget anything it has cached from the previous media. If you have
20//config: such a slightly-broken drive, you will need to run fdflush every time
21//config: you change a disk. Most people have working hardware and can safely
22//config: leave this disabled.
23//config:
24//config:config FREERAMDISK
25//config: bool "freeramdisk"
26//config: default y
27//config: select PLATFORM_LINUX
28//config: help
29//config: Linux allows you to create ramdisks. This utility allows you to
30//config: delete them and completely free all memory that was used for the
31//config: ramdisk. For example, if you boot Linux into a ramdisk and later
32//config: pivot_root, you may want to free the memory that is allocated to the
33//config: ramdisk. If you have no use for freeing memory from a ramdisk, leave
34//config: this disabled.
35
36//applet:IF_FDFLUSH(APPLET_ODDNAME(fdflush, freeramdisk, BB_DIR_BIN, BB_SUID_DROP, fdflush))
37//applet:IF_FREERAMDISK(APPLET(freeramdisk, BB_DIR_SBIN, BB_SUID_DROP))
38
39//kbuild:lib-$(CONFIG_FDFLUSH) += freeramdisk.o
40//kbuild:lib-$(CONFIG_FREERAMDISK) += freeramdisk.o
11 41
12//usage:#define freeramdisk_trivial_usage 42//usage:#define freeramdisk_trivial_usage
13//usage: "DEVICE" 43//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 @@
85 * The device may be a block device or a image of one, but this isn't 85 * The device may be a block device or a image of one, but this isn't
86 * enforced (but it's not much fun on a character device :-). 86 * enforced (but it's not much fun on a character device :-).
87 */ 87 */
88//config:config FSCK_MINIX
89//config: bool "fsck_minix"
90//config: default y
91//config: help
92//config: The minix filesystem is a nice, small, compact, read-write filesystem
93//config: with little overhead. It is not a journaling filesystem however and
94//config: can experience corruption if it is not properly unmounted or if the
95//config: power goes off in the middle of a write. This utility allows you to
96//config: check for and attempt to repair any corruption that occurs to a minix
97//config: filesystem.
98
99//applet:IF_FSCK_MINIX(APPLET_ODDNAME(fsck.minix, fsck_minix, BB_DIR_SBIN, BB_SUID_DROP, fsck_minix))
100
101//kbuild:lib-$(CONFIG_FSCK_MINIX) += fsck_minix.o
88 102
89//usage:#define fsck_minix_trivial_usage 103//usage:#define fsck_minix_trivial_usage
90//usage: "[-larvsmf] BLOCKDEV" 104//usage: "[-larvsmf] BLOCKDEV"
diff --git a/util-linux/getopt.c b/util-linux/getopt.c
index 18d490987..f6ecc3dde 100644
--- a/util-linux/getopt.c
+++ b/util-linux/getopt.c
@@ -28,8 +28,28 @@
28 * Removed --version/-V and --help/-h 28 * Removed --version/-V and --help/-h
29 * Removed parse_error(), using bb_error_msg() from Busybox instead 29 * Removed parse_error(), using bb_error_msg() from Busybox instead
30 * Replaced our_malloc with xmalloc and our_realloc with xrealloc 30 * Replaced our_malloc with xmalloc and our_realloc with xrealloc
31 *
32 */ 31 */
32//config:config GETOPT
33//config: bool "getopt"
34//config: default y
35//config: help
36//config: The getopt utility is used to break up (parse) options in command
37//config: lines to make it easy to write complex shell scripts that also check
38//config: for legal (and illegal) options. If you want to write horribly
39//config: complex shell scripts, or use some horribly complex shell script
40//config: written by others, this utility may be for you. Most people will
41//config: wisely leave this disabled.
42//config:
43//config:config FEATURE_GETOPT_LONG
44//config: bool "Support option -l"
45//config: default y if LONG_OPTS
46//config: depends on GETOPT
47//config: help
48//config: Enable support for long options (option -l).
49
50//applet:IF_GETOPT(APPLET(getopt, BB_DIR_BIN, BB_SUID_DROP))
51
52//kbuild:lib-$(CONFIG_GETOPT) += getopt.o
33 53
34//usage:#define getopt_trivial_usage 54//usage:#define getopt_trivial_usage
35//usage: "[OPTIONS] [--] OPTSTRING PARAMS" 55//usage: "[OPTIONS] [--] OPTSTRING PARAMS"
@@ -327,9 +347,9 @@ static struct option *add_long_options(struct option *long_options, char *option
327 347
328static void set_shell(const char *new_shell) 348static void set_shell(const char *new_shell)
329{ 349{
330 if (!strcmp(new_shell, "bash") || !strcmp(new_shell, "sh")) 350 if (strcmp(new_shell, "bash") == 0 || strcmp(new_shell, "sh") == 0)
331 return; 351 return;
332 if (!strcmp(new_shell, "tcsh") || !strcmp(new_shell, "csh")) 352 if (strcmp(new_shell, "tcsh") == 0 || strcmp(new_shell, "csh") == 0)
333 option_mask32 |= SHELL_IS_TCSH; 353 option_mask32 |= SHELL_IS_TCSH;
334 else 354 else
335 bb_error_msg("unknown shell '%s', assuming bash", new_shell); 355 bb_error_msg("unknown shell '%s', assuming bash", new_shell);
diff --git a/util-linux/hexdump.c b/util-linux/hexdump.c
index ac7e24ff8..4a7f641db 100644
--- a/util-linux/hexdump.c
+++ b/util-linux/hexdump.c
@@ -8,6 +8,34 @@
8 * 8 *
9 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 9 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
10 */ 10 */
11//config:config HEXDUMP
12//config: bool "hexdump"
13//config: default y
14//config: help
15//config: The hexdump utility is used to display binary data in a readable
16//config: way that is comparable to the output from most hex editors.
17//config:
18//config:config FEATURE_HEXDUMP_REVERSE
19//config: bool "Support -R, reverse of 'hexdump -Cv'"
20//config: default y
21//config: depends on HEXDUMP
22//config: help
23//config: The hexdump utility is used to display binary data in an ascii
24//config: readable way. This option creates binary data from an ascii input.
25//config: NB: this option is non-standard. It's unwise to use it in scripts
26//config: aimed to be portable.
27//config:
28//config:config HD
29//config: bool "hd"
30//config: default y
31//config: help
32//config: hd is an alias to hexdump -C.
33
34//applet:IF_HEXDUMP(APPLET_NOEXEC(hexdump, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hexdump))
35//applet:IF_HD(APPLET_NOEXEC(hd, hexdump, BB_DIR_USR_BIN, BB_SUID_DROP, hd))
36
37//kbuild:lib-$(CONFIG_HEXDUMP) += hexdump.o
38//kbuild:lib-$(CONFIG_HD) += hexdump.o
11 39
12//usage:#define hexdump_trivial_usage 40//usage:#define hexdump_trivial_usage
13//usage: "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..." 41//usage: "[-bcCdefnosvx" IF_FEATURE_HEXDUMP_REVERSE("R") "] [FILE]..."
@@ -77,7 +105,9 @@ int hexdump_main(int argc, char **argv)
77 smallint rdump = 0; 105 smallint rdump = 0;
78#endif 106#endif
79 107
80 if (ENABLE_HD && !applet_name[2]) { /* we are "hd" */ 108 if (ENABLE_HD
109 && (!ENABLE_HEXDUMP || !applet_name[2])
110 ) { /* we are "hd" */
81 ch = 'C'; 111 ch = 'C';
82 goto hd_applet; 112 goto hd_applet;
83 } 113 }
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 @@
5 * Copyright (C) 2002 Robert Griebl <griebl@gmx.de> 5 * Copyright (C) 2002 Robert Griebl <griebl@gmx.de>
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8*/ 8 */
9//config:config HWCLOCK
10//config: bool "hwclock"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: The hwclock utility is used to read and set the hardware clock
15//config: on a system. This is primarily used to set the current time on
16//config: shutdown in the hardware clock, so the hardware will keep the
17//config: correct time when Linux is _not_ running.
18//config:
19//config:config FEATURE_HWCLOCK_LONG_OPTIONS
20//config: bool "Support long options (--hctosys,...)"
21//config: default y
22//config: depends on HWCLOCK && LONG_OPTS
23//config: help
24//config: By default, the hwclock utility only uses short options. If you
25//config: are overly fond of its long options, such as --hctosys, --utc, etc)
26//config: then enable this option.
27//config:
28//config:config FEATURE_HWCLOCK_ADJTIME_FHS
29//config: bool "Use FHS /var/lib/hwclock/adjtime"
30//config: default n # util-linux-ng in Fedora 13 still uses /etc/adjtime
31//config: depends on HWCLOCK
32//config: help
33//config: Starting with FHS 2.3, the adjtime state file is supposed to exist
34//config: at /var/lib/hwclock/adjtime instead of /etc/adjtime. If you wish
35//config: to use the FHS behavior, answer Y here, otherwise answer N for the
36//config: classic /etc/adjtime path.
37//config:
38//config: pathname.com/fhs/pub/fhs-2.3.html#VARLIBHWCLOCKSTATEDIRECTORYFORHWCLO
39
40//applet:IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP))
41
42//kbuild:lib-$(CONFIG_HWCLOCK) += hwclock.o
9 43
10#include "libbb.h" 44#include "libbb.h"
11/* After libbb.h, since it needs sys/types.h on some systems */ 45/* 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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config IPCRM
11//config: bool "ipcrm"
12//config: default y
13//config: help
14//config: The ipcrm utility allows the removal of System V interprocess
15//config: communication (IPC) objects and the associated data structures
16//config: from the system.
17
18//applet:IF_IPCRM(APPLET(ipcrm, BB_DIR_USR_BIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_IPCRM) += ipcrm.o
10 21
11//usage:#define ipcrm_trivial_usage 22//usage:#define ipcrm_trivial_usage
12//usage: "[-MQS key] [-mqs id]" 23//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 @@
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9 */ 9 */
10//config:config IPCS
11//config: bool "ipcs"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: The ipcs utility is used to provide information on the currently
16//config: allocated System V interprocess (IPC) objects in the system.
17
18//applet:IF_IPCS(APPLET(ipcs, BB_DIR_USR_BIN, BB_SUID_DROP))
19
20//kbuild:lib-$(CONFIG_IPCS) += ipcs.o
10 21
11//usage:#define ipcs_trivial_usage 22//usage:#define ipcs_trivial_usage
12//usage: "[[-smq] -i shmid] | [[-asmq] [-tcplu]]" 23//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config LOSETUP
10//config: bool "losetup"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: losetup is used to associate or detach a loop device with a regular
15//config: file or block device, and to query the status of a loop device. This
16//config: version does not currently support enabling data encryption.
17
18//kbuild:lib-$(CONFIG_LOSETUP) += losetup.o
19
20//applet:IF_LOSETUP(APPLET(losetup, BB_DIR_SBIN, BB_SUID_DROP))
9 21
10//usage:#define losetup_trivial_usage 22//usage:#define losetup_trivial_usage
11//usage: "[-r] [-o OFS] {-f|LOOPDEV} FILE - associate loop devices\n" 23//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config LSPCI
10//config: bool "lspci"
11//config: default y
12//config: #select PLATFORM_LINUX
13//config: help
14//config: lspci is a utility for displaying information about PCI buses in the
15//config: system and devices connected to them.
16//config:
17//config: This version uses sysfs (/sys/bus/pci/devices) only.
18
19//applet:IF_LSPCI(APPLET(lspci, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_LSPCI) += lspci.o
9 22
10//usage:#define lspci_trivial_usage 23//usage:#define lspci_trivial_usage
11//usage: "[-mk]" 24//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9//config:config LSUSB
10//config: bool "lsusb"
11//config: default y
12//config: #select PLATFORM_LINUX
13//config: help
14//config: lsusb is a utility for displaying information about USB buses in the
15//config: system and devices connected to them.
16//config:
17//config: This version uses sysfs (/sys/bus/usb/devices) only.
18
19//applet:IF_LSUSB(APPLET(lsusb, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_LSUSB) += lsusb.o
9 22
10//usage:#define lsusb_trivial_usage NOUSAGE_STR 23//usage:#define lsusb_trivial_usage NOUSAGE_STR
11//usage:#define lsusb_full_usage "" 24//usage:#define lsusb_full_usage ""
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 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config MKE2FS
11//config: bool "mke2fs"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: Utility to create EXT2 filesystems.
16//config:
17//config:config MKFS_EXT2
18//config: bool "mkfs.ext2"
19//config: default y
20//config: select PLATFORM_LINUX
21//config: help
22//config: Alias to "mke2fs".
23
24//applet:IF_MKE2FS(APPLET_ODDNAME(mke2fs, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2))
25//applet:IF_MKFS_EXT2(APPLET_ODDNAME(mkfs.ext2, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2))
26////////:IF_MKFS_EXT3(APPLET_ODDNAME(mkfs.ext3, mkfs_ext2, BB_DIR_SBIN, BB_SUID_DROP, mkfs_ext2))
27
28//kbuild:lib-$(CONFIG_MKE2FS) += mkfs_ext2.o
29//kbuild:lib-$(CONFIG_MKFS_EXT2) += mkfs_ext2.o
10 30
11//usage:#define mkfs_ext2_trivial_usage 31//usage:#define mkfs_ext2_trivial_usage
12//usage: "[-Fn] " 32//usage: "[-Fn] "
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 @@
62 * Modified for BusyBox by Erik Andersen <andersen@debian.org> -- 62 * Modified for BusyBox by Erik Andersen <andersen@debian.org> --
63 * removed getopt based parser and added a hand rolled one. 63 * removed getopt based parser and added a hand rolled one.
64 */ 64 */
65//config:config MKFS_MINIX
66//config: bool "mkfs_minix"
67//config: default y
68//config: select PLATFORM_LINUX
69//config: help
70//config: The minix filesystem is a nice, small, compact, read-write filesystem
71//config: with little overhead. If you wish to be able to create minix
72//config: filesystems this utility will do the job for you.
73//config:
74//config:config FEATURE_MINIX2
75//config: bool "Support Minix fs v2 (fsck_minix/mkfs_minix)"
76//config: default y
77//config: depends on FSCK_MINIX || MKFS_MINIX
78//config: help
79//config: If you wish to be able to create version 2 minix filesystems, enable
80//config: this. If you enabled 'mkfs_minix' then you almost certainly want to
81//config: be using the version 2 filesystem support.
82
83//applet:IF_MKFS_MINIX(APPLET_ODDNAME(mkfs.minix, mkfs_minix, BB_DIR_SBIN, BB_SUID_DROP, mkfs_minix))
84
85//kbuild:lib-$(CONFIG_MKFS_MINIX) += mkfs_minix.o
65 86
66//usage:#define mkfs_minix_trivial_usage 87//usage:#define mkfs_minix_trivial_usage
67//usage: "[-c | -l FILE] [-nXX] [-iXX] BLOCKDEV [KBYTES]" 88//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 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config MKFS_REISER
10//config: bool "mkfs_reiser"
11//config: default n
12//config: select PLATFORM_LINUX
13//config: help
14//config: Utility to create ReiserFS filesystems.
15//config: Note: this applet needs a lot of testing and polishing.
16
17//applet:IF_MKFS_REISER(APPLET_ODDNAME(mkfs.reiser, mkfs_reiser, BB_DIR_SBIN, BB_SUID_DROP, mkfs_reiser))
18
19//kbuild:lib-$(CONFIG_MKFS_REISER) += mkfs_reiser.o
9 20
10//usage:#define mkfs_reiser_trivial_usage 21//usage:#define mkfs_reiser_trivial_usage
11//usage: "[-f] [-l LABEL] BLOCKDEV [4K-BLOCKS]" 22//usage: "[-f] [-l LABEL] BLOCKDEV [4K-BLOCKS]"
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 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config MKDOSFS
11//config: bool "mkdosfs"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: Utility to create FAT32 filesystems.
16//config:
17//config:config MKFS_VFAT
18//config: bool "mkfs.vfat"
19//config: default y
20//config: select PLATFORM_LINUX
21//config: help
22//config: Alias to "mkdosfs".
23
24//applet:IF_MKDOSFS(APPLET_ODDNAME(mkdosfs, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat))
25//applet:IF_MKFS_VFAT(APPLET_ODDNAME(mkfs.vfat, mkfs_vfat, BB_DIR_SBIN, BB_SUID_DROP, mkfs_vfat))
26
27//kbuild:lib-$(CONFIG_MKDOSFS) += mkfs_vfat.o
28//kbuild:lib-$(CONFIG_MKFS_VFAT) += mkfs_vfat.o
10 29
11//usage:#define mkfs_vfat_trivial_usage 30//usage:#define mkfs_vfat_trivial_usage
12//usage: "[-v] [-n LABEL] BLOCKDEV [KBYTES]" 31//usage: "[-v] [-n LABEL] BLOCKDEV [KBYTES]"
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 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8//config:config MKSWAP
9//config: bool "mkswap"
10//config: default y
11//config: help
12//config: The mkswap utility is used to configure a file or disk partition as
13//config: Linux swap space. This allows Linux to use the entire file or
14//config: partition as if it were additional RAM, which can greatly increase
15//config: the capability of low-memory machines. This additional memory is
16//config: much slower than real RAM, but can be very helpful at preventing your
17//config: applications being killed by the Linux out of memory (OOM) killer.
18//config: Once you have created swap space using 'mkswap' you need to enable
19//config: the swap space using the 'swapon' utility.
20//config:
21//config:config FEATURE_MKSWAP_UUID
22//config: bool "UUID support"
23//config: default y
24//config: depends on MKSWAP
25//config: help
26//config: Generate swap spaces with universally unique identifiers.
27
28//applet:IF_MKSWAP(APPLET(mkswap, BB_DIR_SBIN, BB_SUID_DROP))
29
30//kbuild:lib-$(CONFIG_MKSWAP) += mkswap.o
8 31
9//usage:#define mkswap_trivial_usage 32//usage:#define mkswap_trivial_usage
10//usage: "[-L LBL] BLOCKDEV [KBYTES]" 33//usage: "[-L LBL] BLOCKDEV [KBYTES]"
diff --git a/util-linux/more.c b/util-linux/more.c
index f6923efda..d04c17f90 100644
--- a/util-linux/more.c
+++ b/util-linux/more.c
@@ -13,6 +13,19 @@
13 * 13 *
14 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 14 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
15 */ 15 */
16//config:config MORE
17//config: bool "more"
18//config: default y
19//config: help
20//config: more is a simple utility which allows you to read text one screen
21//config: sized page at a time. If you want to read text that is larger than
22//config: the screen, and you are using anything faster than a 300 baud modem,
23//config: you will probably find this utility very helpful. If you don't have
24//config: any need to reading text files, you can leave this disabled.
25
26//applet:IF_MORE(APPLET(more, BB_DIR_BIN, BB_SUID_DROP))
27
28//kbuild:lib-$(CONFIG_MORE) += more.o
16 29
17//usage:#define more_trivial_usage 30//usage:#define more_trivial_usage
18//usage: "[FILE]..." 31//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 @@
112//config: help 112//config: help
113//config: Support mount -T (specifying an alternate fstab) 113//config: Support mount -T (specifying an alternate fstab)
114 114
115/* On full-blown systems, requires suid for user mounts.
116 * But it's not unthinkable to have it available in non-suid flavor on some systems,
117 * for viewing mount table.
118 * Therefore we use BB_SUID_MAYBE instead of BB_SUID_REQUIRE: */
119//applet:IF_MOUNT(APPLET(mount, BB_DIR_BIN, IF_DESKTOP(BB_SUID_MAYBE) IF_NOT_DESKTOP(BB_SUID_DROP)))
120
121//kbuild:lib-$(CONFIG_MOUNT) += mount.o
122
115//usage:#define mount_trivial_usage 123//usage:#define mount_trivial_usage
116//usage: "[OPTIONS] [-o OPT] DEVICE NODE" 124//usage: "[OPTIONS] [-o OPT] DEVICE NODE"
117//usage:#define mount_full_usage "\n\n" 125//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 @@
8 * 8 *
9 * Licensed under GPLv2, see file LICENSE in this source tree. 9 * Licensed under GPLv2, see file LICENSE in this source tree.
10 */ 10 */
11//config:config PIVOT_ROOT
12//config: bool "pivot_root"
13//config: default y
14//config: select PLATFORM_LINUX
15//config: help
16//config: The pivot_root utility swaps the mount points for the root filesystem
17//config: with some other mounted filesystem. This allows you to do all sorts
18//config: of wild and crazy things with your Linux system and is far more
19//config: powerful than 'chroot'.
20//config:
21//config: Note: This is for initrd in linux 2.4. Under initramfs (introduced
22//config: in linux 2.6) use switch_root instead.
23
24//applet:IF_PIVOT_ROOT(APPLET(pivot_root, BB_DIR_SBIN, BB_SUID_DROP))
25
26//kbuild:lib-$(CONFIG_PIVOT_ROOT) += pivot_root.o
11 27
12//usage:#define pivot_root_trivial_usage 28//usage:#define pivot_root_trivial_usage
13//usage: "NEW_ROOT PUT_OLD" 29//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 @@
6 * by Sterling Huxley <sterling@europa.com> 6 * by Sterling Huxley <sterling@europa.com>
7 * 7 *
8 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 8 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
9*/ 9 */
10//config:config RDATE
11//config: bool "rdate"
12//config: default y
13//config: help
14//config: The rdate utility allows you to synchronize the date and time of your
15//config: system clock with the date and time of a remote networked system using
16//config: the RFC868 protocol, which is built into the inetd daemon on most
17//config: systems.
18
19//applet:IF_RDATE(APPLET(rdate, BB_DIR_USR_SBIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_RDATE) += rdate.o
10 22
11//usage:#define rdate_trivial_usage 23//usage:#define rdate_trivial_usage
12//usage: "[-sp] HOST" 24//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 @@
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 * 9 *
10 */ 10 */
11//config:config RDEV
12//config: bool "rdev"
13//config: default y
14//config: help
15//config: Print the device node associated with the filesystem mounted at '/'.
16
17//applet:IF_RDEV(APPLET(rdev, BB_DIR_USR_SBIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_RDEV) += rdev.o
11 20
12//usage:#define rdev_trivial_usage 21//usage:#define rdev_trivial_usage
13//usage: "" 22//usage: ""
diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c
index 345b676ba..31abb6bb2 100644
--- a/util-linux/readprofile.c
+++ b/util-linux/readprofile.c
@@ -31,6 +31,16 @@
31 * Taken from util-linux and adapted for busybox by 31 * Taken from util-linux and adapted for busybox by
32 * Paul Mundt <lethal@linux-sh.org>. 32 * Paul Mundt <lethal@linux-sh.org>.
33 */ 33 */
34//config:config READPROFILE
35//config: bool "readprofile"
36//config: default y
37//config: #select PLATFORM_LINUX
38//config: help
39//config: This allows you to parse /proc/profile for basic profiling.
40
41//applet:IF_READPROFILE(APPLET(readprofile, BB_DIR_USR_SBIN, BB_SUID_DROP))
42
43//kbuild:lib-$(CONFIG_READPROFILE) += readprofile.o
34 44
35//usage:#define readprofile_trivial_usage 45//usage:#define readprofile_trivial_usage
36//usage: "[OPTIONS]" 46//usage: "[OPTIONS]"
@@ -164,7 +174,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
164 bb_error_msg_and_die("%s(%i): wrong map line", 174 bb_error_msg_and_die("%s(%i): wrong map line",
165 mapFile, maplineno); 175 mapFile, maplineno);
166 176
167 if (!strcmp(fn_name, "_stext")) /* only elf works like this */ { 177 if (strcmp(fn_name, "_stext") == 0) /* only elf works like this */ {
168 add0 = fn_add; 178 add0 = fn_add;
169 break; 179 break;
170 } 180 }
@@ -214,8 +224,9 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv)
214 if (optBins) { 224 if (optBins) {
215 if (optVerbose || this > 0) 225 if (optVerbose || this > 0)
216 printf(" total\t\t\t\t%u\n", this); 226 printf(" total\t\t\t\t%u\n", this);
217 } else if ((this || optAll) 227 } else
218 && (fn_len = next_add-fn_add) != 0 228 if ((this || optAll)
229 && (fn_len = next_add-fn_add) != 0
219 ) { 230 ) {
220 if (optVerbose) 231 if (optVerbose)
221 printf("%016llx %-40s %6u %8.4f\n", fn_add, 232 printf("%016llx %-40s %6u %8.4f\n", fn_add,
diff --git a/util-linux/rev.c b/util-linux/rev.c
index f952447e4..d34838a35 100644
--- a/util-linux/rev.c
+++ b/util-linux/rev.c
@@ -5,17 +5,16 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8
9//applet:IF_REV(APPLET(rev, BB_DIR_BIN, BB_SUID_DROP))
10
11//kbuild:lib-$(CONFIG_REV) += rev.o
12
13//config:config REV 8//config:config REV
14//config: bool "rev" 9//config: bool "rev"
15//config: default y 10//config: default y
16//config: help 11//config: help
17//config: Reverse lines of a file or files. 12//config: Reverse lines of a file or files.
18 13
14//applet:IF_REV(APPLET(rev, BB_DIR_BIN, BB_SUID_DROP))
15
16//kbuild:lib-$(CONFIG_REV) += rev.o
17
19//usage:#define rev_trivial_usage 18//usage:#define rev_trivial_usage
20//usage: "[FILE]..." 19//usage: "[FILE]..."
21//usage:#define rev_full_usage "\n\n" 20//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 @@
22 * RTC uses a local timezone instead (maybe you dual-boot MS-Windows). 22 * RTC uses a local timezone instead (maybe you dual-boot MS-Windows).
23 * That flag should not be needed on systems with adjtime support. 23 * That flag should not be needed on systems with adjtime support.
24 */ 24 */
25//config:config RTCWAKE
26//config: bool "rtcwake"
27//config: default y
28//config: select PLATFORM_LINUX
29//config: help
30//config: Enter a system sleep state until specified wakeup time.
31
32//applet:IF_RTCWAKE(APPLET(rtcwake, BB_DIR_USR_SBIN, BB_SUID_DROP))
33
34//kbuild:lib-$(CONFIG_RTCWAKE) += rtcwake.o
25 35
26//usage:#define rtcwake_trivial_usage 36//usage:#define rtcwake_trivial_usage
27//usage: "[-a | -l | -u] [-d DEV] [-m MODE] [-s SEC | -t TIME]" 37//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 @@
10 * 10 *
11 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 11 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
12 */ 12 */
13//config:config SCRIPT
14//config: bool "script"
15//config: default y
16//config: help
17//config: The script makes typescript of terminal session.
18
19//applet:IF_SCRIPT(APPLET(script, BB_DIR_USR_BIN, BB_SUID_DROP))
20
21//kbuild:lib-$(CONFIG_SCRIPT) += script.o
13 22
14//usage:#define script_trivial_usage 23//usage:#define script_trivial_usage
15//usage: "[-afq" IF_SCRIPTREPLAY("t") "] [-c PROG] [OUTFILE]" 24//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 @@
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 * 8 *
9 */ 9 */
10//config:config SCRIPTREPLAY
11//config: bool "scriptreplay"
12//config: default y
13//config: help
14//config: This program replays a typescript, using timing information
15//config: given by script -t.
16
17//applet:IF_SCRIPTREPLAY(APPLET(scriptreplay, BB_DIR_BIN, BB_SUID_DROP))
18
19//kbuild:lib-$(CONFIG_SCRIPTREPLAY) += scriptreplay.o
10 20
11//usage:#define scriptreplay_trivial_usage 21//usage:#define scriptreplay_trivial_usage
12//usage: "timingfile [typescript [divisor]]" 22//usage: "timingfile [typescript [divisor]]"
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 @@
15//config: specified program (usually a shell). It only makes sense to have 15//config: specified program (usually a shell). It only makes sense to have
16//config: this util on a system that supports both 64bit and 32bit userland 16//config: this util on a system that supports both 64bit and 32bit userland
17//config: (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...). 17//config: (like amd64/x86, ppc64/ppc, sparc64/sparc, etc...).
18//config:
19//config:config LINUX32
20//config: bool "linux32"
21//config: default y
22//config: select PLATFORM_LINUX
23//config: help
24//config: Alias to "setarch linux32".
25//config:
26//config:config LINUX64
27//config: bool "linux64"
28//config: default y
29//config: select PLATFORM_LINUX
30//config: help
31//config: Alias to "setarch linux64".
18 32
19//applet:IF_SETARCH(APPLET(setarch, BB_DIR_BIN, BB_SUID_DROP)) 33//applet:IF_SETARCH(APPLET(setarch, BB_DIR_BIN, BB_SUID_DROP))
20//applet:IF_SETARCH(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32)) 34//applet:IF_LINUX32(APPLET_ODDNAME(linux32, setarch, BB_DIR_BIN, BB_SUID_DROP, linux32))
21//applet:IF_SETARCH(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64)) 35//applet:IF_LINUX64(APPLET_ODDNAME(linux64, setarch, BB_DIR_BIN, BB_SUID_DROP, linux64))
22 36
23//kbuild:lib-$(CONFIG_SETARCH) += setarch.o 37//kbuild:lib-$(CONFIG_SETARCH) += setarch.o
38//kbuild:lib-$(CONFIG_LINUX32) += setarch.o
39//kbuild:lib-$(CONFIG_LINUX64) += setarch.o
24 40
25//usage:#define setarch_trivial_usage 41//usage:#define setarch_trivial_usage
26//usage: "PERSONALITY [-R] PROG ARGS" 42//usage: "PERSONALITY [-R] PROG ARGS"
@@ -58,12 +74,15 @@ int setarch_main(int argc UNUSED_PARAM, char **argv)
58 if (ENABLE_SETARCH && applet_name[0] == 's' 74 if (ENABLE_SETARCH && applet_name[0] == 's'
59 && argv[1] && is_prefixed_with(argv[1], "linux") 75 && argv[1] && is_prefixed_with(argv[1], "linux")
60 ) { 76 ) {
61 applet_name = argv[1];
62 argv++; 77 argv++;
78 applet_name = argv[0];
63 } 79 }
64 if (applet_name[5] == '6') /* linux64 */ 80 if ((!ENABLE_SETARCH && !ENABLE_LINUX32) || applet_name[5] == '6')
81 /* linux64 */
65 pers = PER_LINUX; 82 pers = PER_LINUX;
66 else if (applet_name[5] == '3') /* linux32 */ 83 else
84 if ((!ENABLE_SETARCH && !ENABLE_LINUX64) || applet_name[5] == '3')
85 /* linux32 */
67 pers = PER_LINUX32; 86 pers = PER_LINUX32;
68 else 87 else
69 bb_show_usage(); 88 bb_show_usage();
diff --git a/util-linux/swaponoff.c b/util-linux/swaponoff.c
index 6713852e5..b8f4e9447 100644
--- a/util-linux/swaponoff.c
+++ b/util-linux/swaponoff.c
@@ -6,6 +6,46 @@
6 * 6 *
7 * Licensed under GPLv2, see file LICENSE in this source tree. 7 * Licensed under GPLv2, see file LICENSE in this source tree.
8 */ 8 */
9//config:config SWAPON
10//config: bool "swapon"
11//config: default y
12//config: select PLATFORM_LINUX
13//config: help
14//config: This option enables the 'swapon' utility.
15//config: Once you have created some swap space using 'mkswap', you also need
16//config: to enable your swap space with the 'swapon' utility. The 'swapoff'
17//config: utility is used, typically at system shutdown, to disable any swap
18//config: space. If you are not using any swap space, you can leave this
19//config: option disabled.
20//config:
21//config:config FEATURE_SWAPON_DISCARD
22//config: bool "Support discard option -d"
23//config: default y
24//config: depends on SWAPON
25//config: help
26//config: Enable support for discarding swap area blocks at swapon and/or as
27//config: the kernel frees them. This option enables both the -d option on
28//config: 'swapon' and the 'discard' option for swap entries in /etc/fstab.
29//config:
30//config:config FEATURE_SWAPON_PRI
31//config: bool "Support priority option -p"
32//config: default y
33//config: depends on SWAPON
34//config: help
35//config: Enable support for setting swap device priority in swapon.
36//config:
37//config:config SWAPOFF
38//config: bool "swapoff"
39//config: default y
40//config: select PLATFORM_LINUX
41//config: help
42//config: This option enables the 'swapoff' utility.
43
44//applet:IF_SWAPON(APPLET_ODDNAME(swapon, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapon))
45//applet:IF_SWAPOFF(APPLET_ODDNAME(swapoff, swap_on_off, BB_DIR_SBIN, BB_SUID_DROP, swapoff))
46
47//kbuild:lib-$(CONFIG_SWAPON) += swaponoff.o
48//kbuild:lib-$(CONFIG_SWAPOFF) += swaponoff.o
9 49
10//usage:#define swapon_trivial_usage 50//usage:#define swapon_trivial_usage
11//usage: "[-a] [-e]" IF_FEATURE_SWAPON_DISCARD(" [-d[POL]]") IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]" 51//usage: "[-a] [-e]" IF_FEATURE_SWAPON_DISCARD(" [-d[POL]]") IF_FEATURE_SWAPON_PRI(" [-p PRI]") " [DEVICE]"
@@ -74,7 +114,15 @@ struct globals {
74#endif 114#endif
75#define INIT_G() do { setup_common_bufsiz(); } while (0) 115#define INIT_G() do { setup_common_bufsiz(); } while (0)
76 116
77#define do_swapoff (applet_name[5] == 'f') 117#if ENABLE_SWAPOFF
118# if ENABLE_SWAPON
119# define do_swapoff (applet_name[5] == 'f')
120# else
121# define do_swapoff 1
122# endif
123#else
124# define do_swapoff 0
125#endif
78 126
79/* Command line options */ 127/* Command line options */
80enum { 128enum {
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 @@
5 * 5 *
6 * Licensed under GPLv2, see file LICENSE in this source tree. 6 * Licensed under GPLv2, see file LICENSE in this source tree.
7 */ 7 */
8//config:config SWITCH_ROOT
9//config: bool "switch_root"
10//config: default y
11//config: select PLATFORM_LINUX
12//config: help
13//config: The switch_root utility is used from initramfs to select a new
14//config: root device. Under initramfs, you have to use this instead of
15//config: pivot_root. (Stop reading here if you don't care why.)
16//config:
17//config: Booting with initramfs extracts a gzipped cpio archive into rootfs
18//config: (which is a variant of ramfs/tmpfs). Because rootfs can't be moved
19//config: or unmounted*, pivot_root will not work from initramfs. Instead,
20//config: switch_root deletes everything out of rootfs (including itself),
21//config: does a mount --move that overmounts rootfs with the new root, and
22//config: then execs the specified init program.
23//config:
24//config: * Because the Linux kernel uses rootfs internally as the starting
25//config: and ending point for searching through the kernel's doubly linked
26//config: list of active mount points. That's why.
27
28//applet:IF_SWITCH_ROOT(APPLET(switch_root, BB_DIR_SBIN, BB_SUID_DROP))
29
30//kbuild:lib-$(CONFIG_SWITCH_ROOT) += switch_root.o
8 31
9//usage:#define switch_root_trivial_usage 32//usage:#define switch_root_trivial_usage
10//usage: "[-c /dev/console] NEW_ROOT NEW_INIT [ARGS]" 33//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 @@
3 * 3 *
4 * Licensed under GPLv2, see file LICENSE in this source tree. 4 * Licensed under GPLv2, see file LICENSE in this source tree.
5 */ 5 */
6
7//config:config UEVENT 6//config:config UEVENT
8//config: bool "uevent" 7//config: bool "uevent"
9//config: default y 8//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 @@
7 * 7 *
8 * Licensed under GPLv2, see file LICENSE in this source tree. 8 * Licensed under GPLv2, see file LICENSE in this source tree.
9 */ 9 */
10//config:config UMOUNT
11//config: bool "umount"
12//config: default y
13//config: select PLATFORM_LINUX
14//config: help
15//config: When you want to remove a mounted filesystem from its current mount
16//config: point, for example when you are shutting down the system, the
17//config: 'umount' utility is the tool to use. If you enabled the 'mount'
18//config: utility, you almost certainly also want to enable 'umount'.
19//config:
20//config:config FEATURE_UMOUNT_ALL
21//config: bool "Support option -a"
22//config: default y
23//config: depends on UMOUNT
24//config: help
25//config: Support -a option to unmount all currently mounted filesystems.
26
27//applet:IF_UMOUNT(APPLET(umount, BB_DIR_BIN, BB_SUID_DROP))
28
29//kbuild:lib-$(CONFIG_UMOUNT) += umount.o
10 30
11//usage:#define umount_trivial_usage 31//usage:#define umount_trivial_usage
12//usage: "[OPTIONS] FILESYSTEM|DIRECTORY" 32//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 @@
6 * 6 *
7 * Licensed under GPLv2 or later, see file LICENSE in this source tree. 7 * Licensed under GPLv2 or later, see file LICENSE in this source tree.
8 */ 8 */
9
10//config:config UNSHARE 9//config:config UNSHARE
11//config: bool "unshare" 10//config: bool "unshare"
12//config: default y 11//config: default y