Commit Graph

587 Commits

Author SHA1 Message Date
Denis Vlasenko
342b0ab945 less: forgot trivial #if ENABLE_xxxx 2007-05-31 23:06:18 +00:00
Denis Vlasenko
9a7d38fe24 delete tons of extra #includes 2007-05-31 22:42:12 +00:00
Denis Vlasenko
fad2b86c9e use "glibc errno" trick not only for ash, but for entire busybox
(add/remove: 1/1 grow/shrink: 37/37 up/down: 139/-228)        Total: -89 bytes
2007-05-31 22:16:38 +00:00
Denis Vlasenko
c2f011aa03 more: stop using bss
# make && make bloatcheck
function                                             old     new   delta
gotsig                                                86     107     +21
more_main                                            777     781      +4
cin_fileno                                             4       -      -4
set_tty_to_initial_mode                               25       -     -25
new_settings                                         120      60     -60
initial_settings                                     120      60     -60
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/2 up/down: 25/-149)          Total: -124 bytes
2007-05-31 21:31:56 +00:00
Denis Vlasenko
22a9a3c6f8 less: fix very obscure memory corruption bug 2007-05-31 15:56:10 +00:00
Denis Vlasenko
a1d24a0b6e less: stop using data/bss. Code got smaller too.
# size busybox_old busybox_unstripped
   text    data     bss     dec     hex filename
 700719    2896   17880  721495   b0257 busybox_old
 700547    2832   17432  720811   affab busybox_unstripped
# size */*/less.o
   text    data     bss     dec     hex filename
   6861      50     344    7255    1c57 busybox.t0/miscutils/less.o
   6657       0       0    6657    1a01 busybox.t1/miscutils/less.o
2007-05-31 15:55:03 +00:00
Denis Vlasenko
199c0d542b nmeter: stop using data/bss; reduce amount of reads from /proc
# size */*/nmeter.o
   text    data     bss     dec     hex filename
   4366      80      16    4462    116e busybox.t0/miscutils/nmeter.o
   4386       0       0    4386    1122 busybox.t2/miscutils/nmeter.o
