Commit Graph

616 Commits

Author SHA1 Message Date
christos d47f958456 Rename key to keymacro to avoid conflicts with term.h. The renaming of term
to terminal was again to avoid conflicts with term.h. term.h is a moving
namespace violation.
2011-07-28 01:56:26 +00:00
christos 8cf227343c - check and don't cast malloc return
- more wide function use
2011-07-28 01:08:58 +00:00
christos 98c7cbebbc term -> terminal
XXX: need to rename key_ too.
2011-07-28 01:05:20 +00:00
christos 78cb86e064 regen 2011-07-28 01:05:00 +00:00
christos fd46b57ee4 avoid shadowed variable 2011-07-28 01:04:41 +00:00
christos 5fc21e9736 use vis.h from . 2011-07-28 00:54:26 +00:00
christos b210596944 eliminate alloca for portability
portable getpw{nam,uid}
2011-07-28 00:50:23 +00:00
christos 82edb784c6 term -> terminal
eliminate MAXPATHLEN
2011-07-28 00:49:18 +00:00
christos 0c0f23399c - fix memory allocation botch in wide strings
- check mbstowcs return code
2011-07-28 00:48:21 +00:00
christos e63c844a17 term -> terminal 2011-07-28 00:45:50 +00:00
christos 885062da0b more portability defines 2011-07-28 00:45:30 +00:00
christos c2c011fc82 term -> terminal 2011-07-28 00:45:14 +00:00
christos adb2121e55 term -> terminal
fix wide function confusion
2011-07-28 00:44:35 +00:00
christos f375da6e14 include config.h for all c files. 2011-07-28 00:43:53 +00:00
christos b723d6a65c include vis.h from dot. 2011-07-28 00:43:33 +00:00
christos df2309ca73 fix confusion with wide functions. 2011-07-28 00:43:12 +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 c76d71fc1a fix buffer growing code. 2011-07-27 02:18:30 +00:00
christos 0da54e076e add history testing code. 2011-07-27 02:18:00 +00:00
christos 3021376b9c don't stop reading after empty lines from: Nirbhay Choubey 2011-07-26 21:03:17 +00:00
christos 047570cb9a make obvious what we are trying to do... 2011-07-09 23:54:39 +00:00
tron f5c0fd2c7b Try to fix build of port where "char" is unsigned. 2011-07-09 16:04:34 +00:00
christos c6c51b75eb Support other non-latin1 single byte character sets.
From: Alexander Barkov and Nirbhay Choubey at oracle dot com
2011-07-08 15:54:56 +00:00
mrg 0a0dd75b65 add some XXX'd -Wno-foo if HAVE_GCC >= 45.
XXX: someone should look at these.
2011-06-21 02:32:55 +00:00
mrg 493d341048 various build fixes for gcc 4.5. from chuq. XXX i'm not sure all of
these work properly wtf pointer aliasing, but there are no casts at
least...

the lib/libpuffs/puffs_priv.h is definately a real bug fix.

from chuq.
2011-06-20 09:11:16 +00:00
wiz d489035474 Markup consistency, from YOMURA Masanori. Add serial comma. 2011-04-25 22:47:27 +00:00
bouyer 6d537d7313 Fix use-after-free. Discovered by running tests with MALLOC_OPTIONS=J
(should this be the default for tests ?), pointed out by njoly@
2011-03-20 12:36:14 +00:00
christos c0ee155271 Fix argument for EL_EDITOR from Jess Thrysoee 2011-02-27 01:51:37 +00:00
joerg 9674b81ed9 Introduce __weakref_visible to handle the different required visibility
for weak references. GCC 4.2+ and Clang require static, older GCC wants
extern. Change __weak_reference to include sym. This requires changes
the existing users to not reuse the name of the symbol, but avoids
further differences between GCC 4.1 and GCC 4.2+/clang.
2011-02-22 05:45:05 +00:00
christos 01d6c84859 PR/44599: Steven Vernon: libedit acts as if no data read if editmode is turned
off because nread is uninitialized in the edit disabled case.
2011-02-18 20:53:05 +00:00
joerg 6f7bc0c1ed Deal with changes in the weak_reference semantic in GCC 4.2 and later. 2011-02-17 16:44:48 +00:00
christos 28ef40ccbd fix pasto 2011-01-28 03:41:52 +00:00
christos b2ce31d086 don't turn on editing if stdout is not a tty. 2011-01-27 23:11:40 +00:00
christos 7350622ee8 off by one in fetching history data. From: Gerry Swislow 2011-01-16 03:05:51 +00:00
wiz 3d3c5d42cb Observe the following spelling:
- wide character (noun)
- wide-character (adjective)

