Commit Graph

460 Commits

Author SHA1 Message Date
Aaro Koskinen
6d777b75ed xargs: make -I imply -r
Make -I imply -r (GNU findutils seems to do the same).

Fixes the following bug:

        $ echo -n | xargs -I% echo %
        Segmentation fault

Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-24 22:01:29 +02:00
Denys Vlasenko
0f296a3a56 libiproute: rename invarg(a,b) to invarg_1_to_2(a,b)
invarg(a,b) - "invalid argument", but how a and b enter the message?

invarg_1_to_2(a,b) is somewhat easier to read: "invalid argument 'a' to 'b'"

Audit of usage revealed a number of bad uses, with too long messages.

   text	   data	    bss	    dec	    hex	filename
 938848	    932	  17448	 957228	  e9b2c	busybox_old
 938788	    932	  17448	 957168	  e9af0	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-14 13:21:01 +02:00
Denys Vlasenko
7b85ec30b5 *: more BUILD_BUG_ON conversions
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13 17:17:34 +02:00
Denys Vlasenko
7f3a2a2256 join some common strings, -400 bytes
function                                             old     new   delta
print_intel_cstates                                  499     511     +12
file_insert                                          355     364      +9
dpkg_main                                           2944    2940      -4
ifenslave_main                                       645     640      -5
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 21/-9)              Total: 12 bytes
   text	   data	    bss	    dec	    hex	filename
 937564	    932	  17676	 956172	  e970c	busybox_old
 937164	    932	  17676	 955772	  e957c	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08 11:24:44 +02:00
Denys Vlasenko
8c0708a329 find: support "find . -delete" idiom - do not try rmdir(".")
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 21:01:47 +02:00
Denys Vlasenko
5711a2a4ad libbb: more compact API for bb_parse_mode()
function                                             old     new   delta
make_device                                         2182    2188      +6
parse_command                                       1440    1443      +3
parse_params                                        1497    1499      +2
install_main                                         773     769      -4
mkdir_main                                           168     160      -8
getoptscmd                                           641     632      -9
builtin_umask                                        158     147     -11
bb_parse_mode                                        431     410     -21
umaskcmd                                             286     258     -28
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/6 up/down: 11/-81)            Total: -70 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07 17:55:33 +02:00
Maninder Singh
97c6491b4e typo fixes
Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-25 13:46:36 +02:00
Felix Fietkau
f7466e4776 find: fix regression in status processing for path arguments
Regression added in commit 14158b4127
"find: add optional support for '-exec ... {} +'"

This commit causes find to exit on the first path argument that was not
found, which breaks existing scripts and is incompatible to other
implementations.

Instead of exiting on the first failure, return EXIT_FAILURE at the end
if any error occurred.

Signed-off-by: Felix Fietkau <nbd@openwrt.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-14 16:45:23 +02:00
Denys Vlasenko
3e9b13e4c5 find: support -perm /BITS. Closes 7340
function                                             old     new   delta
parse_params                                        1487    1497     +10
func_perm                                             57      61      +4
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/0 up/down: 14/0)               Total: 14 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-05 12:16:15 +02:00
Denys Vlasenko
34cc6c91a2 grep: fix "grep -r PATTRN SYMLINK_TO_DIR"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-28 15:50:09 +02:00
Denys Vlasenko
f92f1d0181 find: use sysconf(_SC_ARG_MAX) to determine the command-line size limit
The find utility uses a hardcoded value of 32 * 1024 as the limit of
the command-line length when calling 'find -exec ... {} +'. This results
in over 4 times more execve() calls than in coreutils' find.

This patch uses the limit defined in system headers.