2007-05-30 14:48:38 +00:00
Denis Vlasenko
4b924f3a5c whitespace fixes 2007-05-30 00:29:55 +00:00
Denis Vlasenko
b6adbf1be2 usage.c: remove reference to busybox.h
*: s/include "busybox.h"/include "libbb.h"
2007-05-26 19:00:18 +00:00
Denis Vlasenko
6963eb53a1 hdparm: make -T -t code smaller (-194 bytes), and output prettier 2007-05-22 21:46:11 +00:00
Denis Vlasenko
8465a99ce7 less: fix case when regex search finds nothing 2007-05-09 18:32:54 +00:00
Denis Vlasenko
ac678ec2f1 style fixes, no code changes 2007-04-16 22:32:04 +00:00
Denis Vlasenko
16abcd90ae teach find_root_device to deal with /dev/ subdirs
(by "Kirill K. Smirnov" <lich@math.spbu.ru>)
2007-04-13 23:59:52 +00:00
Denis Vlasenko
51742f4bb0 style fixes. No code changes 2007-04-12 00:32:05 +00:00
Denis Vlasenko
50f7f446ec bb_full_fd_action: remove potential xmalloc from NOFORK path
cat: stop using stdio.h opens
libbb: introduce & use open[3]_or_warn
function                                             old     new   delta
open3_or_warn                                          -      54     +54
bb_cat                                               115     144     +29
open_or_warn                                           -      25     +25
unlzma                                              2404    2412      +8
chattr_main                                          334     339      +5
xstrtoul_range_sfx                                   251     255      +4
telnet_main                                         1514    1510      -4
static.opt                                             4       -      -4
qgravechar                                           122     118      -4
fuser_add_pid                                         61      54      -7
fuser_add_inode                                      154     147      -7
writeFileToTarball                                  1542    1534      -8
refresh                                             1156    1148      -8
do_show                                              856     846     -10
read_leases                                          212     200     -12
setup_redirects                                      236     222     -14
iproute_list_or_flush                               1582    1568     -14
read_config                                          427     411     -16
write_leases                                         284     264     -20
hash_file                                            338     318     -20
copy_file                                           1760    1740     -20
do_iproute                                          2610    2588     -22
bb_full_fd_action                                    320     269     -51
open_to_or_warn                                      103      49     -54
fuser_main                                          1660    1596     -64
.rodata                                           131160  131096     -64
------------------------------------------------------------------------------
(add/remove: 2/1 grow/shrink: 4/19 up/down: 125/-423)        Total: -298 bytes
2007-04-11 23:20:53 +00:00
Bernhard Reutner-Fischer
de17ece1db - use skip_non_whitespace() where appropriate 2007-04-10 09:38:35 +00:00
Bernhard Reutner-Fischer
febe3c4211 - sed -e "s/char[[:space:]]*\*[[:space:]]*argv\[\]/char **argv/g" 2007-04-04 20:52:03 +00:00
Denis Vlasenko
ae47cd1da7 hdparm: fix multisector mode setting
(from Toni Mirabete <amirabete@catix.cat>)
2007-03-31 10:30:02 +00:00
Denis Vlasenko
0eec4abb13 hdparm: flag variables can easily be smaller than long
function                                             old     new   delta
process_dev                                         5247    5325     +78
bb_ioctl_on_off                                       72      78      +6
unregister_hwif                                        4       1      -3
...
perform_reset                                          4       1      -3
parse_xfermode                                       111     108      -3
noisy_piomode                                          4       1      -3
...
do_flush                                               4       1      -3
do_ctimings                                            4       1      -3
static.parm                                            4       -      -4
static.multcount                                       4       -      -4
parse_opts                                            54      48      -6
hdparm_main                                         1435    1383     -52
------------------------------------------------------------------------------
(add/remove: 0/2 grow/shrink: 2/61 up/down: 84/-243)         Total: -159 bytes
2007-03-28 01:00:45 +00:00
Denis Vlasenko
7c282a2078 hdparm: remove stray static (-200 bytes bss) 2007-03-28 00:14:54 +00:00
Denis Vlasenko
f1ba749509 hdparm: whitespace style fixes 2007-03-28 00:14:01 +00:00
Denis Vlasenko
10457b90db make pidfile writing configurable.
[ui]toa_to_buf: change API. No users yet.
2007-03-27 22:01:31 +00:00
Denis Vlasenko
53091ecd20 Attempt to get more applets compile for NOMMU.
TODO_config_nommu documents what I managed to compile so far
(yay! msh works! cool). inetd, telnetd, httpd still do not compile. TODO
Also make fork(), daemon() produce warnings on compile stage
(in addition to erros on link stage).
2007-03-26 13:35:09 +00:00
Denis Vlasenko
5a142025d3 move everything to new NOMMU helpers, except udhcp 2007-03-26 13:20:54 +00:00
Denis Vlasenko
f62c6fa1ca nmeter: should die if stdout doesn't like him anymore 2007-03-26 13:16:22 +00:00
Denis Vlasenko
5b27fbe990 dc: use common_bufsiz1 for evaluation stack
msh: fix "underscore bug" (a_b=1111 didn't work)
dnsd: openlog(), so that applet's name is logged
2007-03-24 14:06:51 +00:00
Denis Vlasenko
9067f13be0 NOMMU re-exec trick shuld not depend on existence of "don't daemonize"
option for every affected applet (and dnsd, for example, don't have one).
Thus rework re-exec support to not require it. Code got smaller too.
2007-03-24 12:11:17 +00:00
Denis Vlasenko
c86e052b81 fix accumulated whitespace and indentation damage 2007-03-20 11:30:28 +00:00
Denis Vlasenko
dd2b2f75ae adjtimex: fix argument types (most importantly, allow negative ones) 2007-03-14 23:00:26 +00:00
Denis Vlasenko
cfa2b3a209 watchdog: don't use static variable 2007-03-14 21:55:41 +00:00
Denis Vlasenko
baca175912 kill superfluous returns at the end of void functions 2007-03-11 13:43:10 +00:00
Denis Vlasenko
4eb8b936cb more: do not mess with "/dev/console" (!);
fill whole 1st screen (was "screen sans one line");
    fall back to cat if redirected or no ctty
less: fall back to cat if no ctty (was exiting)
resize: cosmetics
2007-03-10 16:32:14 +00:00
Bernhard Reutner-Fischer
71bc71a7dc - add chrt applet.
text    data     bss     dec     hex filename
    769       0       0     769     301 miscutils/chrt.o
and could use some further shrinkage
2007-03-09 16:56:38 +00:00
Bernhard Reutner-Fischer
48e71c188f - move bbconfig into alphabetical order 2007-03-09 14:27:50 +00:00
Denis Vlasenko
f5a157615d less: handle yet another Home/End key sequence; expand a comment 2007-03-09 08:55:23 +00:00
Denis Vlasenko
a1c631278b less: make '/' (regex search) scan input if no matches are found
in input taken so far.
2007-03-08 18:12:01 +00:00
Denis Vlasenko
18d6fc1a50 less: yet another attempt to make search better 2007-03-08 17:52:36 +00:00
Denis Vlasenko
5c1de36702 less: fix 'n'ext match: sometimes was going to 999999th line 2007-03-08 16:44:32 +00:00
Denis Vlasenko
8e858e2700 clean up accumulated whitespace damage 2007-03-07 09:35:43 +00:00
Denis Vlasenko
3bf0020a5f hdparm: style fixes, no code changes 2007-02-18 13:36:04 +00:00
Denis Vlasenko
b30418ac19 less: support xterm's home/end; improve forward search 2007-02-14 20:49:14 +00:00
Denis Vlasenko
1d76f439da EXEC_PREFER_APPLETS support by Gabriel L. Somlo <somlo@cmu.edu> 2007-02-06 01:20:12 +00:00
Denis Vlasenko
06af216528 suppress warnings about easch <applet>_main() having
no preceding prototype
2007-02-03 17:28:39 +00:00
Denis Vlasenko
89ef65f024 preparatory patch for -Wwrite-strings #5 2007-01-29 23:43:18 +00:00
Denis Vlasenko
06c0a71d23 preparatory patch for -Wwrite-strings #3 2007-01-29 22:51:44 +00:00
Denis Vlasenko
b6aae0f381 preparatory patch for -Wwrite-strings #2 2007-01-29 22:51:25 +00:00
Denis Vlasenko
e935602ff5 taskset: fix incorrect rage spec and allow 0xXXX input
ping: shave off 60 bytes
2007-01-29 18:03:54 +00:00
Bernhard Reutner-Fischer
f98d637ba4 - readahead depends on LFS 2007-01-26 09:03:23 +00:00
Mike Frysinger
08e7097340 "depends ..." -> "depends on ..." 2007-01-24 09:14:09 +00:00
Mike Frysinger
71a6a4e723 correct file format errors 2007-01-24 08:24:43 +00:00
Bernhard Reutner-Fischer
bb8c7c041c - sed -i -e "/\$Id:/d;" 2007-01-22 17:04:53 +00:00
Bernhard Reutner-Fischer
7b1f23610f - use makedev to get device number, else it gives wrong major/minor numbers to devices files on systems which use big device numbers.
Closes #919
2007-01-21 11:20:01 +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
Denis Vlasenko
3a34d0c08a random small size optimizations 2007-01-12 22:10:34 +00:00
Denis Vlasenko
9b1381fd2f convert calloc to xzalloc
fix sleep-on-die option
2007-01-03 02:56:00 +00:00
Denis Vlasenko
50ddabc859 less: fix <tab><backspace> buglet 2006-12-31 19:36:01 +00:00
Denis Vlasenko
95b307103a less: interpret backspace.
less is officially declared PAGER-capable! ;)
(this includes viewing of manpages)
2006-12-31 19:23:31 +00:00
Denis Vlasenko
806116b234 fixes from Yann E. MORIN <yann.morin.1998@anciens.enib.fr> 2006-12-31 12:14:16 +00:00
Denis Vlasenko
3bba545a54 done a dozen of randconfig test. guess what? ALL failed...
these are resulting fixes
2006-12-30 17:57:03 +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
bf0a201008 style fixes
last xcalloc replaced by xzalloc
2006-12-26 10:42:51 +00:00
Denis Vlasenko
5a4f0994b0 less: fix regexp search '/' on large files 2006-12-25 01:23:02 +00:00
Denis Vlasenko
7cea262273 small stupid changes. no code changes 2006-12-24 07:30:09 +00:00
Denis Vlasenko
f4dff77355 less: implement waiting for input using select(). Rather tricky business.
But we do not read entire input anymore up-front.
2006-12-24 07:14:17 +00:00
Denis Vlasenko
c5cb38f4d9 time: -200 bytes of text 2006-12-22 13:43:19 +00:00
Denis Vlasenko
f93ab47c45 time: fix option parsing bug, size optimizations 2006-12-22 12:36:13 +00:00
Denis Vlasenko
f1282a8792 less: a few fixes for cases where we overflow status line 2006-12-21 17:03:20 +00:00
Denis Vlasenko
f65d1338dc less: restore TAB display (was showing as inverse I after prev changes :) 2006-12-21 15:23:45 +00:00
Denis Vlasenko
d51d14e36f less: "(null)" is a bit strange. "standard input" is better :) 2006-12-21 13:57:37 +00:00
Denis Vlasenko
e147a72173 less: how many different kinds of status line we need, three?!
small fixes. [prev commit also added control char filtering
on input (e.g. regexp input, filename input for 'E' etc)]
2006-12-21 13:26:54 +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
3f3190e34c less: total cleanup and bugfix.
Doesn't die horribly on binary files anymore.
In fact, they _100%_ work now. Control chars
are in reverse video, including DEL and that idiocy of VT-10x,
Meta-ESC [inventor of which should be prohibited from reproducing].
Regex search is fixed also. When you specify search ('/' key),
control chars turn into dots (unhighlighted),
and found occurrences highlighted instead. This is reversible.
Memory management fixed (was leaky as hell) and optimized.
Linewrapping fixed and thoroughly tested.
Max buffer size made configurable.
~ 600 bytes saved.
2006-12-21 00:22:03 +00:00
Denis Vlasenko
9a7cef930f less: somewhat buggy applet, but nice. Muchly reduced
xstrdup'ing and memory consumption. Made linewrap saner.
regex matching code was awful - still buggy, but not as
leaky as before. Made buffer size configurable. Killed
several static and on-stack buffers. Hopefully eliminated
staircase effect on Ctrl-C (unable to reproduce).
2006-12-20 02:46:48 +00:00
Denis Vlasenko
b95636c52f remove casts from xmalloc() 2006-12-19 23:36:04 +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
2ea630f9a5 bb_makedev: fix for glibc 2.3.2
sed: fix C++ style declaration
2006-12-10 02:52:19 +00:00
Bernhard Reutner-Fischer
882e60c442 - shrink less.
01a: svn version
01b: merge past_eof and inp_stdin into flags.
01c: merge match_backwards into flags.
01d: add handling of <HOME> and <END> keys, remove set_tty_raw, use fflush_stdout_and_exit
01e: rewrite special-key handling to be smaller.
01f: changing the format saves 4 bytes (alot of places would benefit from this)
   text    data     bss     dec     hex filename
   9034       8     648    9690    25da less.o.01a
   9023       8     640    9671    25c7 less.o.01b
   9027       8     636    9671    25c7 less.o.01c
   9068       8     636    9712    25f0 less.o.01d
   8990       8     636    9634    25a2 less.o.01e
   8986       8     636    9630    259e less.o.01f
