summaryrefslogtreecommitdiff
Commit message (Collapse)AuthorAgeFilesLines
...
* | ash: code shrinkRon Yorston2021-02-143-11/+1
| | | | | | | | | | Since there's only one call to mingw_spawn_forkshell() we might as well just call spawnve() directly from ash.
* | bc: handle ^C in interactive modeRon Yorston2021-02-141-0/+13
| |
* | bc: fix to build on WIN32 and enable in default configurationsRon Yorston2021-02-133-12/+14
| |
* | win32: code shrinkRon Yorston2021-02-133-7/+17
| | | | | | | | | | | | | | | | Rewrite the recent change to tab completion so it only needs one call to sprintf. Then replace sprintf with strcpy/stpcpy, both there and in a couple of other places. Saves 40 bytes.
* | win32: implement symlink(2)Ron Yorston2021-02-123-12/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Provide an implementation of symlink(2). Calls to symlink(2) will fail in default Windows installations unless running with elevated privileges. Failure to create a symlink when extracting files from an archive is therefore treated as a non-fatal error. There are two ways to permit the creation of symlinks: - Edit security policy to give users the 'Create symbolic links' privilege. Unfortunately this doesn't work for users who are an Administrator. - Enable developer mode, which is available in later versions of Windows 10. The ability to create symlinks is not available in Windows XP or ReactOS.
* | win32: allow symlinks to directories to be unlinkedRon Yorston2021-02-121-1/+13
| | | | | | | | | | | | Windows distinguishes between symlinks to directories and files. A symlink to a directory must be deleted by calling rmdir(2) rather than unlink(2).
* | win32: make readlink(2) implementation unconditionalRon Yorston2021-02-128-30/+1
| | | | | | | | | | | | | | 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.
* | libbb: avoid problems with quoted characters in tab completionRon Yorston2021-02-121-3/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit 9e341902d (libbb: copy entire match during tab-completion) adjusted the display of matches during tab completion to make any changes in case visible. Unfortunately the presence of quoted special characters upsets the display: $ touch t+1+2+3 t+1+4+5 $ ls t+1<TAB> changes the command to: $ lst\+1\+ In such cases just revert to the upstream code which only displays the tail of the match, giving: $ ls t+1\+
* | Reformat README.mdRon Yorston2021-02-101-2/+1
| |
* | Link to page on pathnames from README.mdRon Yorston2021-02-101-4/+5
| |
* | winansi: code shrinkRon Yorston2021-02-081-13/+13
| | | | | | | | | | | | Mark floating-point constants as being of type 'float'. Saves 72 bytes.
* | Update READMERon Yorston2021-02-071-2/+5
| |
* | winansi: more accurate colour mappingRon Yorston2021-02-074-22/+111
| | | | | | | | | | | | Use a more accurate technique to map RGB colours to standard Windows console colours. Since this costs 648 bytes it's configurable but is enabled by default.
* | winansi: code shrinkRon Yorston2021-02-071-90/+71
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor handling of ESC[38...m and ESC[48...m: - At lower levels deal only with the standard console foreground colours. This makes handling of foreground and background colours more similar. - Many '|=' assignments (to combine attribute values) have been replaced by simple assinments. - Use a common routine to convert RGB to console colours; colours in the 8-bit 6x6x6 cube are scaled up to make use of this. - Detect invalid escape sequences to avoid setting incorrect colour values. Saves 296 bytes.
* | win32: code shrinkRon Yorston2021-02-064-4/+6
| | | | | | | | | | Don't compile some code that isn't currently supported for WIN32. Saves 24 bytes.
* | Merge branch 'busybox' into mergeRon Yorston2021-02-0547-178/+202
|\|
| * libbb: introduce and use fputs_stdoutRon Yorston2021-02-0336-66/+69
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * libbb: code shrink fgets_strRon Yorston2021-02-031-12/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * nl: ensure '-b n' option displays file contentRon Yorston2021-02-025-3/+67
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
| * cryptpw: typo in usage messageRon Yorston2021-02-021-3/+3
| | | | | | | | | | | | | | '[-p N]' should be '[-P N]' in the trivial usage message. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * vi: fix range selection by forward character motionRon Yorston2021-02-021-6/+9
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Selection of ranges for change/delete/yank by forward character motion commands (SPACE or 'l') was incorrect. The range was always one character whereas vi allows the size of the range to be specified. Fix this by executing the motion command the required number of times. There is a complication when the range is at the end of a line. We need to distinguish between a range which excludes the last character and one which includes it. This requires comparing the actual range with that expected from the command count. (With the additional quirk that a command count of zero is equivalent to a command count of one.) function old new delta find_range 587 619 +32 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: code shrink and speed up index_in_strings()Ron Yorston2021-02-021-4/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Rewrite index_in_strings() to replace calls to strcmp()/strlen(). With this change searching for valid names in the applet_names array (for example) is 40% faster. The code has to assume the strings aren't sorted, so will always scan the entire array when presented with an invalid name. function old new delta index_in_strings 63 56 -7 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-7) Total: -7 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: code shrink and speed up find_applet_by_name()Ron Yorston2021-02-021-79/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | find_applet_by_name() determines the appropriate range of applet indices to check for the given name and performs a linear search in applet_names[]. Revise the code so the index of the upper bound of the range, 'max', isn't calculated. Instead check the value of the first non-matching character to see if we've reached the end of the range. This new code speeds up the time to find a valid applet name by 6% and halves the time to detect that a given name is invalid. The average time to detect an invalid name is now the same as for a valid one. function old new delta find_applet_by_name 155 133 -22 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-22) Total: -22 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * awk: allow printf('%c') to output NUL, closes 13486Ron Yorston2021-02-022-3/+20
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Treat the output of printf as binary rather than a null-terminated string so that NUL characters can be output. This is considered to be a GNU extension, though it's also available in mawk and FreeBSD's awk. function old new delta evaluate 3487 3504 +17 awk_printf 504 519 +15 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 32/0) Total: 32 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * traceroute: fix option parsingDenys Vlasenko2021-02-021-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * update_passwd: fix context variableBernd Kuhls2021-01-141-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Commit https://git.busybox.net/busybox/commit/libbb/update_passwd.c?id=2496616b0a8d1c80cd1416b73a4847b59b9f969a changed the variable used from context to seuser but forgot this change resulting in build errors detected by buildroot autobuilders: http://autobuild.buildroot.net/results/b89/b89b7d0f0601bb706e76cea31cf4e43326e5540c//build-end.log libbb/update_passwd.c:51:11: error: 'context' undeclared (first use in this function); did you mean 'ucontext'? freecon(context); Signed-off-by: Bernd Kuhls <bernd.kuhls@t-online.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | winansi: tweak colour mappingRon Yorston2021-02-041-19/+9
| |
* | 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.
* | winansi: extend ANSI emulationRon Yorston2021-02-031-49/+177
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend ANSI emulation to include: ESC[38;2;R;G;Bm 24-bit foreground colour ESC[48;2;R;G;Bm 24-bit background colour ESC[38;5;Nm 8-bit foreground colour ESC[48;5;Nm 8-bit background colour The colours are selected from the 16 standard console colours. This is unlikely to be aesthetically pleasing but at least it's better than raw escape sequences. Also, add ESC[9m (strike through) as a known but unsupported sequence.
* | winansi: change default 'skip ANSI emulation' settingRon Yorston2021-02-034-15/+24
| | | | | | | | | | | | | | | | | | Change the default 'skip ANSI emulation' setting which is used when the environment variable BB_SKIP_ANSI_EMULATION is unset. Previously it was 0 (always emulate) now it's 2 (detect whether or not the terminal supports ANSI escape sequences and behave accordingly). The default value is also now a build-time option.
* | 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.
* | tar: changes to conditional compilationRon Yorston2021-01-251-4/+6
| | | | | | | | Mostly just cosmetic.
* | ar: only free temporary filename if requiredRon Yorston2021-01-251-2/+3
| |
* | tls: avoid unnecessary changes to POSIX build, part 2Ron Yorston2021-01-258-18/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | tls: avoid unnecessary changes to POSIX buildRon Yorston2021-01-242-6/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | Calls to tls_error_die() embed the line number of the error in the binary. Since some lines had been added to tls.c for the WIN32 port a POSIX build of the busybox-w32 source differed from upstream. Avoid this by pushing the special handling of /dev/urandom down into open_read_close(). tls.c is now unchanged from upstream. The only differences in the POSIX build reported by 'objdump -s' are now the GNU build id, the copyright date and the date of the configuration.
* | nc: alter conditional compilationRon Yorston2021-01-241-7/+55
| | | | | | | | | | | | | | | | | | | | Change conditional compilation to use PLATFORM_MINGW32 instead of NC_EXTRA. Enabling NC_EXTRA won't work for busybox-w32, but then it didn't before. Also, instead of just reverting upstream commit 5b3b468ec (nc: use poll() instead of select()) include both old and new code, keyed on PLATFORM_MINGW32.
* | libbb: reduce changes to find_executable()Ron Yorston2021-01-231-8/+7
| | | | | | | | | | | | | | | | | | Reduce the divergence from upstream in find_executable(): - Reset the path separator after the call to file_is_executable(). Doing it before isn't wrong, but it's different. - Move the declaration 'char *w;' into a platform-specific block.
* | Revert "libbb: reinstate NULL check in last_char_is()"Ron Yorston2021-01-221-1/+1
| | | | | | | | | | | | | | | | This reverts commit 9828af970e6b030823beb05dae56eed44cb65fb3 which was applied as a temporary fix to an upstream issue. Upstream has since fixed the problem with commit 16e82c61d (tar: fix fallout of last_char_is(NULL) no longer being allowed).
* | libarchive: allow extraction of hard linksRon Yorston2021-01-193-14/+8
| | | | | | | | | | | | | | | | Allow create_or_remember_link() to create hardlinks. As a result tar and cpio can now extract hard links. Since unzip only supports symlinks it sees no improvement. As before, attempts to extract symlinks result in a warning.
* | ash: alter handling of interactive ^CFRP-3812-g12e14ebbaRon Yorston2021-01-181-1/+3
| | | | | | | | | | | | | | | | Upstream commit 4ac35a30d (ash: make interactive ^C break out of PS2 mode) doesn't work for WIN32. It causes the shell to exit when ^C is pressed on the command line. Call raise_interrupt() instead of raise(SIGINT).
* | Merge branch 'busybox' into mergeRon Yorston2021-01-14227-2214/+3296
|\|
| * ash: match bash behavior for ${empty_var/*/repl}Denys Vlasenko2021-01-092-4/+4
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: fix ${unset_var/pattern/repl}Denys Vlasenko2021-01-093-1/+5
| | | | | | | | | | | | | | function old new delta subevalvar 1349 1353 +4 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * bc: code shrinkDenys Vlasenko2021-01-061-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * pmap: fix column width, closes 13431Denys Vlasenko2021-01-051-9/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Fix for the FEATURE_UTMP on the FreeBSDAlex Samorukov2021-01-041-1/+5
| | | | | | | | | | | | | | | | FreeBSD is not using <utmp.h> and does not define _PATH_UTMPX. Tested with busybox applets depending on FEATURE_UTMP (e.g. who, users, etc) Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * bc: ^C on input line exits (unlike ^C during calculations, which does not)Denys Vlasenko2021-01-041-10/+10
| | | | | | | | | | | | | | function old new delta xc_read_line 353 344 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Fix mail compilation on the FreeBSDAlex Samorukov2021-01-041-1/+14
| | | | | | | | | | | | | | FreeBSD using procctl instead of Linux prctl Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Fix traceroute applet on the FreeBSDAlex Samorukov2021-01-041-3/+8
| | | | | | | | | | | | | | | | | | | | | | This patch addressing 2 issues: 1. Replacing source/dest with uh_sport/uh_dport. It seems that uh_* members are defined on both Linux and BSD, so no #ifdef here 2. Use SOL_IPV6 instead of SOL_RAW on the FreeBSD to fix IPV6_CHECKSUM setsockopt Signed-off-by: Alex Samorukov <samm@os2.kiev.ua> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>