Based on the patch by  Bartosz Golaszewski <bartekgola@gmail.com>.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-22 13:54:40 +02:00
Denys Vlasenko
6be3a5242c find: exit code fixes for find -exec
function                                             old     new   delta
func_exec                                            127     100     -27

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-19 11:32:11 +02:00
Bartosz Golaszewski
14158b4127 find: add optional support for '-exec ... {} +'
function                                             old     new   delta
do_exec                                                -     309    +309
parse_params                                        1416    1487     +71
find_main                                            342     406     +64
packed_usage                                       29958   30014     +56
func_exec                                            138     127     -11
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 3/1 up/down: 500/-11)           Total: 489 bytes

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-17 17:09:41 +02:00
Denys Vlasenko
3795266841 xargs: fix compilation breakage
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 15:02:36 +01:00
Denys Vlasenko
83e49ade57 grep: fix -w match if first match isn't a word, but second is. Closes 4520
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 14:56:12 +01:00
Denys Vlasenko
6f068904dc xargs: add support for -I and -i. Closes 493
function                                             old     new   delta
process_stdin_with_replace                             -     195    +195
xmalloc_substitute_string                              -     145    +145
xargs_main                                           808     884     +76
count_strstr                                           -      45     +45
packed_usage                                       29580   29571      -9
parse_params                                        1445    1416     -29
func_exec                                            285     138    -147
------------------------------------------------------------------------------
(add/remove: 4/0 grow/shrink: 1/3 up/down: 461/-185)          Total: 276 bytes
   text	   data	    bss	    dec	    hex	filename
 922156	    932	  17692	 940780	  e5aec	busybox_old
 922440	    932	  17692	 941064	  e5c08	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-27 11:17:06 +01:00
Denys Vlasenko
6885e49ba5 find: code shrink
function                                             old     new   delta
func_exec                                            306     285     -21

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-26 15:27:10 +01:00
Bartosz Golaszewski
3ba2df874c grep: properly handle grep -w "^str" in !EXTRA_COMPAT case too
function                                             old     new   delta
grep_file                                           1267    1288     +21

Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-07 17:15:56 +01:00
Denys Vlasenko
6eb0cbe07e find: fix a regression introduced with -HLP support
function                                             old     new   delta
find_main                                            294     342     +48

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-09 16:08:09 +01:00
Denys Vlasenko
cd55f2d933 grep: fix two bugs with -w
Unfortunately, with !EXTRA_COMPAT, "grep -w ^str" still erroneously matches "strstr".