2006-12-04 16:04:50 +00:00
Denis Vlasenko
d9e15f2068 style cleanup: return(a) -> return a, part 2 2006-11-27 16:49:55 +00:00
Denis Vlasenko
079f8afa0a style cleanup: return(a) -> return a, part 1 2006-11-27 16:49:31 +00:00
Denis Vlasenko
cf749bc10c small fixes:
fix xstrdup to not grossly overallocate memory
use xopen instean of xopen3 in several places
etc.
2006-11-26 15:45:17 +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
89f0b3486d rodata cleanup. "unable to" == "cannot". -300 bytes 2006-11-18 22:04:09 +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
aae0311356 smart_ulltoa5: make available in libbb 2006-11-05 00:44:39 +00:00
Denis Vlasenko
9225854144 mostly style fixes 2006-11-01 10:25:35 +00:00
Denis Vlasenko
d3d004dd35 last nail into error_msg() (de)capitalization 2006-10-27 09:02:31 +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
c6f188def8 silly size savings and capitalization fixes 2006-10-26 00:37:00 +00:00
Denis Vlasenko
d18a3a20db use skip_whitespace where appropriate 2006-10-25 12:46:03 +00:00
Bernhard Reutner-Fischer
a481d87ff7 - we take exactly one argument. 2006-10-24 20:06:55 +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
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
1db39b2f51 nmeter: new applet. ~4k
Fix build proble on x86_64
2006-10-11 20:59:02 +00:00
Denis Vlasenko
1385899416 attempt to regularize atoi mess. 2006-10-08 12:49:22 +00:00
Denis Vlasenko
f7a57848c2 eject: remove unmounting. It is buggy for many non-trivial
mounts, and can be done as shell script.
2006-10-07 15:00:29 +00:00
Denis Vlasenko
000b9ba91f eject: -T fix 2006-10-05 23:12:49 +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
2e864cd219 eject: -T (implements single button open/close) 2006-10-02 20:49:25 +00:00
Denis Vlasenko
c16bd212e3 silly switch style fix 2006-09-27 19:51:06 +00:00
Denis Vlasenko
94d5d82bd8 crontab: we indent using tabs 2006-09-27 19:48:56 +00:00
Denis Vlasenko
c290563319 remove unneeded #includes, fix indentation 2006-09-23 16:01:09 +00:00
Denis Vlasenko
6429aabbf1 bb_askpass: shorten static password buffer. 256 is way too large.
simplify code a bit.
2006-09-23 12:22:11 +00:00
Denis Vlasenko
109d21fe74 adjtimex: getopt_ulflags'isation 2006-09-22 08:47:54 +00:00
Rob Landley
e9a7a6212b Change license statements (and clean up headers) on some of the files that
Erik or I are primary copyright holders on.
2006-09-22 02:52:41 +00:00
Denis Vlasenko
9213a9e0f2 whitespace cleanup 2006-09-17 16:28:10 +00:00
Bernhard Reutner-Fischer
64d7e93081 - convert a few xopen3(,,0) into xopen(,). Also peruse the fact that xopen defaults to 0777 on it's own, so we don't need to xopen3(,,0777).
Saves a few bytes:
$ size busybox.old busybox                                text    data     bss     dec     hex filename
 839676    8780  243592 1092048  10a9d0 busybox.old
 839660    8780  243592 1092032  10a9c0 busybox
