aboutsummaryrefslogtreecommitdiff
path: root/miscutils
AgeCommit message (Collapse)Author
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-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-06-07i2cdetect: use break instead of goto in list_i2c_busses_and_exit()Bartosz Golaszewski
Since there are now more statements in the if block after the while loop in list_i2c_busses_and_exit(), there's no need for a label. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-06-07i2cdump: code reworkBartosz Golaszewski
Split i2cdump_main() into shorter functions. Simplify the code a bit. Make block an array of ints so that we can store negative results of read functions (fixes a bug found by Denys Vlasenko). Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-06-07i2cdetect: add a check for (mode == DETECT_MODE_AUTO)Bartosz Golaszewski
We should only warn the user about addresses to be skipped if (mode == DETECT_MODE_AUTO). Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-06-07i2cdetect: don't scan non-regular addresses without the '-a' optionBartosz Golaszewski
Addresses 0x00-0x02 shouldn't be scanned by default. This patch makes 'first' default to 0x03 and only enables lower addresses if '-a' option is passed Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-06-07i2cdetect: don't die on addresses already in use by driversBartosz Golaszewski
We can't use i2c_set_slave_addr() in i2cdetect, as we have to check for EBUSY after calling ioctl(I2C_SLAVE) and print 'UU' on busy addresses instead of bailing-out. While we're at it: reorder definitions of local vars in i2cdetect_main(). function old new delta i2cdetect_main 703 744 +41 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 41/0) Total: 41 bytes text data bss dec hex filename 826097 4164 9584 839845 cd0a5 busybox_old 826145 4164 9584 839893 cd0d5 busybox_unstripped Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-25typo fixesManinder Singh
Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-25dc: fix "dc p" prinitng bogus dataDenys Vlasenko
function old new delta check_under - 20 +20 print_no_pop 27 32 +5 pop 33 24 -9 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 25/-9) Total: 16 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-11i2c-tools: only try /dev/i2c/* if opening /dev/i2c-* fails with ENOENTBartosz Golaszewski
Trying to access /dev/i2c/* on every error after opening /dev/i2c-* can mislead users who e.g. don't have root access. Instead of bailing-out with "permission denied" we currently print "no such file or directory". Fix it by trying open("/dev/i2c/%d") only if we got ENOENT. Upstream i2cdetect tries to get any info it can from /sys and /proc even when invoked by an unprivileged user, but we don't want to add unnecessary bloat. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-05-11i2c-tools: fix 'i2cdetect -l'Bartosz Golaszewski
Calling 'i2cdetect -l' only displays usage and exits. Fix it by correctly parsing command-line arguments. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-04-02*: Switch to POSIX utmpx APIBernhard Reutner-Fischer
UTMP is SVID legacy, UTMPX is mandated by POSIX. Glibc and uClibc have identical layout of UTMP and UTMPX, both of these libc treat _PATH_UTMPX as _PATH_UTMP so from a user-perspective nothing changes except the names of the API entrypoints. Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com>
2015-03-12libbb: introduce and use is_prefixed_with()Denys Vlasenko
function old new delta is_prefixed_with - 18 +18 complete_username 78 77 -1 man_main 737 735 -2 fsck_device 429 427 -2 unpack_ar_archive 80 76 -4 strip_unsafe_prefix 105 101 -4 singlemount 1054 1050 -4 rtc_adjtime_is_utc 90 86 -4 resolve_mount_spec 88 84 -4 parse_one_line 1029 1025 -4 parse_conf 1460 1456 -4 may_wakeup 83 79 -4 loadkmap_main 219 215 -4 get_irqs_from_stat 103 99 -4 get_header_cpio 913 909 -4 findfs_main 79 75 -4 fbsplash_main 1230 1226 -4 load_crontab 776 771 -5 expand_vars_to_list 1151 1146 -5 date_main 881 876 -5 skip_dev_pfx 30 24 -6 make_device 2199 2193 -6 complete_cmd_dir_file 773 767 -6 run_applet_and_exit 715 708 -7 uudecode_main 321 313 -8 pwdx_main 197 189 -8 execute 568 560 -8 i2cdetect_main 1186 1176 -10 procps_scan 1242 1230 -12 procps_read_smaps 1017 1005 -12 process_module 746 734 -12 patch_main 1903 1891 -12 nfsmount 3572 3560 -12 stack_machine 126 112 -14 process_timer_stats 449 435 -14 match_fstype 111 97 -14 do_ipaddr 1344 1330 -14 open_list_and_close 359 343 -16 get_header_tar 1795 1779 -16 prepend_new_eth_table 340 323 -17 fsck_main 1811 1794 -17 find_iface_state 56 38 -18 dnsd_main 1321 1303 -18 base_device 179 158 -21 find_keyword 104 82 -22 handle_incoming_and_exit 2785 2762 -23 parse_and_put_prompt 774 746 -28 modinfo 347 317 -30 find_action 204 171 -33 update_passwd 1470 1436 -34 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/49 up/down: 18/-540) Total: -522 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-18trivial code shrinkDenys Vlasenko
function old new delta rdate_main 246 251 +5 show_entry 291 287 -4 daytime_stream 44 39 -5 packed_usage 30176 30168 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 5/-17) Total: -12 bytes text data bss dec hex filename 929453 932 17684 948069 e7765 busybox_old 929411 932 17684 948027 e773b busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-16dc: tweak parsingBernhard Reutner-Fischer
https://bugs.debian.org/538685 dc requires whitespace between language elements. We were requiring 1 2 + p instead of the abbreviated 1 2+p (for example). function old new delta stack_machine 97 126 +29 dc_main 117 79 -38 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 29/-38) Total: -9 bytes Signed-off-by: Bernhard Reutner-Fischer <rep.dot.nop@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-02-10i2cget, i2cset, i2cdetect, i2cdump: new appletsBartosz Golaszewski
Add a minimal implementation of i2cget, i2cset, i2cdump and i2cdetect tools. Supports most features of upstream i2c-tools. function old new delta i2cdump_main - 1444 +1444 i2cset_main - 1239 +1239 i2cdetect_main - 611 +611 list_i2c_busses_and_exit - 532 +532 packed_usage 29975 30438 +463 i2cget_main - 380 +380 check_read_funcs - 140 +140 i2c_funcs_tab - 128 +128 confirm_action - 100 +100 i2c_dev_open - 57 +57 i2c_smbus_access - 44 +44 confirm_or_abort - 43 +43 check_funcs_test_end - 39 +39 i2c_smbus_read_word_data - 38 +38 i2c_smbus_read_byte_data - 38 +38 i2c_smbus_read_byte - 37 +37 i2c_set_slave_addr - 32 +32 applet_names 2480 2512 +32 adap_descs - 32 +32 i2c_set_pec - 29 +29 get_funcs_matrix - 21 +21 i2c_parse_data_addr - 18 +18 i2c_parse_bus_addr - 18 +18 i2c_bus_lookup - 18 +18 i2c_smbus_write_byte - 17 +17 applet_main 1440 1456 +16 will_skip - 14 +14 no_support - 11 +11 applet_nameofs 720 728 +8 applet_install_loc 180 182 +2 ------------------------------------------------------------------------------ (add/remove: 26/0 grow/shrink: 5/0 up/down: 5601/0) Total: 5601 bytes Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-01-30ubiattach: add option -OMicke Prag
Some images do not have the default VID offset. The option -O must be used to attach such images. Signed-off-by: Micke Prag <micke.prag@telldus.se> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-18nanddump: don't show --bb in usage when disabledBaruch Siach
The --bb options now depends on LONG_OPTS. Omit mentions of --bb from usage text when LONG_OPTS is disabled. Signed-off-by: Baruch Siach <baruch@tkos.co.il> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-17nandwrite: fix build when long options are disabledBaruch Siach
The Required_argument macro is only defined when long options are enabled. Fixes the following build error: miscutils/nandwrite.c: In function 'nandwrite_main': miscutils/nandwrite.c:120:10: error: expected ',' or ';' before 'Required_argument' Reported-by: Christian Kästner <kaestner at cs.cmu.edu> Signed-off-by: Baruch Siach <baruch at tkos.co.il> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-12-10flashcp: change BUFSIZE to 4kJacob Kjaergaard
some flash partitions can be smaller than the existing BUFSIZE thus write BUFSIZE will fail with "no space left on device" Signed-off-by: Jacob Kjaergaard <jacob.kjaergaard@prevas.dk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-30man: do not mangle $MANPATH in memoryDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-11-27man: accept a list of dirs in $MANPATHDenys Vlasenko
function old new delta add_MANPATH - 143 +143 man_main 852 731 -121 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/1 up/down: 143/-121) Total: 22 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-25ubiupdatevol: fix -t to not require an option. Closes 7466Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-23less: make -E workAaro Koskinen
function old new delta buffer_print 71 104 +33 Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-22less: trivial code shrinkDenys Vlasenko
function old new delta read_lines 715 695 -20 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-22less: move "retry-on-EAGAIN" logic closer to read opsDenys Vlasenko
This makes "G" (goto end of input) command work as well as /search_for_nonexistent_string: both will read to EOF now even from somewhat slow input (such as kernel's "git log"). function old new delta ndelay_on 35 43 +8 ndelay_off 35 43 +8 read_lines 695 691 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 16/-4) Total: 12 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-09-21less: disable "suppress empty wraparound" optimizationDenys Vlasenko
It is buggy wrt another use case... Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-31taskset: fix logic error in "if it doesn't start with 0x..."Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-08-17taskset: support CPU masks for more than 64 CPUsDenys Vlasenko
function old new delta taskset_main 522 631 +109 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25nanddump: change default to --bb=skipbadRichard Genoud
since mtd-utils 1.4.7, the default behaviour of nanddump is skipbad (commit 2521d4f1b6b9866a9c89f3c11a4f6a3d763ff1d7) Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25nanddump: kill -b Omit bad blockRichard Genoud
since mtd-utils 1.4.7, the omit bad block method has been removed. (cf commit d8b8f780ec3c916f3990e9227d6bfbb22bf42ef8) Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25nanddump: add options --bb=skipbad and padbadRichard Genoud
In mtd-utils, the bad block options changed in favor of --bb=[skipbad|padbad|dumpbad] and omitbad has been removed. This patch add the --bb=skipbad and padbad methods to busybox' nanddump. padbad is the current default behaviour. The difference between skipbad and omitbad is this one: On a 16K block NAND, if the 1st block of mtd0 is bad, we'll have: nanddump -b -l 16384 /dev/mtd0 | wc -c 0 nanddump --bb=skipbad -l 16384 /dev/mtd0 | wc -c 16384 <- data from 1st good block Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-06-25nanddump: correct rounding to next page (lead to infinite loop)Richard Genoud
The rounding to next page formula was wrong: ex: (len | ~(meminfo->writesize - 1)) + 1; len=128K writesize=4K (len | ~(meminfo->writesize - 1)) + 1 => 4 294 963 201 ?! correct rounding formula: ((len - 1) | (meminfo->writesize - 1)) + 1 => 128K len = 130K ((len - 1) | (meminfo->writesize - 1)) + 1 => 132K modprobe nandsim parts="20,20" badblocks="22,23" without patch: nanddump /dev/mtd1 | wc -c [...] infinite loop with the patch: nanddump /dev/mtd1 | wc -c 327680 Signed-off-by: Richard Genoud <richard.genoud@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-05-02Fix compile failuresDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30crond: implement "SHELL=prog" in crontab. Export LOGNAME as POSIX wantsDenys Vlasenko
function old new delta fork_job 343 456 +113 load_crontab 688 777 +89 crond_main 1456 1434 -22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 202/-22) Total: 180 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30crond: simplify logging codeDenys Vlasenko
Slight change in behavior: now -l 5 will enable the same messages formerly only enabled for -d 5. (Old behavior was non-sensical). function old new delta reopen_logfile_to_stderr - 34 +34 log8 - 26 +26 log7 - 26 +26 log5 - 26 +26 load_crontab 706 688 -18 rescan_crontab_dir 157 137 -20 crond_main 1486 1456 -30 fork_job 389 343 -46 crondlog 108 38 -70 ------------------------------------------------------------------------------ (add/remove: 4/0 grow/shrink: 0/5 up/down: 112/-184) Total: -72 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30libbb: make syslog level for bb_error_msg's configurable. use it in crondDenys Vlasenko
function old new delta bb_verror_msg 380 386 +6 syslog_level - 1 +1 crondlog 165 108 -57 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-30crond: tweak help text, make course less crypticDenys Vlasenko
function old new delta packed_usage 29736 29740 +4 crond_main 1485 1486 +1 load_crontab 712 706 -6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-17adjtimex: make its help text and printed data a bit less crypticDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-04-13less: fix bugs discovered with "git log -p | less -m" on kernel treeDenys Vlasenko
function old new delta read_lines 685 733 +48 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-03-03man: default to asciiDenys Vlasenko
Default to ascii instead of latin1. Otherwise man pages can be displayed incorrectly. E.g. bullets show as "<B7>". Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-02-02zcat: complain if input is not compressedDenys Vlasenko
function old new delta buffer_fill_and_print 178 191 +13 varvalue 735 743 +8 bbunpack 747 755 +8 open_zipped 85 89 +4 xmalloc_open_zipped_read_close 61 63 +2 get_addr_1 240 242 +2 fbsplash_main 1228 1230 +2 pstree_main 322 321 -1 builtin_type 121 119 -2 do_load 954 926 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 7/3 up/down: 39/-31) Total: 8 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-22less: accept and ignore -sDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2014-01-22man: parse "DEFINE pager" in configJohn Spencer
function old new delta man_main 789 844 +55 Signed-off-by: John Spencer <maillist-busybox@barfooze.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29Use unsigned printf/scanf conversion where more appropriateDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-29fix assorted unused code and wrong format specs found by cppchekc (bug 6716)Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-26devfsd: remove static variableDenys Vlasenko
function old new delta static.msg 4 - -4 get_uid_gid 114 107 -7 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/1 up/down: 0/-11) Total: -11 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2013-11-20rfkill: use new-style config/kbuild/appletDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>