aboutsummaryrefslogtreecommitdiff
path: root/editors/awk.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'busybox' into mergeRon Yorston2021-02-051-3/+15
|\
| * awk: allow printf('%c') to output NUL, closes 13486Ron Yorston2021-02-021-3/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Treat the output of printf as binary rather than a null-terminated string so that NUL characters can be output. This is considered to be a GNU extension, though it's also available in mawk and FreeBSD's awk. function old new delta evaluate 3487 3504 +17 awk_printf 504 519 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-01-141-15/+39
|\|
| * awk: FS regex matches only non-empty separators (gawk compat)Denys Vlasenko2020-12-021-8/+25
| | | | | | | | | | | | | | function old new delta awk_split 484 553 +69 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * decrease paddign: gcc-9.3.1 slaps 32-byte alignment on arrays willy-nillyDenys Vlasenko2020-11-301-1/+1
| | | | | | | | | | | | | | | | text data bss dec hex filename 1021988 559 5052 1027599 fae0f busybox_old 1021236 559 5052 1026847 fab1f busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix dodgy multi-char separators splitting logicDenys Vlasenko2020-11-161-9/+16
| | | | | | | | | | | | | | function old new delta awk_split 521 484 -37 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2020-07-091-1/+3
|\|
| * awk: disallow "str"++, closes bug 12981Denys Vlasenko2020-06-091-1/+3
| | | | | | | | | | | | | | function old new delta parse_expr 887 896 +9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2020-02-151-4/+18
|\|
| * awk: fix more "length" cases, closes 12486Denys Vlasenko2020-02-021-4/+18
| | | | | | | | | | | | | | function old new delta next_token 808 831 +23 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-08-161-2/+2
|\|
| * libbb: reduce the overhead of single parameter bb_error_msg() callsJames Byrne2019-07-021-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Back in 2007, commit 0c97c9d43707 ("'simple' error message functions by Loic Grenie") introduced bb_simple_perror_msg() to allow for a lower overhead call to bb_perror_msg() when only a string was being printed with no parameters. This saves space for some CPU architectures because it avoids the overhead of a call to a variadic function. However there has never been a simple version of bb_error_msg(), and since 2007 many new calls to bb_perror_msg() have been added that only take a single parameter and so could have been using bb_simple_perror_message(). This changeset introduces 'simple' versions of bb_info_msg(), bb_error_msg(), bb_error_msg_and_die(), bb_herror_msg() and bb_herror_msg_and_die(), and replaces all calls that only take a single parameter, or use something like ("%s", arg), with calls to the corresponding 'simple' version. Since it is likely that single parameter calls to the variadic functions may be accidentally reintroduced in the future a new debugging config option WARN_SIMPLE_MSG has been introduced. This uses some macro magic which will cause any such calls to generate a warning, but this is turned off by default to avoid use of the unpleasant macros in normal circumstances. This is a large changeset due to the number of calls that have been replaced. The only files that contain changes other than simple substitution of function calls are libbb.h, libbb/herror_msg.c, libbb/verror_msg.c and libbb/xfuncs_printf.c. In miscutils/devfsd.c, networking/udhcp/common.h and util-linux/mdev.c additonal macros have been added for logging so that single parameter and multiple parameter logging variants exist. The amount of space saved varies considerably by architecture, and was found to be as follows (for 'defconfig' using GCC 7.4): Arm: -92 bytes MIPS: -52 bytes PPC: -1836 bytes x86_64: -938 bytes Note that for the MIPS architecture only an exception had to be made disabling the 'simple' calls for 'udhcp' (in networking/udhcp/common.h) because it made these files larger on MIPS. Signed-off-by: James Byrne <james.byrne@origamienergy.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: add a function to remove CRs from a text bufferRon Yorston2019-02-141-14/+5
| |
* | Merge branch 'busybox' into mergeRon Yorston2019-02-121-10/+31
|\|
| * awk: Fix overly permissive func arg list parsingBrian Foley2019-01-211-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It allows things like 'func f(a b)' and 'func f(a,)' which GNU awk forbids. function old new delta parse_program 327 367 +40 chain_expr 40 67 +27 parse_expr 891 915 +24 EMSG_TOO_FEW_ARGS 30 18 -12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 91/-12) Total: 79 bytes Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: Syntax error if delete isn't given an arg.Brian Foley2019-01-211-8/+15
| | | | | | | | | | | | | | | | Unlike exit and return, delete strictly requires an arg, and derefs a null pointer if executed without one. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: Guard pointer chasing when parsing ternary expressions.Brian Foley2019-01-211-1/+2
| | | | | | | | | | | | | | | | | | Avoids an uninit pointer deref for some malformed ternary exprs. Add a test that would crash in busybox before this fix. Signed-off-by: Brian Foley <bpfoley@google.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | awk: fix handling of regular expressions that match end-of-lineRon Yorston2019-01-231-0/+24
| | | | | | | | | | | | | | | | awk failed to match regular expressions that included an end-of-line: it was looking for a LF whereas lines were terminated by CRLF. Rather than tinker with the regex code or arrange for input to be in text mode I've stripped CRs from the input.
* | Merge branch 'busybox' into mergeRon Yorston2019-01-101-1/+1
|\|
| * config: update size informationDenys Vlasenko2018-12-281-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-12-051-0/+2
|\|
| * awk: abort if NF set to negative valueDenys Vlasenko2018-11-281-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-05-131-0/+3
|\|
| * awk: do not allow $(-1)Denys Vlasenko2018-04-231-0/+3
| | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2018-02-131-27/+34
|\|
| * awk: code shrinkDenys Vlasenko2018-01-071-4/+3
| | | | | | | | | | | | | | function old new delta awk_main 955 948 -7 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: fix 'delete array[var--]' decrementing var twiceDenys Vlasenko2018-01-071-23/+31
| | | | | | | | | | | | | | function old new delta evaluate 3395 3390 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-09-271-1/+0
|\|
| * regularize format of source file headers, no code changesDenys Vlasenko2017-09-181-1/+0
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-08-221-2/+6
|\|
| * awk: stop on first non-option, closes 9861Denys Vlasenko2017-08-161-1/+5
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * do not use `a' quoting style in commentsDenys Vlasenko2017-08-021-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-07-291-2/+1
|\|
| * config: trim/improve item names and help texts, take 2Denys Vlasenko2017-07-271-2/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-07-241-10/+10
|\|
| * config: deindent all help textsDenys Vlasenko2017-07-211-9/+9
| | | | | | | | | | | | Those two spaces after tab have no effect, and always a nuisance when editing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libarchive: FEATURE_LZMA_FAST should be visible if FEATURE_SEAMLESS_LZMADenys Vlasenko2017-07-201-1/+1
| | | | | | | | | | | | While at it, tweak some config help texts. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Update menuconfig items with approximate applet sizesDenys Vlasenko2017-07-181-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Use %I64* formats with MinGW instead of %ll* formatsJohannes Schindelin2017-07-181-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The MSVC runtime uses the format specified %I64 for 64-bit data types; It does not understand e.g. %llu for unsigned long longs. However, mingw-w64 provides a compatibility mode in its runtime wrapper which can be activated by defining the constant __USE_MINGW_ANSI_STDIO=1 in which case we must refrain from overriding the %ll* formats. This fixes quite a couple of compile warnings when building with the mingw-w64 compiler. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>
* | Merge branch 'busybox' into mergeRon Yorston2016-10-261-1/+1
|\|
| * awk: fix segfault on for loop syntax errorBrian Foley2016-10-241-1/+1
| | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2016-07-071-6/+2
|\|
| * getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LISTDenys Vlasenko2016-07-061-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2015-10-131-48/+67
|\|
| * awk: support "length" form of "length()". Closes 8371Denys Vlasenko2015-10-021-48/+67
| | | | | | | | | | | | | | | | function old new delta parse_expr 805 848 +43 tokenlist 447 448 +1 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2015-07-141-12/+0
|\|
| * Removes stray empty line from codeManinder Singh2015-07-131-12/+0
| | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2014-06-301-0/+2
|\|
| * awk: fix handling of "if ... break ; else ..." - closes 7226Denys Vlasenko2014-06-261-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | awk: treat \r as a space character to skipRon Yorston2014-01-131-0/+4
|/