$ make CC=gcc-4.2-HEAD bloatcheck
function                                             old     new   delta
static.vconfig_main                                  281     279      -2
static.rx_main                                      1076    1074      -2
static.mt_main                                       294     292      -2
static.gzip_main                                     753     751      -2
static.mkfs_minix_main                              4034    4030      -4
static.unzip_main                                   1771    1766      -5
static.crontab_main                                 1513    1507      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 0/7 up/down: 0/-23)             Total: -23 bytes
2006-09-11 16:01:40 +00:00
Denis Vlasenko
049d6b8c08 Add CONFIG_FEATURE_SYSLOG which controls whether
bb_xx_msg will ever try to send output to syslog.
Add "select CONFIG_FEATURE_SYSLOG" to relevant applets.
This allows to omit syslog code if we do not have
any syslog-capable applets in the build.
2006-09-07 06:02:39 +00:00
Denis Vlasenko
6d655be5df removed a lot of trailing \n in bb_msg() calls. It is added
automatically by function itself.
2006-09-06 19:02:46 +00:00
Rob Landley
98a915713d Michael Opdenacker spotted that makefile should use () instead of {}. 2006-08-21 17:42:03 +00:00
Rob Landley
1ffe1ede54 Oops, Michael pointed out that my cleanup left some dead code in there. 2006-08-21 16:03:38 +00:00
Rob Landley
0e4690d4ef Michael Opdenacker contributed a readahead applet. 2006-08-20 22:12:18 +00:00
Bernhard Reutner-Fischer
d591a360d3 - merge -r15463:15564 from busybox_scratch branch through these changesets:
------------------------------------------------------------------------
r15465 | aldot | 2006-06-21 20:48:06 +0200 (Wed, 21 Jun 2006) | 3 lines