Inspired by jmc@OpenBSD.
2010-12-16 17:42:25 +00:00
dholland eb1ab8ee50 Improve previous to avoid changing the interface of an externally
exposed function. (But note that this function is neither documented
nor declared in any installed header file, and it probably should not
be externally exposed.) Related to PR 44183, closes PR 44186.
2010-12-06 00:05:38 +00:00
dholland 574c2fc5a2 add const, from PR 44183. 2010-12-02 04:42:46 +00:00
dholland 92417c82c1 Fix up bodgy code for printing completion matches; it used to sometimes
skip entries, print (null), run off the end of the array, or occasionally
receive SIGSEGV, and now will, hopefully at least, do none of that.

Based in part on the patch in PR 44183 from Sergio Acereda; I also
did some tidyup and fixed it to print top-to-bottom first like ls(1).
2010-12-02 04:35:17 +00:00
christos a85c37d8d9 don't increment i twice in the loop. From Michael Byrnes 2010-11-15 21:24:31 +00:00
christos 9bc86f7706 PR/43998, PR/44021: In narrow history emulation, don't treat UTF-8 character
sets specially as far as history goes since we always need to do the conversion
from narrow [history] to wide [editline].
2010-11-04 13:53:12 +00:00
christos f70a466a92 fix fd leak found by Igor Zinovik 2010-10-23 23:27:40 +00:00
christos b354315033 unbreak readline history. 2010-09-16 20:08:51 +00:00
christos 7741aae941 setup a callback to be invoked on resize buffers so that readline can
reset rl_line_buffer which unfortunately some applications use it directly.
2010-08-28 15:44:59 +00:00
christos 6e1c968db3 provide rl_on_newline 2010-08-04 20:29:18 +00:00
christos 0ccb4e68f8 refresh only on SIGCONT not SIGWINCH from Edward Sheldrake 2010-07-21 18:18:52 +00:00
christos c157529beb retry the read after sigwinch too, from Edward Sheldrake 2010-07-19 17:18:13 +00:00
christos cbd798c94b tidy up memory allocation and don't unnecessarily print "./" before names. 2010-06-01 18:20:26 +00:00
christos ca8b6091c1 Use the same hack for Solaris and MacOS/X. This is not right, we only really
support UTF-8, but it will get us going until this is fixed properly.
From Jess Thrysoee
2010-04-20 02:01:13 +00:00
christos 72c00e4a7a \033 is more portable than \e still. 2010-04-18 21:17:47 +00:00
christos df810c5405 ffs needs strings.h 2010-04-18 21:17:22 +00:00
christos d29e250074 shame on solaris that is the last OS not supporting $() 2010-04-18 21:17:05 +00:00
christos 839bac947e From Jess Thrysoee
- Fix wint_t to Int confusion
2010-04-15 00:57:33 +00:00
christos 5443e9b772 From Jess Thrysoee
- use nl_langinfo to test for UTF-8, because some locales are UTF-8 without
     reflecting it in their names.
2010-04-15 00:56:40 +00:00
christos a5b37ffc65 From Jess Thrysoee
expose ct_enc_width()
2010-04-15 00:55:57 +00:00
christos 939651fa2b From Jess Thrysoee
- NARROW_HISTORY and IGNORE_EXTCHARS should not take effect if locale is UTF-8
- account for multi byte char length in
2010-04-15 00:52:48 +00:00
christos b77d4fa5c5 From Jess Thrysoee: call setlocale so we can test UTF-8 2010-04-15 00:50:46 +00:00
christos a9dd944f6b From Jess Thrysoee: add ifndef around def of _GNU_SOURCE 2010-04-15 00:50:03 +00:00
christos f576147073 https://bugzilla.redhat.com/show_bug.cgi?id=575383
Handle EINTR properly.
2010-03-22 22:59:06 +00:00
roy 98eb889579 Userland now builds and uses terminfo instead of termcap.
OK: core@, jdc@
2010-02-03 15:34:37 +00:00
christos 6fbbcd94ce PR/42646: Joachim Kuebart: Shell crashes in libedit when window size changes
(SIGWINCH). Return NULL if el_gets() gets interrupted.
2010-01-20 01:15:52 +00:00
christos 654f9c04e7 Fix wrapper for EL_EDITOR, from Michael L. Hitch 2010-01-19 22:38:08 +00:00
christos 081c24c702 PR/42637: Joachim Kuebart: Shell tab completion crashes due to libedit stack
smashing
2010-01-18 19:17:42 +00:00
christos 139d3d5a3b - call the mapping function directly instead of el_wset().
- save the strings passed to the mapping function so that they don't get
  re-used. This leaks. To fix it properly we could either pass a flag to
  free particular entries before re-using, or allocate all of them.
  Allocating all of them wastes memory, allocating some of them makes
  the code more complex.
