aboutsummaryrefslogtreecommitdiff
path: root/miscutils
AgeCommit message (Collapse)Author
2016-11-28Code style fixes, no code changesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-27makedevs: make special node creation idempotentDenys Vlasenko
When makedevs is called for a second time with the same device file, it fails because the files already exist and mknod() gives -EEXIST. Ignore EEXIST errors. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-23Remove trailing empty linesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22Convert all miscutils/* applets to "new style" applet definitionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-11-22Split miscutils/Config.src items into miscutils/*.c filesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-31man: remove -Tascii from nroff invocationDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-31man: make width selection more thorough; explain how to override itDenys Vlasenko
Fedora's "man CMD >file" still uses terminal width, not 80 (but disables formatting), this change mimics that. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-30man: allow nroff and tbl commands be overridden; unmangle writing to filesDenys Vlasenko
Parse this in config files: DEFINE col ... DEFINE tbl ... DEFINE nroff ... Add width options to nroff command line. Use "tbl", not "gtbl", as default tbl command. Export GROFF_NO_SGR=1 and use "col -b -p -x" instead of pager when writing to file. function old new delta man_main 735 863 +128 if_redefined - 64 +64 show_manpage 199 169 -30 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 192/-30) Total: 162 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-10-24strings: implement -t radixTito Ragusa
v2: minor code cleanup, no changes. v1: Implement -t radix option. Fix help text for -o option. Signed-off-by: Tito Ragusa <farmatito@tiscali.it> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-13less: switch off nonblock on kbd_fd before exitDenys Vlasenko
This is only necessary if we use stdout fd. function old new delta less_exit 32 51 +19 less_main 2540 2543 +3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 22/0) Total: 22 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-09-13less: fall back to using fd #1 for keyboard reading. Closes 9231Denys Vlasenko
function old new delta less_main 2535 2540 +5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-22man: fix parsing of "DEFINE pager xyz". Closes 8976Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-16less: fix bracket search to match behavior of less 481Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-08-16less: fix SEGVDenys Vlasenko
testcase: echo "" | less, then press ')' key Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-07-06getopt32: add new syntax of 'o:+' and 'o:*' for -o NUM and -o LISTDenys Vlasenko
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-06-24i2cdump: don't use common_bufsiz1Bartosz Golaszewski
Commit e6a2f4cc changed the way common_bufsiz1 works. Now it needs to be initialized before using, but i2cdump wasn't updated by said patch. Since the fact that we're using common_bufsiz1 here isn't obvious (no G_INIT() macro, no other global variables), drop it and simply allocate the integer array required for block reads on the stack. Tested with i2c block read on a Lenovo Thinkpad laptop. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-20setsid: fix broken -cDenys Vlasenko
This did not work: setsid sh -c 'anything' Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-06-19randomconfig fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-22*: slap on a few ALIGN1/2s where appropriateDenys Vlasenko
The result of looking at "grep -F -B2 '*fill*' busybox_unstripped.map" text data bss dec hex filename 829901 4086 1904 835891 cc133 busybox_before 829665 4086 1904 835655 cc047 busybox Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21*: hopefully all setup_common_bufsiz() are in placeDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21*: add most of the required setup_common_bufsiz() callsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-21libbb: make bb_common_bufsiz1 1 kbyte, add capability to use bss tail for itDenys Vlasenko
The config item is FEATURE_USE_BSS_TAIL. When it is off (default): function old new delta read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 push 46 44 -2 inetd_main 2136 2134 -2 uevent_main 421 418 -3 addLines 97 92 -5 bb_common_bufsiz1 8193 1024 -7169 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 8/5 up/down: 62/-7181) Total: -7119 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829901 4086 1904 835891 cc133 busybox_unstripped FEATURE_USE_BSS_TAIL=y: read_config 210 228 +18 doCommands 2279 2294 +15 ipneigh_list_or_flush 763 772 +9 ipaddr_list_or_flush 1256 1261 +5 display_process_list 1301 1306 +5 conspy_main 1378 1383 +5 do_lzo_compress 352 355 +3 do_lzo_decompress 565 567 +2 inetd_main 2136 2134 -2 bb_common_bufsiz1 8193 - -8193 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 8/1 up/down: 62/-8195) Total: -8133 bytes text data bss dec hex filename 829850 4086 9080 843016 cdd08 busybox_old 829911 4086 880 834877 cbd3d busybox_unstripped FIXME: setup_common_bufsiz() calls are missing. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-03whitespace and namespace cleanupsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-03ubirmvol: Implement -N switch for ubirmvolSven Eisenberg
function old new delta get_volid_by_name - 125 +125 ubi_devnum_from_devname - 43 +43 ubi_tools_main 1215 1220 +5 packed_usage 30674 30655 -19 ubirename_main 394 221 -173 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 1/2 up/down: 173/-192) Total: -19 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-04-03ubirename: new appletSven Eisenberg
function old new delta ubirename_main - 394 +394 packed_usage 30611 30674 +63 applet_names 2530 2540 +10 Signed-off-by: Sven Eisenberg <sven.eisenberg@novero.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30Replace a few more bb_info_msg's by bb_error_msg or printfDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-30Use bb_error_msg instead of bb_info_msg in all commented-out debug printoutsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-14more bionic fixesDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-14fixes for problems found by bionic buildDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-03-06inotifyd: swap meaning of 'y' and 'm' events in help text. Closes 8726Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-02-26taskset: fix non-fancy cpuset printing on big-endianArnout Vandecappelle (Essensium/Mind)
The non-fancy version of the from_cpuset uses CPU_SETSIZE as if it represents the number of bytes in the cpuset, while it is actually the number of bits. This leads to out-of-bounds accesses on the cpu_set_t in the big-endian case. Basically all uses of CPU_SETSIZE have to be divided by 8. This is done correctly in the fancy version of from_cpuset. In addition, the big-endian case is completely wrong to begin with. All standard C libraries that I know of implement cpu_set_t as an unsigned long array, so both for big and little endian, the least significant bits are in the beginning of the array. Therefore, the approach taken for the little endian case is equally valid. We only need special handling for big endian when CPU_SETSIZE is large and we use an unsigned long long to get more bits out. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) <arnout@mind.be> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-01-17setsid: implement -cDenys Vlasenko
function old new delta setsid_main 53 96 +43 packed_usage 30846 30833 -13 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2016-01-02nandwrite: implement -n (read/write without ecc)Aaro Koskinen
Implement -n (read/write without ecc). Signed-off-by: Aaro Koskinen <aaro.koskinen@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-11-01i2c_tools: suppress "'blen' may be used uninitialized in this function"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-11-01i2cdump: display the numeric value for block read ioctl() errorsBartosz Golaszewski
This makes busybox i2cdump compatible with the upstream version, which also displays the numeric error value in case of a block read failure. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-11-01i2cdump: bail-out if block read failsBartosz Golaszewski
We should bail-out if i2c_smbus_read_block_data() or i2c_smbus_read_i2c_block_data() return 0 or less. Add the missing check for the former and fix the existing for the latter. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-11-01i2cdump: use I2C block mode for the 'i' mode parameterBartosz Golaszewski
Currently we're calling i2c_smbus_read_block_data() for both 'i' and 's' mode parameters. If the bus doesn't support SMBus block mode, then the i2c access ioctl() fails. Make i2cdump behave compatibly with upstream version by calling i2c_smbus_read_i2c_block_data() for I2C block. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-11-01i2cdump: don't read block data in non-block modesBartosz Golaszewski
We currently read data twice in byte mode. Add a check to avoid calling i2c_smbus_read_i2c_block_data() if we're not in I2C or SMBus block mode. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-11-01i2cdetect: coding style: add a space after 'for'Bartosz Golaszewski
Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-11-01i2cdetect: fix address skipping in auto modeBartosz Golaszewski
If the bus doesn't support SMBus Quick Write or Receive Byte commands and we're running in auto mode all addresses will be skipped resulting in an empty table being printed. This is caused by not restoring the auto mode after it's been changed for certain address ranges - we need an additional variable to hold the temporary state. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-27fbsplash: use virtual y size in mmap size calculationsTimo Teräs
The virtual y can be larger - and we can be even writing there since we are taking into account the y offset. Avoids possible crash. But use it only if set, seems it is not set if virtual area is not allocated (though, often fbcon allocates some scrollback area). Signed-off-by: Timo Teräs <timo.teras@iki.fi> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-25tweak defconfigDenys Vlasenko
MONOTONIC_SYSCALL=y by default FEATURE_LAST_SMALL is gone: now FEATURE_LAST_FANCY is a "bool", not a "choice". Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-13*: more BUILD_BUG_ON conversionsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-11randconfig fixDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-09use auto_string() where appropriate to kill a few staticsDenys Vlasenko
Custom linker script 'busybox_ldscript' found, using it function old new delta static.str 4 - -4 static.passwd 4 0 -4 bb_ask 322 311 -11 ether_print 63 47 -16 UNSPEC_print 82 66 -16 INET_sprint 59 38 -21 INET6_sprint 54 30 -24 make_human_readable_str 292 235 -57 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 0/7 up/down: 0/-153) Total: -153 bytes text data bss dec hex filename 939880 992 17480 958352 e9f90 busybox_old 939736 992 17456 958184 e9ee8 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-08join some common strings, -400 bytesDenys Vlasenko
function old new delta print_intel_cstates 499 511 +12 file_insert 355 364 +9 dpkg_main 2944 2940 -4 ifenslave_main 645 640 -5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 21/-9) Total: 12 bytes text data bss dec hex filename 937564 932 17676 956172 e970c busybox_old 937164 932 17676 955772 e957c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-10-07build system: -fno-builtin-printfDenys Vlasenko
Benefits are: drops reference to out-of-line putchar(), fixes a few cases of failed string merge. function old new delta i2cdump_main 1488 1502 +14 sha256_process_block64 423 433 +10 sendmail_main 1183 1185 +2 list_table 1114 1116 +2 i2cdetect_main 1235 1237 +2 fdisk_main 2852 2854 +2 builtin_type 119 121 +2 unicode_conv_to_printable2 325 324 -1 scan_recursive 380 378 -2 mkfs_minix_main 2687 2684 -3 buffer_fill_and_print 178 169 -9 putchar 152 - -152 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 7/4 up/down: 34/-167) Total: -133 bytes text data bss dec hex filename 937788 932 17676 956396 e97ec busybox_old 937564 932 17676 956172 e970c busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-09-21i2c-tools: rename remaining definesBartosz Golaszewski
Rename the defines not present in linux UAPI headers to better reflect their purpose. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2015-09-21i2c-tools: remove duplicate definitionsBartosz Golaszewski
Most applets include linux' user API headers instead of duplicating the definitions. Make it the case for i2c-tools as well. Signed-off-by: Bartosz Golaszewski <bartekgola@gmail.com> 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>