aboutsummaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2015-08-25ping: fix recently introduced build breakage for non-optimizing buildsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-25libbb: add a comment describing the way is_prefixed_with() worksBartosz Golaszewski
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-25libbb: add unit tests for is_prefixed_with()Bartosz Golaszewski
Test corner cases too like looking for an empty prefix etc. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24login: don't print motd if .hushlogin exists in users homeSören Tempel
function old new delta login_main 978 996 +18 Signed-off-by: Sören Tempel <soeren@soeren-tempel.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24dmesg: add -r option to print raw format even when FEATURE_DMESG_PRETTY is ↵Peter Korsgaard
enabled Similar to the "big" util-linux version. For !DMESG_PRETTY, the option is accepted (but ignored) as well, for compatibility reasons. Signed-off-by: Peter Korsgaard <peter@korsgaard.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24ifupdown: 'prio' should have been 'metric' in static_up and static_up6Alex Dowad
When a static interface with explicit gateway and metric in /etc/network/interfaces is enabled using 'ifup', and further, the BusyBox 'ip' applet is enabled, the following error message appears at the console (and no default route is added): ip: either "to" is duplicate, or "prio" is garbage Tracing ifup reveals that it is attempting to run the following shell command: ip route add default via <GW> dev <DEVICE> prio <METRIC> 'ip' does not understand the 'prio' argument, causing this error. With 'metric', it works fine. Signed-off-by: Alex Dowad <alexinbeijing@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24libbb: add setsockopt_foo helpersDenys Vlasenko
function old new delta setsockopt_int - 23 +23 do_load 918 934 +16 setsockopt_SOL_SOCKET_int - 14 +14 setsockopt_keepalive - 10 +10 setsockopt_SOL_SOCKET_1 - 10 +10 buffer_fill_and_print 169 178 +9 setsockopt_1 - 8 +8 nfsmount 3560 3566 +6 redirect 1277 1282 +5 tcpudpsvd_main 1782 1786 +4 d6_send_kernel_packet 272 275 +3 i2cget_main 380 382 +2 ed_main 2544 2545 +1 scan_recursive 380 378 -2 nbdclient_main 492 490 -2 hash_find 235 233 -2 cmdputs 334 332 -2 parse_command 1443 1440 -3 static.two 4 - -4 ntpd_main 1039 1035 -4 const_int_1 4 - -4 const_IPTOS_LOWDELAY 4 - -4 RCVBUF 4 - -4 ntp_init 474 469 -5 change_listen_mode 316 310 -6 uevent_main 416 409 -7 arping_main 1697 1690 -7 telnet_main 1612 1603 -9 socket_want_pktinfo 42 33 -9 setsockopt_reuseaddr 21 10 -11 setsockopt_broadcast 21 10 -11 httpd_main 772 757 -15 get_remote_transfer_fd 109 94 -15 make_new_session 503 487 -16 ftpd_main 2177 2160 -17 read_bunzip 1896 1866 -30 common_traceroute_main 4099 4058 -41 common_ping_main 1836 1783 -53 ------------------------------------------------------------------------------ (add/remove: 5/4 grow/shrink: 8/21 up/down: 111/-283) Total: -172 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24Merge setsockopt error messagesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-24traceroute: fix help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-17Makefile: add missing libraries to LDLIBSBartosz Golaszewski
Static build with CONFIG_PAM fails on Debian Jessie due to undefined references to libdl and libaudit. Static build without pam, but with libcrypt required fails as well due to undefined references to libpthread. Fix these two cases by adding the missing libraries to LDLIBS when appropriate. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-17unit-tests: remove code depending on WANT_TIMINGBartosz Golaszewski
Since there is no interest in merging a config option for WANT_TIMING, remove the parts of code depending on it altogether. While we're at it: add some newlines to improve readability. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-17unit-tests: remove unnecesary field from struct bbunit_listelemBartosz Golaszewski
In the initial submission struct bbunit_listelem was manipulated by custom list functions implemented in bbunit.c. Since the tests are now added to the list by llist_add_to_end(), which allocates the llist_t objects behind the scenes, there's no need for the *next field. function old new delta unit_main 142 141 -1 bbunit_strrstr_elem 24 16 -8 bbunit_obscure_weak_pass_elem 24 16 -8 bbunit_obscure_strong_pass_elem 24 16 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-25) Total: -25 bytes Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-16arping: make help text clearerDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-16less: fix botched attempt to use last columnRon Yorston
Commit 1ecb996 attempted to make read_lines() use the last column of the terminal (as re_wrap() did). There were two problems with this: - The size of the buffer allocated for lines wasn't increased to allow for the extra character. - The test for width overflow was moved after the point where the next character was added to the buffer. This caused a buffer overflow in certain circumstances. For example, if the line beyond the end of the display was wider than the display read_lines() would initially read the partial line into a buffer. When the user moved down read_lines() would be called again to ensure the rest of the line was read. This would place the next character in the partial line before checking for overflow. This can be fixed by moving the test for overflow back to where it was before commit 1ecb996 and changing the comparison to `>` rather than `>=`. There are two other places where buffers are created without allowing for width+1 characters. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-15ipcalc: fix trivial usage messageRon Yorston
Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-04zcip: tweak comments and make unsigned division more obviousDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-04zcip: another code shrinkDenys Vlasenko
function old new delta send_arp_request - 185 +185 zcip_main 1273 1272 -1 pick_nip 40 - -40 arp 185 - -185 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 0/1 up/down: 185/-226) Total: -41 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-04zcip: code shrinkDenys Vlasenko
function old new delta zcip_main 1263 1230 -33 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-04zcip: simplify codeDenys Vlasenko
function old new delta zcip_main 1411 1263 -148 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-03uname: make OS name configurableRon Yorston
A mailing list thread in September 2013 discussed changing the string returned by the non-POSIX 'uname -o' option. Nothing ever came of this because there was no agreement as to what the string should be. Make the string configurable so that people can decide for themselves. Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-08-03less: further tweaks to regular file detectionRon Yorston
Test explicitly for REOPEN flags: update_num_lines is called unconditionally so (num_lines != NOT_REGULAR_FILE) is also true when num_lines contains a valid number of lines. The call to fstat doesn't need to be in #if ENABLE_FEATURE_LESS_FLAGS: the whole function is already in such a test. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31diff.tests: add testcases for -B and single line changesAaro Koskinen
Add testcases for -B and single line changes. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31diff: fix -B with single line changesAaro Koskinen
Fix -B with single line changes. They were always ignored regardless if they were blank or not. Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31less: improve regular file detection in line counting codeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31less: allow use of last column of terminalRon Yorston
When read_lines tests whether a character will fit on the current line it checks the *next* character but in case of overflow doesn't display the *current* one. This results in the last column of the terminal never being used. The test in re_wrap (used when the terminal width changes or line numbers are enabled/disabled) is different: it does allow the use of the final column. function old new delta read_lines 764 770 +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>
2015-07-31less: fix line number confusionRon Yorston
Much of the code refers to lines using indices into the flines array (which splits lines into portions that fit on the terminal). In some cases this is wrong and actual line numbers should be used: - when lines are being truncated rather than wrapped (-S flag) - when line numbers have been entered by the user Also fix a bug in numeric input and improve the display at EOF. function old new delta goto_lineno - 111 +111 cap_cur_fline - 101 +101 buffer_to_line - 56 +56 buffer_up 35 66 +31 less_main 2606 2615 +9 goto_match 125 127 +2 buffer_down 81 56 -25 buffer_line 64 - -64 ------------------------------------------------------------------------------ (add/remove: 3/1 grow/shrink: 3/1 up/down: 310/-89) Total: 221 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31less: add a function to detect when display is at end of fileRon Yorston
Add a function to package the test that detects whether enough has been read from the file to allow a screenful to be displayed. Also use this to determine when to display '(END)' in the status line. The previous code was incomplete and didn't handle truncated lines (-S flag) properly. function old new delta at_end - 63 +63 status_print 111 109 -2 read_lines 819 764 -55 getch_nowait 319 264 -55 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/3 up/down: 63/-112) Total: -49 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31less: rearrange detection of non-regular filesRon Yorston
Move the code to detect non-regular files to the point where the file is being opened. If num_lines == READING_FILE guarantees that the file is regular. Detect when a file becomes unreadable between it first being opened and the call to update_num_lines. Mark the file as being non-regular so we don't try that again. function old new delta reinitialize 197 245 +48 update_num_lines 159 127 -32 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 48/-32) Total: 16 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31less: move code to count lines into a separate functionRon Yorston
function old new delta update_num_lines - 159 +159 m_status_print 409 266 -143 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/1 up/down: 159/-143) Total: 16 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31less: fix numeric inputRon Yorston
Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-31echo: make escape sequences depend on fancy modeMike Frysinger
Currently when you disable fancy echo, escape sequences are hardcoded enabled (e.g. as if you used `echo -e` all the time). The opposite behavior is more desirable (always disable -e support) because: * This seems to contradict the spirit of the kconfig help text (where it says enable support for -n/-e flags), although you could say that we aren't supporting the -e flag directly as `echo -e` will show the -e flag. * POSIX makes escape sequences optional, and even says they are there only on XSI-conformant systems. * It saves space (~100 bytes on x86_64). * It makes things faster! * It makes it behave more like bash where you need an explicit -e flag in order for escape sequences to be interpreted. Signed-off-by: Mike Frysinger <vapier@gentoo.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-30fbset: fix rgba parsingLinus Walleij
In commit b5c7220e7b2b6611fe5beca494c67bfe51fcfafb "fbset: respect rgba configuration lines in fb.modes" I somehow managed to swap the offset/length markers around. The man page for fb.modes says it should be offset/length not length/offset as I was accidentally parsing it. As my fb.modes file was also reversed I didn't notice until I tried someone elses fb.modes file. Mea culpa. Signed-off-by: Linus Walleij <linus.walleij@linaro.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-30udhcpc: dns labels can actually start with a numberArthur Gautier
While RFC1035 recommends a label not to start with a number, there is actually no such limitation in dns. One may buy a domain name like 0x1.net and use it. This commit remove this check and allow a user to use such domains. Signed-off-by: Arthur Gautier <baloo@gandi.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-21less: improvements to verbose status messagesRon Yorston
Make verbose status messages (-m/-M flags) behave more like the real `less` command: - fix display of line numbers so they're correct whether lines are being truncated (-S flag) or wrapped. - don't display total lines or percentage when lines are read from stdin: we don't have that information until we reach EOF. When we do reach EOF the additional information is displayed. - when lines are read from a file count the total number of lines so that we can display percentages. Counting lines is avoided until the information is actually needed. If the user pages to EOF the separate read pass can be avoided entirely. Fixes Bug 7586 function old new delta m_status_print 195 382 +187 safe_lineno - 35 +35 reinitialize 172 182 +10 read_lines 675 685 +10 buffer_fill_and_print 178 169 -9 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 3/1 up/down: 242/-9) Total: 233 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-21sync: add support for -d -f FILEDenys Vlasenko
Based on the patch by Ari Sundholm <ari@tuxera.com> function old new delta sync_main 20 163 +143 packed_usage 30653 30673 +20 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 163/0) Total: 163 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-19Remove old_e2fsprogs/*Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-19libbb: add a function to make a copy of a region of memoryRon Yorston
Introduce a library routine to package the idiom: p = xmalloc(b, n); memcpy(p, b, n); and use it where possible. The example in traceroute used xzalloc but it didn't need to. function old new delta xmemdup - 32 +32 last_main 834 826 -8 make_device 2321 2311 -10 common_traceroute_main 3698 3685 -13 readtoken1 3182 3168 -14 procps_scan 1222 1206 -16 forkchild 655 638 -17 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/6 up/down: 32/-78) Total: -46 bytes Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-19less: correctly account for tabs when rewrapping linesRon Yorston
Lines are rewrapped when the terminal width changes or line numbers are enabled/disabled. The current calculation always adds eight to the line length for a tab whereas it should only add enough to move to the next tab stop. This doesn't affect the display of lines, which is handled elsewhere and gets tab stops right, but it does cause lines to be wrapped at the wrong position. Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-19less: fix display of line numbersRon Yorston
Line numbers are displayed incorrectly on lines that have a search pattern highlighted. The problem can be fixed by moving the call to lineno_str in print_found above the while loop that alters the value of the line pointer. However, a more substantial rewrite results in savings. function old new delta buffer_print 688 697 +9 .rodata 156077 156045 -32 lineno_str 85 - -85 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 9/-117) Total: -108 bytes Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-19less: document -S flag and make it independently configurableRon Yorston
The -S flag, to cause long lines to be truncated, was enabled by FEATURE_LESS_DASHCMD. This is non-obvious and -S is useful even if the '-' command isn't enabled. function old new delta .rodata 156045 156077 +32 packed_usage 30223 30244 +21 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 53/0) Total: 53 bytes Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-13ash: use alloca to get rid of setjmpRon Yorston
Now that the only thing protected by setjmp/longjmp is the saved string, we can allocate it on the stack to get rid of the jump. Based on commit bd35d8e from git://git.kernel.org/pub/scm/utils/dash/dash.git by Herbert Xu. function old new delta readtoken1 3182 3116 -66 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-66) Total: -66 bytes Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-13fix file modeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-13ash: remove parsebackquote flagRon Yorston
Commit 503a0b8 from git://git.kernel.org/pub/scm/utils/dash/dash.git by Herbert Xu says: >The parsebackquote flag is only used in a test where it always has the >value zero. So we can remove it altogether. The first statement is incorrect: parsebackquote is non-zero when backquotes (as opposed to $(...)) are used for command substitution. It is possible for the test to be executed with parsebackquote != 0 in that case. The test is question checks whether quotes have been closed, raising the error "unterminated quoted string" if they haven't. There seems to be no good reason to allow unclosed quotes within backquotes. Bash, hush and dash (after commit 503a0b8) all treat the following as an error: XX=`"pwd` whereas BusyBox ash doesn't. It just ignores the unclosed quote and executes pwd. So, parsebackquote should be removed but not for the reason stated. function old new delta parsebackquote 1 - -1 readtoken1 3222 3182 -40 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-41) Total: -41 bytes Signed-off-by: Ron Yorston <rmy@frippery.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-13Removes stray empty line from codeManinder Singh
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-01applets: Add installation of individual binariesClayton Shotwell
Adding support to install individual binaries if the option is enabled. This also installs the shared libbusybox.so.* library. Signed-off-by: Clayton Shotwell <clshotwe@rockwellcollins.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-01ps: fix SEGV on narrow screens. closes 8176Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-01ipaddress: better formatting, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-07-01ip addr: support change and replace commandsMichael Tokarev
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-06-07fix whitespacesManinder Singh
reported by script :- scripts/fix_ws.sh Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-06-07fix if(p)/free(p) constructManinder Singh
No need of explicit NULL check before free. 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>