Commit Graph

1176 Commits

Author SHA1 Message Date
Bernhard Reutner-Fischer
a8e2e1872a - add C99 bool type for setups that support it. 2007-01-20 21:27:18 +00:00
Denis Vlasenko
316355524f fixing bugs revealed by randomconfig runs 2007-01-20 16:54:19 +00:00
Denis Vlasenko
2405ad659e ls: use get_cached_username/groupname 2007-01-19 21:24:17 +00:00
Denis Vlasenko
9af7c9d6b6 openvt,getty,vfork_daemon_rexec,mount: tighten up fd cleanup code
(will close all fd's > 2 on daemonization now)
getty: fix "getty -" support, and also do not try to chown/chmod "-"
telnetd: fix "lost ctty" bug
Yet another attempt on saner function names:
bb_sanitize_server_stdio(0/1) -> bb_sanitize_stdio() + bb_daemonize();
2007-01-19 21:19:35 +00:00
Bernhard Reutner-Fischer
c966ba46a9 - move the smallint that is platform dependant to it's proper place 2007-01-18 10:32:09 +00:00
Peter Kjellerstedt
f8384fa50c Use char for smallint on CRIS as well. 2007-01-18 10:26:07 +00:00
Denis Vlasenko
cbbc043d1b smallint can be a char for amd64 too 2007-01-18 00:16:06 +00:00
Denis Vlasenko
d97c9244b1 Rename bb_sanitize_stdio -> bb_sanitize_server_stdio
(name is still bad - it doesn't hint that function
may do daemonization trick for you if asked to).
Small fixes to fakeidentd.
2007-01-14 13:12:06 +00:00
Denis Vlasenko
7a431b3715 By popular request reinstate fakeidentd's standalone mode.
Since this is also needed for other applets like telnetd,
introduce generic driver for such things.
It even supports inetd-wait ('linger') mode, when inetd
hands out listen socket to child and waits to it to die,
instead of handing out accepted socket and continuing
listening itself (nowait mode).
Code growth ~200 bytes.
NB: our inetd doesn't support wait mode yet (or mabe it is buggy).
2007-01-14 01:29:06 +00:00
Denis Vlasenko
150f402b36 whitespace fixes (leading spaces to tab) 2007-01-13 21:06:21 +00:00
Denis Vlasenko
3a34d0c08a random small size optimizations 2007-01-12 22:10:34 +00:00
Denis Vlasenko
5d68724d5b next part of ipv6-ization. mostly netcat. 2007-01-12 20:59:31 +00:00
Denis Vlasenko
6536a9b583 next part of ipv6-ization is here: wget & httpd 2007-01-12 10:35:23 +00:00
Denis Vlasenko
f8138d1f91 fakeinetd: attempted ipv6-ization (and it's done)
but entire applet can be orders of magnitude smaller
if written as an inetd service.
So did that (#ifdef'ed out entire old version).
inetd version is less than 10% of old one!
function                                             old     new   delta
packed_usage                                       22083   22105     +22
nobodystr                                              4       -      -4
bind_ip_address                                        4       -      -4
ident_substr                                          20       -     -20
chmatch                                               22       -     -22
movefd                                                25       -     -25
skipchars                                             49       -     -49
handlexitsigs                                         51       -     -51
replyError                                            70       -     -70
.rodata                                           158120  158024     -96
deleteConn                                           102       -    -102
G                                                    524     388    -136
conns                                                560       -    -560
fakeidentd_main                                     1457     143   -1314
------------------------------------------------------------------------------
(add/remove: 0/10 grow/shrink: 1/3 up/down: 22/-2453)       Total: -2431 bytes
2007-01-11 23:26:13 +00:00
Denis Vlasenko
f7996f3b70 Trailing whitespace removal over entire tree 2007-01-11 17:20:00 +00:00
Denis Vlasenko
8e9ccba371 ipv6-ization efforts continue. Few bugs are found,
unknown number likely introduced...
2007-01-11 16:50:23 +00:00
Denis Vlasenko
bbe514683a a bit more IPv6-ization work
syslogd: converted to use it (in -R host:port)
2007-01-10 20:19:56 +00:00
Denis Vlasenko
9de420c27c Improve generic ipv4+ipv6 support in libbb.
Convert telnet to it. Now this works:
telnetd -b [::1]:1234 - bind to IPv6 non-standard port
telnet [::1]:1234 - connect to IPv6 non-standard port
telnet ::1 1234 - same
This does not require ANY ipv6-specific code in applets
(no struct sockaddr_in6. In fact, no sockaddr_in, too).
2007-01-10 09:28:01 +00:00
Denis Vlasenko
886bb0df66 Fix typo in usage text by shortening it 2007-01-09 23:48:46 +00:00
Bernhard Reutner-Fischer
5568b722d4 - a few minor tweaks 2007-01-07 15:53:18 +00:00
Denis Vlasenko
fa85b86f38 add arp applet - thanks to
"Eric Spakman" <E.Spakman@inter.nl.net>
2007-01-07 01:24:12 +00:00
Denis Vlasenko
cd42cb8df0 do not expose internal state of [g]zip unpacker.
fix memory leak in inflate_gunzip.
2007-01-05 23:56:53 +00:00
Bernhard Reutner-Fischer
89d49a4236 - remove duplicate includes 2007-01-04 22:13:25 +00:00
Denis Vlasenko
a0e2a0a192 syslogd: start using bb_common_bufsiz1 instead of stack/malloc
logger: optimize, also use bb_common_bufsiz1 (~40 bytes)
tested to eat arbitrarily-sized input at high speed - ok
2007-01-04 21:22:11 +00:00
Denis Vlasenko
a9b60e93ee new libbb func: xmalloc_realpath (+ use it where makes sense)
syslogd, logread: add debugging code (disabled)
syslogs: drastically smaller bss; fix "-C n" behaviour
2007-01-04 17:59:59 +00:00
Denis Vlasenko
9b1381fd2f convert calloc to xzalloc
fix sleep-on-die option
2007-01-03 02:56:00 +00:00
Denis Vlasenko
bb3d0fab3b extern variable declaration in a .c file is heresy - fixing it 2007-01-03 01:57:25 +00:00
Denis Vlasenko
24cfe8fe0c introduce small[u]int
fsck_minix: use it for flag variables. 140 bytes saved
2007-01-03 00:39:15 +00:00
Denis Vlasenko
13463af29f remove commented out #includes etc
move get_hz to the only caller
2006-12-31 18:58:32 +00:00
Denis Vlasenko
98ee06d3d4 stop using __u32 etc. uint32_t is there for a reason 2006-12-31 18:57:37 +00:00
Denis Vlasenko
cb04ff5c68 fixdep.c: avoit doing memcmp in most cases
uidgid_get.c: add forgotten copyright notice
pwd/grp/shadow: avoid collisions with libc names
2006-12-30 21:11:57 +00:00
Denis Vlasenko
b5a122b6f9 fix for uclibc-without-shadow.h compilation 2006-12-30 14:46:51 +00:00
Denis Vlasenko
7fa0fcafca fix build without shadow support 2006-12-28 21:33:30 +00:00
Denis Vlasenko
9a44c4f91c bb_xget[pw/gr]nam were horribly misnamed - fixed.
uidgid_get -> get_uidgid, add additional param
(numeric_ok). Make chown use it.
chown: fix "chown user: ...."
install: fix incorrect use of bb_xget[pw/gr]nam
2006-12-28 05:44:47 +00:00
Denis Vlasenko
666da5e2c6 merge post-1.3.0 fixes 2006-12-26 18:17:42 +00:00
Denis Vlasenko
270c17c0e6 properly export externs thru *.h files 2006-12-26 17:40:33 +00:00
Denis Vlasenko
bf0a201008 style fixes
last xcalloc replaced by xzalloc
2006-12-26 10:42:51 +00:00
Denis Vlasenko
5dd7ef0f37 chattr: bugfixes and size reduction 2006-12-26 03:36:28 +00:00
Denis Vlasenko
0de9375ee6 leftover of e2fsck surgery 2006-12-26 02:51:29 +00:00
Denis Vlasenko
d63c3a032a Fix irregular capitalization in usage texts 2006-12-25 15:10:32 +00:00
Denis Vlasenko
b6488c1780 trim help texts a bit more 2006-12-25 14:25:14 +00:00
Denis Vlasenko
7a50a64986 more usage message cleanups 2006-12-24 17:40:16 +00:00
Denis Vlasenko
765996aaea Cleanup usage messages (-200 bytes).
Remove busybox_main from applet table since
it is called via separate check
2006-12-24 16:59:27 +00:00
Denis Vlasenko
0ee3999d13 random tiny size savings 2006-12-24 15:23:28 +00:00
Denis Vlasenko
a5b3e76c38 missing piece of prev commit: ndelay_off 2006-12-24 07:15:50 +00:00
Denis Vlasenko
714701c890 tar et al: die if bb_copyfd_size copies less than asked for.
(we have bb_copyfd_exact_size now for that kind of usage)
2006-12-22 00:21:07 +00:00
Denis Vlasenko
e865e81d34 less: stop dying on bad regexps, quietly pipe data w/o
user interaction if stdout is not a tty.
size optimizations
2006-12-21 13:24:58 +00:00
Denis Vlasenko
bf66fbc8e2 introduce LONE_CHAR (optimized strcmp with one-char string) 2006-12-21 13:23:14 +00:00
Denis Vlasenko
7cfecc4b36 xfuncs.c: dietlibc actually HAS fdprintf!
platform.h: define strchrnul for dietlibc
ash: stop using few non-standard functions
2006-12-18 22:32:45 +00:00
Denis Vlasenko
c8e6e35ba4 nc: add missing cast
xfuncs: add dprintf for dietlibc
2006-12-18 22:10:24 +00:00
Denis Vlasenko
83e5d6f772 A bunch of defined(__GLIBC__) added. static-linking warning expanded 2006-12-18 21:49:06 +00:00
Denis Vlasenko
7cdc54ff59 fix/shorten some usage strings 2006-12-17 17:27:56 +00:00
Denis Vlasenko
9f739445cd inline strcmp(s, "-") [actually macro-ize it for now - gcc is too stupid] 2006-12-16 23:49:13 +00:00
Denis Vlasenko
a597aaddfa s/extern inline/static ATTRIBUTE_ALWAYS_INLINE/g
xstrtou: disallow leading '+'
2006-12-16 23:48:13 +00:00
Denis Vlasenko
5fa7148761 build system: add "release" target
find: support -size N (needed for above)
2006-12-12 22:31:15 +00:00
Bernhard Reutner-Fischer
95da177b09 - s/:\t\t/\t/ for two helptexts. 2006-12-07 12:16:17 +00:00
Denis Vlasenko
becd8c538c passwd: made smaller by ~130 bytes. size can go negative
if current trend will continue ;)
2006-12-01 21:34:20 +00:00
Denis Vlasenko
c61852a02b fix support for globally disabling --long-options.
(disabling them saves ~4K on fully configured bbox)
2006-11-29 11:09:43 +00:00
Denis Vlasenko
7df69b887a usage: fix few help texts, fix breakage: '\<tab>'
sequence utterly confused cpp :)
2006-11-28 00:46:49 +00:00
Denis Vlasenko
1fffe38e01 fix udhcpc help message, take steps to make usage.h less messy 2006-11-28 00:06:39 +00:00
Denis Vlasenko
e2d3ded354 udhcpc: convert to getopt32 2006-11-27 23:43:28 +00:00
Denis Vlasenko
459903bd4e Provide our own isdigit macro. saves more than 400 bytes. 2006-11-27 14:44:18 +00:00
Denis Vlasenko
d686a045c8 safe_strtoXX interface proved to be a bit unconvenient.
Remove it, introduce saner bb_strtoXX.
Saved ~350 bytes.
2006-11-27 14:43:21 +00:00
Denis Vlasenko
e5667c1cfe Closing bug 730. libbb run_parts is using scandir (a GNUism),
and it is used only by run_parts applet, so move it there.
Also saved ~30 bytes (prolly gcc autoinlining...).
2006-11-26 20:13:39 +00:00
Denis Vlasenko
2d27e4ccbb tee: fix bug: argv[-1] is a no-no!
bb_full_fd_action: optimize
die_if_ferror: "<applet>: filename" isn't a good err msg, add "..I/O error"
2006-11-25 23:50:28 +00:00
Denis Vlasenko
43bddf31e9 small improvements in str -> num convertors 2006-11-25 14:49:04 +00:00
Denis Vlasenko
ed836cdc30 regularize str -> num convertors 2006-11-25 14:44:13 +00:00
Denis Vlasenko
d031ffa623 tar: sanitize option handling 2006-11-24 21:54:44 +00:00
Denis Vlasenko
c50f370f98 tar: cache [ug]id->username/groupname mappings. Cuts down amount
of open/read/close of /etc/passwd and /etc/group
dramatically (we were rereading those for each untarred file!!!)
2006-11-24 14:57:31 +00:00
Denis Vlasenko
0b35470d9b glibc makedev() is a large inline. Save 700+ bytes by wrapping it
into a function.
2006-11-24 14:54:27 +00:00
Denis Vlasenko
cf30cc82a3 header_verbose_list: stop truncating file size in listing 2006-11-24 14:53:18 +00:00
Denis Vlasenko
376ce1e775 tar:
* unpack: handle tar header fields which are not NUL terminated
* pack: handle 4+GB files correctly
* pack: refuse to store 101+ softlinks (was truncating link
  target name)
* pack: mask mode with 07777
2006-11-24 14:51:01 +00:00
Denis Vlasenko
48237b0c88 introduce setsockopt_reuseaddr(int fd), setsockopt_broadcast(int fd),
use them where appropriate. 200 bytes saved
2006-11-22 23:22:06 +00:00
Bernhard Reutner-Fischer
32eddffa30 - revert r15563 (pull current version of taskset off the busybox_scratch branch) 2006-11-22 16:39:48 +00:00
Denis Vlasenko
c8717cd857 telnetd: move generic stuff into libbb. It will make it easy
to make other server applets IPv6-aware too.
2006-11-22 16:10:39 +00:00
Denis Vlasenko
75f8d080a2 telnetd: we were having telnetd with is ONLY inetd or ONLY standalone.
What if I need to have both?? This patch introduces
CONFIG_FEATURE_TELNETD_STANDALONE: y - both, n - only inetd.
2006-11-22 15:54:52 +00:00
Denis Vlasenko
7ca3921e5e bb_INET_default[] is really just a const "default",
nothing INET-specific
2006-11-21 20:34:21 +00:00
Bernhard Reutner-Fischer
921f5df25f - add 'ip rule' support. First take..
text    data     bss     dec     hex filename
   2999       0       0    2999     bb7 networking/libiproute/iprule.o
2006-11-21 15:36:08 +00:00
Denis Vlasenko
9229794ab3 insmod_ng_main: -80 bytes. Stopp mmapping, use xmalloc_open_read_close(). 2006-11-21 11:58:14 +00:00
Denis Vlasenko
736230e209 dhcprelay: new applet 2006-11-20 19:40:36 +00:00
Denis Vlasenko
89f0b3486d rodata cleanup. "unable to" == "cannot". -300 bytes 2006-11-18 22:04:09 +00:00
Denis Vlasenko
f7eaccde13 nc: fix --help text 2006-11-18 02:17:37 +00:00
Denis Vlasenko
a7189f01a4 add -Wundef, fix uncovered bugs 2006-11-17 20:29:00 +00:00
Denis Vlasenko
8a00f44bf4 runit: add runsv, runsvdir and sv. Oh yes.
It even seems to work. +11K. :(
2006-11-17 18:58:16 +00:00
Denis Vlasenko
b3a071543d httpd: reduce ifdef forest. comment out redundant PATH setting 2006-11-16 18:04:43 +00:00
Denis Vlasenko
0871bc89fb httpd: add -i (inetd) and -f (foreground) otions.
-i makes possible to run httpd in both inetd and standalone mode
without recompile (or need to have two different binaries)
2006-11-16 16:17:02 +00:00
Denis Vlasenko
83ea643d8d svlogd: new applet. +9k. Still too big, but it was 12k yesterday. 2006-11-16 02:27:24 +00:00
Denis Vlasenko
5af906e7c8 rename: compare_string_array -> index_in_str_array
introduce index_in_substr_array and use it in
iproute2
2006-11-05 18:05:09 +00:00
Denis Vlasenko
77a1a53a98 usage.h: stop using ancient USAGE_xxx (we have USE_xx now) 2006-11-05 00:46:35 +00:00
Denis Vlasenko
9494919ea5 ps: implement POSIX-like options, most notably -o
(activated by CONFIG_DESKTOP)
2006-11-05 00:45:47 +00:00
Denis Vlasenko
aae0311356 smart_ulltoa5: make available in libbb 2006-11-05 00:44:39 +00:00
Denis Vlasenko
459e4d6cf7 replace /proc scanning code by more versatile one.
Use it where appropriate.
Stop scanning /etc/passwd *for every process*!!! (uid->username)
top: reduce memory usage - we won't save unneeded fields
from /proc info anymore. Downside: ~+250 bytes of code
2006-11-05 00:43:51 +00:00
Denis Vlasenko
fa07680091 top: improve CPU% calculation
style fixes
2006-11-05 00:38:51 +00:00
Denis Vlasenko
dd539f7687 Unneeded code removed, usused field "unsigned pscpu" removed 2006-11-01 20:20:37 +00:00
Denis Vlasenko
35fb512728 PID should be stored in pid_t, not int or long.
find_pid_by_name() was returning 0 or -1 in last array element,
but -1 was never checked. We can use just 0 intead.
2006-11-01 09:16:49 +00:00
Denis Vlasenko
5c7596058d ls: cleanup part 1 2006-10-28 12:37:16 +00:00
Denis Vlasenko
8c35d65c43 recursive_action: add depth param
chmod: match coreutils versus following links
2006-10-27 23:42:25 +00:00
Denis Vlasenko
e80e2a3660 chgrp: just call chown! :) 2006-10-27 23:28:38 +00:00
Denis Vlasenko
51b4c92f80 chown: add -vcf support if CONFIG_DESKTOP
chmod: stop following symlinks
2006-10-27 16:07:20 +00:00
Denis Vlasenko
fefb279ace chmod: support -vcf if CONFIG_DESKTOP 2006-10-27 15:13:54 +00:00
Denis Vlasenko
dca0b707c0 reshuffle libbb.h contents so that order of decls makes sense
Found bad typo in largefile support :)
2006-10-27 09:05:02 +00:00
Denis Vlasenko
1de0830e62 Fix minor breakage in previous commit 2006-10-26 23:32:43 +00:00
Denis Vlasenko
ddec5af6b0 rename functions to more understandable names 2006-10-26 23:25:17 +00:00
Denis Vlasenko
f0ed376eda remove bb_printf and the like 2006-10-26 23:21:47 +00:00
Denis Vlasenko
1457915afc xconnect is non-conforming to "xfunc like libc" rule. Fixing 2006-10-26 01:09:46 +00:00
Bernhard Reutner-Fischer
e63a0dee9e - revert r16191; re-add resize() applet.
text	   data	    bss	    dec	    hex	filename
    288	      0	      0	    288	    120	console-tools/_resize.o.gcc-2.95
    258	      0	      0	    258	    102	console-tools/_resize.o.gcc-3.3
    252	      0	      0	    252	     fc	console-tools/_resize.o.gcc-3.4