This fixes compatibility binding (shell tab completion for example)
2010-01-12 19:40:50 +00:00
christos c9043bbf6e - in the argv conversion, handle NULL as NULL
- when printing tab/nl print them, don't handle them specially.
2010-01-12 19:37:18 +00:00
wiz 0d3270a169 Bump date for historyw -> history_w. 2010-01-03 19:05:26 +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 4168f34493 expose the encode and decode string functions for the benefit of history
and readline.
2009-12-31 18:32:37 +00:00
christos dc8498bec8 - Document and enable wide character support.
- Fix read function compatibility.
2009-12-31 15:58:26 +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 8106943a02 reduce diff with tcsh 2009-12-28 22:15:36 +00:00
christos b90e7198e7 improve on the listing display by printing only one character after the
filename not two, and no trailing blanks. I will revisit this when I write
the ls-F code.
2009-12-28 21:55:38 +00:00
christos c8b67cd8d5 Reduce diff with tcsh's editor. No functional change intended. 2009-12-28 21:54:21 +00:00
christos 969676ec74 Fix bug where tab completion on the second or > line that caused listing
ended up corrupting the display by an extra space in the beginning. Reported
by Mac Chan.
2009-12-28 21:52:43 +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
christos 461d0372fd delete defined(sun), it could be invaded in the user namespace. Suggested
by mrg@
2009-08-31 00:05:43 +00:00
christos 5aa87ec494 use __sun || sun instead of _SunOS, from Jess Thrysoee 2009-08-30 15:41:05 +00:00
christos 085c78fd1f Ignore comment lines in .editrc from Jess Thrysoee 2009-07-25 21:19:23 +00:00
christos bafe66c2cc Only need path if we have issetugid... From Anon Ymous 2009-07-22 18:25:26 +00:00
christos e304eddfd2 Don't depend on side effects inside an assert
From Michael Cook mcook at bbn dot com
2009-07-22 15:58:09 +00:00
christos cfa16c6369 Fix memory leaks in error paths.
From Michael Cook mcook at bbn dot com
2009-07-22 15:57:40 +00:00
christos 83965485c1 Always initialize nread since it is an out param.
From Michael Cook mcook at bbn dot com
2009-07-22 15:57:00 +00:00
christos 17a17e3aeb Move filename to the scope it is being used.
From Michael Cook mcook at bbn dot com
2009-07-22 15:56:29 +00:00
christos cfb4e5f917 Simplify the code. No functional change. 2009-07-17 12:28:27 +00:00
christos e2d0108bb8 - off by one in the term.h case.
- make code more similar to tcsh (if we want to handle wide chars, this is
  needed; for now it is a no-op)
