Commit Graph

63 Commits

Author SHA1 Message Date
christos 991f62167b Change strncpy to either memcpy (when we know the len), or strlcpy (when
we used to NUL terminate explicitly.
2019-10-08 19:17:57 +00:00
kre b8b0289d66 Fix editing mistake, remove ) from func call that is now gone. 2018-09-13 09:03:40 +00:00
christos 26f83385d3 more efficient to use decode_result :-) Pointed out by kre@ 2018-09-13 01:26:33 +00:00
christos 6da79ee096 PR/53597: Yasuhiro Horimoto: Avoid segmentation fault in bad history file. 2018-09-12 22:10:35 +00:00
uwe ec59efb2b5 The order in which the arguments to a function are evaluated is
undefined, so don't use va_arg() twice.

PR lib/52849
2017-12-23 18:25:03 +00:00
christos 27916d7c22 PR/51517: Jay West: Tty settings not restored on exit
PR/51518: Jay West: prompt is interleaved with client output

Both these issues are caused by rl_restore_handler not DTRT; fix
it so that it kills the internal libedit state completely. This is
inefficient, but it works.

Also fix:
1. add append_history()/H_NSAVE_FP
2. call the rl_startup_hook before printing the first prompt as documented.
   callint it from rl_initialize breaks python, because the callback ends
   up being invoked before the readline module is installed, and we end up
   dereferencing a NULL pointer.
3. add el_resize_terminal.

With those changes, s/lreadline/ledit/g in python works.
2017-09-01 10:19:10 +00:00
christos 469d44f8e7 Get rid of private/public; keep protected (Ingo Schwarze) 2016-04-11 18:56:31 +00:00
christos a75ea7b9c4 chartype cleanups from Ingo Schwarze:
- The file tokenizer.c no longer uses chartype.h,
   so don't include the header.

 - The dummy definitions of ct_{de,en}code_string() for the
   NARROWCHAR case are only used in history.c, so move them there.

 - Now the whole content of chartype.h is for the wide character
   case only.  So remove the NARROWCHAR ifdef and include the
   header only in the wide character case.

 - In chartype.h, move ct_encode_char() below the comment explaining it.

 - No more need for underscores before ct_{de,en}code_string().

 - Make the conversion buffer resize functions private.
   They are only called from the decoding and encoding functions
   inside chartype.c, and no need can possibly arise to call them
   from anywhere else.
