Commit Graph

55 Commits

Author SHA1 Message Date
kre 72c6780ab3 Remove a function prototype which was added to <histedit.h> in 2005.
I think we can trust it to be stable by now, and doin't need the dup.
2019-02-10 19:21:52 +00:00
kre e8999de45c INTON / INTOFF audit and cleanup.
No visible differences expected - there is a remote chance that
some internal lossage may no longer occur in interactive shells
that receive SIGINT (untrapped) at inopportune times, but you would
have had to have been very unlucky to have ever suffered from that.
2019-02-09 03:35:55 +00:00
kre c6c29888c4 Remove atoi()
Mostly use number() (no longer implemented using atoi()) when an
unsigned integer is required, but use strtoXXX() when a conversion
is wanted, without the possibility or error (like setting OPTIND
and RANDOM).   Always init OPTIND to 1 when sh starts (overriding
anything in environ.)
2018-07-13 22:43:44 +00:00
kre 4754b1e8f4 Now libedit supports embedded mode switch sequence, improve sh
support for them (adds PSlit variable to set the magic character).
2017-06-28 13:46:06 +00:00
christos 650f73e320 Add literal prompt support this allows one to do:
CA="$(printf '\1')"
PS1="${CA}$(tput bold)${CA}\$${CA}$(tput sgr0)${CA} "
2017-06-27 23:27:03 +00:00
kre 3c2922e71c Properly support EDITRC - use it as (naming) the file when setting
up libedit, and re-do the config whenever EDITRC is set.
2017-06-27 02:22:08 +00:00
christos 57d721417b source .editrc after we initialize so that commands persist! 2017-06-26 20:28:01 +00:00
christos 90f49946eb Sprinkle volatile for gcc 5! 2016-03-16 22:36:40 +00:00
christos f032129312 Adjust to the new alias text libedit API. 2014-06-18 18:17:30 +00:00
dholland c4044741ea don't use sprintf 2014-03-23 05:07:59 +00:00
matt da4f7877a7 Use C89 function definitions 2012-03-20 18:42:28 +00:00
joerg 90ca8ad494 Move the savehandler assignment before setjmp() to avoid triggering
warnings about use before initialization with clang.
2011-07-12 16:40:41 +00:00
christos 4fc4fe2edf PR/45069: Henning Petersen: Use prototypes from builtins.h . 2011-06-18 21:18:46 +00:00
jmmv 416c5b0ff8 Call el_source before initializing sh-specific editline properties (i.e.
the editor type and the tab completion binding).

This allows tab completion to work when a user has an ~/.editrc file.

Addresses PR bin/43404.
2011-01-07 22:21:56 +00:00
joerg f04ccd71b4 Set unique mode for the history, so that repeating a command doesn't
spam the history.
2008-02-13 12:57:16 +00:00
christos 272937609b sprinkle volatile. 2006-10-16 00:36:19 +00:00
mrg 084c052803 quell GCC 4.1 uninitialised variable warnings.
XXX: we should audit the tree for which old ones are no longer needed
after getting the older compilers out of the tree..
2006-05-10 21:53:14 +00:00
aymeric d5d0c11532 Make the -s flag of fc work correctly. Ensure that only one command is specified
and ensure that we break out of the loop after executing it.
With the previous code, because the re-executed command was added to the
history, it would think that it still had to execute it, leading to an infinite
loop.

The last thing which differs from ksh is that we get the "fc -s " command into
the history, but this is actually rather a feature in my humble opinion.

To test:
$ echo hello
$ fc -s ec
<infinite loop or correct behaviour>
2006-03-06 00:09:22 +00:00
christos 0df4f0ca31 Only do certain actions when we are trully interactive, not just when we
are connected to a tty:
	1. enable editor
	2. print directory on directory change.
	3. print job messages