2009-07-17 12:27:57 +00:00
christos 59a88754a7 handle prompt_esc properly. 2009-07-17 12:26:26 +00:00
christos 537657ed45 Use the proper prompt printing function. 2009-07-17 12:25:52 +00:00
christos 8e714f4b6e add stdio.h since we are using FILE. From Grant Erickson 2009-07-09 19:02:04 +00:00
perry eb247ff739 note that the return value of el_gets doesn't remain valid across
calls.
2009-07-05 21:55:24 +00:00
christos 287bd18049 decrement the number of levels after the loop (Julien Torres) 2009-06-09 13:04:33 +00:00
christos e55354196b from Julien Torres, flip the order we pop in the macro array. 2009-06-08 15:10:53 +00:00
christos 189ce7898b always scroll when we advance past bottom. From Caleb Welton
cwelton at greenplum dot com
2009-05-19 21:45:14 +00:00
wiz 35cf287cb8 Punctuation nit. 2009-05-12 08:14:07 +00:00
christos b627b61f7f restore binary compatibility by providing new prompt functions that take
an extra literal character.
2009-05-11 18:33:30 +00:00
christos b203bfe74f PR/41230: -current: sh(1) endlessly looping in interactive
Fix proposed from Matthew Mondor
2009-04-16 19:39:37 +00:00
wiz 55a1b57943 Drop trailing whitespace. 2009-04-11 22:17:52 +00:00
joerg dab0ac3098 Don't use .Xo/.Xc to work around ancient macro argument limit in groff. 2009-04-11 20:53:15 +00:00
joerg 22ce33e2aa Don't use .Xo/.Xc to avoid ancient macro argument limit. 2009-04-11 20:48:26 +00:00
christos 46db7d011d Fix off by one error reported by: Caleb Welton cwelton at greenplum dot com 2009-04-08 21:31:31 +00:00
wiz 3a9e7e68ee Readability improvement. Whitespace nits. 2009-04-01 08:58:47 +00:00
christos 097860c04e cast to size_t to avoid sign / unsigned comparison warning. 2009-03-31 21:33:17 +00:00
christos e6ec3d065c implement RL_PROMPT_{START,END}_IGNORE 2009-03-31 17:53:03 +00:00
christos c8754a5b44 Implement literal prompt sequences. Now someone can implement
RL_PROMPT_START_LITERAL/RL_PROMPT_END_LITERAL :-)
2009-03-31 17:38:27 +00:00
wiz 097d2fd1a6 -1 is not a defined value, it is just a value.
On the other hand, minuses need backslashes, otherwise they become hyphens.
2009-03-10 22:55:14 +00:00
christos ae87843e53 make el_gets set the count to -1 on error to distinguish between EOF and
error.
2009-03-10 20:46:15 +00:00
joerg 997634fe14 Fix preamble to match order set out by mdoc(7). Discussed with wiz. 2009-03-09 19:24:26 +00:00
msaitoh 150e7551ec fix mis-evaluating whether a char is digit or not. 2009-02-27 04:18:45 +00:00
christos 07e886c39c remove VEOF test. the tty is in cooked mode when we are not editing and
the tty driver does the check for us.
2009-02-21 23:35:10 +00:00
christos 954af9bb67 more size_t stuff. 2009-02-21 23:31:56 +00:00
christos 41907725b6 use the VEOF character from the terminal, instead of hard-coding 4. 2009-02-21 23:31:29 +00:00
wiz 6c890a7983 Restore markup changes (probably accidentally) reverted in previous. 2009-02-21 07:58:58 +00:00
christos c51877c3f4 back out all prompt changes. they are not needed. 2009-02-21 00:05:23 +00:00
cube 0931c75c7a Order of evaluation of arguments is undefined, so call va_arg() in an
explicit order.  Fixes a segfault with bc reported by Patrick Welche on
current-users.
2009-02-19 20:27:11 +00:00
christos e8bbf84cd0 reset and redraw on sigcont. From Anon Ymous. 2009-02-19 15:20:22 +00:00
wiz dfe59495b1 Fix wordo, use more markup. 2009-02-19 09:48:08 +00:00
christos f072c3f1a4 bump version for prompt arg. 2009-02-19 01:18:24 +00:00
christos 963ecab70c document extra argument. 2009-02-19 01:18:02 +00:00
christos ec70918ed3 SA_RESTART for all signals but SIGINT. From Anon Ymous. 2009-02-18 15:04:40 +00:00
christos 62dbbc55bc allow for a prompt argument. 2009-02-17 21:34:26 +00:00
christos 7939d24e16 fix sign compare issues. 2009-02-16 00:15:45 +00:00
christos 5c894153a3 pass lint on _LP64. 2009-02-15 21:55:23 +00:00
christos d25b6758ed in order for read() to return EINTR we need to use sigaction, not signal,
otherwise SA_RESTART is set.
2009-02-15 21:25:01 +00:00
christos 6ed9cd5e69 don't restart on EINTR, instead return NULL immediately. From Anon Ymous 2009-02-15 21:24:13 +00:00
sketch fc16547f5e More fixes for existing portability stuff. 2009-02-12 13:39:49 +00:00
sketch 2157800b5b SUNOS is spelt __SunOS. Add missing prototypes. 2009-02-06 20:08:13 +00:00
sketch 957effbd58 Needs errno.h 2009-02-06 19:53:23 +00:00
sketch fe96b18c3f Plug memory leak, from MySQL. 2009-02-06 14:40:32 +00:00
sketch 5e72d51013 Portability fix. 2009-02-06 13:14:37 +00:00
sketch fe3391bda5 de-__P() 2009-02-06 12:45:25 +00:00
christos 1dc5f9b89b match documentation in el_push 2009-02-05 19:15:44 +00:00
christos d052ee7b7f add rl_set_prompt 2009-02-05 19:15:26 +00:00
apb 69a442fa50 Define HAVE_STRUCT_DIRENT_D_NAMLEN in config,h, and test it when
deciding whether to use entry->d_namlen or strlen(entry->d_name).
Addresses PR 40477 by Robert Millan.
2009-01-26 17:32:41 +00:00
lukem c17aaf60c9 WARNS=4 2009-01-18 12:17:49 +00:00
lukem a06595c27b fix -Wsign-compare issues 2009-01-18 12:14:16 +00:00
christos 2d18fd40a7 - insert a space after the recognized string if it was an exact match
- initialize properly the string used for completion.
From Alex Bligh alex at alex dot org dot uk
- Make char constants consistent
2009-01-11 15:00:23 +00:00
christos 46edb91e9f bump shared libraries. 2009-01-11 03:07:47 +00:00
aymeric e56ab6501a have '$' include the last character in the line when embedded in a command.
This fixes c$, d$, y$, and so on in vi mode.
2008-09-30 08:37:42 +00:00
christos 872a7369cc Allow a single process to control multiple ttys (for pthreads using _REENTRANT)
using multiple EditLine objects. Mostly from Preston A. Elder.
2008-09-10 15:45:37 +00:00
christos 365dab42f3 handle EINTR in the termios operations, reported by the GHC folks 2008-07-30 13:00:46 +00:00
christos df0a282e52 Don't bother with SIGSTOP it cannot be caught or ignored. From Jess Thrysoee 2008-07-12 15:27:14 +00:00
martin 11a6dbe728 Convert TNF licenses to new 2 clause variant 2008-04-30 13:10:46 +00:00
martin 3028e483e4 Convert to new 2 clause license 2008-04-29 06:53:00 +00:00
christos 4652e1fb8f bump minor. 2008-04-05 23:53:26 +00:00
christos 0cb4d42e16 add EL_REFRESH for the benefit of readline 2008-04-05 15:53:28 +00:00
christos 3bbc95f39d Add rl_forced_update_display() from Gerry Swislow 2008-04-04 21:18:34 +00:00
christos 5f3802ca6e patches from Axel Thimm 2007-08-12 07:41:51 +00:00
christos 07186f02e2 Fix tab/space confusion; from Stefan Farfeleder 2007-06-10 20:20:28 +00:00
tls 4147a3c54a Add new Makefile knob, USE_FORT, which extends USE_SSP by turning on the
FORTIFY_SOURCE feature of libssp, thus checking the size of arguments to
various string and memory copy and set functions (as well as a few system
calls and other miscellany) where known at function entry.  RedHat has
evidently built all "core system packages" with this option for some time.

This option should be used at the top of Makefiles (or Makefile.inc where
this is used for subdirectories) but after any setting of LIB.

This is only useful for userland code, and cannot be used in libc or in
any code which includes the libc internals, because it overrides certain
libc functions with macros.  Some effort has been made to make USE_FORT=yes
work correctly for a full-system build by having the bsd.sys.mk logic
disable the feature where it should not be used (libc, libssp iteself,
the kernel) but no attempt has been made to build the entire system with
USE_FORT and doing so will doubtless expose numerous bugs and misfeatures.

Adjust the system build so that all programs and libraries that are setuid,
directly handle network data (including serial comm data), perform
authentication, or appear likely to have (or have a history of having)
data-driven bugs (e.g. file(1)) are built with USE_FORT=yes by default,
with the exception of libc, which cannot use USE_FORT and thus uses
only USE_SSP by default.  Tested on i386 with no ill results; USE_FORT=no
per-directory or in a system build will disable if desired.
2007-05-28 12:06:17 +00:00
christos 2d9dad6f00 Add rl_completion_matches, fix remove_history 2007-05-27 19:45:37 +00:00