2006-10-25 15:07:56 +00:00
Denis Vlasenko
c8400a2162 wget: wget $'-\207' ... should not be allowed to work. ever. :)
So fix wget & getopt32. Also fix multiple --header options
order: add and use rev_llist.
2006-10-25 00:33:44 +00:00
Denis Vlasenko
9b44db5d9d cp: update help text 2006-10-22 10:05:01 +00:00
Denis Vlasenko
f24e1f40e0 cp: add support for -s, -l. Fix free(nonmalloc) bug.
Add doc on POSIX's rules on -i and -f (insane!).
ln: make "ln dangling_symlink new_link" work.
2006-10-21 23:40:20 +00:00
Denis Vlasenko
8d73c35916 watch: execute command thru shell, not fork/exec. Other fixes 2006-10-20 23:48:30 +00:00
Denis Vlasenko
c108ed5497 raidautorun: new applet, by:
Thomas Jarosch (email?) and
Bernhard Fischer <rep.nop@aon.at>
2006-10-20 19:39:48 +00:00
Denis Vlasenko
e1a0d486e4 message string changes, mostly for consistency, also -32 bytes in .rodata 2006-10-20 13:28:22 +00:00
Denis Vlasenko
b79b87a30f build system: (try to) get rid of bb_config.h hack 2006-10-19 22:17:44 +00:00
Denis Vlasenko
9fa9950784 build system: check for ENABLE_, USE_ and SKIP_ (not only for CONFIG_) 2006-10-19 22:14:58 +00:00
Denis Vlasenko
13c5a6832f mount: support user mounts if CONFIG_DESKTOP 2006-10-16 22:39:51 +00:00
Denis Vlasenko
d0e70af9d1 nc: fix 2 my own buglets, and few someone else's too. 2006-10-16 01:10:28 +00:00
Denis Vlasenko
3a6755f56f grep: add support for -r 2006-10-14 14:24:30 +00:00
Denis Vlasenko
ea62077b85 add open_read_close() and similar stuff 2006-10-14 02:23:43 +00:00
Denis Vlasenko
2d5ca60bfb bb_get_[chomped]line_from_file wasn't descriptive enough.
Renaming...
2006-10-12 22:43:20 +00:00
Denis Vlasenko
f6f43df60b ifupdown: stop emitting annoying/misleading error messages.
Patch by Gabriel Somlo <somlo at cmu.edu>
2006-10-11 22:16:56 +00:00
Denis Vlasenko
1db39b2f51 nmeter: new applet. ~4k
Fix build proble on x86_64
2006-10-11 20:59:02 +00:00
Denis Vlasenko
1114de7219 od: provide full-blown od from coreutils if CONFIG_DESKTOP 2006-10-10 23:26:05 +00:00
Denis Vlasenko
cba9ef5523 fixes from Vladimir Dronnikov <dronnikov@gmail.ru> 2006-10-10 21:00:47 +00:00
Denis Vlasenko
ca3c981c07 start_stop_daemon: add -N <nice> compat
[re]nice: add support for -nNNN w/o spaces, -NNN (nice only),
          simplified code