- use CONFIG_BUSYBOX_EXEC_PATH as before it one was broken by a recent revert.
- use xchdir() since all is invain if it fails there anyways, supposedly

------------------------------------------------------------------------
r15466 | aldot | 2006-06-21 20:55:16 +0200 (Wed, 21 Jun 2006) | 2 lines

- adjust docs to take CONFIG_BUSYBOX_EXEC_PATH into account.

------------------------------------------------------------------------
r15467 | aldot | 2006-06-21 21:31:24 +0200 (Wed, 21 Jun 2006) | 18 lines

- partial fallout of my TREE_USED touchup against gcc-4.2: rip unused vars, save
s 144 bytes
   text    data     bss     dec     hex filename
 862434   10156  645924 1518514  172bb2 busybox.old
 862322   10156  645892 1518370  172b22 busybox
function                                             old     new   delta
z_len                                                  4       -      -4
textend                                                4       -      -4
part_nb                                                4       -      -4
insize                                                 4       -      -4
ifile_size                                             4       -      -4
do_link                                                4       -      -4
new_text                                              70      60     -10
ipaddr_list_link                                      33      23     -10
gzip_main                                            898     822     -76
------------------------------------------------------------------------------
(add/remove: 0/6 grow/shrink: 0/3 up/down: 0/-120)           Total: -120 bytes


------------------------------------------------------------------------
r15468 | aldot | 2006-06-21 21:43:05 +0200 (Wed, 21 Jun 2006) | 19 lines

- remove useless global exports
function                                             old     new   delta
rpm_main                                             940    1601    +661
rpm_getstring                                        107     112      +5
rpm_getint                                           148     153      +5
loop_through_files                                   103     106      +3
fileaction_dobackup                                  115     113      -2
fileaction_list                                        5       -      -5
rpm_getcount                                          42       -     -42
extract_cpio_gz                                      161       -    -161
rpm_gettags                                          504       -    -504
------------------------------------------------------------------------------
(add/remove: 0/4 grow/shrink: 4/1 up/down: 674/-714)          Total: -40 bytes

   text    data     bss     dec     hex filename
 862322   10156  645892 1518370  172b22 busybox.old
 862290   10156  645892 1518338  172b02 busybox


------------------------------------------------------------------------
r15555 | aldot | 2006-06-30 14:10:11 +0200 (Fri, 30 Jun 2006) | 22 lines

- shrink syslog a little bit, move a big buffer (for 'line') off the bss, fold s
emaphore stuff into single caller manually.
  stats:
function                                             old     new   delta
logMessage                                           395     427     +32
message                                             1245    1257     +12
opts                                                   -       4      +4
small                                                  1       -      -1
local_logging                                          4       -      -4
doRemoteLog                                            4       -      -4
circular_logging                                       4       -      -4
syslogd_main                                        1299    1285     -14
static.res                                            36      16     -20
.rodata                                           186650  186586     -64
static.line                                         1025       -   -1025
------------------------------------------------------------------------------
(add/remove: 1/5 grow/shrink: 2/3 up/down: 48/-1136)        Total: -1088 bytes
cow@s37:~/src/busybox_scratch$ size sysklogd/syslogd.o{.orig,}
   text    data     bss     dec     hex filename
   3723     348    5242    9313    2461 sysklogd/syslogd.o.orig
   3697     348    4188    8233    2029 sysklogd/syslogd.o

==============================================================================
Overall bloatcheck for the changeset mentioned above:
function                                             old     new   delta
rpm_main                                             953    1608    +655
logMessage                                           395     427     +32
message                                             1245    1257     +12
opts                                                   -       4      +4
rpm_getstring                                        107     110      +3
rpm_getint                                           148     151      +3
loop_through_files                                   103     104      +1
small                                                  1       -      -1
fileaction_dobackup                                  115     113      -2
z_len                                                  4       -      -4
textend                                                4       -      -4
part_nb                                                4       -      -4
local_logging                                          4       -      -4
insize                                                 4       -      -4
ifile_size                                             4       -      -4
do_link                                                4       -      -4
doRemoteLog                                            4       -      -4
circular_logging                                       4       -      -4
fileaction_list                                        5       -      -5
new_text                                              70      60     -10
ipaddr_list_link                                      33      23     -10
clear_bufs                                            31      21     -10
syslogd_main                                        1287    1273     -14
builtin_help                                         190     176     -14
static.res                                            36      16     -20
builtin_source                                       229     199     -30
rpm_getcount                                          42       -     -42
gzip_main                                            842     786     -56
.rodata                                           227176  227112     -64
lash_main                                            609     527     -82
busy_loop                                           3883    3739    -144
extract_cpio_gz                                      155       -    -155
rpm_gettags                                          501       -    -501
static.line                                         1025       -   -1025
------------------------------------------------------------------------------
(add/remove: 1/15 grow/shrink: 6/12 up/down: 710/-2221)     Total: -1511 bytes
2006-08-20 17:35:13 +00:00
Rob Landley
403777ffae Patch from tito to improve options parsing. 2006-08-03 20:22:37 +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
Rob Landley
c052576821 Tito said that strings is a complete rewrite. 2006-07-31 16:37:57 +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
1f9145c5c3 More minor tweaks. 2006-07-12 21:31:16 +00:00
"Robert P. J. Day"
801ab14013 Add one-line GPL boilerplate to numerous (but not all yet) source files. 2006-07-12 07:56:04 +00:00
Mike Frysinger
259472e741 remove duplicate CONFIG_TASKSET option 2006-07-03 05:22:36 +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
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
11c7a7bed6 Various cleanups I made while going through Erik Hovland's patch submissions,
some of which are even from him. :)
2006-06-25 22:39:24 +00:00
Bernhard Reutner-Fischer
f087798e8b - convert old-style parameter declarations (K&R) to modern style. 2006-06-25 22:08:53 +00:00
Rob Landley
399d45f1c6 Aurelien Jacobs pointed out inline functions that could be removed. Doing so
shrank the code a bit.
2006-06-21 01:49:17 +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
176f2df69b Patch from Erik Hovland, via Tito. 2006-06-08 14:19:48 +00:00
Rob Landley
9c6f9552ec Some day, maybe gcc will be able to optimize out static functions that are
never used so we don't have to #ifdef them.  Wouldn't that be nice?
2006-06-08 14:11:36 +00:00
Mike Frysinger
9be7435203 initial support for no-mmu systems 2006-06-07 21:48:43 +00:00
Mike Frysinger
2fc534f3f1 hint at where the Magic comes from 2006-06-07 21:37:49 +00:00
Bernhard Reutner-Fischer
f915a77386 - do away with the comment that noted that the current implementation
unly supports linux.
2006-06-07 21:26:09 +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
Rob Landley
4c5ad2fc90 Consolidate devfs garbage and mark it as obsolete. 2006-06-07 20:11:53 +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
ea93f8a397 Tito writes: this patch fixes two potential bugs with the -i -I flags that could be reset during option parsing 2006-06-07 14:25:22 +00:00
Rob Landley
0753f4a15e Callers to identify() converted the endianness of the buffer. So did
identify().  This meant big endian systems had a NUXI problem.  Removed
the redundant conversion from the callers, and made some in-passing cleanups
while I was there.
2006-06-07 00:27:25 +00:00
Mike Frysinger
8e640a1043 use vfork() instead of vork() since the only thing we do is execve() an app after fork (allows time to work on no-mmu) 2006-06-06 06:08:34 +00:00
Bernhard Reutner-Fischer
5084c78cbe - remove superfluous call of stack_machine(0) upon exit. 2006-06-03 21:19:09 +00:00
Bernhard Reutner-Fischer
5f6d67b7d6 - no need to have timer_duration in the data section.
- cleanup a little bit while at it.
2006-06-03 20:53:18 +00:00
Bernhard Reutner-Fischer
b1312c9125 - use bb_msg_write_error in 3 places
- whitespace
2006-06-03 20:09:02 +00:00
Bernhard Reutner-Fischer
c89982dcd7 - move #include busybox.h to the very top so we pull in the config
and eventual platform specific includes in early.
2006-06-03 19:49:21 +00:00
Rob Landley
0620841758 Patch from Tito to remove long options from hdparm. 2006-05-31 22:52:57 +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
Rob Landley
a6e131dab3 Size reductions, mostly switching things to use libbb functions. 2006-05-29 06:43:55 +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
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
Bernhard Reutner-Fischer
95a040fac8 - use the defines CURRENT_TTY and VC_1; also shrink xargs a tiny bit:
add/remove: 0/0 grow/shrink: 2/6 up/down: 5/-37 (-32)
function                                     old     new   delta
static.add_interface                         271     274      +3
static.glob3                                  36      38      +2
static.renice_main                           409     408      -1
static.readcmd                              1083    1081      -2
static.changepath                            176     174      -2
static.parse_opts                             56      51      -5
static.rx_main                              1095    1088      -7
static.xargs_main                            759     739     -20
----------------------------------------------------------------
Result                                                :-)    -32
2006-05-27 09:36:43 +00:00
Bernhard Reutner-Fischer
b21d23bd46 - provide fallback defines for non-linux 2006-05-26 20:33:12 +00:00
Bernhard Reutner-Fischer
01d23ade57 - add central knob to turn off getopt_long everywhere. EXPERIMENTAL!
Adds "Enable getopt long" under "General options", default y.
  Send patches to fix getopt_ulflags and run_parts.c if you turn this off..
  See http://busybox.net/lists/busybox/2006-May/021828.html for a start to run-parts
