summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-03-29vi: improve operations involving paragraph movementRon Yorston
Movement by paragraph doesn't always involve whole lines. If the cursor is positioned in the middle of a line deleting to either end of the paragraph will result in one partial line and zero or more full lines. Adjust the end of ranges delimited by paragraph movement to more closely match what vi does. function old new delta find_range 467 518 +51 at_eof - 49 +49 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/0 up/down: 100/0) Total: 100 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: improve motion by paragraphRon Yorston
When moving by paragraph ('{' and '}'): - Treat multiple empty lines as a single paragraph separator. - When no paragraph separator is found move to the start or end of the file depending on the direction of motion. function old new delta do_cmd 4821 4900 +79 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 79/0) Total: 79 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: allow repetition count for paragraph motionRon Yorston
The paragraph motion commands '{' and '}' should accept a count. function old new delta do_cmd 5054 5071 +17 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 17/0) Total: 17 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: allow motion count for change/delete/yank/shiftRon Yorston
The motion that determines the range of a change, delete, yank or shift operation can have its own count. Thus the commands '5dd' and 'd5d' are equivalent: both delete 5 lines. When the command itself also has a count the two values are multiplied. Thus the command '2d3w' deletes 6 words and '2D3G' deletes from the current line to line 6. (When dealing with structured data it might make sense to think in units of 3 words so '2d3w' is deleting 2 such units. It doesn't seem quite as sensible to express 'delete from current line to line 6' as '2D3G' but vi permits it.) function old new delta get_motion_char - 68 +68 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/0 up/down: 68/0) Total: 68 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: support more commands for range selectionRon Yorston
Add 'F', 'T' and '|' as commands that can be used to specify a range for change/delete/yank operations. function old new delta .rodata 105129 105135 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 6/0) Total: 6 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: improvements to character search within lineRon Yorston
- Use a common routine to handle all commands to search for a character in a line. - When searching for the nth occurrence of a character don't move the cursor if fewer than n occurrences are present. - Add support for the 'T' command, search backwards for character after next occurrence of given character. function old new delta do_cmd 4861 4805 -56 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-56) Total: -56 bytes v2: Add parentheses to avoid searches continuing past end of line. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: remember cursor column during vertical motionRon Yorston
When the 'j'/'k' commands or up/down arrow keys are used to move the cursor vertically 'vi' remembers the original cursor column and positions the cursor there if possible. Also, if the '$' command has been used to position the cursor at the end of a line vertical movements keep the cursor at the end of the line. Make BusyBox 'vi' do the same. function old new delta refresh 674 694 +20 do_cmd 4853 4861 +8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 28/0) Total: 28 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: 'G'/'M' commands move to first visible characterRon Yorston
The 'G' command with no target (meaning 'go to last line') should position the cursor on the first visible character of the line, as it already does in other cases. The 'M' command should position the cursor on the first visible character (as 'H' and 'L' already do). function old new delta do_cmd 4842 4853 +11 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 11/0) Total: 11 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: don't overwrite existing fileRon Yorston
If the name of the file being written doesn't match the current filename and the output file already exists vi should issue a warning and not overwrite the file. Because the test only compares the file names it's somewhat over- protective. If the current file name is 'my_text' and the user tries to save to './my_text' they'll be prevented from doing so. function old new delta colon 3092 3151 +59 .rodata 105118 105146 +28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 87/0) Total: 87 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: make buffer handling more vi-likeRon Yorston
Vi places text affected by change/delete/yank operations into a buffer. The contents of such buffers can be restored with the put commands, 'p' or 'P'. These behave differently depending on whether the buffer contains whole lines or partial lines. For whole lines the text is copied into the file on the line before (P) or after (p) the current line. For partial lines the text is copied before or after the current cursor position. Whether an operation results in whole or partial lines depends on the command used. BusyBox vi treats any buffer with a newline as though it contained whole lines. This is incorrect. Deleting multiple words across a line boundary results in a buffer with a newline but not having whole lines. Rework how buffers are handled to behave more like vi. function old new delta static.text_yank 79 99 +20 colon 3092 3097 +5 edit_file 885 887 +2 yank_delete 127 112 -15 .rodata 105139 105101 -38 find_range 514 467 -47 do_cmd 5088 4842 -246 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/4 up/down: 27/-346) Total: -319 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: code shrinkRon Yorston
I was puzzled by code in find_range() which handles forward word movement. It included a test to see if we're at the start of a word. Since these are forward word movements surely we'd expect to be at the start of a word? In fact, the test was intended to fix a problem with changes to the last word in a file, as discussed in the thread starting here: http://lists.busybox.net/pipermail/busybox/2004-January/044552.html The code can be simplified by testing directly for end of file instead of indirectly for not being at the start of a word. Since trailing whitespace is now handled in do_cmd() the code to back up off a newline is no longer required. function old new delta find_range 619 514 -105 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-105) Total: -105 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-29vi: fix word operations across line boundariesRon Yorston
Commit 4b49422a0 (vi: fix changes to word at end of line. Closes 11796) fixed a problem where an operation on a word at the end of a line followed by a line starting with whitespace incorrectly joined the lines. However it also broke the case where operating on multiple words across a line boundary *should* join the lines. Fix this by detecting when trailing whitepace in a word operation includes a newline. Whitespace beyond the newline is excluded from consideration. function old new delta do_cmd 5083 5088 +5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 5/0) Total: 5 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-26ntpd: code shrink (force not-inlining, stop returning structs)Denys Vlasenko
function old new delta d_to_sfp - 133 +133 lfp_to_d - 84 +84 sfp_to_d - 78 +78 d_to_lfp 141 137 -4 .rodata 103182 103174 -8 recv_and_process_peer_pkt 2380 2173 -207 recv_and_process_client_pkt 706 493 -213 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 0/4 up/down: 295/-432) Total: -137 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-23timeout,top,watch,ping: parse NN.N fractional duration in locales with other ↵Denys Vlasenko
separators Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-20resume: write offset in /sys/power/resume_offsetDenys Vlasenko
Doing this the kernel will hibernate and resume successfully from a swap file. Stop writing offset to /sys/power/resume, as this is not a parameter the kernel takes from this input. (Change added by Sven Mueller) function old new delta resume_main 522 561 +39 .rodata 103175 103182 +7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 46/0) Total: 46 bytes Signed-off-by: Jordi Pujol Palomer <jordipujolp@gmail.com> Signed-off-by: Sven Mueller <sven.mueller72+busybox@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-19login: implement LOGIN_TIMEOUTDenys Vlasenko
function old new delta packed_usage 33559 33598 +39 login_main 953 986 +33 .rodata 103161 103175 +14 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 86/0) Total: 86 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-16udhcpc: ignore zero-length DHCP options, take 2Denys Vlasenko
advance the optionptr by two bytes, not one Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-16udhcpc: ignore zero-length DHCP optionsRussell Senior
Discovered that the DHCP server on a TrendNet router (unknown model) provides a zero-length option 12 (Host Name) in the DHCP ACK message. This has the effect of causing udhcpc to drop the rest of the options, including option 51 (IP Address Lease Time), 3 (Router), and 6 (Domain Name Server), most importantly leaving the OpenWrt device with no default gateway. The TrendNet behavior violates RFC 2132, which in Section 3.14 declares that option 12 has a minimum length of 1 octet. It is perhaps not a cosmic coincidence that I found this behavior on Pi Day. This patch allows zero length options without bailing out, by simply skipping them. function old new delta udhcp_scan_options 183 172 -11 Signed-off-by: Russell Senior <russell@personaltelco.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-15echo: special case "echo --help": it should not show help textDenys Vlasenko
While at it, fix "busybox --help echo" and other special applets to still print the help text. function old new delta run_applet_and_exit 732 761 +29 show_usage_if_dash_dash_help 70 78 +8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 37/0) Total: 37 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-12decompress_gunzip: Fix DoS if gzip is corruptSamuel Sapalski
On certain corrupt gzip files, huft_build will set the error bit on the result pointer. If afterwards abort_unzip is called huft_free might run into a segmentation fault or an invalid pointer to free(p). In order to mitigate this, we check in huft_free if the error bit is set and clear it before the linked list is freed. Signed-off-by: Samuel Sapalski <samuel.sapalski@nokia.com> Signed-off-by: Peter Kaestle <peter.kaestle@nokia.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-10hush: make LINENO selectable without BASH-COMPATDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-09wget: new option FEATURE_WGET_FTP to enable/disable FTPSergey Ponomarev
Introduce a separate option FTPS_SUPPORTED instead of not obvious ENABLE_FEATURE_WGET_HTTPS. function old new delta P_FTP 4 - -4 P_FTPS 5 - -5 reset_beg_range_to_zero 41 - -41 parse_url 431 366 -65 parse_pasv_epsv 154 - -154 .rodata 115566 115408 -158 ftpcmd 204 - -204 spawn_ssl_client 291 - -291 wget_main 2998 2664 -334 ------------------------------------------------------------------------------ (add/remove: 0/7 grow/shrink: 0/3 up/down: 0/-1256) Total: -1256 bytes Signed-off-by: Sergey Ponomarev <stokito@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-09bloat-o-meter: avoid double countingRon Yorston
Disable 'echo' in the default config, run 'make baseline', then re-enable 'echo' and run 'make bloatcheck': function old new delta .rodata 182521 182622 +101 packed_usage 33714 33792 +78 applet_main 3168 3176 +8 applet_names 2730 2735 +5 applet_suid 99 100 +1 applet_install_loc 198 199 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 6/0 up/down: 194/0) Total: 194 bytes text data bss dec hex filename 955052 4195 1808 961055 eaa1f busybox_old 955153 4195 1808 961156 eaa84 busybox_unstripped The Total bytes value doesn't equal the change in the size of the binary. The packed_usage and applet_* items are in .rodata and are counted twice. With this modified bloat-o-meter the size of named items is deducted from .rodata: function old new delta packed_usage 33714 33792 +78 applet_main 3168 3176 +8 .rodata 105105 105113 +8 applet_names 2730 2735 +5 applet_suid 99 100 +1 applet_install_loc 198 199 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 6/0 up/down: 101/0) Total: 101 bytes text data bss dec hex filename 955052 4195 1808 961055 eaa1f busybox_old 955153 4195 1808 961156 eaa84 busybox_unstripped v2: Sections numbered less than 10 were always being omitted from consideration because splitting "[ 1] .interp" leaves "1]" in x[1] where the section name is expected. This wasn't a problem for .rodata (numbered 15 in my testing) but let's fix it anyway. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-09start-stop-daemon: explain -x + -a testDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-02ntpd: tweak commentsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-02ntpd: decrease INITIAL_SAMPLES from 4 to 3Denys Vlasenko
This reduces initial traffic to NTP servers when a lot of devices boot at once. Log inspection tells me we agressively burst-poll servers about 5 times at startup, even though we usually already update clock after second replies. INITIAL_SAMPLES can probably be even lower, e.g. 2, but let's be conservative when changing this stuff. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-01vi: code shrinkDenys Vlasenko
function old new delta setops 85 73 -12 colon 2965 2915 -50 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-62) Total: -62 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-03-01vi: restore 0 offset after :set noXXX commandAlison Winters
Fixes bug where commands after the first noXXX command are ignored. e.g. :set noic tabstop=4 While at it, stop recognizing "notabstop=NNN". function old new delta colon 2990 2965 -25 Signed-off-by: Alison Winters <alisonatwork@outlook.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-26bc: typo fix in commentDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-26dc: more docs in --helpDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-26dc: document what non-GNU commands doDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-26bc/dc: fix length(0) and length(0.000nnn) resultDenys Vlasenko
function old new delta zxc_vm_process 6464 6498 +34 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-26dc: correct --help textDenys Vlasenko
before: Tiny RPN calculator. Operations: +, -, *, /, %, ~, ^, |, p - print top of the stack without popping f - print entire stack k - pop the value and set the precision i - pop the value and set input radix o - pop the value and set output radix After: Tiny RPN calculator. Operations: Arithmetic: + - * / % ^ ~ - divide with remainder | - modular exponentiation v - square root p - print top of the stack without popping f - print entire stack k - pop the value and set precision i - pop the value and set input radix o - pop the value and set output radix function old new delta packed_usage 33519 33565 +46 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-23trylink: do not drop libs from CONFIG_EXTRA_LDLIBSDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-23echo: do not assume that free() leaves errno unmodifiedNatanael Copa
musl libc's mallocng free() may modify errno if kernel does not support MADV_FREE which causes echo to echo with error when it shouldn't. Future versions of POSIX[1] will require that free() leaves errno unmodified but til then, do not rely free() implementation. Should fix downstream issues: https://github.com/alpinelinux/docker-alpine/issues/134 https://gitlab.alpinelinux.org/alpine/aports/-/issues/12311 Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-23lineedit: support empty PATH entries in tab completionRon Yorston
Zero-length path prefixes can be specified in PATH as a leading or trailing colon or two adjacent colons. POSIX says that the use of zero-length prefixes to refer to the current directory is a legacy feature. Nonetheless the shells in BusyBox respect this feature, as does 'which'. Tab-completion of executables using PATH should support this too. function old new delta complete_cmd_dir_file 934 931 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-3) Total: -3 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-22diff: code shrinkRon Yorston
function old new delta diff_main 1515 1495 -20 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-20) Total: -20 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-22dnsd: check that we don't read past packetDenys Vlasenko
function old new delta dnsd_main 1296 1304 +8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-21udhcp: reuse stringsDenys Vlasenko
text data bss dec hex filename 1019916 559 5020 1025495 fa5d7 busybox_old 1019906 559 5020 1025485 fa5cd busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-21ntpd: log responses to clients at log level 3Denys Vlasenko
function old new delta recv_and_process_client_pkt 670 706 +36 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-21ntpd: without INITIAL_FREQ_ESTIMATION code, state variable is not needed tooDenys Vlasenko
function old new delta update_local_clock 917 872 -45 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-21ntpd: remove unused USING_INITIAL_FREQ_ESTIMATION codeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-21ntpd: increase loglevel to 3 for "poll:32s sockets:0 interval:64s" messageDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-20udhcpc: clarify bcast/unicast sends in logs, include server IDDenys Vlasenko
Before: sending discover sending select for 192.168.1.173 lease of 192.168.1.173 obtained, lease time 43200 sending renew to 192.168.1.1 lease of 192.168.1.173 obtained, lease time 43200 After: broadcasting discover broadcasting select for 192.168.1.173, server 192.168.1.1 lease of 192.168.1.173 obtained from 192.168.1.1, lease time 43200 sending renew to server 192.168.1.1 lease of 192.168.1.173 obtained from 192.168.1.1, lease time 43200 function old new delta udhcpc_main 2580 2610 +30 send_select 104 130 +26 send_renew 82 99 +17 send_discover 94 89 -5 send_decline 93 88 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/2 up/down: 73/-10) Total: 63 bytes text data bss dec hex filename 1019732 559 5020 1025311 fa51f busybox_old 1019898 559 5020 1025477 fa5c5 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-18libbb: fix '--help' handling in FEATURE_SH_NOFORK=yDenys Vlasenko
Most BusyBox applets respond to the '--help' option by printing a usage message. This is normally handled by busybox_main() so applet main routines don't have support for '--help'. In standalone shell mode with FEATURE_SH_NOFORK enabled nofork applets are invoked directly, bypassing busybox_main(). This results in inconsistent handling of '--help': - applets which call getopt() report "unrecognized option '--help'" and print help anyway; - realpath says "--help: No such file or directory" and doesn't print help; - usleep says "invalid number '--help'" and doesn't print help. Avoid inconsistency by checking for '--help' in run_nofork_applet(). Bug found by Ron Yorston. function old new delta show_usage_if_dash_dash_help - 70 +70 run_nofork_applet 347 362 +15 run_applet_no_and_exit 432 365 -67 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 85/-67) Total: 18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-18ash: placate -Werror=format-securityDenys Vlasenko
"In function 'sprint_status48': error: format not a string literal and no format arguments" function old new delta sprint_status48 160 158 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-15applets/usage_pod.c: placate gccDenys Vlasenko
"error: format not a string literal and no format arguments" Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-07Makefile.flags: fix the OS detection for libresolvMartin Kaiser
054493350 ("Do not add -lresolv on non-Linux systems") adds a condition to link with libresolv only on linux systems. The check requires that CONFIG_UNAME_OSNAME equals Linux. This works only if the uname applet is enabled. Otherwise, CONFIG_UNAME_OSNAME is empty, regardless of the platform. By default, CONFIG_UNAME_OSNAME is the output of uname -o. For most linux systems, uname -o returns "GNU/Linux" and the check fails. In this case, linking a static busybox fails because of missing symbols from libresolv. networking/lib.a(nslookup.o): In function `add_query': nslookup.c:789: undefined reference to `__res_mkquery' networking/lib.a(nslookup.o): In function `parse_reply': nslookup.c:355: undefined reference to `ns_initparse' nslookup.c:361: undefined reference to `ns_parserr' nslookup.c:404: undefined reference to `ns_name_uncompress' nslookup.c:418: undefined reference to `ns_get16' nslookup.c:419: undefined reference to `ns_name_uncompress' .. nslookup.c:456: undefined reference to `ns_get16' ... nslookup.c:469: undefined reference to `ns_name_uncompress' ... nslookup.c:489: undefined reference to `ns_get32' ... collect2: error: ld returned 1 exit status This patch uses the output of $CC -dumpmachine to detect the target platform for which we compile. Both gcc and clang support -dumpmachine. Like the original patch, we link against libresolv only if our target platform is linux-based. Fixes: 054493350 ("Do not add -lresolv on non-Linux systems") Signed-off-by: Martin Kaiser <martin@kaiser.cx> Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2021-02-03libbb: introduce and use fputs_stdoutRon Yorston
function old new delta fputs_stdout - 12 +12 zxc_vm_process 7237 7230 -7 yes_main 85 78 -7 write_block 380 373 -7 wrapf 305 298 -7 strings_main 437 430 -7 show_bridge 353 346 -7 rev_main 384 377 -7 put_prompt_custom 58 51 -7 put_cur_glyph_and_inc_cursor 168 161 -7 print_numbered_lines 152 145 -7 print_named_ascii 130 123 -7 print_name 135 128 -7 print_login_issue 386 379 -7 print_ascii 208 201 -7 powertop_main 1249 1242 -7 od_main 1789 1782 -7 logread_main 518 511 -7 head_main 804 797 -7 display_process_list 1319 1312 -7 cut_main 1002 995 -7 bb_dump_dump 1550 1543 -7 bb_ask_noecho 393 386 -7 baseNUM_main 702 695 -7 expand_main 755 745 -10 dumpleases_main 497 487 -10 write1 12 - -12 putcsi 37 23 -14 print_login_prompt 55 41 -14 paste_main 525 511 -14 cat_main 440 426 -14 print_it 245 230 -15 print_addrinfo 1188 1171 -17 print_rule 770 750 -20 print_linkinfo 842 822 -20 httpd_main 791 771 -20 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/34 up/down: 12/-341) Total: -329 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-02-03libbb: code shrink fgets_strRon Yorston
Use a NULL value of maxsz_p to indicate to xmalloc_fgets_internal() that the caller doesn't care about the maximum size of the buffer. This allows the default maximum size to be set once in xmalloc_fgets_internal() instead of separately in each caller. function old new delta xmalloc_fgets_internal 273 287 +14 xmalloc_fgets_str 30 9 -21 xmalloc_fgetline_str 33 12 -21 xmalloc_fgets_str_len 38 10 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 14/-70) Total: -56 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>