2006-10-08 23:36:17 +00:00
Denis Vlasenko
7039a66b58 correct largefile support, add comments about it. 2006-10-08 17:54:47 +00:00
Denis Vlasenko
1385899416 attempt to regularize atoi mess. 2006-10-08 12:49:22 +00:00
Denis Vlasenko
5625415085 dd: make it recognize not only 'k' but 'K' too;
make it (partially) CONFIG_LFS-aware
2006-10-07 16:24:46 +00:00
Denis Vlasenko
c12f53090b dnsd fix; option_mask32 added. dnsd needs more love. 2006-10-06 09:49:47 +00:00
Denis Vlasenko
de59c0f58f httpd: add -u user[:grp] support 2006-10-05 22:50:22 +00:00
Denis Vlasenko
1868409c86 fixing build system overhaul fallout... 2006-10-05 17:11:08 +00:00
Denis Vlasenko
7d219aab70 build system overhaul 2006-10-05 10:17:08 +00:00
Denis Vlasenko
8f8f268cfd bb_applet_name -> applet_name 2006-10-03 21:00:43 +00:00
Denis Vlasenko
67b23e6043 getopt_ulflags -> getopt32.
It is impossible to formulate sane ABI based on
size of ulong because it can be 32-bit or 64-bit.
Basically it means that you cannot portably use
more that 32 option chars in one call anyway...
Make it explicit.
2006-10-03 21:00:06 +00:00
Denis Vlasenko
40920825d5 rename bb_default_error_retval -> xfunc_error_retval 2006-10-03 20:28:06 +00:00
Denis Vlasenko
cf94446af7 random style fixes 2006-10-03 19:02:20 +00:00
Denis Vlasenko
fe54458e46 runit/chpst: "change process state" utility
It's "nice" on steroids - can set uid/gid, mem/cpu limits etc. +3.5k
2006-10-03 15:57:40 +00:00
Denis Vlasenko
2e864cd219 eject: -T (implements single button open/close) 2006-10-02 20:49:25 +00:00
Denis Vlasenko
b97c9842a5 sed: unbreak multiple -e, -f option handling (my fault) 2006-10-01 21:05:12 +00:00
Denis Vlasenko
97a8dd3857 g[un]zip: add support for -v (verbose).
Add CONFIG_DESKTOP, almost all bloat from this change
is hidden under that.
2006-10-01 15:55:11 +00:00
Denis Vlasenko
1decd0e529 syslogd: add option to suppress logging of messages lower than level N (-n N) 2006-09-30 19:17:40 +00:00
Denis Vlasenko
0b193a7871 losetup: use /dev/loopN or /dev/loop/N according to CONFIG_FEATURE_DEVFS=n/y 2006-09-29 21:47:11 +00:00
Denis Vlasenko
6c30db8bd3 grep: add help text; fix style 2006-09-29 21:04:12 +00:00
Denis Vlasenko
266bc17690 top: add support for -b, -n <iterations> 2006-09-29 17:16:39 +00:00
Denis Vlasenko
de9ec92958 usage.h: fix compile-time bugs exposed by previous change 2006-09-27 23:31:59 +00:00
Denis Vlasenko
ce97960a6e usage.h: remove ugly tricks. We have USE_FEATURE_xxx now.
Few bugs are now exposed...
2006-09-27 23:31:08 +00:00
Denis Vlasenko
956a569360 losetup: with no arguments lists all /dev/loopN. Corrected help text.
(patch by Vladimir Dronnikov <dronnikov@gmail.ru>)
2006-09-27 14:51:27 +00:00
Denis Vlasenko
0bb628f4f3 kill: implement killall5. OpenWRT folks will be happy.
However their code was unusably different from sysvinit original.
Run tested.
2006-09-27 14:25:33 +00:00
Denis Vlasenko
a77947f5bb kill: fix bugs (kill -l output was horrible), fix style, constify data 2006-09-27 14:19:16 +00:00
Denis Vlasenko
e175ff252f several fixes from openWRT project 2006-09-26 17:41:00 +00:00
Denis Vlasenko
a552eeb498 wget: add (configurable) large file support. Run tested. 2006-09-26 09:22:12 +00:00
Rob Landley
0372197385 "I'll think about it" != "apply it now". It means I need to think about it. 2006-09-22 18:47:45 +00:00
Bernhard Reutner-Fischer
ae843e9cc8 - add new applet resize.
text    data     bss     dec     hex filename
    185       0       0     185      b9 console-tools/resize.o
    255       0       0     255      ff console-tools/resize.o.print
2006-09-22 08:18:41 +00:00
Rob Landley
eb84a42fdd The Software Freedom Law Center wants us to add a copyright notice to the
generated binaries, to make copyright enforcement easier.  Our liason with
them (Bradley Kuhn) suggested the following text:

> Copyright (C) YEAR-2006  Erik Andersen, Rob Landley, and others.
> Licensed under GPLv2.  See source distribution for full notice.

And the busybox help message seems the least offensive place to put it.  (At
some point in the future, I need to strip 128 bytes from the binary to feel
good about this, though. :)

