1
0
mirror of https://github.com/openbsd/src.git synced 2025-01-10 06:47:55 -08:00
Commit Graph

38 Commits

Author SHA1 Message Date
guenther
5b133f3f27 Delete obsolete /* ARGSUSED */ lint comments.
ok miod@ millert@
2023-03-08 04:43:04 +00:00
tb
7b6df1e236 Use calloc(3) and recallocarray(3) instead of *alloc* + memset(0).
ok deraadt
2017-04-12 18:24:37 +00:00
schwarze
5161d913cb Improve modularization at the chared/read boundary, no functional change.
Stop the read.c module from poking the el_chared.c_macro data
structure that used to belong to the chared.c module.  Given that
no other module, not even chared itself, is using that data, move it
into the read modules's own opaque data structure, struct el_read_t.

That gets rid of one struct, one #define, one struct member, and one
function argument in the chared.h interface.

OK czarkoff@
2016-05-22 23:09:56 +00:00
schwarze
04833be782 Move the declaration of the function pointer type el_rfunc_t
from the private header "read.h" to the public header <histedit.h>.
That's not an interface change, it was already used and documented
publicly, merely not properly declared.

Improve encapsulation: Make el_read a pointer to an opaque struct
in struct editline, such that "read.h" no longer needs to be included
from "el.h" but only from the two files using it, read.c and el.c.
Only pass the required el_read_t to el_read_{s,g}etfn(),
do not pass the full struct editline.

OK czarkoff@,
also proofread by Christian Heckendorf <mbie at ulmus dot me>.
2016-05-20 15:30:17 +00:00
schwarze
ddc8143785 delete the "private" and "public" preprocessor macros, just use standard C;
OK martijn@
2016-04-11 21:17:29 +00:00
schwarze
e3191321e1 get rid of the non-standard data type "Char" in almost all files;
ok martijn@
2016-04-11 20:43:33 +00:00
schwarze
5c93237dc6 Move wrapper macros to the two files actually needing them:
FUNW, Strlen, Strdup, Strcmp, Strncmp, Strncpy, Strncat -> history.c
Strchr, tok_strdup -> tokenizer.c
FUN, TYPE, STR -> both of these files

OK martijn@

Also proofread by Christian Heckendorf <mbie at ulmus dot me>
who reported some whitespace issues in parse.c.
2016-04-11 19:54:53 +00:00
schwarze
565aa7e845 Delete 26 wrapper macros and two wrapper functions that are no
longer needed now that we always compile with wide character support,
reducing code obfuscation.

OK czarkoff@ martijn@.
Diff also proofread by Christian Heckendorf <mbie at ulmus dot me>.
2016-04-09 20:15:26 +00:00
schwarze
59aed04376 Always compile with WIDECHAR on and delete that preprocessor switch.
OK martijn@.
Diff also proofread by Christian Heckendorf <mbie at ulmus dot me>.
2016-04-09 19:31:55 +00:00
schwarze
c8b52917b0 Make the read_char() function always take a wchar_t * argument.
On first sight, it might look as if this required a bump because
it seems to change the public type el_rfunc_t.  But we only compile
with WIDECHAR, and in that case, there is no change in the interface.

This also simplifies some logic by getting rid of the NARROW_READ flag
which was broken anyway.

OK czarkoff@
2016-03-21 17:28:10 +00:00
schwarze
7ccfa089d5 Cleanup of standard header inclusion:
1. Add the missing <errno.h> to sig.c.
2. Do not include standard headers from private headers "chared.h"
and "el.h", include them directly where needed.
3. Delete a few needless inclusions of <ctype.h>.
4. Sort the standard headers.
5. Delete _GNU_SOURCE weirdness from histedit.h, that file doesn't even
need the access to wcsdup(3) mentioned in the comment.
6. Delete some trailing blanks and blanks before tabs.

