Mon Mar 30 06:54:37 2020 UTC ()
fix build error with SDEBUG, MAP_DEBUG, DEBUG_REFRESH


(ryo)
diff -r1.48 -r1.49 src/lib/libedit/common.c
diff -r1.52 -r1.53 src/lib/libedit/map.c
diff -r1.56 -r1.57 src/lib/libedit/refresh.c
diff -r1.49 -r1.50 src/lib/libedit/search.c

cvs diff -r1.48 -r1.49 src/lib/libedit/common.c (expand / switch to unified diff)

--- src/lib/libedit/common.c 2018/02/26 17:36:14 1.48
+++ src/lib/libedit/common.c 2020/03/30 06:54:37 1.49
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: common.c,v 1.48 2018/02/26 17:36:14 christos Exp $ */ 1/* $NetBSD: common.c,v 1.49 2020/03/30 06:54:37 ryo Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Christos Zoulas of Cornell University. 8 * Christos Zoulas of Cornell University.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 */ 33 */
34 34
35#include "config.h" 35#include "config.h"
36#if !defined(lint) && !defined(SCCSID) 36#if !defined(lint) && !defined(SCCSID)
37#if 0 37#if 0
38static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; 38static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93";
39#else 39#else
40__RCSID("$NetBSD: common.c,v 1.48 2018/02/26 17:36:14 christos Exp $"); 40__RCSID("$NetBSD: common.c,v 1.49 2020/03/30 06:54:37 ryo Exp $");
41#endif 41#endif
42#endif /* not lint && not SCCSID */ 42#endif /* not lint && not SCCSID */
43 43
44/* 44/*
45 * common.c: Common Editor functions 45 * common.c: Common Editor functions
46 */ 46 */
47#include <ctype.h> 47#include <ctype.h>
48#include <string.h> 48#include <string.h>
49 49
50#include "el.h" 50#include "el.h"
51#include "common.h" 51#include "common.h"
52#include "fcns.h" 52#include "fcns.h"
53#include "parse.h" 53#include "parse.h"
@@ -648,27 +648,27 @@ ed_search_prev_history(EditLine *el, win @@ -648,27 +648,27 @@ ed_search_prev_history(EditLine *el, win
648 return CC_ERROR; 648 return CC_ERROR;
649 649
650 hp = HIST_FIRST(el); 650 hp = HIST_FIRST(el);
651 if (hp == NULL) 651 if (hp == NULL)
652 return CC_ERROR; 652 return CC_ERROR;
653 653
654 c_setpat(el); /* Set search pattern !! */ 654 c_setpat(el); /* Set search pattern !! */
655 655
656 for (h = 1; h <= el->el_history.eventno; h++) 656 for (h = 1; h <= el->el_history.eventno; h++)
657 hp = HIST_NEXT(el); 657 hp = HIST_NEXT(el);
658 658
659 while (hp != NULL) { 659 while (hp != NULL) {
660#ifdef SDEBUG 660#ifdef SDEBUG
661 (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); 661 (void) fprintf(el->el_errfile, "Comparing with \"%ls\"\n", hp);
662#endif 662#endif
663 if ((wcsncmp(hp, el->el_line.buffer, (size_t) 663 if ((wcsncmp(hp, el->el_line.buffer, (size_t)
664 (el->el_line.lastchar - el->el_line.buffer)) || 664 (el->el_line.lastchar - el->el_line.buffer)) ||
665 hp[el->el_line.lastchar - el->el_line.buffer]) && 665 hp[el->el_line.lastchar - el->el_line.buffer]) &&
666 c_hmatch(el, hp)) { 666 c_hmatch(el, hp)) {
667 found = 1; 667 found = 1;
668 break; 668 break;
669 } 669 }
670 h++; 670 h++;
671 hp = HIST_NEXT(el); 671 hp = HIST_NEXT(el);
672 } 672 }
673 673
674 if (!found) { 674 if (!found) {
@@ -703,27 +703,27 @@ ed_search_next_history(EditLine *el, win @@ -703,27 +703,27 @@ ed_search_next_history(EditLine *el, win
703 return CC_ERROR; 703 return CC_ERROR;
704 704
705 if (el->el_history.ref == NULL) 705 if (el->el_history.ref == NULL)
706 return CC_ERROR; 706 return CC_ERROR;
707 707
708 hp = HIST_FIRST(el); 708 hp = HIST_FIRST(el);
709 if (hp == NULL) 709 if (hp == NULL)
710 return CC_ERROR; 710 return CC_ERROR;
711 711
712 c_setpat(el); /* Set search pattern !! */ 712 c_setpat(el); /* Set search pattern !! */
713 713
714 for (h = 1; h < el->el_history.eventno && hp; h++) { 714 for (h = 1; h < el->el_history.eventno && hp; h++) {
715#ifdef SDEBUG 715#ifdef SDEBUG
716 (void) fprintf(el->el_errfile, "Comparing with \"%s\"\n", hp); 716 (void) fprintf(el->el_errfile, "Comparing with \"%ls\"\n", hp);
717#endif 717#endif
718 if ((wcsncmp(hp, el->el_line.buffer, (size_t) 718 if ((wcsncmp(hp, el->el_line.buffer, (size_t)
719 (el->el_line.lastchar - el->el_line.buffer)) || 719 (el->el_line.lastchar - el->el_line.buffer)) ||
720 hp[el->el_line.lastchar - el->el_line.buffer]) && 720 hp[el->el_line.lastchar - el->el_line.buffer]) &&
721 c_hmatch(el, hp)) 721 c_hmatch(el, hp))
722 found = h; 722 found = h;
723 hp = HIST_NEXT(el); 723 hp = HIST_NEXT(el);
724 } 724 }
725 725
726 if (!found) { /* is it the current history number? */ 726 if (!found) { /* is it the current history number? */
727 if (!c_hmatch(el, el->el_history.buf)) { 727 if (!c_hmatch(el, el->el_history.buf)) {
728#ifdef SDEBUG 728#ifdef SDEBUG
729 (void) fprintf(el->el_errfile, "not found\n"); 729 (void) fprintf(el->el_errfile, "not found\n");

cvs diff -r1.52 -r1.53 src/lib/libedit/map.c (expand / switch to unified diff)

--- src/lib/libedit/map.c 2019/07/23 10:18:52 1.52
+++ src/lib/libedit/map.c 2020/03/30 06:54:37 1.53
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: map.c,v 1.52 2019/07/23 10:18:52 christos Exp $ */ 1/* $NetBSD: map.c,v 1.53 2020/03/30 06:54:37 ryo Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Christos Zoulas of Cornell University. 8 * Christos Zoulas of Cornell University.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 */ 33 */
34 34
35#include "config.h" 35#include "config.h"
36#if !defined(lint) && !defined(SCCSID) 36#if !defined(lint) && !defined(SCCSID)
37#if 0 37#if 0
38static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93"; 38static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93";
39#else 39#else
40__RCSID("$NetBSD: map.c,v 1.52 2019/07/23 10:18:52 christos Exp $"); 40__RCSID("$NetBSD: map.c,v 1.53 2020/03/30 06:54:37 ryo Exp $");
41#endif 41#endif
42#endif /* not lint && not SCCSID */ 42#endif /* not lint && not SCCSID */
43 43
44/* 44/*
45 * map.c: Editor function definitions 45 * map.c: Editor function definitions
46 */ 46 */
47#include <ctype.h> 47#include <ctype.h>
48#include <stdlib.h> 48#include <stdlib.h>
49#include <string.h> 49#include <string.h>
50 50
51#include "el.h" 51#include "el.h"
52#include "common.h" 52#include "common.h"
53#include "emacs.h" 53#include "emacs.h"
@@ -896,31 +896,31 @@ static const el_action_t el_map_vi_comma @@ -896,31 +896,31 @@ static const el_action_t el_map_vi_comma
896 896
897/* map_init(): 897/* map_init():
898 * Initialize and allocate the maps 898 * Initialize and allocate the maps
899 */ 899 */
900libedit_private int 900libedit_private int
901map_init(EditLine *el) 901map_init(EditLine *el)
902{ 902{
903 903
904 /* 904 /*
905 * Make sure those are correct before starting. 905 * Make sure those are correct before starting.
906 */ 906 */
907#ifdef MAP_DEBUG 907#ifdef MAP_DEBUG
908 if (sizeof(el_map_emacs) != N_KEYS * sizeof(el_action_t)) 908 if (sizeof(el_map_emacs) != N_KEYS * sizeof(el_action_t))
909 EL_ABORT((el->errfile, "Emacs map incorrect\n")); 909 EL_ABORT((el->el_errfile, "Emacs map incorrect\n"));
910 if (sizeof(el_map_vi_command) != N_KEYS * sizeof(el_action_t)) 910 if (sizeof(el_map_vi_command) != N_KEYS * sizeof(el_action_t))
911 EL_ABORT((el->errfile, "Vi command map incorrect\n")); 911 EL_ABORT((el->el_errfile, "Vi command map incorrect\n"));
912 if (sizeof(el_map_vi_insert) != N_KEYS * sizeof(el_action_t)) 912 if (sizeof(el_map_vi_insert) != N_KEYS * sizeof(el_action_t))
913 EL_ABORT((el->errfile, "Vi insert map incorrect\n")); 913 EL_ABORT((el->el_errfile, "Vi insert map incorrect\n"));
914#endif 914#endif
915 915
916 el->el_map.alt = el_calloc(N_KEYS, sizeof(*el->el_map.alt)); 916 el->el_map.alt = el_calloc(N_KEYS, sizeof(*el->el_map.alt));
917 if (el->el_map.alt == NULL) 917 if (el->el_map.alt == NULL)
918 return -1; 918 return -1;
919 el->el_map.key = el_calloc(N_KEYS, sizeof(*el->el_map.key)); 919 el->el_map.key = el_calloc(N_KEYS, sizeof(*el->el_map.key));
920 if (el->el_map.key == NULL) 920 if (el->el_map.key == NULL)
921 return -1; 921 return -1;
922 el->el_map.emacs = el_map_emacs; 922 el->el_map.emacs = el_map_emacs;
923 el->el_map.vic = el_map_vi_command; 923 el->el_map.vic = el_map_vi_command;
924 el->el_map.vii = el_map_vi_insert; 924 el->el_map.vii = el_map_vi_insert;
925 el->el_map.help = el_calloc(EL_NUM_FCNS, sizeof(*el->el_map.help)); 925 el->el_map.help = el_calloc(EL_NUM_FCNS, sizeof(*el->el_map.help));
926 if (el->el_map.help == NULL) 926 if (el->el_map.help == NULL)

cvs diff -r1.56 -r1.57 src/lib/libedit/refresh.c (expand / switch to unified diff)

--- src/lib/libedit/refresh.c 2019/01/04 03:03:44 1.56
+++ src/lib/libedit/refresh.c 2020/03/30 06:54:37 1.57
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: refresh.c,v 1.56 2019/01/04 03:03:44 uwe Exp $ */ 1/* $NetBSD: refresh.c,v 1.57 2020/03/30 06:54:37 ryo Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Christos Zoulas of Cornell University. 8 * Christos Zoulas of Cornell University.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,34 +27,35 @@ @@ -27,34 +27,35 @@
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 */ 33 */
34 34
35#include "config.h" 35#include "config.h"
36#if !defined(lint) && !defined(SCCSID) 36#if !defined(lint) && !defined(SCCSID)
37#if 0 37#if 0
38static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; 38static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93";
39#else 39#else
40__RCSID("$NetBSD: refresh.c,v 1.56 2019/01/04 03:03:44 uwe Exp $"); 40__RCSID("$NetBSD: refresh.c,v 1.57 2020/03/30 06:54:37 ryo Exp $");
41#endif 41#endif
42#endif /* not lint && not SCCSID */ 42#endif /* not lint && not SCCSID */
43 43
44/* 44/*
45 * refresh.c: Lower level screen refreshing functions 45 * refresh.c: Lower level screen refreshing functions
46 */ 46 */
47#include <stdio.h> 47#include <stdio.h>
 48#include <stdlib.h>
48#include <string.h> 49#include <string.h>
49#include <unistd.h> 50#include <unistd.h>
50 51
51#include "el.h" 52#include "el.h"
52 53
53static void re_nextline(EditLine *); 54static void re_nextline(EditLine *);
54static void re_addc(EditLine *, wint_t); 55static void re_addc(EditLine *, wint_t);
55static void re_update_line(EditLine *, wchar_t *, wchar_t *, int); 56static void re_update_line(EditLine *, wchar_t *, wchar_t *, int);
56static void re_insert (EditLine *, wchar_t *, int, int, wchar_t *, int); 57static void re_insert (EditLine *, wchar_t *, int, int, wchar_t *, int);
57static void re_delete(EditLine *, wchar_t *, int, int, int); 58static void re_delete(EditLine *, wchar_t *, int, int, int);
58static void re_fastputc(EditLine *, wint_t); 59static void re_fastputc(EditLine *, wint_t);
59static void re_clear_eol(EditLine *, int, int, int); 60static void re_clear_eol(EditLine *, int, int, int);
60static void re__strncopy(wchar_t *, wchar_t *, size_t); 61static void re__strncopy(wchar_t *, wchar_t *, size_t);

cvs diff -r1.49 -r1.50 src/lib/libedit/search.c (expand / switch to unified diff)

--- src/lib/libedit/search.c 2019/07/23 10:18:52 1.49
+++ src/lib/libedit/search.c 2020/03/30 06:54:37 1.50
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: search.c,v 1.49 2019/07/23 10:18:52 christos Exp $ */ 1/* $NetBSD: search.c,v 1.50 2020/03/30 06:54:37 ryo Exp $ */
2 2
3/*- 3/*-
4 * Copyright (c) 1992, 1993 4 * Copyright (c) 1992, 1993
5 * The Regents of the University of California. All rights reserved. 5 * The Regents of the University of California. All rights reserved.
6 * 6 *
7 * This code is derived from software contributed to Berkeley by 7 * This code is derived from software contributed to Berkeley by
8 * Christos Zoulas of Cornell University. 8 * Christos Zoulas of Cornell University.
9 * 9 *
10 * Redistribution and use in source and binary forms, with or without 10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions 11 * modification, are permitted provided that the following conditions
12 * are met: 12 * are met:
13 * 1. Redistributions of source code must retain the above copyright 13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer. 14 * notice, this list of conditions and the following disclaimer.
@@ -27,27 +27,27 @@ @@ -27,27 +27,27 @@
27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 27 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 28 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 29 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 30 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 31 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
32 * SUCH DAMAGE. 32 * SUCH DAMAGE.
33 */ 33 */
34 34
35#include "config.h" 35#include "config.h"
36#if !defined(lint) && !defined(SCCSID) 36#if !defined(lint) && !defined(SCCSID)
37#if 0 37#if 0
38static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93"; 38static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93";
39#else 39#else
40__RCSID("$NetBSD: search.c,v 1.49 2019/07/23 10:18:52 christos Exp $"); 40__RCSID("$NetBSD: search.c,v 1.50 2020/03/30 06:54:37 ryo Exp $");
41#endif 41#endif
42#endif /* not lint && not SCCSID */ 42#endif /* not lint && not SCCSID */
43 43
44/* 44/*
45 * search.c: History and character search functions 45 * search.c: History and character search functions
46 */ 46 */
47#include <stdlib.h> 47#include <stdlib.h>
48#include <string.h> 48#include <string.h>
49#if defined(REGEX) 49#if defined(REGEX)
50#include <regex.h> 50#include <regex.h>
51#elif defined(REGEXP) 51#elif defined(REGEXP)
52#include <regexp.h> 52#include <regexp.h>
53#endif 53#endif
@@ -152,27 +152,27 @@ el_match(const wchar_t *str, const wchar @@ -152,27 +152,27 @@ el_match(const wchar_t *str, const wchar
152 else 152 else
153 return re_exec(ct_encode_string(str, &conv)) == 1; 153 return re_exec(ct_encode_string(str, &conv)) == 1;
154#endif 154#endif
155} 155}
156 156
157 157
158/* c_hmatch(): 158/* c_hmatch():
159 * return True if the pattern matches the prefix 159 * return True if the pattern matches the prefix
160 */ 160 */
161libedit_private int 161libedit_private int
162c_hmatch(EditLine *el, const wchar_t *str) 162c_hmatch(EditLine *el, const wchar_t *str)
163{ 163{
164#ifdef SDEBUG 164#ifdef SDEBUG
165 (void) fprintf(el->el_errfile, "match `%s' with `%s'\n", 165 (void) fprintf(el->el_errfile, "match `%ls' with `%ls'\n",
166 el->el_search.patbuf, str); 166 el->el_search.patbuf, str);
167#endif /* SDEBUG */ 167#endif /* SDEBUG */
168 168
169 return el_match(str, el->el_search.patbuf); 169 return el_match(str, el->el_search.patbuf);
170} 170}
171 171
172 172
173/* c_setpat(): 173/* c_setpat():
174 * Set the history seatch pattern 174 * Set the history seatch pattern
175 */ 175 */
176libedit_private void 176libedit_private void
177c_setpat(EditLine *el) 177c_setpat(EditLine *el)
178{ 178{
@@ -182,30 +182,30 @@ c_setpat(EditLine *el) @@ -182,30 +182,30 @@ c_setpat(EditLine *el)
182 (size_t)(EL_CURSOR(el) - el->el_line.buffer); 182 (size_t)(EL_CURSOR(el) - el->el_line.buffer);
183 if (el->el_search.patlen >= EL_BUFSIZ) 183 if (el->el_search.patlen >= EL_BUFSIZ)
184 el->el_search.patlen = EL_BUFSIZ - 1; 184 el->el_search.patlen = EL_BUFSIZ - 1;
185 if (el->el_search.patlen != 0) { 185 if (el->el_search.patlen != 0) {
186 (void) wcsncpy(el->el_search.patbuf, el->el_line.buffer, 186 (void) wcsncpy(el->el_search.patbuf, el->el_line.buffer,
187 el->el_search.patlen); 187 el->el_search.patlen);
188 el->el_search.patbuf[el->el_search.patlen] = '\0'; 188 el->el_search.patbuf[el->el_search.patlen] = '\0';
189 } else 189 } else
190 el->el_search.patlen = wcslen(el->el_search.patbuf); 190 el->el_search.patlen = wcslen(el->el_search.patbuf);
191 } 191 }
192#ifdef SDEBUG 192#ifdef SDEBUG
193 (void) fprintf(el->el_errfile, "\neventno = %d\n", 193 (void) fprintf(el->el_errfile, "\neventno = %d\n",
194 el->el_history.eventno); 194 el->el_history.eventno);
195 (void) fprintf(el->el_errfile, "patlen = %d\n", el->el_search.patlen); 195 (void) fprintf(el->el_errfile, "patlen = %ld\n", el->el_search.patlen);
196 (void) fprintf(el->el_errfile, "patbuf = \"%s\"\n", 196 (void) fprintf(el->el_errfile, "patbuf = \"%ls\"\n",
197 el->el_search.patbuf); 197 el->el_search.patbuf);
198 (void) fprintf(el->el_errfile, "cursor %d lastchar %d\n", 198 (void) fprintf(el->el_errfile, "cursor %ld lastchar %ld\n",
199 EL_CURSOR(el) - el->el_line.buffer, 199 EL_CURSOR(el) - el->el_line.buffer,
200 el->el_line.lastchar - el->el_line.buffer); 200 el->el_line.lastchar - el->el_line.buffer);
201#endif 201#endif
202} 202}
203 203
204 204
205/* ce_inc_search(): 205/* ce_inc_search():
206 * Emacs incremental search 206 * Emacs incremental search
207 */ 207 */
208libedit_private el_action_t 208libedit_private el_action_t
209ce_inc_search(EditLine *el, int dir) 209ce_inc_search(EditLine *el, int dir)
210{ 210{
211 static const wchar_t STRfwd[] = L"fwd", STRbck[] = L"bck"; 211 static const wchar_t STRfwd[] = L"fwd", STRbck[] = L"bck";
@@ -563,28 +563,29 @@ ce_search_line(EditLine *el, int dir) @@ -563,28 +563,29 @@ ce_search_line(EditLine *el, int dir)
563 return CC_ERROR; 563 return CC_ERROR;
564 } 564 }
565} 565}
566 566
567 567
568/* cv_repeat_srch(): 568/* cv_repeat_srch():
569 * Vi repeat search 569 * Vi repeat search
570 */ 570 */
571libedit_private el_action_t 571libedit_private el_action_t
572cv_repeat_srch(EditLine *el, wint_t c) 572cv_repeat_srch(EditLine *el, wint_t c)
573{ 573{
574 574
575#ifdef SDEBUG 575#ifdef SDEBUG
576 (void) fprintf(el->el_errfile, "dir %d patlen %d patbuf %s\n", 576 static ct_buffer_t conv;
577 c, el->el_search.patlen, ct_encode_string(el->el_search.patbuf)); 577 (void) fprintf(el->el_errfile, "dir %d patlen %ld patbuf %s\n",
 578 c, el->el_search.patlen, ct_encode_string(el->el_search.patbuf, &conv));
578#endif 579#endif
579 580
580 el->el_state.lastcmd = (el_action_t) c; /* Hack to stop c_setpat */ 581 el->el_state.lastcmd = (el_action_t) c; /* Hack to stop c_setpat */
581 el->el_line.lastchar = el->el_line.buffer; 582 el->el_line.lastchar = el->el_line.buffer;
582 583
583 switch (c) { 584 switch (c) {
584 case ED_SEARCH_NEXT_HISTORY: 585 case ED_SEARCH_NEXT_HISTORY:
585 return ed_search_next_history(el, 0); 586 return ed_search_next_history(el, 0);
586 case ED_SEARCH_PREV_HISTORY: 587 case ED_SEARCH_PREV_HISTORY:
587 return ed_search_prev_history(el, 0); 588 return ed_search_prev_history(el, 0);
588 default: 589 default:
589 return CC_ERROR; 590 return CC_ERROR;
590 } 591 }