summaryrefslogtreecommitdiffstats
path: root/lib/libedit/search.c
diff options
context:
space:
mode:
authormillert <millert@openbsd.org>1997-01-16 05:18:27 +0000
committermillert <millert@openbsd.org>1997-01-16 05:18:27 +0000
commitbabb851a03da708c23432c3b0e2db2e2d63a0ef9 (patch)
treed668950408f4b1778018080418b2f76b9aff9340 /lib/libedit/search.c
parentSpeak in English and note that editline(3) now exists. (diff)
downloadwireguard-openbsd-babb851a03da708c23432c3b0e2db2e2d63a0ef9.tar.xz
wireguard-openbsd-babb851a03da708c23432c3b0e2db2e2d63a0ef9.zip
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)
Diffstat (limited to 'lib/libedit/search.c')
-rw-r--r--lib/libedit/search.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/libedit/search.c b/lib/libedit/search.c
index 29b2f6f5234..f1c987de0bf 100644
--- a/lib/libedit/search.c
+++ b/lib/libedit/search.c
@@ -1,3 +1,5 @@
+/* $OpenBSD: search.c,v 1.2 1997/01/16 05:18:44 millert Exp $ */
+
/*-
* Copyright (c) 1992, 1993
* The Regents of the University of California. All rights reserved.
@@ -35,7 +37,11 @@
*/
#if !defined(lint) && !defined(SCCSID)
+#if 0
static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93";
+#else
+static char rcsid[] = "$OpenBSD: search.c,v 1.2 1997/01/16 05:18:44 millert Exp $";
+#endif
#endif /* not lint && not SCCSID */
/*
@@ -464,7 +470,8 @@ cv_search(el, dir)
(void) strcpy(tmpbuf, el->el_search.patbuf);
el->el_search.patbuf[0] = '.';
el->el_search.patbuf[1] = '*';
- (void) strcpy(&el->el_search.patbuf[2], tmpbuf);
+ (void) strncpy(&el->el_search.patbuf[2], tmpbuf, EL_BUFSIZ - 3);
+ el->el_search.patbuf[EL_BUFSIZ - 1] = '\0';
el->el_search.patlen++;
el->el_search.patbuf[el->el_search.patlen++] = '.';
el->el_search.patbuf[el->el_search.patlen++] = '*';