2006-05-26 20:19:22 +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
Mike Frysinger
314c739b07 Yann E. MORIN. writes:
hdparm has a uint64_t passed to printf with a %llu format (which is ok, because
it's the same size), but without first being casted(?) to unsigned long long int.
Which is kinda funny because it's done OK on a few lines above...
2006-05-26 02:05:19 +00:00
Rob Landley
69d863b6c6 And fix the error I just introduced. :) 2006-05-25 21:13:30 +00:00
Rob Landley
5a2997de72 Remove pointless #define. 2006-05-25 21:12:40 +00:00
Rob Landley
ade7f95bd1 Patch from Tito:
Remove -v verbose -V version -q quiet flags
Remove parse_opt_v2();
Rename parse_opt_v3() to parse_xfermode()
Remove if_strcat()
Rearrange code in  dump_identity() to reduce size
Modify some strings so that they could be optimized by the compiler
Minor code clean up
Remove unneeded #define <shm.h>

#if BB_BIG_ENDIAN && !defined(__USE_XOPEN)
# define __USE_XOPEN
#endif    
Must be before #include <unistd.h> and #include "busybox.h"
(noticed by Bernhard Fischer <rep.nop@aon.at>)

Remove duplicate code in do_time()
2006-05-25 18:53:06 +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
ef21629a6b - silence warning about no return in function returning non-void
- put CONFIG_DEBUG_CROND_OPTION into config
no changes in size when debugging is disabled.
2006-05-20 14:14:05 +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
Rob Landley
4ae2f511cf Patch from tito to replace shared memory usage with mlock(), slightly tweaked
by me.
2006-05-19 17:24:26 +00:00
Bernhard Reutner-Fischer
a85a63f6ee - fix invalid mode 2006-05-19 12:22:11 +00:00
Rob Landley
adde79883f Largeish cleanup patch from Tito, mostly if statement therapy. 2006-05-16 15:32:30 +00:00
Mike Frysinger
39440e520c pull Rules.mak from top_srcdir as pointed out by Robert P. J. Day on the mailing list 2006-05-13 02:33:09 +00:00
Mike Frysinger
e92923862e typecast bbig to kill format warnings 2006-05-11 02:31:45 +00:00
Rob Landley
19802563ed The if() is cheaper than the extra function parameter. According to make
bloatcheck, this saves 112 bytes on x86...
2006-05-08 15:35:46 +00:00
Rob Landley
20deab0537 Cleanup patch from tito. 2006-05-07 23:34:15 +00:00
Rob Landley
39cf645ce0 Patch from Dennis Vlasenko resetting values that get reused. 2006-05-05 16:52:28 +00:00
Rob Landley
2584e9b39f Remove HDIO_GETGEO_BIG which is dead (removed from 2.6) and was pointless back
in 2.4 (it fetched the same hd_geometry struct only with uint cylinders instead
of ushort cylinders: nothing that big has ever accurately reported gemoetry,
it's all LBA.

Also stop declaring the hd_geometry struct static: it's two chars, a short, and
a long for a grand total of 8 bytes.  That can go on the stack.
2006-05-03 20:00:00 +00:00
Rob Landley
0f0b645f73 Use ATTRIBUTE_NORETURN as suggested by tito, plus a few in-passing cleanups. 2006-05-03 18:28:06 +00:00
Rob Landley
6389ff1115 Patch from tito removing obsolete code. 2006-05-01 19:28:53 +00:00
Rob Landley
5bc3f05a23 Remove some unused code pointed out by Tito, plus a slightly more graceful
way of handling endianness.
2006-04-29 19:11:24 +00:00
Rob Landley
a3e4f38f7b Style fixes from Denis Vlasenko. 2006-04-29 16:06:31 +00:00
Rob Landley
5f8b5ecda2 Another patch from Denis Vlasenko:
Make hdparm smaller:
* Make bb_ioctl return the status
* Replace ioctl with bb_ioctl in a few places
* Add bb_ioctl_alt, use where appropriate (four places)
* unsigned char args1[4+512] = {WIN_IDENTIFY,0,0,1,};
  ate 0.5k of rodata, fix that
2006-04-29 16:03:40 +00:00
Rob Landley
e5b281f89e From Dennis Vlasenko, Make hdparm smaller:
* Use combined no_scsi_no_xt()
 * Have common unsigned char args[4] = {WIN_SETFEATURES,0,0,0};
2006-04-29 15:49:18 +00:00
Rob Landley
2e2d752d49 Cleanup to hdparm by tito. 2006-04-29 15:23:33 +00:00
Mike Frysinger
59c6baedf7 just include fcntl.h not sys/fcntl.h 2006-04-29 04:43:50 +00:00
Mike Frysinger
f054be12de Rob Sullivan writes: rewrite the regex handling to improve stability 2006-04-29 04:21:10 +00:00
Rob Landley
0e6a3e14e4 Patch from tito to update output of hdparm. 2006-04-28 01:33:30 +00:00
Bernhard Reutner-Fischer
56fbd21fa7 - return ret so we return something meaningful. 2006-04-24 17:41:29 +00:00
Rob Landley
a2e98043d5 From Rob Sullivan: Fix a segfault with searching, plus some cleanups. 2006-04-18 01:53:41 +00:00
Rob Landley
026147a48f Patch from Tito to fix printing null and make output look like hdparm 6.3. 2006-04-17 22:29:13 +00:00
Mike Frysinger
20c22e0883 just use the stack to kill memleak and return if user didnt give us anything to match 2006-04-16 21:41:00 +00:00
Mike Frysinger
bf2d9905ca use xmalloc, dont hardcode length of string, and get rid of pointless call to memset 2006-04-16 21:30:47 +00:00
Mike Frysinger
00d10a94f3 uncuddle if statements 2006-04-16 20:54:19 +00:00
Mike Frysinger
f284c767e5 use more boiler plate GPL notices 2006-04-16 20:38:26 +00:00
Mike Frysinger
3a2b103eea uncuddle brackets 2006-04-16 20:34:26 +00:00
Rob Landley
2ec922eed5 Patch from Robert P Day: let menuconfig indent stuff for us, we don't have
to do it in Config.in.
2006-04-13 23:22:16 +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
2c99851181 - patch from Denis Vlasenko to add and use bb_xdaemon() 2006-04-12 18:09:26 +00:00
Bernhard Reutner-Fischer
9460f66e4e - tweak visibility of label expected_hwif_error as it's only needed for
CONFIG_FEATURE_HDPARM_HDIO_UNREGISTER_HWIF or CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF
2006-04-11 08:01:29 +00:00
Bernhard Reutner-Fischer
061fd0a353 - make sure that the label expected_hwif_error is visible even when
CONFIG_FEATURE_HDPARM_HDIO_SCAN_HWIF isn't set.
2006-04-05 16:37:25 +00:00