OK czarkoff@
2016-03-20 23:48:27 +00:00
schwarze
5564fb9496 Cleanup of private header inclusion:
1. Do not include private headers from "chared.h", "hist.h", "prompt.h",
"refresh.h", "search.h", "sig.h", "terminal.h", "tty.h".
The only private header having to include other private headers is "el.h".
2. Do not include "common.h", "parse.h", "help.h" from "el.h",
and do not include "emacs.h" and "vi.h" from "chared.h",
include them directly where needed.
3. Do include "fcns.h" from "el.h" because el_func_t is needed for "map.h".
4. Do not include private headers again that are already included by "el.h".
5. Include private headers after standard headers.

OK czarkoff@
2016-03-20 22:57:59 +00:00
schwarze
f3a50c9efd Use getline(3) rather than fgetln(3) because it is standardized
and simpler and safer to use.  Implemented by Christos Zoulas
following my suggestion, with a bug fix by me.
2016-03-20 22:09:24 +00:00
schwarze
624bc356e5 Get rid of an ugly #ifdef in the middle of el_init() by
hiding the system dependencies away in "sys.h" where they belong.
No binary change on OpenBSD.
Seems reasonable to christos at NetBSD, too.
2016-02-02 00:43:12 +00:00
schwarze
7b85e16be0 Fifth step in synching with NetBSD:
Delete the silly ptr_t and ioctl_t typedefs
and delete some "#ifdef notdef" code from "sys.h".
No functional change.
This makes hist.h identical to the NetBSD version.
It reduces the remaining diff from +1526 -734 to +1430 -592.
OK czarkoff@
2016-01-30 17:32:52 +00:00
schwarze
28d54ee83c Fourth step in synching with NetBSD:
KNF: Remove parentheses from return lines.  No object change.
This makes emacs.c and prompt.c identical to the NetBSD versions.
It reduces the remaining diff from +2053 -1261 to +1526 -734.
OK czarkoff@
2016-01-30 12:22:20 +00:00
schwarze
fd40972a32 Third step in synching with NetBSD:
* rename fkey_t to funckey_t and el_term_t to el_terminal_t
* rename struct editline member el_term to el_terminal
* rename many functions in terminal.c from term_*() to terminal_*(),
for consistency with the file name and to not look related to <term.h>
No functional change.
This makes refresh.c and sig.c almost identical to the NetBSD versions.
It reduces the remaining diff from +2446 -1805 to +2053 -1420.
OK czarkoff@
2016-01-30 00:06:39 +00:00
schwarze
36facb1333 Second step in synching with NetBSD:
* Rename some types from *key*_t to *keymacro*_t.
* Rename struct editline member el_key to el_keymacro.
* Rename some functions in keymacro.c from key*() to keymacro*().
This removes the conflict of key_clear(), key_end(), and key_print()
with macros in <term.h>.  No functional change.
This makes keymacro.h identical to the NetBSD version.
It reduces the remaining diff from +2640 -1998 to +2446 -1805.
OK czarkoff@
2016-01-29 19:32:33 +00:00
deraadt
aea60bee5e Move to the <limits.h> universe.
review by millert, binary checking process with doug, concept with guenther
2015-01-16 16:48:51 +00:00
deraadt
014b1be8e7 Remove non-exposed malloc/realloc/free wrappers, and then substitute
reallocarray() where it helps.
ok doug
2014-10-17 06:07:50 +00:00
otto
b51eafda39 Reintroduce lost local diff; detective work by matthew@; ok okan@ oga@
all hail the more strict malloc S flag!
2011-07-13 11:05:17 +00:00
okan
5f805b19df sync with upstream, retaining local modifications.
ok nicm@
2011-07-07 05:40:42 +00:00
nicm
aed0ee816f Update libedit to bring it into sync with the latest version from NetBSD.
ok deraadt
2010-06-30 00:05:35 +00:00
deraadt
043fbe51c1 rcsid[] and sccsid[] and copyright[] are essentially unmaintained (and
unmaintainable).  these days, people use source.  these id's do not provide
any benefit, and do hurt the small install media
(the 33,000 line diff is essentially mechanical)
ok with the idea millert, ok dms
2009-10-27 23:59:19 +00:00
otto
b28794f646 Fix fgetln handling and always increment the size if we need to realloc,
Based on a diff by kjell@; latter hunk from a diff by Sergey S.  Kostyliov.
ok kjell@ canacar@
2004-08-23 18:31:25 +00:00
otto
6e02e0734f Sync libedit to NetBSD libedit as of Nov 8, 2003.
Tested by jmc@ djm@ and myself
2003-11-25 20:12:38 +00:00
otto
d484b7d03a Update to NetBSD libedit (from Oct 1, 2003), adding some string
cleaning and history bug fixes. The code includes GNU libreadline
functionality, but the corresponding header files are not installed,
since some libreadline functions are missing. There are some minor API
changes, notably:

old: EditLine *el_init(const char *, FILE *, FILE *);
new: EditLine *el_init(const char *, FILE *, FILE *, FILE *);

old: HistEvent *history(History *h, int op, ...);
new: int history(History *h, HistEvent *ev, int op, ...); plus some
changes in operation names. See editline(3) for details.

Tested by djm@, mouring@, jmc@.

ok deraadt@
2003-10-31 08:42:23 +00:00
millert
6580fee329 Remove the advertising clause in the UCB license which Berkeley
rescinded 22 July 1999.  Proofed by myself and Theo.
2003-06-02 20:18:29 +00:00
avsm
41d8ad6b55 is -Wall clean by making rcsid const 2003-05-01 21:11:21 +00:00
millert
e7beb4a7d5 We live in an ANSI C world. Remove lots of gratuitous #ifdef __STDC__ cruft. 2002-02-19 19:39:35 +00:00
millert
7bdcf72f14 Another case where we need to use u_char, not char for array
subscripts to avoid buf[-1] problems.
Also add a missing include of unistd.h.  OK'd by Theo
2001-04-13 20:35:19 +00:00
dugsong
21516dcde8 restrict editrc lookup to home directory, thanks kris@freebsd.org. ok deraadt@ 2000-06-28 17:45:25 +00:00
millert
84d7b780dc Updates from NetBSD (christos@netbsd.org)
* Portability fixes:
	__const         -> const
	BADSIG          -> SIG_ERR
	int flags       -> u_int flags
	#if __STDC__    -> #ifdef __STDC__
  * Don't allow CSWTCH to interfere with CSUSP on __SVR4 systems.
  * Return -1 if the terminal set operation resulted in dumb terminal settings.
  * Handle properly the case where the last line in the sourced file does
    not have a trailing '\n'. From Jeffrey C Honig.
  * editrc -> editline in editline(3)
1997-06-29 23:40:46 +00:00
millert
f840f2e031 fix el_source() - a block needed braces around it (from NetBSD)
Some strcpy() -> strncpy (from NetBSD)
Some KNF
Add current NetBSD tags
1997-03-14 05:12:41 +00:00
millert
babb851a03 Merge in NetBSD libedit changes and new man pages. Also fix some
strncpy() usage in their code.  NetBSD change log was:
    * add a man page for the editline routines
    * add a man page describing editrc
    * fix bugs in el_parse():
      * didn't execute command when program name matched (test reversed)
      * was checking against empty string instead of program name
      * after checks, command to run also pointed to empty string
    * document ^char and \ escape sequences
    * when parsing ^char control chars, check the correct char when determining
      validity (previously, ^char was a NOP interpreted as the literal string
      because of this bug)
    * Implement CC_REDISPLAY, which (unlike CC_REFRESH) redraws the entire input
    * line (a la ^R). This is useful if the binding outputs information and
    * mucks up the input line. To be used in ``list-choices'' bindings (refer
    * to the ^D binding in csh when filec is set)
1997-01-16 05:18:27 +00:00
deraadt
f5c716373b stncat misuse 1996-12-16 15:09:45 +00:00
deraadt
6ee6661bb2 use issetugid() to protect against bad getenv 1996-08-26 00:17:14 +00:00
deraadt
df930be708 initial import of NetBSD tree 1995-10-18 08:37:01 +00:00