function                                             old     new   delta
grep_file                                           1499    1510     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-07 14:59:30 +01:00
Denys Vlasenko
982e87f2fb Whitespace fixes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-30 11:52:58 +02:00
Denys Vlasenko
6db5f679a2 find:: get rid of nested function (it's a gcc-ism)
function                                             old     new   delta
alloc_action                                           -      80     +80
parse_params                                        1459    1445     -14
static.alloc_action                                   98       -     -98
------------------------------------------------------------------------------
(add/remove: 1/1 grow/shrink: 0/1 up/down: 80/-112)           Total: -32 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-16 18:36:42 +02:00
James Hogan
5fc0585c01 grep: fix grep -x to not set REG_NOSUB
When -F isn't specified (and !ENABLE_EXTRA_COMPAT), grep -x uses
regexec's regmatch_t output to determine if the match was the entire
line. However it also set the REG_NOSUB flag which makes it ignore the
regmatch_t argument.

Add an exception to the setting of REG_NOSUB for OPT_x and add some test
cases to test the behaviour of -x.

Signed-off-by: James Hogan <james.hogan@imgtec.com>
Cc: Natanael Copa <ncopa@alpinelinux.org>
Cc: Denys Vlasenko <vda.linux@googlemail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-16 14:47:05 +02:00
Bartosz Golaszewski
414db791d0 grep: don't bail out on first mismatch if '-w' option is set
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-15 09:20:40 +02:00
Denys Vlasenko
6782f48ccb find: support -HLP
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-05-14 17:20:35 +02:00
Denys Vlasenko
2f5b5beb28 grep: fix grep -Fw not respecting the -w option. Closes 5792
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-20 16:57:19 +01:00
Denys Vlasenko
60cb48ca50 whitespace cleanup. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 15:57:44 +01:00
Denys Vlasenko
6967578728 whitespace fixes. no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-01-14 01:34:48 +01:00
Denys Vlasenko
2dc1a97272 find: make -mindepth N -xdev correctly stop on mountpoints
function                                             old     new   delta
fileAction                                           153     193     +40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-09-06 15:24:11 +02:00
Denys Vlasenko
7c8aa2b47c typo fix in comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-18 02:53:11 +02:00
Denys Vlasenko
be1cfeea2e find: if DESKTOP=y, support -wholename (synonym for -path)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-05-17 12:25:25 +02:00
Natanael Copa
cd09e81520 grep: support for -x, match whole line
Specified in POSIX.
http://pubs.opengroup.org/onlinepubs/009604499/utilities/grep.html

Signed-off-by: Natanael Copa <ncopa@alpinelinux.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-02-28 03:44:08 +01:00
Lauri Kasanen
7b46220d92 grep: be GNU compatible with -f EMPTY_FILE
Signed-off-by: Lauri Kasanen <curaga@operamail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-28 12:39:04 +02:00
Ian Wienand
abc33ac8b2 Fix find -follow support
Signed-off-by: Ian Wienand <ianw@vmware.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-28 06:53:20 +02:00
Denys Vlasenko
87249fbf50 find: fix a bug in !ENABLE_FEATURE_FIND_XDEV config
A subtle one: wrong pairing of "else"!

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-08-11 02:27:13 +02:00
Denys Vlasenko
66426760be *: remove "Options:" string from help texts
function                                             old     new   delta
packed_usage                                       28706   28623     -83

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-06-05 03:58:28 +02:00
Denys Vlasenko
b24ef035bd find: cater for libc w/o FNM_CASEFOLD
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-23 00:40:54 +02:00
Bogdan Harjoc
7948ecb505 find: implement -ipath
Signed-off-by: Bogdan Harjoc <harjoc@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-05-22 03:50:21 +02:00
Denys Vlasenko
7cfe6ea99e xargs: support --no-run-if-empty (synonym to -r)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-03-03 09:51:57 +01:00
Denys Vlasenko
e1a4209a5e find: trim help text a bit
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-12 20:37:41 +01:00
Denys Vlasenko
053c12e0de find: remove the hack we use to parse options first, replace with simpler code
text	   data	    bss	    dec	    hex	filename
 867764	    438	   7552	 875754	  d5cea	busybox_old
 867629	    438	   7552	 875619	  d5c63	busybox_unstripped

function                                             old     new   delta
parse_params                                        1377    1440     +63
static.params                                        151     192     +41
static.options                                        42      57     +15
fileAction                                           151     153      +2
find_main                                            466     267    -199
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 4/1 up/down: 121/-199)          Total: -78 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-12 20:27:13 +01:00
Denys Vlasenko
805f2453d0 find: print/print0/prune _can_ be inverted, fix it
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-12 20:26:14 +01:00
Denys Vlasenko
27076b8233 find: document ! (not) operator
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-12 18:49:48 +01:00
Denys Vlasenko
4604dd86c5 find: help text: PATH must be first
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-12 18:24:15 +01:00
Denys Vlasenko
56cdb2fc37 find: yet another tweak to help text
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-12 17:13:03 +01:00
Denys Vlasenko
4dea9eb07f find: fix help text about -prune: it also does assume -print
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-12 17:08:16 +01:00
Denys Vlasenko
cef85c2442 find: significantly improve hext text. +116 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-02-12 16:35:24 +01:00
Denys Vlasenko
b9f2d9f7d9 mass removal of underscores from _BB_DIR_foo and _BB_SUID_foo
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-01-18 13:58:01 +01:00
Denys Vlasenko
b1993380ba remove findutils/.gitignore, top-level one covers it
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-11 12:53:19 +02:00
Denys Vlasenko
0296fd3af1 grep: cap insane -B NUM values to MAX_INT / 8. Fixes bug 2653.
function                                             old     new   delta
grep_main                                            766     779     +13

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-02 12:42:28 +02:00
Denys Vlasenko
a61ff51b49 find: add rudimentary support for -exec {} +
function                                             old     new   delta
parse_params                                        1421    1414      -7

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-08-31 19:17:42 +02:00
Denys Vlasenko
3d8b96d58d grep: fix -o match with empty string (suggested by Colin Watson <cjwatson@ubuntu.com>)
function                                             old     new   delta
grep_file                                           1216    1251     +35

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-23 02:39:47 +02:00
Denys Vlasenko
0ef64bdb40 *: make GNU licensing statement forms more regular
This change retains "or later" state! No licensing _changes_ here,
only form is adjusted (article, space between "GPL" and "v2" and so on).

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-16 20:14:46 +02:00
Denys Vlasenko
7783248eaa *: s/xatoi_u/xatoi_positive/g - I got bored of mistyping xatoi_u as xatou_i
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-08-12 14:14:45 +02:00
Denys Vlasenko
4a96617095 xargs: bump default -sNUM up to 32k. Use sysconf() to trim it down if necessary
function                                             old     new   delta
xargs_main                                           819     830     +11

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-19 21:44:01 +02:00
Denys Vlasenko
4f731ce30e findutils/*: move usage and applet bits to *.c files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-15 15:40:16 +02:00
Denys Vlasenko
237aecedab xargs: another code shrink
function                                             old     new   delta
process0_stdin                                       117     103     -14
process_stdin                                        336     314     -22

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-15 10:18:01 +02:00
Denys Vlasenko
f7e929e795 xargs: trivial code shrink
function                                             old     new   delta
xargs_main                                           807     787     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-15 10:02:04 +02:00
Denys Vlasenko
c28cafb18d xargs: trivial code shrink
function                                             old     new   delta
process_stdin                                        343     336      -7
process0_stdin                                       124     117      -7
xargs_main                                           807     787     -20

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-14 12:38:36 +02:00
Denys Vlasenko
7a4021deba xargs: simplify logic
Removed double-buffering in a linked list.

function                                             old     new   delta
store_param                                            -      56     +56
xargs_main                                           871     840     -31
process_stdin                                        458     396     -62
process0_stdin                                       267     143    -124
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 0/3 up/down: 56/-217)          Total: -161 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-14 00:57:05 +02:00
Denys Vlasenko
aaa24e09f9 xargs: fix accounting of -sNUM
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-13 12:43:54 +02:00
Denys Vlasenko
1613de85d9 xargs: make -s NUM accept practically unlimited range
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-13 03:44:27 +02:00
Denys Vlasenko
d5fa1a0f49 xargs: code shrink -15 bytes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-13 03:43:43 +02:00
Denys Vlasenko
19ced5c425 pipe_progress: make it independent of printf machinery
function                                             old     new   delta
bb_putchar_stderr                                      -      24     +24
ParseField                                           494     471     -23
progress_meter                                       212     188     -24
xargs_main                                           888     842     -46
pipe_progress_main                                   151     105     -46
------------------------------------------------------------------------------
(add/remove: 2/0 grow/shrink: 0/4 up/down: 24/-139)          Total: -115 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 21:53:09 +02:00
Denys Vlasenko
2f32bf8be6 remove defconfig. Now "make defconfig" simply uses defaults from Config.in
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-06-06 04:14:28 +02:00
Peter Tyser
0b7412e66b findutils: Add Config.in and Kbuild to .gitignore
These are auto-generated files and should be ignored by git.

Signed-off-by: Peter Tyser <ptyser@xes-inc.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-16 02:51:00 +02:00
Denys Vlasenko
7fb68f199f make it possible to keep Config/Kbuild snippets in *.c files
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-05-09 04:22:48 +02:00
Ian Wienand
0a2c793bd6 grep: fix -Fi
function                                             old     new   delta
grep_file                                           1151    1169     +18

Signed-off-by: Ian Wienand <ianw@vmware.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-30 09:32:10 +02:00
Denys Vlasenko
9138817a27 find: fix -name matching for dotfiles. -1 byte
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-26 09:54:04 +02:00
Denys Vlasenko
05273daf6f grep: makw -w support unconditional
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-26 08:45:44 +02:00
Denys Vlasenko
d7b5289209 xargs: do not decrease orig_arg_max to negative values
Based on patch by Nguyễn Thái Ngọc Duy <pclouds@gmail.com>

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-09 14:58:40 +02:00
Denys Vlasenko
651a2697f7 *: merge some common strings
text   data    bss    dec    hexfilename
 838650   8009      0 846659  ceb43busybox_old
 838519   8009      0 846528  ceac0busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-23 16:25:17 +01:00
Denys Vlasenko
8531d76a15 *: code shrink and better "died from signal" reporting from wait4pid
function                                             old     new   delta
parse                                                964     967      +3
udhcp_run_script                                     670     665      -5
singlemount                                          911     906      -5
mount_it_now                                         360     355      -5
inotifyd_main                                        521     516      -5
xspawn                                                21       -     -21
------------------------------------------------------------------------------
(add/remove: 0/1 grow/shrink: 1/4 up/down: 3/-41)             Total: -38 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-18 22:44:00 +01:00
Bernhard Reutner-Fischer
2e73d84c02 find: tweak error message
big find:
find: missing argument to `-exec'
we now say
find: -exec requires an argument
instead of the cryptic message we emitted previously.
Additional benefit is that it's now 23 bytes smaller.

Add TODO to add '-exec {} +' support

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2010-02-25 13:22:37 +01:00
Denys Vlasenko
98a4c7cf3d *: suppress ~60% of "aliased warnings" on gcc-4.4.1
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-04 15:00:15 +01:00
Denys Vlasenko
ce9b97f18b find: correct handling of -xdev
function                                             old     new   delta
find_main                                            467     448     -19
fileAction                                          1336    1311     -25

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-10 02:33:02 +01:00
Matheus Izvekov
d0f601f066 find: add optional support for -links. +100 bytes
Signed-off-by: Matheus Izvekov <mizvekov@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-06 09:19:04 +01:00
Denys Vlasenko
2ec91aead5 *: remove some uses of argc
function                                             old     new   delta
whoami_main                                           34      37      +3
logname_main                                          60      63      +3
hostid_main                                           35      38      +3
ttysize_main                                         136     135      -1
nmeter_main                                          673     672      -1
logger_main                                          387     386      -1
uuencode_main                                        330     328      -2
ifupdown_main                                       2125    2123      -2
mesg_main                                            158     155      -3
free_main                                            333     330      -3
cal_main                                             902     899      -3
acpid_main                                           443     440      -3
ar_main                                              196     189      -7
find_main                                            476     467      -9
ifconfig_main                                       1235    1221     -14
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/12 up/down: 9/-49)            Total: -40 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-01-04 14:15:38 +01:00
Denys Vlasenko
6dc0ace109 grep: fix a case when -o loops forever
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-12-04 02:48:14 +01:00
Denys Vlasenko
6331cf059c *: use "can't" instead of "cannot"
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-13 09:08:27 +01:00
Denys Vlasenko
8131eea3dc *: introduce and use ffulsh_all()
function                                             old     new   delta
buffer_fill_and_print                                179     196     +17
fflush_all                                             -       9      +9
spawn                                                 87      92      +5
rtcwake_main                                         455     453      -2
...
alarm_intr                                            93      84      -9
readcmd                                             1072    1062     -10
bb_ask                                               345     333     -12
more_main                                            845     832     -13
flush_stdout_stderr                                   42      23     -19
xfflush_stdout                                        27       -     -27
flush_stderr                                          30       -     -30
------------------------------------------------------------------------------
(add/remove: 1/2 grow/shrink: 2/50 up/down: 31/-397)         Total: -366 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-11-02 14:19:51 +01:00
Denys Vlasenko
1b34d4f0b1 find: add zeroing of G.xxx; ftpd - remove extraneous zeroing of G.xxx
Brought "G trick" to the same shape in a few more places.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-30 02:39:57 +02:00
Denys Vlasenko
8f7a6d294f find: -follow should not error out on dandling links
function                                             old     new   delta
recursive_action                                     425     465     +40
find_main                                            436     465     +29
test_main                                            247     253      +6
need_print                                             1       -      -1
doCommands                                          2523    2521      -2
compare_keys                                         737     735      -2
xdev_dev                                               4       -      -4
xdev_count                                             4       -      -4
recurse_flags                                          4       -      -4
mkfs_vfat_main                                      1609    1605      -4
actions                                                4       -      -4
fileAction                                           588     583      -5
------------------------------------------------------------------------------
(add/remove: 0/5 grow/shrink: 3/4 up/down: 75/-30)             Total: 45 bytes
   text	   data	    bss	    dec	    hex	filename
 822711	    450	   7684	 830845	  cad7d	busybox_old
 822773	    445	   7668	 830886	  cada6	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-29 11:07:04 +02:00
Denys Vlasenko
6c750f1518 find: do not recurse into directories with depth == --maxdepth
This may avoid many, many unnecessary stat() calls

function                                             old     new   delta
fileAction                                           718     758     +40

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-27 01:51:47 +02:00
Denys Vlasenko
606291beab *: more portability fixes by Dan Fandrich
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-23 23:15:43 +02:00
Denys Vlasenko
aa7da73880 add USE_PORTABLE_CODE option and use it in find applet
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-13 14:57:24 +02:00
Denys Vlasenko
043b1e5d99 more C standard compat fixes from Dan Fandrich
function                                             old     new   delta
docolon                                              207     204      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-09-06 12:47:55 +02:00
Denys Vlasenko
09449630fb grep: fix -E + {range}; fix -o not printing all matches (bug 489)
two different bugs, one with EXTRA_COMPAT, other without.

function                                             old     new   delta
grep_file                                           1132    1129      -3

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-07-29 01:20:09 +02:00
Denys Vlasenko
2207cd6e14 tweak to config wording, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-18 19:59:51 +02:00
Denys Vlasenko
bcbd37df24 tweak Config texts and some broken English elsewhere
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-18 13:23:58 +02:00
Denys Vlasenko
d5f1b1bbe0 *: add FAST_FUNC to function ptrs where it makes sense
function                                             old     new   delta
evalcommand                                         1195    1209     +14
testcmd                                                -      10     +10
printfcmd                                              -      10     +10
echocmd                                                -      10     +10
func_exec                                            270     276      +6
echo_dg                                              104     109      +5
store_nlmsg                                           85      89      +4
pseudo_exec_argv                                     195     198      +3
dotcmd                                               287     290      +3
machtime_stream                                       29      31      +2
discard_stream                                        24      26      +2
argstr                                              1299    1301      +2
killcmd                                              108     109      +1
evalfor                                              226     227      +1
daytime_stream                                        43      44      +1
run_list                                            2544    2543      -1
lookupvar                                             62      61      -1
ipaddr_modify                                       1310    1309      -1
...
parse_stream                                        2254    2245      -9
evalpipe                                             356     347      -9
collect_if                                           210     197     -13
read_opt                                             869     851     -18
handle_dollar                                        681     658     -23
print_addrinfo                                      1342    1303     -39
iterate_on_dir                                       156      59     -97
print_route                                         1709    1609    -100
------------------------------------------------------------------------------
(add/remove: 3/0 grow/shrink: 12/130 up/down: 74/-767)       Total: -693 bytes
   text    data     bss     dec     hex filename
 841748     467    7872  850087   cf8a7 busybox_old
 841061     467    7872  849400   cf5f8 busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2009-06-05 12:06:05 +02:00
Denis Vlasenko
5e34ff29bc *: mass renaming of USE_XXXX to IF_XXXX
and SKIP_XXXX to IF_NOT_XXXX - the second one was especially
badly named. It was not skipping anything!
2009-04-21 11:09:40 +00:00
Denis Vlasenko
3266aa9ec2 trailing whitespace removal 2009-04-01 11:24:04 +00:00
Denis Vlasenko
83518d18a3 Compatibility fixes:
grep: support -z
find: support --mindepth
  together +45 bytes
cpio: support -p (configurable, +230 bytes)
libbb: tweaks for cpio
2009-03-20 22:17:13 +00:00
Denis Vlasenko
a9acbe6cad timeout: new applet. 370 bytes. by Roberto Foglietta. 2008-11-24 13:25:20 +00:00
Bernhard Reutner-Fischer
d498850e02 - typo in documentation 2008-10-27 21:30:39 +00:00
Denis Vlasenko
f60719cd49 grep: fix 'echo aaa | grep -o a' + ENABLE_EXTRA_COMPAT case
by Natanael Copa
2008-09-30 22:37:29 +00:00
Denis Vlasenko
9ac706b7a6 grep: yet another fixlet for EXTRA_COMPAT 2008-09-19 21:32:51 +00:00
Denis Vlasenko
c110b7d61f grep: fix EXTRA_COMPAT grep to honor -E and -i 2008-09-19 21:29:21 +00:00
Denis Vlasenko
3fd15e197e grep: option to use GNU regex matching instead of POSIX one.
This fixes problems with NULs in files being scanned, but
 costs +800 bytes. The same can be done to sed (TODO).
2008-08-09 16:15:14 +00:00