Minor header file cleanup while I was there, since libbb.h already #includes
most of that stuff...
2006-09-20 21:41:13 +00:00
Bernhard Reutner-Fischer
d1f939eaf3 - fix documentation for the command-line options of ipcs. Closes #1036 2006-09-20 15:56:53 +00:00
Denis Vlasenko
0b5fd45ef7 change char *string = "foo" -> char string[] = "foo"
function                                             old     new   delta
xsetenv                                               45      44      -1
iproute_list_or_flush                               1834    1833      -1
ipaddr_modify                                       1915    1914      -1
ipaddr_list_or_flush                                1861    1860      -1
invarg                                                39      38      -1
do_set                                              1259    1258      -1
bb_verror_msg                                        268     267      -1
create_icmp_socket                                   142     140      -2
create_icmp6_socket                                  142     140      -2
bb_full_fd_action                                    324     322      -2
bb_path_mtab_file                                     10       -     -10
.rodata                                           214796  214720     -76
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 0/11 up/down: 0/-99)            Total: -99 bytes
2006-09-19 09:55:09 +00:00
Denis Vlasenko
9213a9e0f2 whitespace cleanup 2006-09-17 16:28:10 +00:00
Bernhard Reutner-Fischer
4d0f54af94 - Steven Scholz pointed out that ssd's make-pid doesn't take an argument. 2006-09-15 19:25:18 +00:00
Rob Landley
69115c656d Unbreak allbareconfig.
We've had -Werror in the tree for quite a while, so adding #warning
somewhat counterproductve way to make comments on the code that belong on the
mailing list anyway.
2006-09-15 04:01:03 +00:00
Denis Vlasenko
25098f7fd5 mount: move code from nfsmount.c into mount.c 2006-09-14 15:46:33 +00:00
Rob Landley
577905f1e4 Revert duplicate patch.
I don't know why patch decided to apply this even though it was already in
the tree.  I thought the other hunks failed because they were totally
unrelated leakage from Bernhard's tree (which they are; was the a reason
for bundling them in with this fix?  Do they have something to do with
the GCC 2.95 fix?  I suspect they prevent me from backporting this
patch to 1.2.2 because the header consolidation into libbb.h hadn't
been done yet, and no I'm not fixing it up: if that's the case then
this patch won't be in 1.2.2 due to extraneous changes bundled with it that
prevent a clean backport without rolling a new patch).
2006-09-12 22:42:03 +00:00
Rob Landley
20cc6d567f Remove pointless "const". Bloatcheck says 0 bytes difference. 2006-09-12 21:42:17 +00:00
Rob Landley
1b2b5cfba8 Fix from Bernhard for somebody trying to limp along with gcc 2.95.4. 2006-09-12 20:29:22 +00:00
Bernhard Reutner-Fischer
b5f50ea344 - small trivia to be gentle to gcc-2.95.x which had no va_copy but only __va_copy. 2006-09-12 13:27:55 +00:00
Denis Vlasenko
00d7d6cef6 nfsmount: sanitize it. It had a rather peculiar idea of implementing "bg"
option - it was going to return a special flag back to caller and
expecting caller to call it again with special parameter! Also
caller was charged with calling mount() syscall...

