aboutsummaryrefslogtreecommitdiff
path: root/libbb/lineedit.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* | Merge branch 'busybox' into mergeRon Yorston2019-02-121-4/+5
|\|
| * lineedit: fix SEGV in isk, hexedit, ed, closes 11661Denys Vlasenko2019-02-041-4/+5
| | | | | | | | | | | | | | | | | | | | | | fdisk, hexedit and ed calls read_line_edit in libbb/lineedit.c with NULL as first argument. On line 2373 of lineedit.c of busybox version 1.29.3, state->hist_file is referenced without checking the state->flag. This causes segmentation fault on fdisk, hexedit and ed on ARM Cortex-A9. It somehow works on x86_64. Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2019-01-101-9/+23
|\|
| * randomconfig fixesDenys Vlasenko2018-12-271-8/+10
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: fix "defined but not used" sigaction2 warningDenys Vlasenko2018-12-081-0/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * suppress gcc 8 aliasing warningsDenys Vlasenko2018-12-081-1/+11
| | | | | | | | | | | | | | | | | | function old new delta sigprocmask_SIG_SETMASK - 16 +16 wait_for_child_or_signal 221 213 -8 dowait 432 424 -8 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * bc: unbreak FEATURE_CLEAN_UP buildDenys Vlasenko2018-12-061-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * Treat custom and applet scripts as appletsRon Yorston2018-11-171-16/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | BusyBox has support for embedded shell scripts. Two types can be distinguished: custom scripts and scripts implementing applets. Custom scripts should be placed in the 'embed' directory at build time. They are given a default applet configuration and appear as applets to the user but no further configuration is possible. Applet scripts are integrated with the BusyBox build system and are intended to be used to ship standard applets that just happen to be implemented as scripts. They can be configured at build time and appear just like native applets. Such scripts should be placed in the 'applets_sh' directory. A stub C program should be written to provide the usual applet configuration details and placed in a suitable subsystem directory. It may be helpful to have a configuration option to enable any dependencies the script requires: see the 'nologin' applet for an example. function old new delta scripted_main - 41 +41 applet_names 2773 2781 +8 applet_main 1600 1604 +4 i2cdetect_main 672 674 +2 applet_suid 100 101 +1 applet_install_loc 200 201 +1 applet_flags 100 101 +1 packed_usage 33180 33179 -1 tryexec 159 152 -7 evalcommand 1661 1653 -8 script_names 9 - -9 packed_scripts 123 114 -9 complete_cmd_dir_file 826 811 -15 shellexec 271 254 -17 find_command 1007 990 -17 busybox_main 642 624 -18 run_applet_and_exit 100 78 -22 find_script_by_name 51 - -51 ------------------------------------------------------------------------------ (add/remove: 1/2 grow/shrink: 6/9 up/down: 58/-174) Total: -116 bytes text data bss dec hex filename 950034 477 7296 957807 e9d6f busybox_old 949918 477 7296 957691 e9cfb busybox_unstripped Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: autocompletion for embedded scriptsRon Yorston2018-11-011-4/+10
| | | | | | | | | | | | | | | | function old new delta complete_cmd_dir_file 811 826 +15 Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: allow shell scripts to be embedded in the binaryDenys Vlasenko2018-11-011-0/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | To assist in the deployment of shell scripts it may be convenient to embed them in the BusyBox binary. 'Embed scripts in the binary' takes any files in the directory 'embed', concatenates them with null separators, compresses them and embeds them in the binary. When scripts are embedded in the binary, scripts can be run as 'busybox SCRIPT [ARGS]' or by usual (sym)link mechanism. embed/nologin is provided as an example. function old new delta packed_scripts - 123 +123 unpack_scripts - 87 +87 ash_main 1103 1171 +68 run_applet_and_exit 78 128 +50 get_script_content - 32 +32 script_names - 10 +10 expmeta 663 659 -4 ------------------------------------------------------------------------------ (add/remove: 4/0 grow/shrink: 2/1 up/down: 370/-4) Total: 366 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | lineedit: allow non-ASCII characters when tab-completing filenamesRon Yorston2019-01-051-0/+4
| |
* | win32: special treatment for PATHRon Yorston2018-12-141-10/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The PATH shell variable is a special case. It can be exported to the environment where it might be interpreted by native applications which assume the separator is ';'. Hence: - require that the separator used in PATH is ';' - enforce this by intercepting calls to setvareq() that set PATH and adjusting its value if necessary. As a result of this the code to parse PATH can be simplified by replacing the hardcoded Unix ':' path separator by the platform- dependent macro PATH_SEP. The MANPATH variable is also required to use ';' as its separator but since it's less likely to be used this isn't enforced.
* | lineedit: more case-insensitive comparisons in tab completionRon Yorston2018-12-081-0/+14
| |
* | lineedit: improvements to tab completionRon Yorston2018-12-081-10/+9
| | | | | | | | | | | | | | | | | | | | Since getpwent isn't implemented for WIN32 there's no point in enabling FEATURE_USERNAME_COMPLETION. Use case-insensitive comparisons when matching filenames. The code to exclude non-executables when tab completing executables is WIN32-specific and shouldn't omit directories.
* | Merge branch 'busybox' into mergeRon Yorston2018-10-081-1/+1
|\|
| * unzip: use printable_string() for printing filenamesDenys Vlasenko2018-09-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta unzip_main 2726 2792 +66 printable_string2 - 57 +57 identify 4329 4336 +7 expmeta 659 663 +4 add_interface 99 103 +4 beep_main 286 289 +3 changepath 192 194 +2 builtin_type 115 117 +2 devmem_main 469 470 +1 input_tab 1076 1074 -2 create_J 1821 1819 -2 poplocalvars 314 311 -3 doCommands 2222 2214 -8 do_load 918 902 -16 printable_string 57 9 -48 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 8/6 up/down: 146/-79) Total: 67 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: reinstate code in read_line_input to handle non-ttysRon Yorston2018-05-251-4/+5
| | | | | | | | | | | | | | | | | | Commit f7c592f6d "win32: exclude termios code" excluded some code to handle line input when stdin or stdout aren't ttys. It turns out that this is required when 'busybox sh -i' is run from an MSYS2 shell. See GitHub issue #115. Revert this part of the commit.
* | Merge branch 'busybox' into mergeRon Yorston2018-04-091-1/+2
|\|
| * hush: fix "unset PS1/PS2", and put them into initial variable setDenys Vlasenko2018-04-061-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | "unset PS1/PS2" causes prompts to be empty strings function old new delta hush_main 1031 1089 +58 goto_new_line 27 33 +6 fgetc_interactive 244 245 +1 unset_local_var 155 149 -6 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/1 up/down: 65/-6) Total: 59 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: allow window size tracking to be disabledRon Yorston2018-02-251-4/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta lineedit_read_key 269 261 -8 win_changed 47 - -47 read_line_input 3884 3821 -63 cmdedit_setwidth 63 - -63 ------------------------------------------------------------------------------ (add/remove: 0/2 grow/shrink: 0/2 up/down: 0/-181) Total: -181 bytes Signed-off-by: Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | win32: exclude termios codeRon Yorston2018-04-051-7/+12
| | | | | | | | | | The code to manipulate terminal settings serves no purpose in WIN32. Use conditional compilation to exclude much of it.
* | lineedit: disable window size tracking in default configurationRon Yorston2018-03-011-4/+14
| | | | | | | | | | SIGWINCH isn't available on Microsoft Windows. Make the use of SIGWINCH configurable and disable it by default.
* | Merge branch 'busybox' into mergeRon Yorston2018-02-131-1/+2
|\|
| * randomconfig fixesDenys Vlasenko2017-12-311-1/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-12-091-2/+14
|\|
| * lineedit: get terminal width before printing promptDenys Vlasenko2017-11-081-2/+2
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: do not tab-complete any strings which have control charactersDenys Vlasenko2017-11-081-0/+12
| | | | | | | | | | | | | | function old new delta add_match 41 68 +27 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-11-031-24/+64
|\|
| * lineedit: improve multiline PS1 - redraw using last PS1 line. Closes 10381Avi Halachmi2017-10-121-24/+64
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This patch only affects prompts with newlines. We redraw the prompt [+ input] occasionally, e.g. during tab completion, history browsing or search, etc, and we expect it to align with prior redraws, such that the visible effect is that only the input changes. With multi-line PS1, redraw always printed the prompt some lines below the old one, which resulted in terminal scroll during every redraw. Now we only redraw the last PS1 line, so vertical alignment is easier to manage (we already calculated it using only the last line, but re-drew all lines - that was the culprit), which fixes those extra scrolls. Notes: - We now use the full prompt for the initial draw, after clear-screen (^L), and after tab-completion choices are displayed. Everything else now redraws using the last/sole prompt line. - During terminal resize we now only redraw the last[/sole] prompt line, which is arguably better because it's hard to do right (and we never did). - Good side effect for reverse-i-search: its prompt now replaces only the last line of the original prompt - like other shells do. function old new delta put_prompt_custom - 66 +66 draw_custom - 66 +66 parse_and_put_prompt 766 806 +40 read_line_input 3867 3884 +17 input_tab 1069 1076 +7 cmdedit_setwidth 61 63 +2 redraw 59 47 -12 put_prompt 46 - -46 ------------------------------------------------------------------------------ (add/remove: 2/1 grow/shrink: 4/1 up/down: 198/-58) Total: 140 bytes Signed-off-by: Avi Halachmi <avihpit@yahoo.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-09-271-19/+7
|\|
| * less,microcom,lineedit: use common routine to set raw termiosDenys Vlasenko2017-09-151-16/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta get_termios_and_make_raw - 139 +139 xget1 39 8 -31 read_line_input 3912 3867 -45 less_main 2525 2471 -54 set_termios_to_raw 116 36 -80 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 0/4 up/down: 139/-210) Total: -71 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * *: use ESC define instead of "\033"; use ESC[m instead of ESC[0mDenys Vlasenko2017-09-131-1/+1
| | | | | | | | | | | | | | | | text data bss dec hex filename 922535 481 6832 929848 e3038 busybox_old 922534 481 6832 929847 e3037 busybox_unstripped Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-08-221-7/+16
|\|
| * line editing: make read_line_input() not take timeout paramDenys Vlasenko2017-08-021-7/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It's almost always -1. function old new delta read_line_input 3902 3912 +10 new_line_input_t 24 31 +7 pgetc 583 585 +2 save_command_ps_at_cur_history 80 78 -2 read_line 76 74 -2 fgetc_interactive 246 244 -2 addLines 84 82 -2 doCommands 2226 2222 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 3/5 up/down: 19/-12) Total: 7 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | lineedit: fix incorrect conflict resolution in bb8d79ead mergeRon Yorston2017-07-291-38/+0
| |
* | ash: remove old code to tab-complete 'busybox' in standalone shellRon Yorston2017-07-291-10/+2
| |
* | Merge branch 'busybox' into mergeRon Yorston2017-07-291-2/+2
|\|
| * shell: make standalone shell tab-complete "busybox"Denys Vlasenko2017-07-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta busybox_main - 624 +624 packed_usage 31758 31777 +19 applet_names 2638 2646 +8 applet_main 1528 1532 +4 applet_install_loc 191 192 +1 run_applet_and_exit 681 78 -603 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 4/1 up/down: 656/-603) Total: 53 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-02-081-1/+1
|\|
| * libbb: consolidate the code to set termios unbuffered modeDenys Vlasenko2017-01-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta set_termios_to_raw - 116 +116 count_lines 72 74 +2 powertop_main 1458 1430 -28 top_main 943 914 -29 more_main 759 714 -45 fsck_minix_main 2969 2921 -48 conspy_main 1197 1135 -62 rawmode 99 36 -63 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 1/6 up/down: 118/-275) Total: -157 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2016-11-291-44/+68
|\|
| * lineedit: simplify code a bitDenys Vlasenko2016-11-281-16/+14
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta lineedit_read_key 155 162 +7 put_prompt 51 46 -5 read_line_input 3722 3715 -7 cmdedit_setwidth 81 50 -31 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 1/3 up/down: 7/-43) Total: -36 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: fix two bugs in SIGWINCH signal handlingDenys Vlasenko2016-11-271-29/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (1) restore entire sigaction, not only signal handler function (2) do not use stdio when not sure WINCH did not interrupt a printf() or such. function old new delta cmdedit_setwidth - 81 +81 read_line_input 3682 3722 +40 lineedit_read_key 138 155 +17 put_prompt 55 51 -4 win_changed 93 47 -46 ------------------------------------------------------------------------------ (add/remove: 1/0 grow/shrink: 2/2 up/down: 138/-50) Total: 88 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash,hush: make ^C in interactive mode visually much closer to bash behaviorDenys Vlasenko2016-11-251-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * lineedit: fix handling of repeating Alt-b, Alt-f, Alt-d, Alt-BackspaceRostislav Skudnov2016-11-241-42/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | These key combinations should repeat correctly when the keys are pressed and held. Before this change, they do this erratically - many repeats are "eaten" because they are treated as unrecognized ESC seqs: ESC 0x7f is treated by Alt+baskspace, but ESC 0x7f ESC 0x7f ESC 0x7f is unrecognized. Escape sequences corresponding to these key combinations are moved from read_line_input to lineedit_read_key. Also, these key sequences are now enabled regardless of whether FEATURE_EDITING_VI is set, since Vim does not actually support these key combinations, but they are present in readline library. function old new delta static.esccmds 93 103 +10 read_line_input 3737 3687 -50 Signed-off-by: Rostislav Skudnov <rostislav@tuxera.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2016-10-261-1/+1
|\|
| * lineedit: fix completion with applet names. closes 9361Denys Vlasenko2016-10-241-1/+1
| | | | | | | | | | | | Patch by Ron Yorston <rmy@pobox.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch busybox (up to "ash: comment out free(p) just before...")Ron Yorston2016-10-191-8/+14
|\|
| * lineedit: trivial codeshrink for vi-modeNatanael Copa2016-08-141-8/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce and use BB_isalnum_or_underscore(). function old new delta BB_isalnum_or_underscore - 43 +43 vi_word_motion 162 150 -12 vi_end_motion 163 145 -18 vi_back_motion 198 179 -19 BB_isalnum 39 - -39 ------------------------------------------------------------------------------ (add/remove: 1/1 grow/shrink: 0/3 up/down: 43/-88) Total: -45 bytes Signed-off-by: Natanael Copa <ncopa@alpinelinux.org> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | lineedit: tweak tab completion of commands in standalone shell modeRon Yorston2016-07-081-3/+11
| | | | | | | | | | | | | | | | | | | | When tab-completing commands in standalone shell mode: don't search the list of applet names if the command includes a path separator; since "busybox" doesn't appear in the list of applet names check for it separately.