2005-07-15 17:49:43 +00:00
christos c3b8cf7d21 Only add the function when we initialize. Restore the binding of tab to
ed-insert if tabcomplete is cleared.
2005-05-09 11:35:19 +00:00
dsl 82537bf8e8 If 'set -o tabcomplete' it set, then bind <tab> to the libedit filename
completion function.
Note that the libedit code will probably want fine-tuning!
While editing the man page, add a note that non-whitespace IFS chars are
terminators and can generate null arguments.
2005-05-07 19:52:17 +00:00
lukem 7568eb663a skip a leading `-' on the arg0 name when calling el_init() 2003-10-27 06:19:29 +00:00
christos 1bbc81a501 Let libedit handle signals so we resize properly. I might change my mind
later on that.
2003-10-19 19:13:21 +00:00
lukem 1e840c4d40 Ensure that $TERM is set in the real environment before calling el_init(3)
when executing "set -o (emacs|vi)".   Fixes [bin/23175] from me.
2003-10-19 01:55:05 +00:00
agc b5b2954259 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22249, verified by myself.
2003-08-07 09:05:01 +00:00
itojun a69cd45b93 use bounded string op 2003-07-13 08:31:13 +00:00
gmcgarry 5e5ffccb2b ANSIify. 2003-05-04 06:36:50 +00:00
gmcgarry f8d2e9e189 Add new builtin 'inputrc' which allows keybindings to be redefined
for the current shell.  From Arne H Juul in PR#10097.
2003-05-04 01:05:24 +00:00
christos c02b3bbdf4 Fixes from David Laight:
- ansification
- format of output of jobs command (etc)
- job identiers %+, %- etc
- $? and $(...)
- correct quoting of output of set, export -p and readonly -p
- differentiation between nornal and 'posix special' builtins
- correct behaviour (posix) for errors on builtins and special builtins
- builtin printf and kill
- set -o debug (if compiled with DEBUG)
- cd src obj (as ksh - too useful to do without)
- unset -e name, remove non-readonly variable from export list.
  (so I could unset -e PS1 before running the test shell...)
2002-11-24 22:35:38 +00:00
christos ccbeeb7cba get rid of sp completely, we were free-ing a bogus pointer; found by simonb. 2002-03-12 00:14:31 +00:00
christos 3380980447 remove redundant declarations and nexted externs. 2001-02-04 19:52:06 +00:00
mycroft 3112db7eb8 Call el_source() to use .editrc. 2000-11-06 04:21:14 +00:00
simonb 51ee9dc68d Don't declare 'extern opt*' getopt variables. 2000-04-14 05:52:56 +00:00
christos d6ac7627ea Fix bin/9184, bin/9194, bin/9265, bin/9266
Exitcode and negation problems (From Martin Husemann)
2000-01-27 23:39:38 +00:00
christos 3d42469030 compile with WARNS = 2 1999-07-09 03:05:49 +00:00
mycroft ee9e50eacb Be more retentive about use of NOTREACHED and noreturn. 1998-07-28 11:41:40 +00:00
christos 338ea4cec8 fix bug where if moving in history during a multi-line event, the
append to history event would end up in the last event where the history
was moved to instead of the multi-line event; reported by Mycroft
1998-05-20 00:29:26 +00:00
fair 618cca243b Change a few things to reference /usr/include/paths.h instead of local
references. Fixing the default PATH is a bit more effort.
1998-04-07 10:16:04 +00:00
cjs af5956aa6b Make this compile with -DSMALL and warnings on. 1997-11-12 03:40:55 +00:00
christos 946049095f PR/4257: Jaromir Dolecek: Update for libedit interface change. 1997-10-14 15:06:42 +00:00
lukem 92d7aa0376 getopt returns -1 not EOF 1997-09-14 07:43:56 +00:00
christos cd799663e4 Fix compiler warnings. 1997-07-04 21:01:48 +00:00
christos 7efa5addb4 Track $TERM and call the appropriate editline(3) routine to update the
terminal type.
1997-04-11 22:45:38 +00:00
christos 7accaec421 NO_HISTORY->SMALL 1997-03-14 01:42:18 +00:00
christos 6042831b7e Fix problems with -DNO_HISTORY 1997-03-13 21:57:32 +00:00
christos 435812e77d PR/2808: Remove extraneous newlines from error routines (from FreeBSD) 1996-10-16 14:40:32 +00:00
christos 02b3c16118 change sethistsize() to take the history size as an argument so it can
be used directly by the new variable callback functions.
1996-06-25 16:43:33 +00:00
christos 07bae7eddd Merge in my changes from vangogh, and fix the x=`false`; echo $? == 0
bug.
1995-05-11 21:28:33 +00:00
christos df504509f1 1. Don't core dump on 'fc -l' (From Gerard J van der Grinten)
2. PATH=xxx ls, does the PATH assignment first and then tries to find ls in xxx
3. VAR=xxx exec ls, does the variable assignment.
1995-03-31 21:58:09 +00:00
cgd 49f0ad8601 convert to new RCS id conventions. 1995-03-21 09:01:59 +00:00