mount: mtab support was non-functional. Enabling it revealed serious bug
which is not fixed yet.
2006-09-11 17:42:44 +00:00
Bernhard Reutner-Fischer
57b56674a3 - merge xstat.c into xfuncs.c 2006-09-11 09:18:09 +00:00
Rob Landley
69674941dd Error reporting fix for sulogin, plus remove help entries for options we never
implemented.  (Plus a bit more of bbsh leaking in from my tree, but it
shouldn't hurt anything and I'm lazy...)
2006-09-11 00:34:01 +00:00
Denis Vlasenko
2e502914b0 login: style fixes 2006-09-08 17:22:45 +00:00
Denis Vlasenko
a9801658ee getty, sulogin: convert to using bb_msg for syslog output 2006-09-07 16:20:03 +00:00
Denis Vlasenko
3538b9a882 Implement optional syslog logging using ordinary
bb_xx_msg calls, and convert networking/* to it.
The rest of bbox will be converted gradually.
2006-09-06 18:36:50 +00:00
Denis Vlasenko
21afc7dc29 uuencode: common implementation for wget and uuencode (closing bug 694) 2006-09-03 15:49:40 +00:00
Denis Vlasenko
314908da9e tar: revert older fix (non-portable), added new one.
testsuite tar-extracts-all-subdirs now passes.
2006-09-03 14:04:33 +00:00
Denis Vlasenko
2cbe6e6eb2 ping: implement -I option 2006-09-02 16:17:30 +00:00
Bernhard Reutner-Fischer
bfbc4ebf40 - patch from Csaba Henk to make the "User-Agent" header field configurable. 2006-09-02 15:30:26 +00:00
Bernhard Reutner-Fischer
73561cc75a - pull from busybox_scratch: r15829:15850
Various fixes, cleanups and shrinkage:
saves 952 Bytes:
   text    data     bss     dec     hex filename
1087742   15853  790632 1894227  1ce753 ../busybox/busybox.old
1086790   15853  790632 1893275  1ce39b busybox
via:
# scripts/bloat-o-meter ../busybox/busybox_unstripped.old busybox_unstripped 
function                                             old     new   delta
ipcrm_main                                           756     822     +66
getval                                                 -      61     +61
maybe_set_utc                                          -      40     +40
udhcpc_main                                         2896    2912     +16
md5_hash_block                                       428     437      +9
opt                                                    8      16      +8
qgravechar                                           106     110      +4
make_bitmap                                          292     295      +3
inflate_unzip                                       2056    2059      +3
add_partition                                       1412    1414      +2
__parsespent                                         156     158      +2
qrealloc                                              41      42      +1
format                                                 -       1      +1
catv_main                                            313     314      +1
watch_main                                           293     292      -1
varunset                                              81      80      -1
part                                                   1       -      -1
check_if_skip                                        837     836      -1
start_stop_daemon_main                               840     837      -3
create_lost_and_found                                175     172      -3
supress_non_delimited_lines                            4       -      -4
static.l                                               4       -      -4
static.c                                               5       1      -4
bsd_sum_file                                         237     233      -4
eval2                                                338     332      -6
arithmetic_common                                    166     158      -8
cmpfunc                                               22       5     -17
cksum_main                                           294     275     -19
cmp_main                                             465     439     -26
dd_main                                             1535    1508     -27
rmmod_main                                           376     333     -43
cut_file                                             727     644     -83
ipcs_main                                           3809    3721     -88
cut_main                                             722     614    -108
date_main                                           1443    1263    -180
remove_ids                                           222       -    -222
------------------------------------------------------------------------------
(add/remove: 3/4 grow/shrink: 11/18 up/down: 217/-853)       Total: -636 bytes
2006-08-28 23:31:54 +00:00
Rob Landley
abfe107f78 No real need for my_query_module() and this eliminates some type-punned
pointer warning on certain gcc versions (and saves 38 bytes).
2006-08-28 19:40:08 +00:00
Rob Landley
0e4690d4ef Michael Opdenacker contributed a readahead applet. 2006-08-20 22:12:18 +00:00
Rob Landley
b988462d3e Ok, features.h already defines _OPEN_SOURCE (and complains if it's already
defined), yet it's not doing it for scripts/individual for some reason.
(I hate fighting with header files.)
2006-08-10 01:08:41 +00:00
Rob Landley
519d7df930 Another whack at scripts/individual. Now builds 212 applets. 2006-08-09 20:56:23 +00:00
Rob Landley
e55a73c7a8 Update usage to talk about the new shared subtree stuff in mount. 2006-08-09 20:55:35 +00:00
Rob Landley
e3781b7312 Add shared subtree support, suggested by Vladimir Dronnikov. Also break out a
few new (unfinished) config options, which I intend to make hidden (but
enabled) when CONFIG_NITPICK is disabled.  Getting the .config infrastructure
to do that is non-obvious, it seems...
2006-08-08 01:39:49 +00:00
Rob Landley
236c6755d2 Teach md5sum and sha1sum to work the way other applets do so I don't have to
teach scripts/individual new tricks.  And while I'm at it, teach
scripts/individual other new tricks.  Now builds 198 applets, some of which
I should teach it to hardlink together because they're really the same app...
2006-08-06 02:13:36 +00:00
Rob Landley
affb7a61a6 scripts/individual now builds 171 applets. Some of them may even work. :) 2006-08-05 00:41:39 +00:00
Rob Landley
081e38483e Remove xcalloc() and convert its callers to xzalloc(). About half of them
were using "1" as one of the arguments anyway, and as for the rest a multiply
and a push isn't noticeably bigger than pushing two arguments on the stack.
2006-08-03 20:07:35 +00:00
Rob Landley
86b4d64aa3 These should have been part of 15767 too. 2006-08-03 17:58:17 +00:00
Rob Landley
d921b2ecc0 Remove bb_ prefixes from xfuncs.c (and a few other places), consolidate
things like xasprintf() into xfuncs.c, remove xprint_file_by_name() (it only
had one user), clean up lots of #includes...  General cleanup pass.  What I've
been doing for the last couple days.

And it conflicts!  I've removed httpd.c from this checkin due to somebody else
touching that file.  It builds for me.  I have to catch a bus.  (Now you know
why I'm looking forward to Mercurial.)
2006-08-03 15:41:12 +00:00
Mike Frysinger
8840759c61 move lchown/chown define out of specific files and into platform.h where it belongs 2006-07-20 19:31:07 +00:00
"Robert P. J. Day"
eea561871b "formated" -> "formatted" throughout the code base. 2006-07-20 19:02:24 +00:00
Rob Landley
f0623a2c98 Patch from Thaddeus Ternes, adding chuid to start-stop-daemon. 2006-07-17 00:35:07 +00:00
Rob Landley
534374755d Cleaup read() and write() variants, plus a couple of new functions like
xlseek and fdlength() for the new mkswap.
2006-07-16 08:14:35 +00:00
Rob Landley
df822f2606 We need xsetuid() and xsetgid() because per-user process resource limits can
prevent a process from switching to a user that has too many processes, and
when that happens WE'RE STILL ROOT.  See http://lwn.net/Articles/190331/
2006-07-15 23:00:46 +00:00
Rob Landley
c9c1a41c58 A couple things that got tangled up in my tree, easier to check in both than
untangle them:

Rewrite u_signal_names() into get_signum() and get_signame(), plus trim the
signal list to that required by posix (they can specify the numbers for
the rest if they really need them).  (This is preparatory cleanup for adding
a timeout applet like Roberto Foglietta wants.)

Export the itoa (added due to Denis Vlasenko, although it's not quite his
preferred implementation) from xfuncs.c so it's actually used, and remove
several other redundant implementations of itoa and utoa() in the tree.
2006-07-12 19:17:55 +00:00
Rob Landley
ab7d9be17c Patch from Tito to remove pwd_to_spwd (which we don't actually need), with
some #ifdef removal from me.
2006-07-11 16:19:17 +00:00
Rob Landley
1cca9484db Upgrade netcat a lot. Make -e able to take the rest of the command line as
what to exec.  Add -f mode and a brief explanation of how to use it to replace
minicom.  Add -l -l mode so you can turn any command into a server.  And group
all of netcat's command line options under two CONFIG entries, so if you
disable both it doesn't use getopt at all.
2006-07-10 19:45:20 +00:00
Rob Landley
4ae905a31c Minor build tweaks that save 1100 bytes building busybox on Ubuntu 6.06. 2006-07-06 17:22:54 +00:00
"Robert P. J. Day"
63fc1a9e08 Standardize on the vi editing directives being on the first line. 2006-07-02 19:47:05 +00:00
Rob Landley
12d9419273 Revert taskset for 1.2.0. It emits a warning, breaks building under RH9,
and nobody seemed interested in fixing it despite repeated complaints.
I'll worry about it in the 1.3 timeframe...
2006-06-30 22:20:43 +00:00
Rob Landley
7077ea30f5 Some old kernel headers don't #include BLKSSZGET in sys/mount.h. 2006-06-29 19:00:12 +00:00
Mike Frysinger
cc826d74e4 cleanup patch usage 2006-06-28 00:22:32 +00:00
Mike Frysinger
cd68a2e1a8 fix watchdog on no-mmu systems by adding -F option for rexec 2006-06-26 21:31:17 +00:00
Rob Landley
ef10d52745 Upgrade mdev to allow commands to be run on create/delete.
Both Jason Schoon and Giuseppe Ciotta deserve credit for this, I used elements
of both.  It's been upgraded so that you can specify that a given command
should run at create, at delete, or at both using different special characters
(@, $, and * respectively).  It uses the system() method of running command
lines which means you can use environment variables on the command line (it
sets $MDEV to the name of the current device being created/deleted, which is
useful if you matched it via regex), and the documentation warns that you need
a /bin/sh to make that work, so you probably want to pick a default shell.
2006-06-26 14:11:33 +00:00
Rob Landley
e1ee482684 Document mount's new error return conventions. 2006-06-24 22:39:19 +00:00
Rob Landley
5d9c42aadc Slowly pulling more common headers into libbb.h. Andre pointed out that
older uClibc didn't include sys/socket.h from netinet/in.h, so add an
explicit #include for that too...
2006-06-24 17:55:02 +00:00
Rob Landley
1fa4a9448b Patch from Shaun Jackman to replace CFLAGS_EXTRA with .config.mak 2006-06-22 22:05:00 +00:00
Rob Landley
67d4943393 CONFIG_DHCP -> CONFIG_APP_DHCP. 2006-06-22 18:48:34 +00:00
Rob Landley
b13fee4cbb Since rangecoder is just a bunch of C functions, move it into the one user
(decompress_unlzma.c).  Also a slight #include cleanup, and I've been meaning
to put #include <unistd.h> into libbb.h since it's so darn common...
2006-06-20 22:38:00 +00:00
Rob Landley
290fcb4213 Undo all of the ugliness and some of the bloat from 15412. 2006-06-18 23:59:03 +00:00
Rob Landley
ea224be6aa skip_whitespace() shouldn't claim its return value is const, it doesn't know
that and callers wind up typecasting it back.
2006-06-18 20:20:07 +00:00
Rob Landley
148734df99 We came up with our own names for ATTRIBUTE_*, so why check if they're already
#defined?  Also remove a check for a gcc version older than RH9 (if non-linux
needs that #define they can put it in their section.)
2006-06-15 16:00:42 +00:00
Rob Landley
22d26fc6ae Patch from Yann Morin to put BLKGETSIZE64 in platform.h had rather a lot of
fallout due to the #include <sys/mount.h>.  Removed that #include from various
applets and fixed up those that were unhappy when that #include was made
because they'd block copied stuff out of it.  (Sigh.)
2006-06-15 15:49:36 +00:00
Rob Landley
c7ddefc062 Attempt at fixing bug 815 by upgrading bb_spawn() so that builtins are at
the start of the path.  (This should be under the same config option as
the standalone shell, but right now that's buried in the shell menu.)

Also add the ability to specify CONFIG_BUSYBOX_EXEC_PATH with /proc/self/exe
as an overrideable default.
2006-06-14 01:24:33 +00:00
Rob Landley
18958e9309 Random cleanup of platform.h. 2006-06-13 18:28:33 +00:00
Bernhard Reutner-Fischer
a926f8e50a - add fancy mode to start-stop-daemon to support --oknodo and --verbose 2006-06-11 17:24:01 +00:00
Paul Fox
6ba8bbe88a add ordering warning on enum Location 2006-06-09 12:25:10 +00:00
Paul Fox
6ab037872f made "test" an ash built-in.
moved the contents of libbb/bb_echo.c back into coreutils/echo.c,
which is a more reasonable place for them than libbb.  this
forces anyone who wants echo and test to be builtin to ash to
also have them available as applets.  their cost is very small,
and the number of people who wouldn't want them as applets is
also very small.

added warning about shell builtins vs. CONFIG_FEATURE_SH_STANDALONE_SHELL,
which conflicts with their use.

thanks to nathanael copa for debugging help.

some string size optimization in test.c may have been lost with
this commit, but this is a good new baseline.
2006-06-08 21:37:26 +00:00
Mike Frysinger
2e7dfc179c need prototype for new vfork_daemon() 2006-06-07 21:58:57 +00:00
Rob Landley
6d8ce170b0 Fix from Tito to read from stdin only when it's not a tty. 2006-06-07 21:22:42 +00:00
Bernhard Reutner-Fischer
19008b8373 - reuse strings and messages. Saves about 600B 2006-06-07 20:17:41 +00:00
Bernhard Reutner-Fischer
16d3e4e0af - add applet taskset to set/retrieve the CPU affinity of a process
text    data     bss     dec     hex filename
    584       0       0     584     248 taskset.o.gcc-2.95
    509       0       0     509     1fd taskset.o.gcc-3.3
    505       0       0     505     1f9 taskset.o.gcc-3.4
    506       0       0     506     1fa taskset.o.gcc-4.0
    498       0       0     498     1f2 taskset.o.gcc-4.1
    495       0       0     495     1ef taskset.o.gcc-4.2-HEAD
2006-06-07 15:44:59 +00:00
Mike Frysinger
b16b5bb08f only check __GNU_LIBRARY__ if it is actually defined 2006-06-06 06:00:20 +00:00
Rob Landley
362dc2bf33 Header cleanup on two more networking files (move libbb.h to the top and
remove #includes that libbb.h already does), plus a minor cleanup of
libbb.h to move #includes towards the top of the file where we can see 'em.
2006-06-05 17:35:24 +00:00
Paul Fox
f0327f8e98 fix fdflish typo (reported by erik hovland) 2006-06-02 03:37:16 +00:00
Rob Landley
8fc32d9326 Shaun Jackman pointed out that KERNEL_VERSION() is used without guards, so
defining it in a guard is silly.
2006-06-01 00:52:30 +00:00
Rob Landley
317a45cb62 The common case APPLET() macro only needs three arguments. 2006-06-01 00:51:38 +00:00
Rob Landley
0620841758 Patch from Tito to remove long options from hdparm. 2006-05-31 22:52:57 +00:00
Rob Landley
b623a542df Header file cleanup. platform.h apparently needs to be included early on so it
can figure out what header files to include, and override stuff that comes
later.  But applets shouldn't include platform.h directly, they should include
busybox.h or libbb.h.  Since busybox.h already includes libbb.h, move libbb.h
to the top of busybox.h and platform.h near the top of libbb.h (right after
bbconfig.h, which is something platform.h also needs access to).

While we're at it, move some stuff from busybox.h to libbb.h so we have one
big file to audit/clean up/try to make sense of instead of many.
2006-05-31 22:09:03 +00:00
Rob Landley
8abbee474c Add catv (separate applet instead of cat -v). Also cleanup cat.c comments,
the following of which (from cat.c) belongs in svn history instead of the
source code:

/* Mar 16, 2003      Manuel Novoa III   (mjn3@codepoet.org)
 *
 * This is a new implementation of 'cat' which aims to be SUSv3 compliant.
 *
 * Changes from the previous implementation include:
 * 1) Multiple '-' args are accepted as required by SUSv3.  The previous
 *    implementation would close stdin and segfault on a subsequent '-'.
 * 2) The '-u' options is required by SUSv3.  Note that the specified
 *    behavior for '-u' is done by default, so all we need do is accept
 *    the option.
 */
