Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | When system calls indicate an error they return -1, not some arbitrary | 2019-06-28 | 1 | -5/+5 | |
| | | | | | | value < 0. errno is only updated in this case. Change all (most?) callers of syscalls to follow this better, and let's see if this strictness helps us in the future. | ||||
* | Favor usage of __func__ in warning/error messages. Some of them referred to the | 2018-03-15 | 1 | -4/+4 | |
| | | | | | | | wrong function and fix the rest for consistency. Diff from Michael W. Bombardieri with some cosmetic cleanup applied. ok benno@ tb@ | ||||
* | Introduce internal_warningf() and mark internal_errorf() as noreturn | 2018-01-16 | 1 | -5/+5 | |
| | | | | | This helps tools like scan-build, and follows the example of warningf() and errorf(). ok anton@ | ||||
* | Stop pretending we support building ksh without EDIT/HISTORY support | 2018-01-15 | 1 | -3/+1 | |
| | | | | ok anton@ | ||||
* | Add -Wshadow to Makefile and fix the resulting warnings. Many of | 2017-12-27 | 1 | -4/+4 | |
| | | | | | | | the warnings are due to the use of globals with generic names, specifically "options" and "path". I've renamed "options" to "sh_options" since it holds the shell options and "path" to "search_path". OK jca@ tb@ | ||||
* | Get rid of a todo by stop declaring variable texec as static and instead zeroing | 2017-12-18 | 1 | -2/+3 | |
| | | | | | | it out prior to continuing down the recursive call chain. Initial diff from Michael W. Bombardieri, later tweaked; ok tb@ | ||||
* | I missed a bit of the indentation fix from Kartik Agaram. | 2016-12-11 | 1 | -4/+4 | |
| | |||||
* | When ERREXIT (set -e) is in effect, don't disable it after a | 2016-12-11 | 1 | -3/+11 | |
| | | | | | | | short-circuited `&&` or `||` chain in later iterations of `for` loops. It should be disabled after a short-circuited `&&` or `||` chain only in the *final* iteration of loops (as well as in conditionals, which was already working). From Kartik Agaram. | ||||
* | In execute() we assign xerrorok to a dummy value if it is NULL | 2016-12-11 | 1 | -7/+4 | |
| | | | | | so there is no need to check xerrorok for NULL after that. From Kartik Agaram. | ||||
* | Fix for() loop indentation for TCASE in execute() and add some | 2016-12-11 | 1 | -6/+8 | |
| | | | | braces for improved readability. Based on a diff from Kartik Agaram. | ||||
* | rename global "e" to genv to avoid accidental shadowing and aliasing. | 2015-12-30 | 1 | -31/+31 | |
| | | | | ok millert nicm tb | ||||
* | Move system headers from sh.h to those files that actually need them. | 2015-12-14 | 1 | -1/+6 | |
| | | | | ok mmcc@ a while ago | ||||
* | Add uses of areallocarray(). mksh and Bitrig ksh already have similar | 2015-11-01 | 1 | -3/+3 | |
| | | | | | | functions. With help from Theo Buehler. ok nicm@ | ||||
* | Move string.h include from sh.h to the files that use it. | 2015-10-19 | 1 | -1/+2 | |
| | | | | ok nicm@ | ||||
* | Apply style(9) to header includes. | 2015-10-19 | 1 | -4/+6 | |
| | | | | ok nicm@ | ||||
* | Drop two useless defines. | 2015-10-17 | 1 | -3/+3 | |
| | | | | ok nicm@ | ||||
* | Move a system header include from the global header (sh.h) into the | 2015-10-17 | 1 | -1/+2 | |
| | | | | | | files that need it. No binary change. "This looks fine" -nicm@ | ||||
* | Make errorf() and bi_errorf() handle a NULL argument. | 2015-09-22 | 1 | -2/+2 | |
| | | | | From Michael McConville; OK nicm@ | ||||
* | Last of the (thing *)0 -> NULL, from Michael McConville. No binary | 2015-09-18 | 1 | -8/+8 | |
| | | | | change. | ||||
* | Remove unnecessary casts, from Michael McConville. No binary change. | 2015-09-17 | 1 | -2/+2 | |
| | |||||
* | correct spelling of NULL from (char *)0. from Michael McConville. | 2015-09-15 | 1 | -12/+12 | |
| | | | | ok md5 | ||||
* | Replace Tflag typedef with just int; ok tedu | 2015-09-14 | 1 | -4/+3 | |
| | |||||
* | Replace newline and space defines by "\n" and " " directly, from Michael | 2015-09-10 | 1 | -3/+3 | |
| | | | | McConville. ok millert | ||||
* | Convert many atoi() calls to strtonum(), adding range checks and failure | 2015-04-18 | 1 | -3/+6 | |
| | | | | | handling along the way. Reviews by Brendan MacDonell, Jeremy Devenport, florian, doug, millert | ||||
* | POSIX specifies that for an AND/OR list, only the last command's | 2013-06-10 | 1 | -5/+7 | |
| | | | | | | exit status matters for "set -e". Revert the part of revision 1.49 that always sets xerrok for AND/OR. This makes sh/ksh pass the updated regress tests. OK espie@ jca@ | ||||
* | pass "xerrok" status across the execution call stack to more closely | 2009-01-29 | 1 | -33/+43 | |
| | | | | | | | | | | | | | | | | match what both POSIX and ksh.1 already describe in regards to set -e/errexit's behavior in determining when to exit from nonzero return values. specifically, the truth values tested as operands to `&&' and `||', as well as the resulting compound expression itself, along with the truth value resulting from a negated command (i.e. a pipeline prefixed `!'), should not make the shell exit when -e is in effect. issue reported by matthieu. testing matthieu, naddy. ok miod (earlier version), otto. man page ok jmc. | ||||
* | Call ERR trap _before_ doing exit handling. Otherwise it's too late | 2007-09-05 | 1 | -2/+2 | |
| | | | | and the ERR trap won't get called at all. ok millert@ | ||||
* | another memory leak fix found by coverity. from netbsd but modified. | 2007-08-02 | 1 | -2/+8 | |
| | | | | millert@ ok. | ||||
* | fix lint comments, no functional changes; ok ray | 2006-04-10 | 1 | -3/+3 | |
| | |||||
* | Simplify savefd() by removing the "noclose" flag and make noclose | 2006-03-17 | 1 | -7/+6 | |
| | | | | | behavior the default. Almost all uses of savefd() are followed by an implicit or explicit close. OK otto@ | ||||
* | fix a few name clashes with libc; found by lint. ok deraadt@ | 2005-12-11 | 1 | -10/+10 | |
| | |||||
* | remove unused variables and functions | 2005-12-11 | 1 | -2/+2 | |
| | |||||
* | Fix " handling in here documents. POSIX says they are not special, so | 2005-09-11 | 1 | -2/+2 | |
| | | | | | | | | cat << EOF \" EOF should print \" Fixes PR 4472; testing jmc@ and Adam Montague. ok millert@ | ||||
* | lots of indentation cleanup, now ksh is readable like our other code. | 2005-03-30 | 1 | -124/+116 | |
| | | | | double checked to make sure no binaries change, and eyed by niallo | ||||
* | spacing | 2005-03-28 | 1 | -6/+3 | |
| | |||||
* | Fix a use-after-free, that causs core dumps if a shell is killed | 2004-12-22 | 1 | -10/+9 | |
| | | | | | | | running with strict malloc.conf options. Problem spotted by hshoexer@; fix by me with some help from millert@. ok millert@ hshoexer@ krw@ deraadt@ | ||||
* | Use stdbool.h instead of rolling our own bools. | 2004-12-22 | 1 | -35/+35 | |
| | |||||
* | Ansification plus some minor knf. No binary change on i386 and | 2004-12-20 | 1 | -94/+44 | |
| | | | | | sparc64, binary change in lex.o on macppc due to introduction of dopprompt() prototype. ok millert@ | ||||
* | spacing | 2004-12-19 | 1 | -3/+3 | |
| | |||||
* | Replace fd_clexec() with calls to fcntl(fd, F_SETFD, FD_CLOEXEC) | 2004-12-18 | 1 | -12/+1 | |
| | |||||
* | deregister | 2004-12-18 | 1 | -12/+12 | |
| | |||||
* | Get rid of #ifdef KSH since we don't care about building a V7 style sh and | 2004-12-18 | 1 | -29/+4 | |
| | | | | the #ifdef KSH code is required to make a POSIX sh. From Matthias Kilian | ||||
* | Remove unused OS dependent #ifdef blocks, #defines and macro abstraction. | 2004-12-18 | 1 | -257/+34 | |
| | | | | First step in making the ksh code easier to read. From Matthias Kilian | ||||
* | Unbreak parameter assignment when calling bourne style functions; | 2003-12-15 | 1 | -3/+7 | |
| | | | | | | resolves PR 2450. ok deraadt@ millert@ | ||||
* | If "from fd" == "to fd" don't call dup2() or close "from fd". | 2003-11-10 | 1 | -3/+5 | |
| | |||||
* | For the >& and <& operators, add a check for "dup from" == "dup to" and | 2003-11-10 | 1 | -1/+3 | |
| | | | | | just return success if they are the same. Fixes the "ls 2>&2" problem miod@ found. | ||||
* | typos from Jared Yanovich; | 2003-10-22 | 1 | -2/+2 | |
| | | | | ok deraadt@ | ||||
* | typos; from Brian Poole | 2003-02-28 | 1 | -2/+2 | |
| | |||||
* | knf | 2002-06-09 | 1 | -5/+5 | |
| | |||||
* | Use the volatile specifier to fix warnings about variables being | 2002-01-16 | 1 | -6/+2 | |
| | | | | clobbered by longjmp / vfork instead of the gcc "(void)&foo;" hack. |