2016-04-11 16:06:52 +00:00
christos 0594af8028 Char -> wchar_t from Ingo Schwarze. 2016-04-11 00:50:13 +00:00
christos 0aefc7f9ad more macro WIDECHAR undoing from Ingo Schwarze. 2016-04-11 00:22:48 +00:00
christos 4e541d85ca Start removing the WIDECHAR ifdefs; building without it has stopped working
anyway. (Ingo Schwarze)
2016-03-23 22:27:48 +00:00
christos 22383670cc whitespace and header sorting changes (Ingo Schwarze). No functional changes. 2016-02-17 19:47:49 +00:00
christos 1e12a8d1ca Don't free getline memory (Ingo Schwarze). 2016-02-15 21:35:52 +00:00
christos a7ab79fbe5 Use getline for better portability. 2016-02-15 15:53:45 +00:00
christos c825536317 Change the test for the size of encoded buffer to include the NULL, from
OpenBSD; no functional change.
2016-02-15 15:30:50 +00:00
christos 87240809e9 Use fparseln to avoid newline hacks. 2016-02-15 15:26:48 +00:00
christos 58ced3d761 Add a history function that takes a FILE pointer; needed for Capsicum.
From Eitan Adler
2014-05-11 01:05:17 +00:00
christos ae5295ee5d Add coverity annotations about unreachable code (Kamil Dudka) 2011-11-18 20:39:18 +00:00
christos c11bd863f5 pass -Wconversion 2011-07-29 23:44:44 +00:00
christos 1237974a30 - fix unused params
- unconditionalize vis.h
2011-07-29 20:58:07 +00:00
christos b71bed95b3 KNF return (\1); -> return \1; 2011-07-29 15:16:33 +00:00
christos a13cd75612 kill ptr_t and ioctl_t, add * sizeof(*foo) to all allocations. 2011-07-28 20:50:55 +00:00
christos b723d6a65c include vis.h from dot. 2011-07-28 00:43:33 +00:00
christos 5bf2e3dbda fix narrow compilation 2011-07-27 13:18:20 +00:00
christos 32d7653d74 - don't leave cursor dangling on memory failure or after clearing the list
- compute the string length to be strvis'ed after the string is encoded
2011-07-27 02:23:29 +00:00
christos 7350622ee8 off by one in fetching history data. From: Gerry Swislow 2011-01-16 03:05:51 +00:00
christos 73eda9fe27 rename historyw -> history_w for consistency.
add wide tst code and make it the default.
2010-01-03 18:27:10 +00:00
christos 0b9ae3fdf0 Fix wide build, test it, but don't turn it on yet. 2009-12-30 23:54:52 +00:00
christos 34e53048e6 Wide character support (UTF-8) from Johny Mattsson; currently disabled. 2009-12-30 22:37:40 +00:00
christos ea3813ed2f apply apple patches from:
http://opensource.apple.com/source/libedit/libedit-11/patches/
2009-09-07 21:24:33 +00:00
sketch fe96b18c3f Plug memory leak, from MySQL. 2009-02-06 14:40:32 +00:00
christos d9590bcae9 Fix memory leak found by valgrind (Julien Torres) 2006-09-28 13:52:51 +00:00
christos ee399edc73 Don't forget to initialize h_del; from Julien Torres. 2005-08-01 14:34:06 +00:00
christos 45542456a5 PR/30747: David N. Williams: libedit is missing remove_history()
Added, please test.
2005-07-14 15:00:58 +00:00
christos 32bff6afc2 Fix memory leaks found by valgrind. From Julien Torres 2005-07-06 21:13:02 +00:00
christos 3bca82ec33 PR/26785: Jess Thrysoee: libedit - H_NEXT and H_PREV shifts cursor on failure 2004-11-27 18:31:45 +00:00
christos 9b6268f92e make sure that we round up to 1K. 2004-08-24 12:41:06 +00:00
christos 848a98512e PR/26725: Sergey S. Kostyliov: Typo in libedit, possible buffer overflow in src/lib/libedit/history.c:history_save() 2004-08-20 12:54:05 +00:00
christos 6e782349a3 change allocation policy in el_push to allocate the string itself.
fix issues with strdup.
2003-10-18 23:48:42 +00:00
agc eb7c1594f1 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22280, verified by myself.
2003-08-07 16:42:00 +00:00
christos 839ca00b3c From michael@moria.de:
- use __attribute__((__unused__)) in arguments where appropriate.
- some int -> size_t and char * to const char * conversions.
2003-06-19 15:55:05 +00:00
christos f24857bf36 Add a uniquefier for the history function. 2003-01-21 18:40:23 +00:00
christos e6ee03013b don't crash in memory shortage conditions. 2002-10-27 20:24:28 +00:00
christos 4a964eaf87 write the vis(3) converted string into the file, not the original one.
Noted by Tim Robbins. Hi luke!
2002-10-13 17:15:53 +00:00
christos 0e0ac6b723 - constify; passes all gcc and lint strict checks.
- add config.h [Jason Evans], to create a portable version of libedit that
  can be easily compiled on other OS's.
2002-03-18 16:00:50 +00:00
jdolecek e7e71e37c6 history_def_enter: fix off-by-one mistake in delete condition (the behaviour
to keep at least one entry on the history list is retained)
This fixes lib/9704 by Phil Nelson.
2001-09-29 17:52:10 +00:00
christos e125f8f194 chmod the history file to 600 so that only the owner can read it.
[inspired by the openbsd fix to readline]
2001-03-20 00:08:31 +00:00
lukem d30d584a91 convert to new style guide, which includes:
- ansi prototypes & features (such as stdargs)
- 8 space indents
2000-09-04 22:06:28 +00:00
lukem f5e2e0bfea history_def_set has a `const int' as a third arg, not an `int'.
picked up by the ultrix compiler, reported by simonb@ ...
2000-08-29 07:04:32 +00:00
simonb 1528b77539 More trailing white space. 1999-07-02 15:14:07 +00:00