summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2021-04-15vi: move undo_queue_state in globals to other byte-sized membersDenys Vlasenko
function old new delta vi_main 278 275 -3 undo_queue_commit 62 56 -6 undo_push 374 362 -12 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/3 up/down: 0/-21) Total: -21 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: allow line addresses to have an offsetRon Yorston
Line addresses in colon commands can be defined using an expression that includes '+' or '-' operators. The implementation follows traditional vi: - The first term in the expression defines an address. It can be an absolute line number, '.', '$', a search or a marker. - The second and subsequent terms must be non-negative integers. - If the first term is missing '.' is assumed. If the operator is missing addition is assumed. If the final term in missing an offset of 1 is assumed. Thus the following are valid addresses: .+1 .+ + .1 .-1 .- - The following are not valid (though they are in vim): .+$ .$ 2+. function old new delta colon 3701 3844 +143 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 143/0) Total: 143 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: allow backward search to specify line addressRon Yorston
It should be possible to use a backward search as a line address in colon commands. function old new delta colon 3661 3701 +40 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 40/0) Total: 40 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: detect and warn about invalid line addressesRon Yorston
BusyBox vi didn't have proper handling for invalid markers or unsuccessful searches in colon line addresses. This could result in the wrong lines being affected by a change. Detect when an invalid address is specified, propagate an error indicator up the call chain and issue a warning. function old new delta colon 3604 3661 +57 .rodata 105195 105211 +16 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 73/0) Total: 73 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: code shrink colon line addressesRon Yorston
Remove some unnecessary code in get_one_address() and rewrite get_address(). function old new delta colon 3325 3604 +279 get_one_address 342 - -342 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/0 up/down: 279/-342) Total: -63 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: make context marks more like viRon Yorston
The context marks that are automatically updated and can be used with the "''" command didn't behave the same as in vi. Marks were only being set for certain editing commands when they should have been set on successful movement commands. Make BusyBox vi behave more like vi. function old new delta .rodata 105179 105194 +15 do_cmd 4723 4668 -55 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 15/-55) Total: -40 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: correct autoindent for 'O' commandRon Yorston
Opening a line above the current line with the 'O' command should use the current, not previous, line to determine how much to autoindent. function old new delta char_insert 531 563 +32 do_cmd 4746 4723 -23 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 32/-23) Total: 9 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: allow ctrl-D to reduce indentationRon Yorston
When whitespace has been automatically added to a new line due to autoindent entering ctrl-D should reduce the level of indentation. Implement an approximation of this by treating ctrl-D as backspace. For the common case of indentation using tabs this is good enough. My attempt at a full implementation was three times bigger. function old new delta char_insert 476 531 +55 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 55/0) Total: 55 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: don't move cursor when yanking whole linesRon Yorston
When whole lines are yanked using 'yy' or 'Y' vi doesn't change the cursor position. Make BusyBox vi do the same. function old new delta do_cmd 4776 4786 +10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 10/0) Total: 10 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: reset command count when specifying '0' rangeRon Yorston
Since commit a54450248 (vi: allow the '.' command to have a repetition count) using '0' to specify a range doesn't work with a non-zero repeat count, e.g. '1d0'. Users wouldn't normally try to do that but the '.' command does. Add a special case in get_motion_char() to handle this. function old new delta find_range 737 746 +9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 9/0) Total: 9 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: code shrink motion by paragraphRon Yorston
Use a hand-coded loop to search for paragraph boundaries instead of calling char_search(). We were using a loop anyway to skip consecutive newlines. function old new delta do_cmd 4792 4752 -40 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-40) Total: -40 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: position cursor on last column of tabRon Yorston
Vi places the cursor on the last column of a tab character whereas BusyBox vi puts it on the first. This is disconcerting for experienced vi users and makes it impossible to distinguish visually between an empty line and one containing just a tab. It wasn't always this way. Prior to commit e3cbfb91d (vi: introduce FEATURE_VI_8BIT) BusyBox vi also put the cursor on the last column. However there were problems with cursor positioning when text was inserted before a tab. Commit eaabf0675 (vi: multiple fixes by Natanael Copa) includes a partial attempt to fix this. (The code is still present but it's never executed. Clever compilers optimise it away.) Revert the changes of commit e3cbfb91d and fix the insert problem for all tabs, not just the first. To quote Natanael: "Costs a few bytes but its worth it imho". function old new delta refresh 974 1000 +26 move_to_col 81 83 +2 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 28/0) Total: 28 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-15vi: correctly record deleted charactersRon Yorston
The undo queue didn't record deleted characters properly. For example, insert some text, backspace over a couple of characters then exit insert mode. At this point undo will restore two nulls instead of the deleted characters. The fix is in undo_push(): record the state of the UNDO_USE_SPOS flag and clear it before using 'u_type'. Also, update the comments to reflect the fact that UNDO_QUEUED_FLAG isn't actually used. function old new delta undo_push 443 435 -8 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/1 up/down: 0/-8) Total: -8 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14platform.h: fix for Bionic >= 21 not having wait3()Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14unzip: add -tDenys Vlasenko
function old new delta packed_usage 33584 33598 +14 .rodata 103218 103219 +1 unzip_main 2665 2656 -9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 15/-9) Total: 6 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14unzip: fix for .zip archives with >4GB fileDenys Vlasenko
function old new delta unzip_main 2644 2665 +21 input_tab 926 927 +1 bb_banner 46 47 +1 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/0 up/down: 23/0) Total: 23 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14fix "warning array subscript has type 'char'"Denys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14Makefile.flags: add a test for -lrt availabilityDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14echo: fix !ENABLE_FEATURE_FANCY_ECHO buildDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14fix gcc-11.0 warningsDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14*: --help text tweaksDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14touch: shorten --help textDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14touch: code shrinkDenys Vlasenko
function old new delta touch_main 424 421 -3 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-14touch: fix -amDenys Vlasenko
function old new delta touch_main 414 424 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-13dd: support iflag=count_bytesRafał Miłecki
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>
2021-04-13vi: allow writing to another file if this one is readonlyAlison Winters
Version 2. Same change but rebased after Ron's improvements. Fixes bug where if you open a read only file, you can't save it as a different filename. function old new delta colon 3160 3162 +2 Signed-off-by: Alison Winters <alisonatwork@outlook.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-13build system: avoid build failure during bisectionRon Yorston
Commit 4bdc914ff (build system: fix compiler warnings) added a test on the return value of fgets() in split-include.c. During bisection it's possible to go back to a state where a configuration value didn't exist. This results in an empty include file corresponding to the missing feature. If a subsequent bisection returns to a state where the feature exists split-include treats the empty file as an error and the build fails. Add a call to ferror() to distinguish between fgets() failing due to an error and due to there being no data to read. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-13hush: beautify ^D handling to match ash / bashDenys Vlasenko
function old new delta fgetc_interactive 227 244 +17 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-13watchdog: make open-write-close-open functionality a config knobRasmus Villemoes
The behaviour introduced by commit 31c765081dc4 ("watchdog: stop watchdog first on startup") causes warnings in the kernel log when the nowayout feature is enabled: [ 16.212184] watchdog: watchdog0: nowayout prevents watchdog being stopped! [ 16.212196] watchdog: watchdog0: watchdog did not stop! The latter may also appear by itself in case the watchdog is of the type that cannot be stopped once started (e.g. the common always-running gpio_wdt kind). These warnings can be somewhat ominous and distracting, so allow configuring whether to use this open-write-close-open sequence rather than just open. Also saves a bit of .text when disabled: function old new delta shutdown_on_signal 31 58 +27 watchdog_main 339 306 -33 shutdown_watchdog 34 - -34 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 1/1 up/down: 27/-67) Total: -40 bytes Make it default n: - It's a workaround for one specific type of watchdog (and that seems to be a defect in the kernel driver) - Even when not enabled in busybox config, it can easily be implemented outside busybox - Code size - Commit 31c765081dc4 should be considered a regression for all the boards that now end up with KERN_CRIT warnings in dmesg. - The author of that commit said "This use case is evidently rare, so if it is indeed causing problems for other people I'd OK then I understand whatever needs to be done." in the v1 thread. Cc: Matt Spinler <mspinler@linux.vnet.ibm.com> Cc: deweloper@wp.pl Cc: tito <farmatito@tiscali.it> Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-13touch: fix previous commitDenys Vlasenko
function old new delta touch_main 423 414 -9 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-13touch: make FEATURE_TOUCH_NODEREF unconditionalDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-13touch: code shrinkDenys Vlasenko
function old new delta touch_main 450 423 -27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-13touch: code shrinkDenys Vlasenko
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>
2021-04-13touch: prevent usage of -r and -t at onceXabier Oneca
coreutils forbids this combination. Signed-off-by: Xabier Oneca <xoneca@gmail.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-13touch: switch to using utimensat() and futimens()Denys Vlasenko
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>
2021-04-12touch: unbreak -hDenys Vlasenko
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-12touch: remove unneeded GETOPT32 definesXabier Oneca
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>
2021-04-12touch: fix atime set from reference fileXabier Oneca
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>
2021-04-12touch: add SUSv3 options -a and -mXabier Oneca
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>
2021-04-11lineedit: fix tab completion with equal signNatanael Copa
Fix tab completion for the path when equal sign (=) is used. For example: dd if=/dev/ze<tab> Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-11vi: improvements to reporting of changesRon Yorston
Traditional vi is mostly silent about the results of yank, delete, change, undo or substitution commands. Vim reports some details about undo and substitution. BusyBox vi is positively verbose in comparison. Make some improvements to BusyBox vi: - Add vim-like reporting of changes caused by substitutions, of the form '64 substitutions on 53 lines'. This replaces a fairly useless report of the result of the last change made. - Ensure that the report about put operations correctly reflects the newly introduced repetition count. - Commit 25d2592640 tried to limit status updates for delete and yank operations by detecting whether the register had changed. This didn't always work because the previously allocated memory could be reused for the new register contents. Fix this by delaying freeing the old register until after the new one has been allocated. - Add a configuration option to control verbose status reporting. This is on by default. Turning it off make BusyBox vi as taciturn as traditional vi and saves 435 bytes. function old new delta colon 3212 3292 +80 yank_status - 74 +74 static.text_yank 99 86 -13 string_insert 130 76 -54 do_cmd 4842 4776 -66 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/3 up/down: 154/-133) Total: 21 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-11vi: issue a warning on failure to find a characterRon Yorston
When a search for a character within a line fails issue a warning. function old new delta ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/0 up/down: 0/0) Total: 0 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-11vi: make the substitute command more like viRon Yorston
Make the ':s/find/replace/g' command behave more like vi: - the final delimiter is optional if no flag is specified; - the cursor is moved to the first visible character of the last line where a substitution was made; - a warning is displayed if no substitution was made. function old new delta colon 3156 3212 +56 .rodata 105133 105142 +9 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/0 up/down: 65/0) Total: 65 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-11vi: make put commands more like viRon Yorston
Make the put commands 'p' and 'P' behave more like vi: - allow a repetition count to be specified; - when the text being inserted doesn't include a newline the cursor should be positioned at the end of the inserted text. function old new delta do_cmd 4765 4842 +77 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 77/0) Total: 77 bytes v2: Don't break build when FEATURE_VI_UNDO is disabled. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-11vi: allow the '.' command to have a repetition countRon Yorston
The '.' command repeats the last text change. When it has a repetition count replay the change the number of times requested. Update the stored count if it changes. For example, 3dw deletes 3 words . deletes another 3 words 2. deletes 2 words and changes the stored count . deletes 2 words function old new delta do_cmd 4746 4781 +35 .rodata 105133 105138 +5 edit_file 887 849 -38 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/1 up/down: 40/-38) Total: 2 bytes v2: Change implementation to include repetition count in string. Otherwise repeating 'r' doesn't work properly. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-11vi: allow 'r' command to be aborted, repeatedRon Yorston
Make the 'r' command behave more like vi: - abort the command if ESC is entered after the 'r'; - allow a repeat count to be entered before the 'r'; - if the repeat count exceeds the space available on the line don't change any characters and issue an alert. function old new delta do_cmd 4679 4746 +67 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 67/0) Total: 67 bytes v2: Don't break build when FEATURE_VI_UNDO is disabled. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-11vi: improvements to undoRon Yorston
The left shift operator ('<') didn't support undo at all; right shift ('>') required changes to be undone separately for each line. Allow both types of shift to be undone as a single operation. Also, neither traditional vi nor vim yank the lines being shifted by the '<' and '>' commands, so remove that call to yank_delete(); When a repetition count was specified for the '~', 'x', 'X' or 's' commands the changes had to be undone one character at a time. Allow undo as a single operation (though the delete and change parts of the 's' command still have to be undone separately). function old new delta undo_push_insert 37 40 +3 do_cmd 4695 4663 -32 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/1 up/down: 3/-32) Total: -29 bytes v2: Don't break build when FEATURE_VI_UNDO is disabled. Don't reset 'undo_del' too early in '~' handling code. Code shrink '~'. Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-11vi: more fixes to range selection by wordRon Yorston
An example in my vi book presents different ways to fix the spelling of the last word in a line: ... anyweigh. With the cursor on the 'e' the command 'cway' should do the job. Since commit 776b56d77, though, 'cw' incorrectly includes the full stop in the range if we're on the last line of the file. (Prior to commit 776b56d77 BusyBox vi got 'cw' right in this case but 'cW' wrong: it *didn't* delete the full stop.) Reinstate some of the bloat removed by the earlier commit to fix this. Also, commit 7b4c2276a (vi: fix word operations across line boundaries) incorrectly ignores whitespace after a single character word. Adjust the condition to avoid this. function old new delta find_range 707 737 +30 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/0 up/down: 30/0) Total: 30 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-11vi: improvements to range selectionRon Yorston
Rewrite find_range(), pushing quite a bit of code from do_cmd() down into it. - The commands 'y', 'd', 'c', '<' and '>' can be given twice to specify a whole-line range. BusyBox vi actually accepted any second character from that group, e.g. 'dc' or '<y', with the latter being accepted even if yank was disabled. Require the two characters to match. - '<' and '>' commands followed by ESC incorrectly issued an alert. - Allow search commands and a marker (specified as "y'a", for example) to define a range for those operators that support it. function old new delta find_range 518 707 +189 .rodata 105119 105133 +14 get_motion_char 68 - -68 do_cmd 4860 4695 -165 ------------------------------------------------------------------------------ (add/remove: 0/1 grow/shrink: 2/1 up/down: 203/-233) Total: -30 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
2021-04-11vi: code shrink search commandsRon Yorston
Changes to search commands ('/', '?', 'n' and 'N'): - Rewrite to be smaller and (possibly) clearer. - Issue a warning when a repeat search is requested without a previous search having been made. Vim and BusyBox vi support a repetition count for searches though the original vi doesn't. If the count exceeds the number of occurrences of the search string the search may loop through the file multiple times. function old new delta .rodata 105135 105119 -16 do_cmd 4898 4860 -38 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-54) Total: -54 bytes Signed-off-by; Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>