summaryrefslogtreecommitdiff
path: root/bin
AgeCommit message (Collapse)Author
2017-12-30backslash also escapes newlines when quoted;Jason McIntyre
from kshe
2017-12-27Add -Wshadow to Makefile and fix the resulting warnings. Many ofTodd C. Miller
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@
2017-12-26The hack for /dev/fd support on systems without it was removed aTodd C. Miller
long time ago. Update the comments and replace test_stat() calls with stat() since test_stat() now just calls stat() directly. Also rename the "mode" parameter to "amode" in test_eaccess() to match access(2) and make it clear that this is the access mode and not the file mode. OK jca@
2017-12-23As we only use the .tv_sec field, simplify gettimeofday(2) -> time(3).cheloha
While here, use err(3) instead of errx(3) if adjtime(2) fails. Discussed/tweaked with/by tb@ and jca@. ok tb@ jca@
2017-12-18Get rid of a todo by stop declaring variable texec as static and instead zeroinganton
it out prior to continuing down the recursive call chain. Initial diff from Michael W. Bombardieri, later tweaked; ok tb@
2017-12-18No need to declare variable name as static in dounsetenv(). Also, drop aanton
redundant call to free() since name is always freed upon return. From Michael W. Bombardieri, with some tweaks by myself.
2017-12-18Add another pair of home/end key bindings; from Lari Rasku.anton
ok jca@
2017-12-16Passing NULL to free() is fine; from Michael W. Bombardieri.anton
2017-12-15oops - previous should have been a list item;Jason McIntyre
2017-12-12Document change in the default shell prompts.Theo Buehler
Discussed with and ok jmc
2017-12-12Include hostname in shell prompts by defaultTheo Buehler
With tmux, ssh and vmd, we tend to open shells on many different hosts simultaneously and the default prompts '$ ' and '# ' for {,k}sh as well as '% ' and '# ' for csh become dangerous: it's very easy to issue a command on the wrong host. This can easily be avoided by displaying the hostname in the prompt. Everything beyond "hostname{$,#,%} " is going to be a matter of taste, so we left it at that. If you use an FQDN, only the first part (the output of 'hostname -s') will be printed. requested by and ok deraadt; mostly positive feedback many ok anton, brynet, bcallah and others
2017-12-08Convert snprintf+write into dprintf. It is simply easier to read, andTheo de Raadt
provides retry on short-write file descriptors. ok florian, previous versions seen by millert
2017-12-07Drop the unused second argument from set_prompt(). It used to be used forTheo Buehler
early special casing of ! and !! in the PS1 expansion. This was removed from set_prompt() as part of the implementaion of the character count toggles \[ and \] back in 2004. ok jca
2017-11-27Follow emacs mode and remove the interactive "version" function.Theo Buehler
ok jca, anton (who both had the same diff) and deraadt
2017-11-26Remove the "version" interactive function in emacs mode.Jeremie Courreges-Anglas
Not bound by default and not very useful. ok schwarze@ anton@
2017-11-22Fix some incorrectness related to Emacs editing mode in ksh:anton
- Keep the order of bindings in sync between the manual and implementation - Fix wrongly documented bindings in the manual - Break out commands without a default binding in the manual ok jmc@ tb@
2017-11-21Initialize *histbase to NULL to fix a bus error in emacs editing modeTheo Buehler
found by anton. To reproduce, run "env EDITOR=emacs MALLOC_OPTIONS=J ksh" then press "^[_". ok anton, jca
2017-11-16In revision 1.35 of file.c, tenex() was modified to respect the inputline_sizeanton
argument but I forgot to adapt one conditional. Still no functional change since tenex() only has one call site where `inputline_size == sizeof(buf)`.
2017-11-16Zap a redundant cast.anton
2017-11-02Switch calloc(3) back to malloc(3). The call to calloc was introducedTheo Buehler
by the plaintext history diff, but the code that may have depended on this was since removed from history.c. None of the code introduced between the plaintext history commit and now depends on calloc(3). This way we can again use malloc.conf(5)'s J option to recognize use of uninitialized memory. ok jca
2017-10-24When dd(1) fails because it receives an INT signal,Ingo Schwarze
exit with a non-zero EXIT STATUS, as required by POSIX, consistent with what other operating systems do, consistent with how other OpenBSD programs behave, and making wait(2) consistent with what happens when dd(1) dies from other signals. Patch from <ScottCheloha at gmail dot com>. OK florian@ tb@.
2017-10-23Kill needless rewind(3) call in hist_init()Jeremie Courreges-Anglas
We may have read two bytes from the file, but history_load() needs to call rewind(3) anyway. ok benno@
2017-10-23Skip (and warn about) overlong history lines.Jeremie Courreges-Anglas
With much input from Ori Bernstein and anton@; ok anton@ (and benno@ on a previous version).
2017-10-19Delete the deprecated emacs-usemeta option.Jeremie Courreges-Anglas
ok tb@ anton@
2017-10-18The return value of this function isn't used.Jeremie Courreges-Anglas
ok anton@ tb@
2017-10-09Better document what the -v flag actually does and that you canTodd C. Miller
specify it more than once. Adapted from a diff by and OK schwarze@
2017-09-16Carefully add casts to silence clang sign-compare warnings. ok millert@Otto Moerbeek
2017-09-12there is no offical way to get the max value of time_t, but this one worksOtto Moerbeek
on any sensible posix system (in which time_t must be an integer type) ok deraadt@ millert@
2017-09-11Use getrusage(2) for the built-in time trial instead of getttimeofday(2).Todd C. Miller
This makes it possible to measure just the ellapsed user time, which is what we really care about when benchmarking an algorithm. OK deraadt@
2017-09-10Backslash escapes the next character in filename patterns.Philip Guenther
ok millert@
2017-09-08Avoid clang warning and make code better by using a signed long;Otto Moerbeek
with hint from millert@; ok millert@ guenther@
2017-09-07Keep histptr inside of the allocated history arrayJeremie Courreges-Anglas
histptr == history -1 means that the history is empty, but the behavior is then undefined. Allocate an extra array entry to work around this. Input & ok tb@
2017-09-06intvar < sizeof(...) does not catch negative values since an int -> unsignedOtto Moerbeek
conversion is involved. Cast the sizeof to int to get a signed compare; ok deraadt@ bluhm@
2017-09-03Use PATH_MAX instead of a local defineJeremie Courreges-Anglas
okk deraadt@ millert@ anton@
2017-09-02whitespace commit from BCTheo de Raadt
2017-08-31ignoredups implementation quirkJeremie Courreges-Anglas
Reminded by tb@
2017-08-30Guard FEMACSUSEMETA uses behind #ifdef EMACSJeremie Courreges-Anglas
2017-08-30Implement HISTCONTROL ignoredups & ignorespace featuresJeremie Courreges-Anglas
ignoredups: don't save the current line if it is identical to the last history line. ignorespace: don't save the current line if it starts with a space ok anton@ millert@
2017-08-30Stop exposing the emacs-usemeta option, and warn when trying to set it.Jeremie Courreges-Anglas
Unused since 2012, to be removed after 6.2. Input from anton@, ok anton@ millert@
2017-08-30Drop needless commentJeremie Courreges-Anglas
ok anton@ millert@
2017-08-30No need for NULL checks before afree()Jeremie Courreges-Anglas
2017-08-30Zap redundant assignment; ok jca@anton
2017-08-30Respect inputline_size argument. No functional change since tenex() only has oneanton
call site where `inputline_size == sizeof(buf)`.
2017-08-30Fix pasting of long (>BUFSIZ) lines in csh with filec enabled. NUL-terminatinganton
the input buffer instructs csh that the buffer contains a complete command. This is wrong and should only happen when buffer is not full, otherwise more data has to be read in order form a complete command. While here, do not print the prompt again when the input exceeds the input buffer and while inserting a line continuation (backslash).
2017-08-29Kill a useless setlocale() queryJeremie Courreges-Anglas
Pointless since the removal of the setlocale() call in main.c:rev1.82, the emacs-usemeta flag isn't used in the code since 2012. This kills a chunk of code in a statically linked ksh. ok millert@
2017-08-29Since rev 1.61 of print.c exp(3) and log(3) are not used anymore.Alexander Bluhm
Do not link ps(1) with libm. from miod@; OK millert@
2017-08-28Don't bother setting freed history lines to NULL.Jeremie Courreges-Anglas
Dead code that could send the wrong hint to an unsuspicious reader. The code should walk use 'history' & 'histptr' to walk the array. ok millert@, "go for it" tb@
2017-08-28Put history_write() in line with other functions that walk historyJeremie Courreges-Anglas
One method is enough: only access history lines between 'history' and 'histptr'. Pointers outside these bounds might be invalid. ok millert@, "go for it" tb@
2017-08-27Free history entries when resizing/reloadingJeremie Courreges-Anglas
Cluebat & ok tb@
2017-08-27Remove unused copy_non_glob() in ksh.Nayden Markatchev
Report and diff by David Crosby <dave@dafyddcrosby.com> OK otto@