aboutsummaryrefslogtreecommitdiff
path: root/coreutils (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
| * *: more --help tweakingDenys Vlasenko2021-06-131-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * *: more --help tweaks, mostly expanding ts --helpDenys Vlasenko2021-06-134-5/+5
| | | | | | | | | | | | | | function old new delta packed_usage 33554 33596 +42 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * *: --help tweaksDenys Vlasenko2021-06-133-9/+11
| | | | | | | | | | | | | | | | | | | | function old new delta .rodata 103190 103189 -1 packed_usage 33590 33566 -24 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-25) Total: -25 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-06-073-45/+65
|\|
| * ls: trim --help textDenys Vlasenko2021-06-051-9/+9
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ls: don't output any colors with TERM=dumbSören Tempel2021-06-041-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The TERM variable is usually set to "dumb" to indicate that the terminal does not support any ANSI escape sequences. Presently, ls does not honor this variable and outputs colors anyhow which results in unreadable output, unless the user explicitly disables colors using `ls --color=never`. The rational behind this change is that ls should "just work" by default, even on dumb terminals. For this reason, this patch adds a check which additionally consults the TERM variable before printing any colors. This is analogous to the existing check for ensuring that standard output is a tty. As such, colors can still be forced with `--color=force`, even if TERM is set to dumb. function old new delta is_TERM_dumb - 40 +40 ls_main 579 598 +19 .rodata 103246 103251 +5 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/0 up/down: 64/0) Total: 64 bytes Signed-off-by: Sören Tempel <soeren+git@soeren-tempel.net> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tail: do not lose the tail of old file if new file (-F) is detectedDenys Vlasenko2021-06-021-12/+26
| | | | | | | | | | | | | | | | | | | | function old new delta tail_main 1619 1645 +26 .rodata 103246 103250 +4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 30/0) Total: 30 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * tail: fix typo in variable nameDenys Vlasenko2021-06-021-6/+6
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * head,tail: trim --help textDenys Vlasenko2021-06-022-14/+16
| | | | | | | | | | | | | | function old new delta packed_usage 33598 33560 -38 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: rename update_dev_fd() as update_special_fd()Ron Yorston2021-06-071-1/+1
| | | | | | | | Avoid confusion between special devices and /dev/fd.
* | Merge branch 'busybox' into mergeRon Yorston2021-05-1418-112/+117
|\|
| * echo: fix !ENABLE_FEATURE_FANCY_ECHO buildDenys Vlasenko2021-04-141-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * *: --help text tweaksDenys Vlasenko2021-04-1413-17/+17
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: shorten --help textDenys Vlasenko2021-04-141-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: code shrinkDenys Vlasenko2021-04-141-6/+4
| | | | | | | | | | | | | | function old new delta touch_main 424 421 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: fix -amDenys Vlasenko2021-04-141-5/+8
| | | | | | | | | | | | | | function old new delta touch_main 414 424 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dd: support iflag=count_bytesRafał Miłecki2021-04-131-18/+32
| | | | | | | | | | | | | | | | | | | | | | | | | | | | It allows passing amount of bytes in the count= function old new delta packed_usage 33599 33617 +18 static.iflag_words 29 41 +12 dd_main 1601 1607 +6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 36/0) Total: 36 bytes Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: fix previous commitDenys Vlasenko2021-04-131-1/+1
| | | | | | | | | | | | | | function old new delta touch_main 423 414 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: make FEATURE_TOUCH_NODEREF unconditionalDenys Vlasenko2021-04-131-18/+9
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: code shrinkDenys Vlasenko2021-04-131-4/+4
| | | | | | | | | | | | | | function old new delta touch_main 450 423 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: code shrinkDenys Vlasenko2021-04-131-23/+17
| | | | | | | | | | | | | | | | | | | | function old new delta .rodata 103215 103218 +3 touch_main 460 450 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 3/-10) Total: -7 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: prevent usage of -r and -t at onceXabier Oneca2021-04-131-7/+11
| | | | | | | | | | | | | | coreutils forbids this combination. Signed-off-by: Xabier Oneca <xoneca@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: switch to using utimensat() and futimens()Denys Vlasenko2021-04-131-41/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch changes the functions used to update timestamps in touch. Before, utimes() and lutimes() were used, which had certain disadvantages. They are unable to handle nanosecond timestamps, and implementations of certain features like -a and -m require running stat() in a loop. Almost all implementations of utimes() and lutimes() are wrappers for utimensat(), this is the case for glibc, ulibc and musl libc. function old new delta __futimens_time64 - 24 +24 __lutimes_time64 80 - -80 touch_main 539 456 -83 ------------------------------------------------------------------------------ (add/remove: 2/2 grow/shrink: 0/1 up/down: 24/-163) Total: -139 bytes Signed-off-by: urmum-69 <urmum69@snopyta.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: unbreak -hDenys Vlasenko2021-04-121-9/+10
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: remove unneeded GETOPT32 definesXabier Oneca2021-04-121-18/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Long options handling (getopt32 vs getopt32long) is done in libbb.h, no need to care here of the same logic. This cleans the code a bit. Also, --no-create was grouped as a SUSv3 option, where as the short -c was not. Even if it is part of SUS, leave it out as was the short option. v2: Fix for disabled ENABLE_LONG_OPTS. getopt32long does not like IF_FEATURE_xxx() style conditionals... :/ Signed-off-by: Xabier Oneca <xoneca@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: fix atime set from reference fileXabier Oneca2021-04-121-1/+2
| | | | | | | | | | | | | | | | When using a file's times as reference, use both atime and mtime for the files to be modified. Signed-off-by: Xabier Oneca <xoneca@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * touch: add SUSv3 options -a and -mXabier Oneca2021-04-121-14/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Add missing -a and -m options to be fully SUSv3 compliant. function old new delta touch_main 415 510 +95 packed_usage 33824 33865 +41 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 136/0) Total: 136 bytes v2: Ignore -a/-m if not ENABLE_FEATURE_TOUCH_SUSV3. Signed-off-by: Xabier Oneca <xoneca@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * timeout,top,watch,ping: parse NN.N fractional duration in locales with other ↵Denys Vlasenko2021-03-233-4/+2
| | | | | | | | | | | | separators Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2021-03-011-5/+5
|\|
| * echo: do not assume that free() leaves errno unmodifiedNatanael Copa2021-02-231-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | nproc: port to WIN32 and enable by defaultRon Yorston2021-02-171-0/+30
| | | | | | | | | | | | Use the WIN32 API GetProcessAffinityMask() to obtain the number of processors configured and the number available to the current process. This only works for up to 64 processors.
* | win32: make readlink(2) implementation unconditionalRon Yorston2021-02-122-9/+0
| | | | | | | | | | | | | | There doesn't seem to be much advantage in having readlink(2) as a configuration option. Making it unconditional reduces divergence from upstream and allows the removal of a check for ENOSYS that's been in busybox-w32 since the start.
* | Merge branch 'busybox' into mergeRon Yorston2021-02-0513-27/+27
|\|
| * libbb: introduce and use fputs_stdoutRon Yorston2021-02-0312-25/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * nl: ensure '-b n' option displays file contentRon Yorston2021-02-022-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The command 'nl -b n' should output no line numbers, just some spaces as a placeholder followed by the actual file content. Add tests for line numbering by cat and nl. The correct results were obtained from coreutils. function old new delta print_numbered_lines 152 157 +5 .rodata 182456 182453 -3 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 5/-3) Total: 2 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | printf: better support for escape sequencesRon Yorston2021-02-031-48/+60
| | | | | | | | | | | | | | | | | | | | | | | | Upstream printf outputs one character at a time which doesn't play well with emulation of ANSI escape sequences. Previous workarounds for this only applied in limited circumstances. Try a different approach: replace putchar() and printf() calls in the printf applet with custom routines which store the output in memory. It's only really output at the end of the program or when a newline is detected and a non-trivial amount has been collected.
* | printf: code shrinkRon Yorston2021-01-271-19/+7
| | | | | | | | | | | | | | | | | | | | Instead of constructing null-terminated strings to print, output the characters between the 's' and 't' pointers using fwrite(). This avoids having to output two separate strings when an escaped literal NUL character is encountered in the format string. Saves 32 bytes.
* | stat: improve conditional compilationRon Yorston2021-01-261-5/+4
| | | | | | | | | | | | | | | | | | If FEATURE_READLINK2 isn't enabled: - in print_stat() combine the code for 'n' and 'N' format; - in do_stat() let the compiler figure out that it doesn't need to emit code to print the symbolic link.
* | tls: avoid unnecessary changes to POSIX build, part 2Ron Yorston2021-01-253-10/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On reflection, the previous commit may have been ill-advised. There are many calls to open_read_close() and most shouldn't be able to access special devices. (Though in practice only a few are enabled in busybox-w32.) Nonetheless, I've implemented a new mechanism which uses the macro MINGW_SPECIAL() to mark calls to functions that are allowed to access special devices. An unrelated change is to avoid compiling fputs_stdout() in coreutils/printf.c for the POSIX build.
* | Merge branch 'busybox' into mergeRon Yorston2021-01-1421-211/+424
|\|
| * Fix mknod compilation on the FreeBSDAlex Samorukov2021-01-041-1/+3
| | | | | | | | | | | | | | | | <sys/sysmacros.h> is linux-only FreeBSD defines makedev in sys/types.h already included in the libbb.h. Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * factor: fix commentDenys Vlasenko2020-12-231-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * factor: detect squaresDenys Vlasenko2020-12-221-3/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | If we have a square, the speedup can be extremely large (in best case example below, it's ~40000 times faster): $ time ./busybox_old factor 18446743988964486098 18446743988964486098: 2 3037000493 3037000493 real 0m4.246s $ time ./busybox factor 18446743988964486098 18446743988964486098: 2 3037000493 3037000493 real 0m0.000s function old new delta isqrt_odd - 57 +57 print_w - 36 +36 factorize 218 236 +18 print_h - 7 +7 factorize_numstr 65 72 +7 ------------------------------------------------------------------------------ (add/remove: 3/0 grow/shrink: 2/0 up/down: 125/0) Total: 125 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * factor: fix typo in undefDenys Vlasenko2020-12-211-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * factor: code shrinkDenys Vlasenko2020-12-211-9/+8
| | | | | | | | | | | | | | function old new delta factor_main 176 171 -5 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * factor: 30% faster trial division (better sieve)Denys Vlasenko2020-12-201-75/+95
| | | | | | | | | | | | | | | | | | | | | | function old new delta packed_wheel - 192 +192 factor_main 108 176 +68 factorize 284 218 -66 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/1 up/down: 260/-66) Total: 194 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * help text tweaksDenys Vlasenko2020-12-183-3/+3
| | | | | | | | | | | | | | function old new delta packed_usage 33570 33502 -68 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * dd: support for O_DIRECT i/oDenys Vlasenko2020-12-141-31/+80
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Based on patch by Akash Hadke <hadkeakash4@gmail.com> function old new delta dd_read - 66 +66 clear_O_DIRECT - 55 +55 write_and_stats 102 135 +33 dd_main 1578 1601 +23 static.oflag_words 19 26 +7 static.iflag_words 22 29 +7 packed_usage 33665 33668 +3 ------------------------------------------------------------------------------ (add/remove: 2/0 grow/shrink: 5/0 up/down: 194/0) Total: 194 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * help text: replace [OPTIONS] with actual options (if not too long)Denys Vlasenko2020-12-134-5/+5
| | | | | | | | | | | | | | function old new delta packed_usage 33620 33665 +45 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * help text tweaksDenys Vlasenko2020-12-134-4/+4
| | | | | | | | | | | | | | function old new delta packed_usage 33547 33545 -2 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>