2006-05-31 19:36:04 +00:00
Bernhard Reutner-Fischer
c418d482ba - s/defined(__uClinux__)/BB_NOMMU/
This needs a second pass to:
+ add bb_daemon(unsigned char no_chdir, unsigned char no_close, const char*flag)
+ eventually globally export argc and argv, so we don't need to pass it to
  bb_daemon().
2006-05-31 10:19:51 +00:00
Bernhard Reutner-Fischer
507cd755a4 - conditionally define BB_NOMMU 2006-05-31 10:04:03 +00:00
Rob Landley
752f0a6001 Put parentheses around some of the SWAP() macros, as pointed out by Peter
Kjellerstedt.
2006-05-30 06:28:03 +00:00
Rob Landley
bba7f08d27 Add SWAP_LE?? and SWAP_BE?? macros, and make things use them. Converts values
to/from little endian or big endian, which is a NOP if that's what the current
platform already is.
2006-05-29 05:51:12 +00:00
Rob Landley
9755197448 This is not C++. 2006-05-29 05:21:29 +00:00
Rob Landley
15d20a03d6 Remove _() and N_() from platform.h. #define them as NOP macros in the two
files still using them.  I didn't remove them from e2fsck.c to avoid stomping
pending cleanup patches from Garrett, and I didn't bother to remove them from
fdisk.c because that entire file needs to be rewritten from scratch.
2006-05-29 05:00:44 +00:00
Rob Landley
81dab2cf83 Fix hdparm to use PRIu64 instead of typecasting to long long (which is 128 bits
on 64 bit platforms), and move #include <inttypes.h> to libbb.h.
2006-05-28 01:56:08 +00:00
Rob Landley
8fba99f35e Move portability stuff to platform.h, and clean up adjtimex.c a bit while
I'm in the area.
2006-05-27 22:08:01 +00:00
Rob Landley
299a6b4d7b Consolidate #include <sys/time.h> so libbb.h does it. 2006-05-27 21:42:58 +00:00
Rob Landley
8bb50782a5 Change llist_add_* to take the address of the list rather than returning the new
head, and change all the callers.
2006-05-26 23:44:51 +00:00
Rob Landley
5edc10275e Slight sanity fix: data is void *, not char *. And it's called data
almost everywhere, so be consistent.
2006-05-26 23:00:10 +00:00
Bernhard Reutner-Fischer
781e42d66c - introduce and use bb_path_wtmp_file for portability (saves 11 Bytes).
- fix last.c to also look at the double-underscore UT_ defines.
2006-05-26 14:41:40 +00:00
Bernhard Reutner-Fischer
8379053b11 - move llist to top of file so we can potentially use it in all prototypes easily 2006-05-26 13:54:07 +00:00
Bernhard Reutner-Fischer
4ed1f1d99d - add workaround for tar being broken since it uses a non-portable constant. 2006-05-26 13:34:25 +00:00
Bernhard Reutner-Fischer
e00fc16aaa - move libc checks from busybox.h to platform.h
- add ATTRIBUTE_ALWAYS_INLINE, endian handling for DEC UNIX, some more
  compiler dependent defines to platform.h
- add conditional bb_setpgrp define to platform.h
- remove superfluous specifying args from "#define fdprintf dprintf"
2006-05-26 13:10:10 +00:00
Mike Frysinger
fa6c4844b2 fix spelling mistakes 2006-05-26 01:48:17 +00:00
Rob Landley
399d2b5c24 Rich Felker suggested removing dprintf() from watch, and one thing led to
another... This adds bb_xspawn() support, which does vfork/exec.  (I don't
know why using a static instead of a local adds ~40 bytes, but using
the local doesn't work...)
2006-05-25 23:02:40 +00:00
Rob Landley
c020f5f518 New version of nohup that's much smaller, less paranoid, consistent,
vaguely portable, and licensed GPLv2 "or later".
2006-05-21 18:28:13 +00:00
Bernhard Reutner-Fischer
35017fb4fc - backout erroneously checked in snippet.. 2006-05-19 20:48:22 +00:00
Rob Landley
80b8ff07ca A pending item in my tree I might as well check in: I plan to migrate calloc()
and bb_calloc() calls to bb_xzalloc() which allocates prezeroed memory but
only takes one argument (the size).
2006-05-19 20:36:49 +00:00
Bernhard Reutner-Fischer
b1629b1b2a - remove emacs layout block as suggested by Robert P.J. Day
- use shorter boilerplate while at it
2006-05-19 19:29:19 +00:00
Mike Frysinger
cf89c37d08 fix indenting in help output for ifconfig 2006-05-19 16:14:31 +00:00
Bernhard Reutner-Fischer
e2e56c7c41 - single KERNEL_VERSION(a,b,c) macro in platform.h
- rename get_kernel_revision() to get_linux_version_code
from Robert P. J. Day
2006-05-19 11:54:02 +00:00
Rob Landley
2686d3bc38 Rob Sullivan cleaned up the longstanding patch from Hideki IWAMOTO to add
ibs and obs support to dd, and made it configurable.  I cleaned it up a bit
further and moved conv= into the same config option.
2006-05-16 16:52:12 +00:00
Rob Landley
34b5319d86 Make md5 calculation always go through an the buffer so that A) we don't
handle packets out of sequence if some data goes through the buffer and
some doesn't, B) it works on systems that can't handle aligned access,
C) we just have one code path to worry about.

While we're at it, sizeof() and RESERVE_CONFIG_BUFFER() really don't combine
well, which is why md5sum has been reading and processing data 4 bytes at a
time.  I suspect that the existence of CONFIG_MD5_SIZE_VS_SPEED to do loop
unrolling and such in the algorithm was an attempt to work around that bug.
2006-05-16 02:38:26 +00:00
Paul Fox
d7384296f6 implement -print0 for find 2006-05-12 14:47:20 +00:00
Rob Landley
a6b5b60942 Fiddling with llist to make memory management easier. Specifically, the
option to delete the contents of the list when we delete the list is a
good thing.
2006-05-08 19:03:07 +00:00
Mike Frysinger
7031f62d9b add back in udhcp support 2006-05-08 03:20:50 +00:00
Rob Landley
63e4c637cb The udhcp was deleted from busybox in 14634. Bolting an external project to
the side of the tree doesn't _COUNT_, and I will not ship it.

Udhcp was deleted shortly after I posted my philosophy for what should and
shouldn't go into busybox:

http://www.busybox.net/lists/busybox/2006-March/019484.html

I complained about the change t the time.  I've complained repeatedly since.
But nobody felt like fixing it.  External dependencies are something to be
minimized.  I don't care about the ability for packages to build outside
busybox: something is either part of busybox, or it isn't.  If I convert any
part of the external udhcp repository to use libbb, I've broken the external
package.  Any random cleanups that touch that directory suddenly have to worry
about external dependencies that are NOT OUR PROBLEM.  Therefore, that
directory is not and cannot be part of busybox.  Wishful thinking isn't going
to change that.  I will not ship something I can't maintain.

I'll try to get a new dhcp client and server in before the ship window closes,
but I have a half-dozen other projects pending.  I'm sorry this happened, but
I'm not the one who removed it, and I'm not the one who ignored the project
maintainer's repeated complaints about the situation for the next month and a
half.
2006-05-07 23:19:20 +00:00
Rob Landley
a389651115 Remove bb_strlen() in favor of -fno-builtin-strlen. Saves as many bytes
as the old optimization did (actually does slightly better under gcc 4.0), and
simplifies the code.
2006-05-07 20:20:34 +00:00
Mike Frysinger
89ede3f586 fix udhcp again 2006-05-06 05:30:46 +00:00
Rob Landley
2381f702c9 Patch from Dennis Vlasenko simplifying the APPLET macros. 2006-05-05 15:55:06 +00:00
Rob Landley
552b56dfd1 Not quite compiler independent, but we've never tried to be gcc independent
anyway.  This is at least less ugly than what was there before, and fixes
building all sources at once.
2006-05-04 21:22:27 +00:00
Rob Landley
3b89039c25 It was sitting there, in the patches directory, for years. It was delete it
or apply it.  It's small, simple, evil, part of SUSv3, and we can switch it
off.
2006-05-04 20:56:43 +00:00
Rob Landley
a2d9a1752c More usage.h cleanups, with collateral changes to httpd. Specifically,
most of our CONFIG entries switch stuff on instead of off when enabled, so fix
the gratuitously reversed INETD thing.
2006-04-28 19:38:04 +00:00
Rob Landley
7e21d5f6b1 Patch from Dennis Vlasenko to add the option to compress help text. 2006-04-27 23:34:46 +00:00
Rob Landley
5fe8d5b9c5 Convert a chunk of usage.h to USE_ and SKIP_ (more to do there), and fix a
DEFALT typo in du while I was there.
2006-04-25 22:40:53 +00:00
Rob Landley
856489b63c New applet cksum, from Rob Sullivan. 2006-04-18 20:57:28 +00:00
Bernhard Reutner-Fischer
ba31d27249 - enable dumpleases applet again; bad rob 2006-04-18 10:04:08 +00:00
Mike Frysinger
5c16988910 enable udhcp applets again; bad rob 2006-04-17 02:00:49 +00:00
Bernhard Reutner-Fischer
c2cb0f32b4 - patch from Denis Vlasenko to add and use bb_xopen3() 2006-04-13 12:45:04 +00:00
Bernhard Reutner-Fischer
d9cf7ac781 - patch from Denis Vlasenko to add and use bb_xchdir() 2006-04-12 18:39:58 +00:00
Bernhard Reutner-Fischer
67f641e75b - patch from Denis Vlasenko to add bb_xbind() and bb_xlisten() 2006-04-12 18:24:37 +00:00
Bernhard Reutner-Fischer
2c99851181 - patch from Denis Vlasenko to add and use bb_xdaemon() 2006-04-12 18:09:26 +00:00
Bernhard Reutner-Fischer
dac7ff15b7 - patch from Denis Vlasenko to add and use bb_xsocket() and to use
bb_xopen some more while at it.
  Also use shorter boilerplate while at it.
