Commit Graph

153 Commits

Author SHA1 Message Date
Denys Vlasenko
75a1c87357 awk: abort if NF set to negative value
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-11-28 12:16:29 +01:00
Denys Vlasenko
2454e678cb awk: do not allow $(-1)
function                                             old     new   delta
EMSG_NEGATIVE_FIELD                                    -      25     +25
evaluate                                            3390    3403     +13
------------------------------------------------------------------------------
(add/remove: 1/0 grow/shrink: 1/0 up/down: 38/0)               Total: 38 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-04-23 10:53:18 +02:00
Denys Vlasenko
844a6c5abd awk: code shrink
function                                             old     new   delta
awk_main                                             955     948      -7

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-07 14:39:34 +01:00
Denys Vlasenko
6f4a785bd1 awk: fix 'delete array[var--]' decrementing var twice
function                                             old     new   delta
evaluate                                            3395    3390      -5

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2018-01-07 01:19:08 +01:00
Denys Vlasenko
0c4dbd481a regularize format of source file headers, no code changes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-09-18 16:28:43 +02:00
Denys Vlasenko
a1799db4ac awk: stop on first non-option, closes 9861
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-16 19:07:53 +02:00
Denys Vlasenko
95f7953f2c do not use `a' quoting style in comments
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-08-02 14:26:33 +02:00
Denys Vlasenko
68b653b66b config: trim/improve item names and help texts, take 2
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-27 10:53:09 +02:00
Denys Vlasenko
72089cf6b4 config: deindent all help texts
Those two spaces after tab have no effect, and always a nuisance when editing.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-21 09:50:55 +02:00
Denys Vlasenko
75d151e31d libarchive: FEATURE_LZMA_FAST should be visible if FEATURE_SEAMLESS_LZMA
While at it, tweak some config help texts.

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-20 23:28:00 +02:00
Denys Vlasenko
4eed2c6c50 Update menuconfig items with approximate applet sizes
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2017-07-18 22:01:24 +02:00
Brian Foley
61d5997b58 awk: fix segfault on for loop syntax error
Parsing "for()" segfaults as awk fails to find loop iteration expressions.

Signed-off-by: Brian Foley <bpfoley@google.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-24 02:09:56 +02:00
Denys Vlasenko
237bedd499 getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LIST
In many cases, this aqllows to drop use of opt_complementary.
Approximately -400 bytes:

function                                             old     new   delta
getopt32                                            1423    1502     +79
opt_string                                            17      18      +1
OPT_STR                                               24      25      +1
uniq_main                                            416     406     -10
timeout_main                                         279     269     -10
sulogin_main                                         270     260     -10
readprofile_main                                    1825    1815     -10
ps_main                                              543     533     -10
pidof_main                                           245     235     -10
pgrep_main                                           611     601     -10
od_main                                             2600    2590     -10
mkfs_minix_main                                     2684    2674     -10
mkfs_ext2_main                                      2603    2593     -10
microcom_main                                        712     702     -10
makemime_main                                        315     305     -10
ionice_main                                          282     272     -10
inetd_main                                          2074    2064     -10
ifplugd_main                                        1144    1134     -10
halt_main                                            353     343     -10
getopt_main                                          636     626     -10
fdisk_main                                          2854    2844     -10
env_main                                             206     196     -10
dmesg_main                                           319     309     -10
conspy_main                                         1214    1204     -10
awk_main                                             981     971     -10
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/22 up/down: 81/-220)         Total: -139 bytes
   text	   data	    bss	    dec	    hex	filename
 919373	    906	  14060	 934339	  e41c3	busybox_old
 918969	    906	  14060	 933935	  e402f	busybox_unstripped

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-06 21:58:02 +02:00
Denys Vlasenko
28b00ce6ff awk: support "length" form of "length()". Closes 8371
function                                             old     new   delta
parse_expr                                           805     848     +43
tokenlist                                            447     448      +1

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-02 02:41:39 +02:00
Maninder Singh
97f2f7ca7f Removes stray empty line from code
This patch removes stray empty line from busybox code
reported by script find_stray_empty_lines

Signed-off-by: Maninder Singh <maninder1.s@samsung.com>
Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-13 03:25:46 +02:00
Denys Vlasenko
5f8daefb83 awk: fix handling of "if ... break ; else ..." - closes 7226
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-26 16:40:28 +02:00
Denys Vlasenko
bd0e221620 awk: fix a bug in argc counting in recent change
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-21 15:09:55 +01:00
Sven-Göran Bergh
f200f732f4 awk: optionally support -e AWK_PROG
function                                             old     new   delta
awk_main                                             959     978     +19

Signed-off-by: Sven-Göran Bergh <sgb@systemasis.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-12 14:18:25 +01:00
Denys Vlasenko
7985bc109e awk: fix length(array)
function                                             old     new   delta
evaluate                                            3526    3548     +22

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-10-12 04:51:54 +02:00
Bernhard Reutner-Fischer
a060a1ad96 awk: Fix handling of functions with empty body
ammend b79a0fef99 to properly
handle functions defined in another scope.

Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-07-31 21:51:14 +02:00
Denys Vlasenko
1390a010b6 awk: use "long long" as integer type, not "int"
Testcase:
awk "BEGIN{n=(2^31)-1; print n, int(n), n%1, ++n, int(n), n%1}"
2147483647 2147483647 0 2147483648 2147483648 0

(last three values weren't showing right)

function                                             old     new   delta
evaluate                                            3444    3458     +14
fmt_num                                              221     230      +9

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-07-20 21:23:01 +02:00
Bernhard Reutner-Fischer
b79a0fef99 awk: Fix handling of functions with empty body
Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2013-03-13 09:47:07 +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
df8066a78c awk: fix FS assignment behavior. Closes 5108
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-07-11 01:27:15 +02:00
Denys Vlasenko
ea664dde87 awk: make -F STR interpret escape sequences. Closes 5126
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2012-06-22 18:41:01 +02:00
Denys Vlasenko
7b46d11582 awk: fix a SEGV
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-11 00:30:56 +02:00
Denys Vlasenko
202a1b9284 awk: fix define name collision with BSD headers
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-10 04:51:09 +02:00
Denys Vlasenko
f65c5f5c54 awk: next_input_file can return NULL, don't SEGV in this case.
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-09-07 20:01:39 +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
Pere Orga
6a3e01d5a9 move help text from include/usage.src.h to debianutils/*.c e2fsprogs/*.c editors/*.c loginutils/*.c mailutils/*.c
Signed-off-by: Pere Orga <gotrunks@gmail.com>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2011-04-03 01:33:55 +02:00
Denys Vlasenko
fb132e4737 whitespace cleanup
Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-29 11:46:52 +02:00
Rob Landley
d8205b39ab awk: reduce ifdef forest
Signed-off-by: Rob Landley <rob@landley.net>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 03:27:22 +02:00
Denys Vlasenko
2b299fed6a awk: fix breakage in last commit
While at it, made bb_process_escape_sequence faster (same size)

function                                             old     new   delta
nextchar                                              49      53      +4
bb_process_escape_sequence                           138     140      +2
next_token                                           838     839      +1
static.charmap                                        20      18      -2
is_assignment                                        143     135      -8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 3/2 up/down: 7/-10)              Total: -3 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-24 01:58:04 +02:00
Denys Vlasenko
6a0d7490ea awk: fix segfault on closing non-opened file
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-10-23 21:02:15 +02:00
Denys Vlasenko
28458c64db awk: code shrink
function                                             old     new   delta
fsrealloc                                            112     107      -5
next_token                                           862     844     -18

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-05 16:49:03 +02:00
Denys Vlasenko
d527e0c81d awk: 00.123 is not a octal constant; neither is 009.123. fixing this
function                                             old     new   delta
my_strtod                                             80     113     +33

Signed-off-by: Denys Vlasenko <dvlasenk@redhat.com>
2010-10-05 13:22:11 +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
7379cd1ca1 awk: add comment about fixing bug 1333
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 01:48:12 +02:00
Denys Vlasenko
fab288cf0b awk: don't append bogus data after NUL in sub(); shrink
also renamed variables to more sensible names

function                                             old     new   delta
mk_re_node                                            56      49      -7
awk_sub                                              601     591     -10

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-04-04 01:17:30 +02:00
Denys Vlasenko
f9782ffc45 awk: code shrink
function                                             old     new   delta
evaluate                                            3550    3487     -63

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 21:32:13 +01:00
Denys Vlasenko
c6ba997978 awk: code shrink
function                                             old     new   delta
hash_find                                            233     234      +1
evaluate                                            3899    3550    -349

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 21:05:09 +01:00
Denys Vlasenko
7b81db1379 awk: style fixes
function                                             old     new   delta
hash_find                                            234     233      -1
awk_printf                                           457     453      -4

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 21:04:47 +01:00
Denys Vlasenko
39fe4d1599 awk: code shrink
function                                             old     new   delta
exec_builtin                                        1538    1489     -49

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-12 16:57:06 +01:00
Denys Vlasenko
b0a57abb79 awk: code shrink
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 12:44:25 +01:00
Denys Vlasenko
6ebdf7aa7b awk: code shrink; style fixes
function                                             old     new   delta
next_token                                           932     862     -70

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 12:41:55 +01:00
Denys Vlasenko
da62b09ab1 awk: be more paranoid when freeing loop variable; make code less obfuscated
function                                             old     new   delta
nvfree                                               149     170     +21
next_token                                           928     932      +4
getvar_i                                              95      94      -1
skip_spaces                                           51      45      -6
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/2 up/down: 25/-7)              Total: 18 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-11 12:13:18 +01:00
Denys Vlasenko
c9955f23a2 awk: simple code shrink
function                                             old     new   delta
awk_getline                                          710     724     +14
awk_printf                                           455     457      +2
hash_find                                            234     233      -1
qrealloc                                              33      31      -2
handle_special                                       499     482     -17
awk_sub                                              641     601     -40
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 2/4 up/down: 16/-60)            Total: -44 bytes

Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-10 19:21:54 +01:00
Denys Vlasenko
3cb60c3973 awk: fix the case where nested "for" loops with the same variable misbehave
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-03-10 19:20:32 +01:00
Alexander Shishkin
d03cd3be24 awk: skip whitespace between array name and subscript
It is supported in both mawk and gawk and there are actually scripts
out there that use this "flexibility".

function                                             old     new   delta
next_token                                          1144    1152      +8
------------------------------------------------------------------------------
(add/remove: 0/0 grow/shrink: 1/0 up/down: 8/0)                 Total: 8 bytes

Signed-off-by: Alexander Shishkin <virtuoso@slind.org>
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-26 08:48:56 +01:00
Denys Vlasenko
3dbc5a9742 awk: remove wrong comment
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2010-02-05 14:54:22 +01:00