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

30 Commits

Author SHA1 Message Date
guenther
5b133f3f27 Delete obsolete /* ARGSUSED */ lint comments.
ok miod@ millert@
2023-03-08 04:43:04 +00:00
asou
97a352df3f read() returns -1 on failure
ok yasuoka@
2019-08-14 08:31:00 +00:00
deraadt
df69c215c7 When system calls indicate an error they return -1, not some arbitrary
value < 0.  errno is only updated in this case.  Change all (most?)
callers of syscalls to follow this better, and let's see if this strictness
helps us in the future.
2019-06-28 13:32:41 +00:00
schwarze
ef07c437df Fix a crash in stifle_history() that occurred when the history
contained more than twice as many entries as the new limit:  The
argument of remove_history() only counts existing elements, not
those previously deleted.

Crash found by bentley@ when exiting sqlite3(1).
2016-05-31 16:12:00 +00:00
schwarze
47f0686a86 Fix next_history() and previous_history():
* The meaning of "next" and "previous" is exchanged in readline(3) with
respect to editline(3); this part of the patch from Bastian Maerkisch.
* next_history() can move beyond the newest entry; issue pointed out
by Bastian Maerkisch, fix by me.

While here, make the documentation of ed-next-history, ed-prev-history,
H_NEXT, and H_PREV more precise.

OK czarkoff@.
2016-05-10 11:07:53 +00:00
schwarze
dddc8490d9 Fix history_get():
* Respect history_base.
* Bail out early for arguments that are too small.
* Select entry by readline offset, not by editline event number.
* Restore history cursor in case of failure.
This fixes the test_remove() regression test.

Based on a patch from Bastian Maerkisch <bmaerkisch at web dot de>.
Dmitrij Czarkoff pointed out a flaw in it that i fixed.
OK czarkoff@.
2016-05-10 10:49:37 +00:00
schwarze
5eaeb63fcf Fix stifle_history(): Remove excessive entries, if any.
Based on a patch from Bastian Maerkisch <bmaerkisch at web dot de>,
with an additional fix for a memory leak by me.
OK czarkoff@
2016-05-09 12:31:55 +00:00
schwarze
42bbcabc56 Change where_history() to agree with the GNU implementation:
Return 0 for the oldest entry and increment by 1 for each newer,
non-deleted entry.
This fixes the test_where() regression test.

Patch from Bastian Maerkisch <bmaerkisch at web dot de>.
OK czarkoff@.
2016-05-08 13:52:33 +00:00
schwarze
07f7d775ab Make the history_set_pos() return values agree with the GNU implementation.
Patch from Bastian Maerkisch <bmaerkisch at web dot de>
with a minor tweak from Christos Zoulas.
Fixes the test_set_pos_return_values() regression test.

OK czarkoff@,
also proofread by zhuk@ and by Christian Heckendorf <mbie at ulmus dot me>.
2016-05-08 13:34:35 +00:00
schwarze
13e01c7add Replace the generated file "fcns.c" by a simpler header "func.h"
included only in the one file needing it, "map.c".
That allows to define el_action_t directly in "map.h",
which in turn allows to stop including "fcns.h" from "el.h"
and include it only in the modules needing it.
Now we no longer autogenerate any C files.

Feedback and OK martijn@.
First version also proofread by Christian Heckendorf <mbie at ulmus dot me>.
2016-05-06 13:12:52 +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
krw
830940108c Currently we have about a 50/50 split over fcntl(n, F_GETFL [,0])
idioms.

Adopt the more concise fcntl(n, F_GETFL) over fcntl(n, F_GETFL, 0)
where it is obvious further investigation will not yield and
even better way.

Obviousness evaluation and ok guenther@
2016-03-20 00:01:21 +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
millert
4239b8225f SIZE_MAX is standard, we should be using it in preference to the
obsolete SIZE_T_MAX.  OK miod@ beck@
2015-02-06 23:21:58 +00:00
reyk
e6f9da1133 libedit claims compatibility with readline 4.2, so provide a stub for
rl_set_keyboard_input_timeout() that was added in this version.
Also crank the minor version.

OK krw@ yasuoka@ deraadt@
2015-01-13 08:33:12 +00:00
deraadt
4d46e16d52 use reallocarray() 2014-10-15 10:55:11 +00:00
doug
e1cb83d709 Userland reallocarray() audit.
Avoid potential integer overflow in the size argument of malloc() and
realloc() by using reallocarray() to avoid unchecked multiplication.

ok deraadt@
2014-10-11 04:24:06 +00:00
nicm
e9b259441c el_set EL_BIND or EL_SETTC must have argument lists ending with NULL.
ok tedu
2011-07-08 05:41:11 +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
martynas
363f7aca39 fix rcs ids. ok sthen@ 2009-06-21 00:38:22 +00:00
tobias
7c635cc475 typo fixed (overriden -> overridden)
ok espie, jmc
2008-11-09 12:34:46 +00:00
ray
d874cce4b1 First pass at removing clauses 3 and 4 from NetBSD licenses.
Not sure what's more surprising: how long it took for NetBSD to
catch up to the rest of the BSDs (including UCB), or the amount of
code that NetBSD has claimed for itself without attributing to the
actual authors.

OK deraadt@
2008-06-26 05:42:03 +00:00
deraadt
a9230d4e4b use asprintf() 2005-11-14 13:36:37 +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