2006-04-12 17:55:51 +00:00
Bernhard Reutner-Fischer
cb44816ba3 - add and use bb_opendir(), bb_xopendir().
text    data     bss     dec     hex filename
 889445    9392 1035784 1934621  1d851d busybox.gcc-4.2.orig
 889297    9392 1035784 1934473  1d8489 busybox.gcc-4.2
 889009    9820 1037860 1936689  1d8d31 busybox.gcc-4.1.orig
 888817    9820 1037860 1936497  1d8c71 busybox.gcc-4.1
2006-04-12 07:35:12 +00:00
Bernhard Reutner-Fischer
a23a6d7819 - include netinet/in.h for struct sockaddr_in.
Closes bug #735
2006-04-11 18:15:17 +00:00
Mike Frysinger
f785255a44 Robert P. J. Day writes: even in the header file, make it clear that the routine depends on __uClinux__ 2006-04-11 04:04:40 +00:00
Rob Landley
81c40b39cb Patch from Tito to unify deluser and delgroup, and generally shrink code. 2006-04-10 18:03:17 +00:00
Rob Landley
c57ec37959 Patch from Rob Sullivan to consolidate crc32 table generation. 2006-04-10 17:07:15 +00:00
Bernhard Reutner-Fischer
bc14214018 - patch from Rob Sullivan to add support for -L 2006-04-06 16:07:08 +00:00
Bernhard Reutner-Fischer
8f7d389700 - new applet diff. Rob Sullivan writes:
Here's my attempt at a mini diff applet - it's adapted from the code at
http://www.openbsd.org/cgi-bin/cvsweb/src/usr.bin/diff/, and only supports
unified diffs.

I've busyboxified everything to a reasonable degree, so I think the code is
suitable enough to be included, but there's still a fair bit of cleaning up
to be done.
2006-04-06 08:11:08 +00:00
Bernhard Reutner-Fischer
421d9e5941 - move buffer allocation schemes to libbb.h
- include the correct headers: applets need busybox.h while lib* need libbb.h
2006-04-03 16:39:31 +00:00
Bernhard Reutner-Fischer
a1bccc0ba8 - typos: s/compatability/compatibility/g;s/compatable/compatible/g; 2006-04-02 20:17:55 +00:00
Bernhard Reutner-Fischer
9457e70357 - typo: s/compenent/component/g
add a bit of documentation.
2006-04-02 20:12:31 +00:00
Bernhard Reutner-Fischer
e47c4cbd4d - update help text.
the interface argument is now a lowercase 'i' to match the big arping
  commandline-syntax.
2006-03-31 18:10:31 +00:00
Rob Landley
daa4a6dcbd Update ipaddr help to match reality. 2006-03-30 01:59:30 +00:00
Bernhard Reutner-Fischer
cb8d4319a3 find ./ -name .cvsignore | xargs svn rm 2006-03-29 15:51:19 +00:00
Mike Frysinger
f885513940 just whitespace fixes 2006-03-28 02:35:56 +00:00
Rob Landley
87848d91c7 setlogcons, from Jan Kaszka. 2006-03-27 23:23:43 +00:00
Rob Landley
90ece609e6 Define both big endian and little endian macros. 2006-03-25 03:01:59 +00:00
Mike Frysinger
64bef2ab9c fix typo 2006-03-23 02:06:29 +00:00
Rob Landley
8caffaa9a9 Cleanup: remove double quotes that don't seem to be needed. 2006-03-20 18:39:02 +00:00
Rob Landley
0b22c1c962 Tito unified fdflush and freeramdisk. I tweaked the result a bit. 2006-03-14 02:40:51 +00:00
Rob Landley
c5b1d4d6b1 Patch from Denis Vlasenko to add xstat() and use it. 2006-03-13 15:45:16 +00:00
Rob Landley
dae6aa2859 Fixup to the previous (portability) patch. Linux actually does need
arpa/inet.h rather than netinet/in.h, otherwise we get warnings.
2006-03-09 22:39:08 +00:00
Rob Landley
1f305dc0fd Portability patch from rfelker. The bb_asprintf.c thing needs an eventual
follow up in platform.h to set the #ifdef, but the workaround works for
everybody, so...
2006-03-09 22:21:20 +00:00
Mike Frysinger
874af85d5e import most of e2fsprogs 1.38 updates 2006-03-08 07:03:27 +00:00
Rob Landley
883e0e83f2 Missed one in the get_line_from_file() update... 2006-02-24 03:12:03 +00:00
Bernhard Reutner-Fischer
ed7bb6278d - put NLS stuff in one central place to avoid redefines.
Fixes warnings about:
fdisk.c:45:1: warning: "_" redefined
nfsmount.c:121:1: warning: "_" redefined
nfsmount.c:122:1: warning: "N_" redefined
interface.c:84:1: warning: "_" redefined
2006-02-23 14:25:15 +00:00
Rob Landley
51be57e4df Convert all the applets from #include to USE(). Had to fix some nonstandard
naming along the way to get USE() macros for everything.
2006-02-23 00:42:25 +00:00
Mike Frysinger
73b4710974 fix applet order 2006-02-22 23:33:39 +00:00
Rob Landley
c6d09a6276 You don't need an #ifdef around #defines in usage. 2006-02-22 20:33:15 +00:00
Rob Landley
5cf7c2df66 Patch from Devin Bayer to split up hash_fd.c into md5.c and sha1.c. (I tweaked
md5_sha1_sum.c to convert some #ifdef CONFIG to if(ENABLE).)
2006-02-21 06:44:43 +00:00
Rob Landley
c5789a6e23 Walter Harms added -D to date, and I did a code cleanup while I was in the
area.  Probably broke something...
2006-02-21 05:06:42 +00:00
Mike Frysinger
bf28ed8834 eat extraneous newlines at the end of applet full usage 2006-02-21 04:32:03 +00:00
Mike Frysinger
0a6b0bfa7a add setarch/linux32/linux64 applet 2006-02-21 04:26:52 +00:00
Rob Landley
a2841e6d4b Patch from Giuseppe Ciotta to specify retry count. 2006-02-20 23:26:38 +00:00
"Vladimir N. Oleynik"
0c6ff43a0c remove #undef strlen, use #define strlen always but without xfunc/BB_STRLEN_IMPLEMENTATION 2006-02-20 12:15:10 +00:00
"Vladimir N. Oleynik"
dd1ccddf1b moved BB_BANNER to applets/version.c file: make kernel like version,
removed depend loop: busybox.h depend with BB_BT, and all sources depend with busybox.h
2006-02-16 15:40:24 +00:00
"Vladimir N. Oleynik"
6732af2766 full removed config.h, use bb_config.h only 2006-02-15 12:29:37 +00:00
Rob Landley
7bfa88f315 New USE() macros
For each CONFIG_SYMBOL, include/bb_config.h now has both ENABLE_SYMBOL
and USE_SYMBOL(x).  ENABLE_SYMBOL is still always defined (1 or 0) so that
if(ENABLE) should optimize out when it's zero.  The USE_SYMBOL(X) will only
splice in X if the symbol is defined, otherwise it'll be empty.

Thus we can convert this:

#ifdef CONFIG_ARGS
    opt = bb_getopt_ulflags(argc, argv, "ab:c"
#ifdef CONFIG_THINGY
        "d:"
#endif
        , &bvalue
#ifdef CONFIG_THINGY
        , &thingy
#endif
    );
#endif

into this:
    if (ENABLE_ARGS) {
        opt = bb_getopt_ulflags(argc, argv, "ab:c" USE_THINGY("d:"), &bvalue
                USE_THINGY(, &thingy));
    }

And it should produce the same code.

Unlike the old versions in include/_usage.h, the new USE_SYMBOL(x) can handle
commas in its arguments (as shown above).  (The _usage.h file is obsolete and
no longer generated.)

Nobody should need to include config.h directly anymore, bb_config.h should
define all the configuration stuff we need.  Someday, the CONFIG_SYMBOL
versions should go away in favor of ENABLE_SYMBOL and USE_SYMBOL().

Thanks to vodz for the new version of bb_mkdep.c that works with function
macros.
2006-02-13 19:16:41 +00:00
Mike Frysinger
4fcefb9e90 fixup whitespace in awk help output 2006-02-06 23:38:59 +00:00
Mike Frysinger
35cf19d741 fix mdev help output 2006-02-02 22:52:59 +00:00
Bernhard Reutner-Fischer
9f4a1e1c75 - add and use ATTRIBUTE_ALIGNED(num_bytes)
- remove unused parameter pindex from fdisk.c, xbsd_initlabel()
2006-01-31 09:53:53 +00:00
Rob Landley
646129163a Re-add initrd support, unify halt/reboot/poweroff, add -n and -f options. 2006-01-30 08:31:37 +00:00
"Vladimir N. Oleynik"
7b4aa6ffc6 new applet. Thanks Roberto A. Foglietta 2006-01-25 14:19:11 +00:00
Tim Riker
c1ef7bdd8d just whitespace 2006-01-25 00:08:53 +00:00
Rob Landley
6130b9b160 Testing CONFIG_SORT_BIG to display the help for the big version of sort isn't
much use when the symbol is CONFIG_FEATURE_SORT_BIG.
2006-01-23 21:10:38 +00:00
Bernhard Reutner-Fischer
86f5c9906b - add platform.h.
- use shorter boilerplate while at it.
2006-01-22 22:55:11 +00:00
Rob Landley
c1d69906a0 Patch from Aurelien Jacobs to add unlzma. (A new decompression type,
see www.7-zip.org)
2006-01-20 18:28:50 +00:00
Bernhard Reutner-Fischer
5a620ea220 - Document -m, -c, -s and provide a default shell for standalone build.
- Wrap overlong lines plus a few whitespace fixes.
- add GPL header.
2006-01-19 18:04:15 +00:00
Bernhard Reutner-Fischer
7ca61b6f33 - shared libbusybox.
- IMA compilation option (aka IPO, IPA,..)
Please holler if i broke something..
2006-01-15 14:04:57 +00:00
Paul Fox
72d1a2357d add find's "-mmin" option. configurable. 2006-01-13 21:05:41 +00:00
Mike Frysinger
e885d5300a Tito writes:
Somehow while applying the bb_do_delay patch a change slipped
in libbb.h that broke compilation.

libbb.h Line 355 
  extern char bb_path_mtab_file[];

This conflicts with mtab_file.c
#if defined(CONFIG_FEATURE_MTAB_SUPPORT)
const char bb_path_mtab_file[] = "/etc/mtab";
#else
const char bb_path_mtab_file[] = "/proc/mounts";
#endif
2006-01-08 11:15:34 +00:00
Rob Landley
84cb76733f patch from tito: consolidate delay functions as bb_do_delay() 2006-01-06 20:59:09 +00:00
Mike Frysinger
29ed59ee11 make mount usage a bit more terse 2006-01-04 00:04:08 +00:00
Rob Landley
ce88793698 When you went "losetup -d /dev/loop0 /dev/loop1" the error message was strange. 2005-12-21 17:00:25 +00:00
Rob Landley
70f7ef7be3 Nothing to see here. Move along.
Not buying it, eh?

I know I said new features before 1.1, but, well...  (I was weak!)

The config file and hotplug modes aren't implemented yet.  Might take a stab at
those tomorrow.  (I _should_ go back to focusing on the bug triage list.)
2005-12-13 08:21:33 +00:00
Rob Landley
9c32a15220 Yann E. Morin's update to modprobe usage. 2005-12-11 20:12:24 +00:00
Glenn L McGrath
0bd0257fe0 Add build options to control SuS compatability, allows numeric
option handling to be disabled.
Defaults to enabled, so no changes in default behaviour
2005-12-11 03:09:05 +00:00
Rob Landley
02bab6869e Tito is using broken kernel headers that pollute the namespace with every
CONFIG_ symbol in the kernel, and this clashes with busybox's CONFIG_TR
and CONFIG_WATCHDOG, causing applets.h to barf if they're not switched
on (since the broken headers don't affect kconfig or the makefiles).

Since such broken kernel headers are common enough to crop up every few
months, a simple work around is to move TR and WATCHDOG from CONFIG_
to ENABLE_ early.
2005-12-06 22:48:29 +00:00
"Vladimir N. Oleynik"
2f0a5f947a restore compare_string_array new interface (make broken by landley) 2005-12-06 12:00:39 +00:00
Rob Landley
1d589b2e2d Fix losetup so that it A) actually works again, B) has much better error
messages, C) can show the current association (if any) when called
with only one argument.  Update the documentation a lot too.

