aboutsummaryrefslogtreecommitdiff
path: root/shell/shell_common.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Merge branch 'busybox' into mergeRon Yorston2018-09-101-30/+27
|\
| * ash,hush: fold shell_builtin_read() way-too-many params into a struct paramDenys Vlasenko2018-08-051-29/+26
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta getoptscmd 587 584 -3 readcmd 240 224 -16 shell_builtin_read 1426 1399 -27 builtin_read 210 182 -28 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/4 up/down: 0/-74) Total: -74 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2018-05-131-1/+36
|\|
| * hush: fix IFS handling in readDenys Vlasenko2018-04-111-1/+36
| | | | | | | | | | | | | | | | | | | | | | | | $ echo "X:Y:" | (IFS=": " read x y; echo "|$x|$y|") |X|Y| $ echo "X:Y : " | (IFS=": " read x y; echo "|$x|$y|") |X|Y| function old new delta shell_builtin_read 1320 1426 +106 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: make 'read -s' workRon Yorston2018-04-101-1/+2
| | | | | | | | | | | | Raw input should also be used when the -s flag is present. Related to GitHub issue #112.
* | Merge branch 'busybox' into mergeRon Yorston2018-04-091-1/+0
|\|
| * libbb.h: always include sys/resource.hDenys Vlasenko2018-04-081-1/+0
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: emulate raw input to read builtinRon Yorston2018-04-051-2/+36
| | | | | | | | | | | | | | | | | | | | | | | | | | Use read_key to emulate raw input when reading from the console. Limit this to cases where raw input is necessary: - a maximum number of characters is to be read (-n) - a timeout has been specified (-t) - a non-standard delimiter is in use (-d) This should fix GitHub issue #112 (and other things too!). Also, omit sections of code that serve no purpose on WIN32.
* | Merge branch 'busybox' into mergeRon Yorston2017-09-271-2/+2
|\|
| * hush: GETOPT_RESET() _after_ getopts too.Denys Vlasenko2017-08-291-2/+2
| | | | | | | | | | | | | | | | | | NOEXEC'ed applets which use getopt() need this. function old new delta builtin_getopts 403 413 +10 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-08-221-3/+6
|\|
| * shell: more efficient check for EOL in readDenys Vlasenko2017-08-091-4/+3
| | | | | | | | | | | | | | function old new delta shell_builtin_read 1334 1320 -14 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * ash: implement -d DELIM option for readJohannes Schindelin2017-08-091-3/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The POSIX standard only requires the read builtin to handle -r: http://pubs.opengroup.org/onlinepubs/9699919799/utilities/read.html However, Bash introduced the option -d <DELIM> to override IFS for just one invocation, and it is quite useful. It is also super easy to implement in BusyBox' ash, so let's do that. The motivation: This option is used by Git's test suite. function old new delta .rodata 163505 163587 +82 shell_builtin_read 1244 1289 +45 readcmd 233 259 +26 builtin_read 258 263 +5 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 4/0 up/down: 158/0) Total: 158 bytes Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-07-241-30/+52
|\|
| * shell: optional support for read -t N.NNN, closes 10101Denys Vlasenko2017-07-201-30/+52
| | | | | | | | | | | | | | | | function old new delta shell_builtin_read 1097 1277 +180 dump_procs 353 359 +6 Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-07-181-3/+1
|\|
| * fixes for bugs found by make_single_applets.shDenys Vlasenko2017-07-031-3/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2017-05-291-16/+12
|\|
| * ash,hush: fix SIGCHLD interrupting read builtinDenys Vlasenko2017-05-221-9/+11
| | | | | | | | | | | | | | | | | | | | | | | | function old new delta readcmd 169 217 +48 shell_builtin_read 1087 1097 +10 localcmd 366 364 -2 builtin_read 197 193 -4 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 2/2 up/down: 58/-6) Total: 52 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: GETOPT_RESET macroKaarle Ritvanen2017-04-121-7/+1
| | | | | | | | | | Signed-off-by: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi> 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 (up to "ash: comment out free(p) just before...")Ron Yorston2016-10-191-0/+1
|\|
| * ash: [VAR] Initialise OPTIND after importing environmentDenys Vlasenko2016-09-301-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Upstream commit 1: Date: Fri, 23 Aug 2013 21:27:42 +1000 [VAR] Initialise OPTIND after importing environment On Sat, Mar 23, 2013 at 01:46:20AM +0000, Chris F.A. Johnson wrote: > According to both the dash man page and the POSIX spec, "When the > shell is invoked, OPTIND is initialized to 1." > > However, it actually takes the value of the environment variable > if it exists: > > $ OPTIND=4 dash -c 'echo "$OPTIND"' > 4 > $ OPTIND=4 bash -c 'echo "$OPTIND"' > 1 > $ OPTIND=4 ksh -c 'echo "$OPTIND"' > 1 > $ OPTIND=4 ksh93 -c 'echo "$OPTIND"' > 1 This patch fixes this by initialising OPTIND after importing the environment. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Upstream commit 2: Date: Tue, 7 Oct 2014 22:24:42 +0800 [VAR] Use setvareq to set OPTIND initially There is no need to setvarint to set the initial value of OPTIND of one. This patch switchs to setvareq which also lets us avoid an unnecessary memory allocation. Signed-off-by: Herbert Xu <herbert@gondor.apana.org.au> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2016-05-161-1/+1
|\|
| * *: slap on a few ALIGN1/2s where appropriateDenys Vlasenko2016-04-221-1/+1
| | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2015-10-131-1/+1
|\|
| * build system: -fno-builtin-printfDenys Vlasenko2015-10-071-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* | Merge branch 'busybox' into mergeRon Yorston2015-07-141-1/+0
|\|
| * Removes stray empty line from codeManinder Singh2015-07-131-1/+0
| | | | | | | | | | | | | | | | | | This patch removes stray empty line from busybox code reported by script find_stray_empty_lines Signed-off-by: Maninder Singh <maninder1.s@samsung.com> Signed-off-by: Akhilesh Kumar <akhilesh.k@samsung.com> Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | ash: skip poll in read built-inRon Yorston2015-03-241-0/+2
| | | | | | | | | | | | | | | | | | | | | | GNUlib poll doesn't seem to work when the file descriptor refers to a file on disk. This may not be surprising given the warning in the Windows API documentation against using disk file handles in calls to WaitForSingleObject. Skipping poll in the read built-in allows file redirection to work and doesn't make interrupt handling any worse than it was before.
* | shell_common: exclude more unused ulimit codeRon Yorston2014-03-231-7/+6
| |
* | shell: add \r to IFSRon Yorston2014-01-121-0/+4
| | | | | | | | | | | | When commands run in backquotes generated multiple lines of output the carriage returns weren't being removed. Adding \r to IFS fixes this.
* | Make dummy resource.hRon Yorston2014-01-061-2/+0
| |
* | Merge branch 'busybox' into mergeRon Yorston2013-08-271-1/+1
|\|
| * typo fix in commentDenys Vlasenko2013-07-141-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge branch 'busybox' into mergeRon Yorston2012-09-071-1/+4
|\| | | | | | | | | | | Conflicts: include/libbb.h shell/ash.c
| * ash: fix "read -s" + ^C. Closes 5504Denys Vlasenko2012-09-061-1/+1
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * include sys/resource.h where neededMike Frysinger2012-07-051-0/+1
| | | | | | | | | | | | | | | | We use functions from sys/resource.h in misc applets, but don't include the header. This breaks building with newer glibc versions, so add the include where needed. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
* | Merge branch 'busybox' into mergeRon Yorston2012-03-231-1/+7
|\| | | | | | | | | Conflicts: Makefile.flags
| * shell_builtin_read: set cc[VMIN] to 1; lineedit: don't clear c_cc[VINTR]Denys Vlasenko2012-01-151-1/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | First change fixes "read -n NUM". Apparently poll() won't report data availability if cc[VMIN] > 1 until there are at least cc[VMIN] bytes. function old new delta read_line_input 3885 3877 -8 shell_builtin_read 1097 1087 -10 ------------------------------------------------------------------------------ (add/remove: 0/0 grow/shrink: 0/2 up/down: 0/-18) Total: -18 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge commit '56a3b82e9692a25ef9c9269e88feac0d579ce8e8' into mergeRon Yorston2012-03-221-11/+32
|\| | | | | | | | | | | | | Conflicts: coreutils/ls.c include/platform.h libbb/bb_basename.c
| * hush: use SA_RESTARTed signal handlers across read.Denys Vlasenko2011-05-111-13/+21
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * hush: make read builtin interruptible.Denys Vlasenko2011-05-081-2/+15
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | function old new delta builtin_read 185 471 +286 check_and_run_traps 200 262 +62 nonblock_immune_read 73 119 +46 sigismember - 44 +44 record_signal - 21 +21 sigisemptyset - 16 +16 ... ------------------------------------------------------------------------------ (add/remove: 5/0 grow/shrink: 7/5 up/down: 483/-46) Total: 437 bytes Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
| * libbb: nonblock_safe_read->nonblock_immune_read, remove unused param of ↵Denys Vlasenko2011-05-081-1/+1
| | | | | | | | | | | | xmalloc_reads Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge commit 'b83c9704128dd106071184e4b00335a3b8486857' into mergeRon Yorston2012-03-221-0/+12
|\|
| * ash,hush: add ulimit -e -r (RLIMIT_NICE, RLIMIT_RTPRIO)Denys Vlasenko2011-04-041-0/+12
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Merge commit 'da4441c44f6efccb6f7b7588404d9c6bfb7b6af8' into mergeRon Yorston2012-03-221-3/+3
|\| | | | | | | | | | | | | Conflicts: libbb/vfork_daemon_rexec.c networking/wget.c procps/ps.c
| * whitespace fixesDenys Vlasenko2011-02-031-3/+3
| | | | | | | | Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
* | Skip carriage return in read builtin commandRon Yorston2012-02-061-1/+1
| |