summaryrefslogtreecommitdiffstats
path: root/bin/sh/histedit.c
Commit message (Collapse)AuthorAgeFilesLines
* sh: Prefer internal nextopt() to libc getopt().jilles2012-09-151-29/+15
| | | | | | | | | This reduces code duplication and code size. /usr/bin/printf is not affected. Side effect: different error messages when certain builtins are passed invalid options.
* Add prototypes, ANSIfy functions definitions to reduce WARNS=6 output.charnier2012-01-251-2/+1
|
* sh: Make various functions static.jilles2012-01-011-2/+4
|
* sh: Fix duplicate prototypes for builtins.jilles2011-06-131-0/+1
| | | | | | Have mkbuiltins write the prototypes for the *cmd functions to builtins.h instead of builtins.c and include builtins.h in more .c files instead of duplicating prototypes for *cmd functions in other headers.
* sh: Properly restore exception handler in fc.jilles2010-12-291-1/+2
| | | | | | | | | | | If SIGINT arrived at exactly the right moment (unlikely), an exception handler in a no longer active stack frame would be called. Because the old handler was not used in the normal path, clang thought it was a dead value and if an exception happened it would longjmp() to garbage. This caused builtins/fc1.0 to fail if histedit.c was compiled with clang. MFC after: 1 week
* sh: Code size optimizations to "stack string" memory allocation:jilles2010-11-231-2/+1
| | | | | | | | * Prefer one CHECKSTRSPACE with multiple USTPUTC to multiple STPUTC. * Add STPUTS macro (based on function) and use it instead of loops that add nul-terminated strings to the stack string. No functional change is intended, but code size is about 1K less on i386.
* sh: Tweak some string constants to reduce code size.jilles2010-10-291-2/+2
| | | | | * Reduce some needless differences. * Shorten some error messages that should not happen.
* Do not assume in growstackstr() that a "precious" character will beobrien2010-10-131-1/+1
| | | | | | | | | | | | | | | | immediately written into the stack after the call. Instead let the caller manage the "space left". Previously, growstackstr()'s assumption causes problems with STACKSTRNUL() where we want to be able to turn a stack into a C string, and later pretend the NUL is not there. This fixes a bug in STACKSTRNUL() (that grew the stack) where: 1. STADJUST() called after a STACKSTRNUL() results in an improper adjust. This can be seen in ${var%pattern} and ${var%%pattern} evaluation. 2. Memory leak in STPUTC() called after a STACKSTRNUL(). Reviewed by: jilles
* In the spirit of r90111, depend on c89 and remove the "STATIC" macroobrien2010-10-131-2/+2
| | | | and its usage.
* sh: Do not enter consecutive duplicates into the history.jilles2010-08-011-0/+1
| | | | | | | | | | | | This simply sets a flag in libedit. It has a shortcoming in that it does not apply to multi-line commands. Note that a configuration option for this is not going to happen, but always having this seems better than not having it. NetBSD has done the same. PR: bin/54683 Obtained from: NetBSD MFC after: 1 month
* sh: Add filename completion.jilles2010-06-151-0/+4
| | | | | | | | | | | | This uses the new libedit completion function with quoting support. Unlike NetBSD, there is no 'set +o tabcomplete' option to disable completion. I do not see any reason for such a special treatment, as completion is rather useful and it is possible to do bind ^I ed-insert to disable completion and insert a tab character instead. Submitted by: Guy Yur
* sh: Pass TERM changes to libedit.jilles2010-06-021-0/+14
| | | | | | | | I have changed the patch slightly to ignore TERM changes in subshells. PR: bin/146916 Submitted by: Guy Yur Obtained from: NetBSD
* sh: Various warning fixes (from WARNS=6 NO_WERROR=1):jilles2009-12-271-4/+4
| | | | | | | - const - initializations to silence -Wuninitialized (it was safe anyway) - remove nested extern declarations - rename "index" locals to "idx"
* sh: Constify various strings.jilles2009-12-241-3/+3
| | | | | Most of this is adding const keywords, but setvar() in var.c had to be changed somewhat more.
* sh: Some changes to stderr flushing:jilles2009-11-211-2/+3
| | | | | | | | | * increase buffer size from 100 to 256 bytes * remove implied flush from out2str(), in particular this avoids unnecessary flushing in the middle of a -x tracing line * rename dprintf() to out2fmt_flush(), make it flush out2 and use this function in various places where flushing is desired after an error message
* sh: Improve handling of setjmp/longjmp volatile:jilles2009-06-231-22/+9
| | | | | | | | | | | - remove ineffective and unnecessary (void) &var; [1] - remove some unnecessary volatile keywords - add a necessary volatile keyword - save the old handler before doing something that could use the saved value Submitted by: Christoph Mallon [1] Approved by: ed (mentor)
* Fix the eval command in combination with set -e. Before this change the shellstefanf2009-05-311-2/+2
| | | | | | | | | would always terminate if eval returned with a non-zero exit status regardless if the status was actually tested. Unfortunately a new file-scope variable is needed, the alternative would only be to add a new parameter to all built-ins. PR: 134881
* Commit the results of the typo hunt by Darren Pilgrim.yar2006-08-041-1/+1
| | | | | | | | | | This change affects documentation and comments only, no real code involved. PR: misc/101245 Submitted by: Darren Pilgrim <darren pilgrim bitfreak org> Tested by: md5(1) MFC after: 1 week
* Use the new name H_SETSIZE instead of the old H_EVENT to set the historystefanf2005-10-191-1/+1
| | | | | | size. PR: 86355
* El_parse's third parameter is now const-qualified, add a cast.stefanf2005-08-111-1/+1
|
* Remove clause 3 from the UCB licenses.markm2004-04-061-4/+0
| | | | OK'ed by: imp, core
* Delete worthless comments.tjr2002-10-301-5/+1
|
* Set opterr to zero to avoid duplicate warnings from getopt(3) for unknowntjr2002-07-251-0/+1
| | | | options.
* Call el_source() to read the contents of .editrc when line editing is enabled.tjr2002-07-231-0/+1
| | | | | Obtained from: NetBSD MFC after: 2 weeks
* Add a `bind' builtin command, which is simply a wrapper around libedit'stjr2002-07-231-0/+18
| | | | | | | builtin command of the same name. This allows the key bindings for the shell's line editor to be changed. MFC after: 2 weeks
* Consistently use FBSDIDobrien2002-06-301-2/+2
|
* Fix typo causing ``fc -e'' to not work correctly. getopt() sets optarg,tjr2002-06-021-1/+1
| | | | not shoptarg.
* Adding an entry to the history with H_ENTER moves libedit's internaltjr2002-06-021-0/+9
| | | | | history cursor. Reset the cursor after adding the entry to the history when doing ``fc -s'' so the output is correct.
* o __P has been reovedimp2002-02-021-16/+7
| | | | | | | | | | | | | | | | | | o Old-style K&R declarations have been converted to new C89 style o register has been removed o prototype for main() has been removed (gcc3 makes it an error) o int main(int argc, char *argv[]) is the preferred main definition. o Attempt to not break style(9) conformance for declarations more than they already are. o Change int foo() { ... to int foo(void) { ...
* *** empty log message ***obrien2001-10-011-28/+31
|
* Use PATH_MAX in preference in MAXPATHLEN.imp2001-05-301-1/+2
|
* Fix warnings, some of them serious because sh violated namecracauer2000-04-201-3/+1
| | | | | | | | spaces reserved by the header files it includes. mkinit.c still produces C code with redundant declarations, although they are more harmless since they automatically derived from the right places.
* $Id$ -> $FreeBSD$peter1999-08-271-1/+1
|
* Add rcsid. Spelling.charnier1998-05-181-3/+5
|
* When NO_HISTORY is defined and the history command is usedsteve1997-04-281-3/+16
| | | | | | show an error message. Inspired by: NetBSD
* compare return value from getopt against -1 rather than EOF, per the finalimp1997-03-281-2/+2
| | | | posix standard on the topic.
* Revert $FreeBSD$ to $Id$peter1997-02-221-1/+1
|
* Make the long-awaited change from $Id$ to $FreeBSD$jkh1997-01-141-1/+1
| | | | | | | | This will make a number of things easier in the future, as well as (finally!) avoiding the Id-smashing problem which has plagued developers for so long. Boy, I'm glad we're not using sup anymore. This update would have been insane otherwise.
* Merge in NetBSD mods and -Wall cleaning.steve1996-12-141-15/+12
| | | | Obtained from: NetBSD, me
* Misc cleanups and fixes from Bruce:peter1996-09-031-2/+2
| | | | | | | | | | - don't put \n on error() calls, error adds it already. - don't prepend "ulimit" on error() calls in miscbltin.c. - getopt typo on ulimit -p -> -u conversion - get/setrlimit() calls were not being error checked ulimit formatting cleanup from me, use same wording as bash on Bruce's suggestion. Add ulimit arg to output on Joerg's suggestion.
* Merge of 4.4-Lite2 sh source, plus some gcc -Wall cleaning. This is apeter1996-09-011-10/+42
| | | | | | | | | | | | | | merge of parallel duplicate work by Steve Price and myself. :-] There are some changes to the build that are my fault... mkinit.c was trying (poorly) to duplicate some of the work that make(1) is designed to do. The Makefile hackery is my fault too, the depend list was incomplete because of some explicit OBJS+= entries, so mkdep wasn't picking up their source file #includes. This closes a pile of /bin/sh PR's, but not all of them.. Submitted by: Steve Price <steve@bonsai.hiwaay.net>, peter
* Remove trailing whitespace.rgrimes1995-05-301-9/+9
| | | | Reviewed by: phk
* From "Philippe Charnier" <charnier@lirmm.fr>:dg1995-05-051-1/+5
| | | | | | | | | There is a bug in sh: the built in command "fc -l" generates a core dump (*NULL in not_fcnumber). According to the sh manual page (fc -l [-nr] [first [last]]), fc -l is a correct sequence (in that case, values are defaulted to -16 and -1) but fails when first is not given.
* Added $Id$dg1994-09-241-0/+2
|
* BSD 4.4 Lite bin Sourcesrgrimes1994-05-261-0/+442
OpenPOWER on IntegriCloud