Remind me to add a test suite for this thing.  I think I've figured out
how to handle root-only testsuites...
2005-11-29 23:47:10 +00:00
Paul Fox
969af89797 add "-C" format to hexdump
fixes bug #113 and satisfies a personal need at the same time.

output compares identically to util-linux version.  (with
exception of whitespace differences on last lines of output with
non-uniform length, which are neither fixed nor worsened by this
change.)
2005-11-28 21:06:00 +00:00
"Vladimir N. Oleynik"
cc34344d91 change the interface of libbb/compare_string_array (unsigned short to int), usaging for e2fsprogs/fsck 2005-11-26 10:45:26 +00:00
"Vladimir N. Oleynik"
61ff4b3973 more use const for interface of libbb/compare_string_array, example usage for e2fsprogs/fsck 2005-11-26 10:33:55 +00:00
Rob Landley
fe25715792 Update to modprobe usage from Yann E. Morin 2005-11-23 04:55:02 +00:00
Rob Landley
64a5f96780 telnetd -b (bind to specific address) support from Iuri Gomes Diniz. 2005-11-10 22:37:40 +00:00
Bernhard Reutner-Fischer
62d7acc97e - add BB_APPLET_RUNLEVEL used by emdebian via /etc/init.d/rc.
Note that we leave the buggy CONFIG_* namespace now, so please fix any applet you thouch.
2005-10-28 20:37:03 +00:00
Rob Landley
aa87276bed New applet, fuser, from Tony J. White. (Needs some cleanup.) 2005-10-28 13:05:12 +00:00
Rob Landley
0f34a821ab Add a switch_root utility (like kconfig's utils/run_init.c, although not
actuall using any of that code).  This is needed because pivot_root doesn't
work right under initramfs.  (See the menuconfig help.)
2005-10-27 22:55:50 +00:00
Rob Landley
f3d6c94c7f Add --no-same-owner and --no-same-permissions options to tar. 2005-10-27 22:49:08 +00:00
"Vladimir N. Oleynik"
6f347ef9dc common BUFSIZ BSS buffer, small reduce code, data and bss 2005-10-15 10:23:55 +00:00
"Vladimir N. Oleynik"
86a1073e0b bb_dev_null 2005-10-12 15:21:32 +00:00
Bernhard Reutner-Fischer
81c3a518d3 - pidof(8): make -s optional and optional -o; closes #168
first cut.
2005-10-06 15:37:02 +00:00
Bernhard Reutner-Fischer
56b217117a - add llist_free_one() and llist_free() to libbb; Add a bit of documentation.
- change llist_add_to_end as proposed by vodz in http://busybox.net/lists/busybox/2005-September/016411.html
- remove unneeded includes, add short boilerplate and copyright to llist.c
- move COMM_LEN from find_pid_by_name to libbb.h and use it in procps_status_t
- add reverse_pidlist() to find_pid_by_name. Will be needed for pidof.
2005-10-06 12:10:48 +00:00
Bernhard Reutner-Fischer
6d6a40cc4b - add option 'w' to ps (wide output, optional feature defaults to off).
- move to ENABLE_ and use shorter boilerplate.

sizes without selinux-support:
   text	   data	    bss	    dec	    hex	filename
    356	      0	      0	    356	    164	procps/ps.o.with-w
    300	      0	      0	    300	    12c	procps/ps.o.no-w
    302	      0	      0	    302	    12e	procps/ps.o.oorig
2005-10-04 14:31:18 +00:00
Bernhard Reutner-Fischer
5209e18ba7 - add prototype for llist_add_to_end to libbb.h 2005-10-04 13:39:06 +00:00
Rob Landley
5d3a0e8ed3 Add find -exec support from Rob Sullivan, and convert CONFIG_ to ENABLE_
while we're in the area.
2005-10-04 03:34:39 +00:00
"Vladimir N. Oleynik"
39a841cecf change interface to bb_xasprintf() - more perfect for me.
ln.c: error_msg(str)->error_msg(%s, str) - remove standart "feature" for hackers
reduce 100 bytes don't care in sum
2005-09-29 16:18:57 +00:00
"Vladimir N. Oleynik"
843c5ef0f9 reorder include <sys/types.h> and <sys/types.h>. 2005-09-29 07:55:51 +00:00
Mike Frysinger
036f299137 Cristian Ionescu-Idbohrn says: touchup whitespace/display 2005-09-24 23:50:14 +00:00
Rob Landley
16722554bf Tito switched option parsing over to switch umount over to bb_getopt_ulflags(). 2005-09-24 22:41:08 +00:00