summaryrefslogtreecommitdiff
path: root/bin/ksh
AgeCommit message (Collapse)Author
2017-02-19Assigning to RANDOM calls srand_deterministic(3), not srand(3),Ingo Schwarze
and simplify the next sentence; triggered by a different patch from Anton dot Lindqvist at gmail dot com. OK millert@ tb@
2016-12-11I missed a bit of the indentation fix from Kartik Agaram.Todd C. Miller
2016-12-11When ERREXIT (set -e) is in effect, don't disable it after aTodd C. Miller
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.
2016-12-11In execute() we assign xerrorok to a dummy value if it is NULLTodd C. Miller
so there is no need to check xerrorok for NULL after that. From Kartik Agaram.
2016-12-11Fix for() loop indentation for TCASE in execute() and add someTodd C. Miller
braces for improved readability. Based on a diff from Kartik Agaram.
2016-11-14Remove an escaped blank space and insert an No macro to keep \&; at aTheo Buehler
distance from 'Ar command'. This is schwarze's correct version of an initial incorrect diff from me.
2016-11-14Markup improvements:Ingo Schwarze
1. Mark up reserved words intended to appear at the beginning of command lines with .Ic. 2. Mark up syntax elements intended to appear in the middle of command lines with .Cm. This is not only more systematic, but also makes internal search commands like :tif<enter>, :tstop<enter>, and :t[[<enter> work in man(1).
2016-11-12Fix lexicographic order of shell built-ins: trap comes before true.Theo Buehler
2016-10-17simplify implementation of the '$' command, no functional change;Ingo Schwarze
OK nicm@ tb@ czarkoff@
2016-10-17resolve code duplication in domove() for the commands: b B w WIngo Schwarze
no functional change; suggested by tb@
2016-10-17No need to inspect LC_CTYPE:Ingo Schwarze
* It was only used in vi input mode. * No functional change in case of set -o vi-show8. * No functional change if LC_CTYPE is set to UTF-8. * More robust for the default of LC_CTYPE=C on a UTF-8 xterm. Behaviour changes for the combination LC_CTYPE=C with set +o vi-show8 on non-UTF-8 terminals, but that combination is useless and dangerous with or without this patch. If you want to edit individual raw non-ASCII non-UTF-8 bytes on the shell command line, always use set -o vi-show8. (Besides, i doubt that you actually want to do that; better use a real hex editor in the first place.) OK czarkoff@.
2016-10-17Make sure the cursor goes to the first byte of a UTF-8 characterIngo Schwarze
and not to a continuation byte for these commands: b B e E w W | Let {e,E}ndword return the position after the word because that is easier to handle in the caller. OK tb@ czarkoff@
2016-10-15remove the "in the future" notes from the past;Jason McIntyre
from ray lai
2016-10-14Correct description of the "bind" builtin command.Ingo Schwarze
jmc@ finds the key binding stuff "disgusting" (i can't argue with that) and doesn't want to comment on the content, but agrees with the wording.
2016-10-11Partial UTF-8 line editing support for ksh(1) vi input mode;Ingo Schwarze
so far, it covers these commands: a h i l x / This is an isu8cont()-based hack similar in style to what i did in emacs input mode, but less elegant and slightly more intrusive because the vi mode code is much more ugly and less straightforward than the emacs mode code. This one required partial rewrites of a few helper functions, and comments were added while there. This is not perfect, but hopefully reduces people's cursing until a more rigorous solution can be devised (much) later. Some polishing may be useful in tree, in particular adding utf8cont() support to a few missing commands. Mostly written shortly after Christmas 2015. Reminded by and OK czarkoff@. Feedback, partial review and testing, no longer any objection by martijn@. Feedback and testing by tb@. Also read fine to nicm@.
2016-10-07note that ulimit -m is not enforced, spotted by jmcTed Unangst
2016-09-30remove unneccessary .Pp; from jan staryJason McIntyre
2016-09-27Move bug description to the BUGS sectionDmitrij Czarkoff
OK natano@, jmc@ (I forgot to commit it back in mid-August when it was discussed.)
2016-09-08Mark PPID read-only as per the manual. From Anthony Coulter.Todd C. Miller
2016-09-08Add KSH_IGNORE_RDONLY flag and use it in var.c instead of the 0x4Todd C. Miller
magic number.
2016-09-08Allow "typeset -ir FOO" if FOO is not already marked read-only. OK tb@Todd C. Miller
2016-09-08Don't try to look up array names for complete_* that aren'tNicholas Marriott
alphanumeric, spotted by and ok sthen
2016-09-07remove unused variable 'last'David Coppa
ok nicm@
2016-09-04Allow simple custom completions by creating an array namedNicholas Marriott
"complete_commandname_argnum", for example: set -A complete_kill_1 -- -9 -HUP -INFO -KILL -TERM To set completions for the first argument to kill(1). If no complete_* arrays are present, the normal filename completion is offered. positive comments from many; man page ok/tweaks jmc; ok tedu
2016-08-24Use writev(2) to write history records using a single syscall.Todd C. Miller
OK deraadt@
2016-08-24Avoid recursively calling c_fc(). Fixes a core dump from "r r" andTodd C. Miller
other edge cases found by gsoares@. OK tb@ gsoares@
2016-08-16Avoid a compiler warning about use of uninitialized l.beg emittedTheo Buehler
when ksh is compiled with -Os (done in distrib/special): move the bit using XPptrv(l) (which expands to l.beg) where it is actually used and clearly initialized. ok tedu, tweak + ok millert
2016-08-12rework initial text a little, to read better;Jason McIntyre
2016-08-09In emacs incremental search mode (^R),Ingo Schwarze
make commands starting with the escape key (^[) work as documented. Long-standing bug, this time reported by Dave minus Cohen dot com. OK natano@ halex@
2016-07-28remove note about command substitution and double quotes: it is probableJason McIntyre
that i misunderstood something when i wrote it; found by guenther and naddy
2016-07-18rework the first sentence of this page;Jason McIntyre
with help from otto
2016-06-01put this in the public domain as well. reminded by theo. we discussedMarc Espie
this before previous release, and I plain forgot about it.
2016-05-04Correct the description of the != operator in arithmetic expansion;Ingo Schwarze
from Andras Farkas <deepbluemistake at gmail dot com>.
2016-05-04line editing correction; from andras farkasJason McIntyre
2016-04-27Do not handle echo "`echo \"hi\"`" in POSIX mode differently than inChristian Weisgerber
traditional mode. This aligns ksh's behavior with bash and FreeBSD sh. The interpretation of the POSIX text is disputed, but it is unlikely that a change from the traditional behavior was intended. ok millert@
2016-03-30for some time now mandoc has not required MLINKS to functionJason McIntyre
correctly - logically complete that now by removing MLINKS from base; authors need only to ensure there is an entry in NAME for any function/ util being added. MLINKS will still work, and remain for perl to ease upgrades; ok nicm (curses) bcook (ssl) ok schwarze, who provided a lot of feedback and assistance ok tb natano jung
2016-03-21More ksh POSIX compliance fixes by Martijn Dekker:tb
This simple patch makes the 'command' builtin POSIX-compliant and consistent with other current shells. It fixes two things: a) 'command -v' does not find shell reserved words (a.k.a. keywords). For instance, 'command -v select' outputs nothing but should output 'select'. b) 'command -pv' always outputs the path of an external command, even if 'command -p' would execute a builtin. For instance, 'command -p kill' executes the 'kill' builtin, as expected, but 'command -pv kill' outputs '/bin/kill'. The '-v' option is supposed to reflect what would actually be executed, so 'command -pv kill' should output 'kill'. The -p option sets the PATH to a default system value before doing the search, but that has no bearing on the fact that builtins take precedence over external commands. The patch fixes both issues for 'command' without affecting the behaviour of the ksh-specific builtin 'whence', which is handled by the same C function. Regression test added to obsd-regress.t. Issues found and fixed by Martijn Dekker, ok millert@
2016-03-20Currently we have about a 50/50 split over fcntl(n, F_GETFL [,0])Kenneth R Westerback
idioms. Adopt the more concise fcntl(n, F_GETFL) over fcntl(n, F_GETFL, 0) where it is obvious further investigation will not yield and even better way. Obviousness evaluation and ok guenther@
2016-03-17remove some ARGSUSEDmmcc
2016-03-06tweak previous a little;Jason McIntyre
2016-03-06Make set +o conform with POSIX.natano
It should be possible to use set +o to save the current shell options, then modify them at will and later restore them to the saved value. Therefore the output must not only contain the options which are currently set, but also the ones that are _not_ set, so a restore disables them if they are enabled. from Martijn Dekker (martijn (at) inlv (dot) org) ok sthen@, tb@
2016-03-05POSIX-compliant behavior of "set -u" regarding "$*" and "$@" specialsDmitrij Czarkoff
All work done by Martijn Dekker OK millert@
2016-03-04Fix a typo. The command is to get the default system PATH valueTodd C. Miller
is "getconf PATH" not "getconf CS_PATH".
2016-03-04remove CSRG BSD-licensed mknod builtin code which was previously used toTheo de Raadt
accelerate install/upgrade time MAKEDEV runs. That allows ramdisk ksh to be pledged, without needing "dpath". We'll solve the performance issues a different way (soon). ok otto espie natano tb tobiasu rpe
2016-03-04don't parse (...|...) patterns in variable substitution inside double quotesDmitrij Czarkoff
fixes posix compatibility issue OK millert@, nicm@, otto@
2016-01-29Therefor -> Therefore (where appropriate)tb
from ray@, ok jmc@
2016-01-26remove a useless macrommcc
ok nicm@
2016-01-15Initialize a struct kill_info and an associated int in the declarationsmmcc
instead of scattering their initialization through the body. This makes the body simpler and avoids an uninitialized use false positive. ok nicm@
2016-01-08Next step in UTF-8 support:Ingo Schwarze
1. Improve all functions involving words by allowing non-ASCII characters to be part of words. 2. Allow insertion of non-ASCII characters without screwing up the display, by backing up to the start byte after inserting a continuation byte, and starting to re-print there. 3. Fix forward movement which i didn't get quite right in my previous commit: Always advance to a start byte, never to a final continuation byte, or the next insertion would split the character in the middle. OK mpi@
2015-12-30add another combo for home/end keys that works in tmux.Ted Unangst
ok bmercer gsoares nicm sthen