- fix unused params - unconditionalize vis.hdiff -r1.27 -r1.28 src/lib/libedit/common.c
(christos)
--- src/lib/libedit/common.c 2011/07/29 15:20:39 1.27
+++ src/lib/libedit/common.c 2011/07/29 20:58:07 1.28
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: common.c,v 1.27 2011/07/29 15:20:39 christos Exp $ */ | 1 | /* $NetBSD: common.c,v 1.28 2011/07/29 20:58:07 christos 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 | |
38 | static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; | 38 | static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; | |
39 | #else | 39 | #else | |
40 | __RCSID("$NetBSD: common.c,v 1.27 2011/07/29 15:20:39 christos Exp $"); | 40 | __RCSID("$NetBSD: common.c,v 1.28 2011/07/29 20:58:07 christos 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 "el.h" | 47 | #include "el.h" | |
48 | 48 | |||
49 | /* ed_end_of_file(): | 49 | /* ed_end_of_file(): | |
50 | * Indicate end of file | 50 | * Indicate end of file | |
51 | * [^D] | 51 | * [^D] | |
52 | */ | 52 | */ | |
53 | protected el_action_t | 53 | protected el_action_t | |
@@ -127,27 +127,27 @@ ed_delete_prev_word(EditLine *el, Int c | @@ -127,27 +127,27 @@ ed_delete_prev_word(EditLine *el, Int c | |||
127 | el->el_line.cursor = cp; | 127 | el->el_line.cursor = cp; | |
128 | if (el->el_line.cursor < el->el_line.buffer) | 128 | if (el->el_line.cursor < el->el_line.buffer) | |
129 | el->el_line.cursor = el->el_line.buffer; /* bounds check */ | 129 | el->el_line.cursor = el->el_line.buffer; /* bounds check */ | |
130 | return CC_REFRESH; | 130 | return CC_REFRESH; | |
131 | } | 131 | } | |
132 | 132 | |||
133 | 133 | |||
134 | /* ed_delete_next_char(): | 134 | /* ed_delete_next_char(): | |
135 | * Delete character under cursor | 135 | * Delete character under cursor | |
136 | * [^D] [x] | 136 | * [^D] [x] | |
137 | */ | 137 | */ | |
138 | protected el_action_t | 138 | protected el_action_t | |
139 | /*ARGSUSED*/ | 139 | /*ARGSUSED*/ | |
140 | ed_delete_next_char(EditLine *el, Int c) | 140 | ed_delete_next_char(EditLine *el, Int c __attribute__((__unused__))) | |
141 | { | 141 | { | |
142 | #ifdef DEBUG_EDIT | 142 | #ifdef DEBUG_EDIT | |
143 | #define EL el->el_line | 143 | #define EL el->el_line | |
144 | (void) fprintf(el->el_errlfile, | 144 | (void) fprintf(el->el_errlfile, | |
145 | "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", | 145 | "\nD(b: %x(%s) c: %x(%s) last: %x(%s) limit: %x(%s)\n", | |
146 | EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar, | 146 | EL.buffer, EL.buffer, EL.cursor, EL.cursor, EL.lastchar, | |
147 | EL.lastchar, EL.limit, EL.limit); | 147 | EL.lastchar, EL.limit, EL.limit); | |
148 | #endif | 148 | #endif | |
149 | if (el->el_line.cursor == el->el_line.lastchar) { | 149 | if (el->el_line.cursor == el->el_line.lastchar) { | |
150 | /* if I'm at the end */ | 150 | /* if I'm at the end */ | |
151 | if (el->el_map.type == MAP_VI) { | 151 | if (el->el_map.type == MAP_VI) { | |
152 | if (el->el_line.cursor == el->el_line.buffer) { | 152 | if (el->el_line.cursor == el->el_line.buffer) { | |
153 | /* if I'm also at the beginning */ | 153 | /* if I'm also at the beginning */ | |
@@ -422,27 +422,28 @@ ed_argument_digit(EditLine *el, Int c) | @@ -422,27 +422,28 @@ ed_argument_digit(EditLine *el, Int c) | |||
422 | el->el_state.argument = c - '0'; | 422 | el->el_state.argument = c - '0'; | |
423 | el->el_state.doingarg = 1; | 423 | el->el_state.doingarg = 1; | |
424 | } | 424 | } | |
425 | return CC_ARGHACK; | 425 | return CC_ARGHACK; | |
426 | } | 426 | } | |
427 | 427 | |||
428 | 428 | |||
429 | /* ed_unassigned(): | 429 | /* ed_unassigned(): | |
430 | * Indicates unbound character | 430 | * Indicates unbound character | |
431 | * Bound to keys that are not assigned | 431 | * Bound to keys that are not assigned | |
432 | */ | 432 | */ | |
433 | protected el_action_t | 433 | protected el_action_t | |
434 | /*ARGSUSED*/ | 434 | /*ARGSUSED*/ | |
435 | ed_unassigned(EditLine *el, Int c __attribute__((__unused__))) | 435 | ed_unassigned(EditLine *el __attribute__((__unused__)), | |
436 | Int c __attribute__((__unused__))) | |||
436 | { | 437 | { | |
437 | 438 | |||
438 | return CC_ERROR; | 439 | return CC_ERROR; | |
439 | } | 440 | } | |
440 | 441 | |||
441 | 442 | |||
442 | /** | 443 | /** | |
443 | ** TTY key handling. | 444 | ** TTY key handling. | |
444 | **/ | 445 | **/ | |
445 | 446 | |||
446 | /* ed_tty_sigint(): | 447 | /* ed_tty_sigint(): | |
447 | * Tty interrupt character | 448 | * Tty interrupt character | |
448 | * [^C] | 449 | * [^C] |
--- src/lib/libedit/filecomplete.c 2011/07/29 15:16:33 1.27
+++ src/lib/libedit/filecomplete.c 2011/07/29 20:58:07 1.28
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: filecomplete.c,v 1.27 2011/07/29 15:16:33 christos Exp $ */ | 1 | /* $NetBSD: filecomplete.c,v 1.28 2011/07/29 20:58:07 christos Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jaromir Dolecek. | 8 | * by Jaromir Dolecek. | |
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. | |
@@ -21,46 +21,42 @@ | @@ -21,46 +21,42 @@ | |||
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include "config.h" | 32 | #include "config.h" | |
33 | #if !defined(lint) && !defined(SCCSID) | 33 | #if !defined(lint) && !defined(SCCSID) | |
34 | __RCSID("$NetBSD: filecomplete.c,v 1.27 2011/07/29 15:16:33 christos Exp $"); | 34 | __RCSID("$NetBSD: filecomplete.c,v 1.28 2011/07/29 20:58:07 christos Exp $"); | |
35 | #endif /* not lint && not SCCSID */ | 35 | #endif /* not lint && not SCCSID */ | |
36 | 36 | |||
37 | #include <sys/types.h> | 37 | #include <sys/types.h> | |
38 | #include <sys/stat.h> | 38 | #include <sys/stat.h> | |
39 | #include <stdio.h> | 39 | #include <stdio.h> | |
40 | #include <dirent.h> | 40 | #include <dirent.h> | |
41 | #include <string.h> | 41 | #include <string.h> | |
42 | #include <pwd.h> | 42 | #include <pwd.h> | |
43 | #include <ctype.h> | 43 | #include <ctype.h> | |
44 | #include <stdlib.h> | 44 | #include <stdlib.h> | |
45 | #include <unistd.h> | 45 | #include <unistd.h> | |
46 | #include <limits.h> | 46 | #include <limits.h> | |
47 | #include <errno.h> | 47 | #include <errno.h> | |
48 | #include <fcntl.h> | 48 | #include <fcntl.h> | |
49 | #ifdef HAVE_VIS_H | 49 | ||
50 | #include <vis.h> | |||
51 | #else | |||
52 | #include "vis.h" | |||
53 | #endif | |||
54 | #include "el.h" | 50 | #include "el.h" | |
55 | #include "fcns.h" /* for EL_NUM_FCNS */ | 51 | #include "fcns.h" /* for EL_NUM_FCNS */ | |
56 | #include "histedit.h" | 52 | #include "histedit.h" | |
57 | #include "filecomplete.h" | 53 | #include "filecomplete.h" | |
58 | 54 | |||
59 | static const Char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', | 55 | static const Char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', | |
60 | '$', '>', '<', '=', ';', '|', '&', '{', '(', '\0' }; | 56 | '$', '>', '<', '=', ';', '|', '&', '{', '(', '\0' }; | |
61 | 57 | |||
62 | 58 | |||
63 | /********************************/ | 59 | /********************************/ | |
64 | /* completion functions */ | 60 | /* completion functions */ | |
65 | 61 | |||
66 | /* | 62 | /* |
--- src/lib/libedit/history.c 2011/07/29 15:16:33 1.43
+++ src/lib/libedit/history.c 2011/07/29 20:58:07 1.44
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: history.c,v 1.43 2011/07/29 15:16:33 christos Exp $ */ | 1 | /* $NetBSD: history.c,v 1.44 2011/07/29 20:58:07 christos 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,41 +27,37 @@ | @@ -27,41 +27,37 @@ | |||
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 | |
38 | static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93"; | 38 | static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93"; | |
39 | #else | 39 | #else | |
40 | __RCSID("$NetBSD: history.c,v 1.43 2011/07/29 15:16:33 christos Exp $"); | 40 | __RCSID("$NetBSD: history.c,v 1.44 2011/07/29 20:58:07 christos Exp $"); | |
41 | #endif | 41 | #endif | |
42 | #endif /* not lint && not SCCSID */ | 42 | #endif /* not lint && not SCCSID */ | |
43 | 43 | |||
44 | /* | 44 | /* | |
45 | * hist.c: TYPE(History) access functions | 45 | * hist.c: TYPE(History) access functions | |
46 | */ | 46 | */ | |
47 | #include <string.h> | 47 | #include <string.h> | |
48 | #include <stdlib.h> | 48 | #include <stdlib.h> | |
49 | #include <stdarg.h> | 49 | #include <stdarg.h> | |
50 | #ifdef HAVE_VIS_H | |||
51 | #include <vis.h> | 50 | #include <vis.h> | |
52 | #else | |||
53 | #include "vis.h" | |||
54 | #endif | |||
55 | #include <sys/stat.h> | 51 | #include <sys/stat.h> | |
56 | 52 | |||
57 | static const char hist_cookie[] = "_HiStOrY_V2_\n"; | 53 | static const char hist_cookie[] = "_HiStOrY_V2_\n"; | |
58 | 54 | |||
59 | #include "histedit.h" | 55 | #include "histedit.h" | |
60 | #include "chartype.h" | 56 | #include "chartype.h" | |
61 | 57 | |||
62 | typedef int (*history_gfun_t)(void *, TYPE(HistEvent) *); | 58 | typedef int (*history_gfun_t)(void *, TYPE(HistEvent) *); | |
63 | typedef int (*history_efun_t)(void *, TYPE(HistEvent) *, const Char *); | 59 | typedef int (*history_efun_t)(void *, TYPE(HistEvent) *, const Char *); | |
64 | typedef void (*history_vfun_t)(void *, TYPE(HistEvent) *); | 60 | typedef void (*history_vfun_t)(void *, TYPE(HistEvent) *); | |
65 | typedef int (*history_sfun_t)(void *, TYPE(HistEvent) *, const int); | 61 | typedef int (*history_sfun_t)(void *, TYPE(HistEvent) *, const int); | |
66 | 62 | |||
67 | struct TYPE(history) { | 63 | struct TYPE(history) { |
--- src/lib/libedit/readline.c 2011/07/29 15:16:33 1.96
+++ src/lib/libedit/readline.c 2011/07/29 20:58:07 1.97
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: readline.c,v 1.96 2011/07/29 15:16:33 christos Exp $ */ | 1 | /* $NetBSD: readline.c,v 1.97 2011/07/29 20:58:07 christos Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. | 4 | * Copyright (c) 1997 The NetBSD Foundation, Inc. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * This code is derived from software contributed to The NetBSD Foundation | 7 | * This code is derived from software contributed to The NetBSD Foundation | |
8 | * by Jaromir Dolecek. | 8 | * by Jaromir Dolecek. | |
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. | |
@@ -21,47 +21,44 @@ | @@ -21,47 +21,44 @@ | |||
21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | 21 | * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR | |
22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | 22 | * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS | |
23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | 23 | * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR | |
24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 24 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 25 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 26 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 27 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 28 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
29 | * POSSIBILITY OF SUCH DAMAGE. | 29 | * POSSIBILITY OF SUCH DAMAGE. | |
30 | */ | 30 | */ | |
31 | 31 | |||
32 | #include "config.h" | 32 | #include "config.h" | |
33 | #if !defined(lint) && !defined(SCCSID) | 33 | #if !defined(lint) && !defined(SCCSID) | |
34 | __RCSID("$NetBSD: readline.c,v 1.96 2011/07/29 15:16:33 christos Exp $"); | 34 | __RCSID("$NetBSD: readline.c,v 1.97 2011/07/29 20:58:07 christos Exp $"); | |
35 | #endif /* not lint && not SCCSID */ | 35 | #endif /* not lint && not SCCSID */ | |
36 | 36 | |||
37 | #include <sys/types.h> | 37 | #include <sys/types.h> | |
38 | #include <sys/stat.h> | 38 | #include <sys/stat.h> | |
39 | #include <stdio.h> | 39 | #include <stdio.h> | |
40 | #include <dirent.h> | 40 | #include <dirent.h> | |
41 | #include <string.h> | 41 | #include <string.h> | |
42 | #include <pwd.h> | 42 | #include <pwd.h> | |
43 | #include <ctype.h> | 43 | #include <ctype.h> | |
44 | #include <stdlib.h> | 44 | #include <stdlib.h> | |
45 | #include <unistd.h> | 45 | #include <unistd.h> | |
46 | #include <limits.h> | 46 | #include <limits.h> | |
47 | #include <errno.h> | 47 | #include <errno.h> | |
48 | #include <fcntl.h> | 48 | #include <fcntl.h> | |
49 | #include <setjmp.h> | 49 | #include <setjmp.h> | |
50 | #ifdef HAVE_VIS_H | |||
51 | #include <vis.h> | 50 | #include <vis.h> | |
52 | #else | 51 | ||
53 | #include "vis.h" | |||
54 | #endif | |||
55 | #include "readline/readline.h" | 52 | #include "readline/readline.h" | |
56 | #include "el.h" | 53 | #include "el.h" | |
57 | #include "fcns.h" /* for EL_NUM_FCNS */ | 54 | #include "fcns.h" /* for EL_NUM_FCNS */ | |
58 | #include "histedit.h" | 55 | #include "histedit.h" | |
59 | #include "filecomplete.h" | 56 | #include "filecomplete.h" | |
60 | 57 | |||
61 | void rl_prep_terminal(int); | 58 | void rl_prep_terminal(int); | |
62 | void rl_deprep_terminal(void); | 59 | void rl_deprep_terminal(void); | |
63 | 60 | |||
64 | /* for rl_complete() */ | 61 | /* for rl_complete() */ | |
65 | #define TAB '\r' | 62 | #define TAB '\r' | |
66 | 63 | |||
67 | /* see comment at the #ifdef for sense of this */ | 64 | /* see comment at the #ifdef for sense of this */ | |
@@ -195,27 +192,27 @@ _move_history(int op) | @@ -195,27 +192,27 @@ _move_history(int op) | |||
195 | 192 | |||
196 | rl_he.line = ev.str; | 193 | rl_he.line = ev.str; | |
197 | rl_he.data = NULL; | 194 | rl_he.data = NULL; | |
198 | 195 | |||
199 | return &rl_he; | 196 | return &rl_he; | |
200 | } | 197 | } | |
201 | 198 | |||
202 | 199 | |||
203 | /* | 200 | /* | |
204 | * read one key from user defined input function | 201 | * read one key from user defined input function | |
205 | */ | 202 | */ | |
206 | static int | 203 | static int | |
207 | /*ARGSUSED*/ | 204 | /*ARGSUSED*/ | |
208 | _getc_function(EditLine *el, char *c) | 205 | _getc_function(EditLine *el __attribute__((__unused__)), char *c) | |
209 | { | 206 | { | |
210 | int i; | 207 | int i; | |
211 | 208 | |||
212 | i = (*rl_getc_function)(NULL); | 209 | i = (*rl_getc_function)(NULL); | |
213 | if (i == -1) | 210 | if (i == -1) | |
214 | return 0; | 211 | return 0; | |
215 | *c = i; | 212 | *c = i; | |
216 | return 1; | 213 | return 1; | |
217 | } | 214 | } | |
218 | 215 | |||
219 | static void | 216 | static void | |
220 | _resize_fun(EditLine *el, void *a) | 217 | _resize_fun(EditLine *el, void *a) | |
221 | { | 218 | { | |
@@ -1876,37 +1873,38 @@ rl_insert_text(const char *text) | @@ -1876,37 +1873,38 @@ rl_insert_text(const char *text) | |||
1876 | if (!text || *text == 0) | 1873 | if (!text || *text == 0) | |
1877 | return 0; | 1874 | return 0; | |
1878 | 1875 | |||
1879 | if (h == NULL || e == NULL) | 1876 | if (h == NULL || e == NULL) | |
1880 | rl_initialize(); | 1877 | rl_initialize(); | |
1881 | 1878 | |||
1882 | if (el_insertstr(e, text) < 0) | 1879 | if (el_insertstr(e, text) < 0) | |
1883 | return 0; | 1880 | return 0; | |
1884 | return (int)strlen(text); | 1881 | return (int)strlen(text); | |
1885 | } | 1882 | } | |
1886 | 1883 | |||
1887 | /*ARGSUSED*/ | 1884 | /*ARGSUSED*/ | |
1888 | int | 1885 | int | |
1889 | rl_newline(int count, int c) | 1886 | rl_newline(int count __attribute__((__unused__)), | |
1887 | int c __attribute__((__unused__))) | |||
1890 | { | 1888 | { | |
1891 | /* | 1889 | /* | |
1892 | * Readline-4.0 appears to ignore the args. | 1890 | * Readline-4.0 appears to ignore the args. | |
1893 | */ | 1891 | */ | |
1894 | return rl_insert(1, '\n'); | 1892 | return rl_insert(1, '\n'); | |
1895 | } | 1893 | } | |
1896 | 1894 | |||
1897 | /*ARGSUSED*/ | 1895 | /*ARGSUSED*/ | |
1898 | static unsigned char | 1896 | static unsigned char | |
1899 | rl_bind_wrapper(EditLine *el, unsigned char c) | 1897 | rl_bind_wrapper(EditLine *el __attribute__((__unused__)), unsigned char c) | |
1900 | { | 1898 | { | |
1901 | if (map[c] == NULL) | 1899 | if (map[c] == NULL) | |
1902 | return CC_ERROR; | 1900 | return CC_ERROR; | |
1903 | 1901 | |||
1904 | _rl_update_pos(); | 1902 | _rl_update_pos(); | |
1905 | 1903 | |||
1906 | (*map[c])(NULL, c); | 1904 | (*map[c])(NULL, c); | |
1907 | 1905 | |||
1908 | /* If rl_done was set by the above call, deal with it here */ | 1906 | /* If rl_done was set by the above call, deal with it here */ | |
1909 | if (rl_done) | 1907 | if (rl_done) | |
1910 | return CC_EOF; | 1908 | return CC_EOF; | |
1911 | 1909 | |||
1912 | return CC_NORM; | 1910 | return CC_NORM; | |
@@ -1981,27 +1979,27 @@ rl_redisplay(void) | @@ -1981,27 +1979,27 @@ rl_redisplay(void) | |||
1981 | int | 1979 | int | |
1982 | rl_get_previous_history(int count, int key) | 1980 | rl_get_previous_history(int count, int key) | |
1983 | { | 1981 | { | |
1984 | char a[2]; | 1982 | char a[2]; | |
1985 | a[0] = key; | 1983 | a[0] = key; | |
1986 | a[1] = '\0'; | 1984 | a[1] = '\0'; | |
1987 | while (count--) | 1985 | while (count--) | |
1988 | el_push(e, a); | 1986 | el_push(e, a); | |
1989 | return 0; | 1987 | return 0; | |
1990 | } | 1988 | } | |
1991 | 1989 | |||
1992 | void | 1990 | void | |
1993 | /*ARGSUSED*/ | 1991 | /*ARGSUSED*/ | |
1994 | rl_prep_terminal(int meta_flag) | 1992 | rl_prep_terminal(int meta_flag __attribute__((__unused__))) | |
1995 | { | 1993 | { | |
1996 | el_set(e, EL_PREP_TERM, 1); | 1994 | el_set(e, EL_PREP_TERM, 1); | |
1997 | } | 1995 | } | |
1998 | 1996 | |||
1999 | void | 1997 | void | |
2000 | rl_deprep_terminal(void) | 1998 | rl_deprep_terminal(void) | |
2001 | { | 1999 | { | |
2002 | el_set(e, EL_PREP_TERM, 0); | 2000 | el_set(e, EL_PREP_TERM, 0); | |
2003 | } | 2001 | } | |
2004 | 2002 | |||
2005 | int | 2003 | int | |
2006 | rl_read_init_file(const char *s) | 2004 | rl_read_init_file(const char *s) | |
2007 | { | 2005 | { | |
@@ -2197,59 +2195,65 @@ _rl_qsort_string_compare(char **s1, char | @@ -2197,59 +2195,65 @@ _rl_qsort_string_compare(char **s1, char | |||
2197 | HISTORY_STATE * | 2195 | HISTORY_STATE * | |
2198 | history_get_history_state(void) | 2196 | history_get_history_state(void) | |
2199 | { | 2197 | { | |
2200 | HISTORY_STATE *hs; | 2198 | HISTORY_STATE *hs; | |
2201 | 2199 | |||
2202 | if ((hs = el_malloc(sizeof(*hs))) == NULL) | 2200 | if ((hs = el_malloc(sizeof(*hs))) == NULL) | |
2203 | return NULL; | 2201 | return NULL; | |
2204 | hs->length = history_length; | 2202 | hs->length = history_length; | |
2205 | return hs; | 2203 | return hs; | |
2206 | } | 2204 | } | |
2207 | 2205 | |||
2208 | int | 2206 | int | |
2209 | /*ARGSUSED*/ | 2207 | /*ARGSUSED*/ | |
2210 | rl_kill_text(int from, int to) | 2208 | rl_kill_text(int from __attribute__((__unused__)), | |
2209 | int to __attribute__((__unused__))) | |||
2211 | { | 2210 | { | |
2212 | return 0; | 2211 | return 0; | |
2213 | } | 2212 | } | |
2214 | 2213 | |||
2215 | Keymap | 2214 | Keymap | |
2216 | rl_make_bare_keymap(void) | 2215 | rl_make_bare_keymap(void) | |
2217 | { | 2216 | { | |
2218 | return NULL; | 2217 | return NULL; | |
2219 | } | 2218 | } | |
2220 | 2219 | |||
2221 | Keymap | 2220 | Keymap | |
2222 | rl_get_keymap(void) | 2221 | rl_get_keymap(void) | |
2223 | { | 2222 | { | |
2224 | return NULL; | 2223 | return NULL; | |
2225 | } | 2224 | } | |
2226 | 2225 | |||
2227 | void | 2226 | void | |
2228 | /*ARGSUSED*/ | 2227 | /*ARGSUSED*/ | |
2229 | rl_set_keymap(Keymap k) | 2228 | rl_set_keymap(Keymap k __attribute__((__unused__))) | |
2230 | { | 2229 | { | |
2231 | } | 2230 | } | |
2232 | 2231 | |||
2233 | int | 2232 | int | |
2234 | /*ARGSUSED*/ | 2233 | /*ARGSUSED*/ | |
2235 | rl_generic_bind(int type, const char * keyseq, const char * data, Keymap k) | 2234 | rl_generic_bind(int type __attribute__((__unused__)), | |
2235 | const char * keyseq __attribute__((__unused__)), | |||
2236 | const char * data __attribute__((__unused__)), | |||
2237 | Keymap k __attribute__((__unused__))) | |||
2236 | { | 2238 | { | |
2237 | return 0; | 2239 | return 0; | |
2238 | } | 2240 | } | |
2239 | 2241 | |||
2240 | int | 2242 | int | |
2241 | /*ARGSUSED*/ | 2243 | /*ARGSUSED*/ | |
2242 | rl_bind_key_in_map(int key, rl_command_func_t *fun, Keymap k) | 2244 | rl_bind_key_in_map(int key __attribute__((__unused__)), | |
2245 | rl_command_func_t *fun __attribute__((__unused__)), | |||
2246 | Keymap k __attribute__((__unused__))) | |||
2243 | { | 2247 | { | |
2244 | return 0; | 2248 | return 0; | |
2245 | } | 2249 | } | |
2246 | 2250 | |||
2247 | /* unsupported, but needed by python */ | 2251 | /* unsupported, but needed by python */ | |
2248 | void | 2252 | void | |
2249 | rl_cleanup_after_signal(void) | 2253 | rl_cleanup_after_signal(void) | |
2250 | { | 2254 | { | |
2251 | } | 2255 | } | |
2252 | 2256 | |||
2253 | int | 2257 | int | |
2254 | rl_on_new_line(void) | 2258 | rl_on_new_line(void) | |
2255 | { | 2259 | { |
--- src/lib/libedit/vi.c 2011/07/29 15:16:33 1.37
+++ src/lib/libedit/vi.c 2011/07/29 20:58:07 1.38
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: vi.c,v 1.37 2011/07/29 15:16:33 christos Exp $ */ | 1 | /* $NetBSD: vi.c,v 1.38 2011/07/29 20:58:07 christos 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. | |
@@ -32,27 +32,27 @@ | @@ -32,27 +32,27 @@ | |||
32 | * SUCH DAMAGE. | 32 | * SUCH DAMAGE. | |
33 | */ | 33 | */ | |
34 | 34 | |||
35 | #include "config.h" | 35 | #include "config.h" | |
36 | #include <stdlib.h> | 36 | #include <stdlib.h> | |
37 | #include <unistd.h> | 37 | #include <unistd.h> | |
38 | #include <limits.h> | 38 | #include <limits.h> | |
39 | #include <sys/wait.h> | 39 | #include <sys/wait.h> | |
40 | 40 | |||
41 | #if !defined(lint) && !defined(SCCSID) | 41 | #if !defined(lint) && !defined(SCCSID) | |
42 | #if 0 | 42 | #if 0 | |
43 | static char sccsid[] = "@(#)vi.c 8.1 (Berkeley) 6/4/93"; | 43 | static char sccsid[] = "@(#)vi.c 8.1 (Berkeley) 6/4/93"; | |
44 | #else | 44 | #else | |
45 | __RCSID("$NetBSD: vi.c,v 1.37 2011/07/29 15:16:33 christos Exp $"); | 45 | __RCSID("$NetBSD: vi.c,v 1.38 2011/07/29 20:58:07 christos Exp $"); | |
46 | #endif | 46 | #endif | |
47 | #endif /* not lint && not SCCSID */ | 47 | #endif /* not lint && not SCCSID */ | |
48 | 48 | |||
49 | /* | 49 | /* | |
50 | * vi.c: Vi mode commands. | 50 | * vi.c: Vi mode commands. | |
51 | */ | 51 | */ | |
52 | #include "el.h" | 52 | #include "el.h" | |
53 | 53 | |||
54 | private el_action_t cv_action(EditLine *, Int); | 54 | private el_action_t cv_action(EditLine *, Int); | |
55 | private el_action_t cv_paste(EditLine *, Int); | 55 | private el_action_t cv_paste(EditLine *, Int); | |
56 | 56 | |||
57 | /* cv_action(): | 57 | /* cv_action(): | |
58 | * Handle vi actions. | 58 | * Handle vi actions. | |
@@ -455,27 +455,27 @@ protected el_action_t | @@ -455,27 +455,27 @@ protected el_action_t | |||
455 | vi_delete_meta(EditLine *el, Int c __attribute__((__unused__))) | 455 | vi_delete_meta(EditLine *el, Int c __attribute__((__unused__))) | |
456 | { | 456 | { | |
457 | 457 | |||
458 | return cv_action(el, DELETE); | 458 | return cv_action(el, DELETE); | |
459 | } | 459 | } | |
460 | 460 | |||
461 | 461 | |||
462 | /* vi_end_big_word(): | 462 | /* vi_end_big_word(): | |
463 | * Vi move to the end of the current space delimited word | 463 | * Vi move to the end of the current space delimited word | |
464 | * [E] | 464 | * [E] | |
465 | */ | 465 | */ | |
466 | protected el_action_t | 466 | protected el_action_t | |
467 | /*ARGSUSED*/ | 467 | /*ARGSUSED*/ | |
468 | vi_end_big_word(EditLine *el, Int c) | 468 | vi_end_big_word(EditLine *el, Int c __attribute__((__unused__))) | |
469 | { | 469 | { | |
470 | 470 | |||
471 | if (el->el_line.cursor == el->el_line.lastchar) | 471 | if (el->el_line.cursor == el->el_line.lastchar) | |
472 | return CC_ERROR; | 472 | return CC_ERROR; | |
473 | 473 | |||
474 | el->el_line.cursor = cv__endword(el->el_line.cursor, | 474 | el->el_line.cursor = cv__endword(el->el_line.cursor, | |
475 | el->el_line.lastchar, el->el_state.argument, cv__isWord); | 475 | el->el_line.lastchar, el->el_state.argument, cv__isWord); | |
476 | 476 | |||
477 | if (el->el_chared.c_vcmd.action != NOP) { | 477 | if (el->el_chared.c_vcmd.action != NOP) { | |
478 | el->el_line.cursor++; | 478 | el->el_line.cursor++; | |
479 | cv_delfini(el); | 479 | cv_delfini(el); | |
480 | return CC_REFRESH; | 480 | return CC_REFRESH; | |
481 | } | 481 | } | |
@@ -791,27 +791,27 @@ vi_repeat_prev_char(EditLine *el, Int c | @@ -791,27 +791,27 @@ vi_repeat_prev_char(EditLine *el, Int c | |||
791 | r = cv_csearch(el, -dir, el->el_search.chacha, | 791 | r = cv_csearch(el, -dir, el->el_search.chacha, | |
792 | el->el_state.argument, el->el_search.chatflg); | 792 | el->el_state.argument, el->el_search.chatflg); | |
793 | el->el_search.chadir = dir; | 793 | el->el_search.chadir = dir; | |
794 | return r; | 794 | return r; | |
795 | } | 795 | } | |
796 | 796 | |||
797 | 797 | |||
798 | /* vi_match(): | 798 | /* vi_match(): | |
799 | * Vi go to matching () {} or [] | 799 | * Vi go to matching () {} or [] | |
800 | * [%] | 800 | * [%] | |
801 | */ | 801 | */ | |
802 | protected el_action_t | 802 | protected el_action_t | |
803 | /*ARGSUSED*/ | 803 | /*ARGSUSED*/ | |
804 | vi_match(EditLine *el, Int c) | 804 | vi_match(EditLine *el, Int c __attribute__((__unused__))) | |
805 | { | 805 | { | |
806 | const Char match_chars[] = STR("()[]{}"); | 806 | const Char match_chars[] = STR("()[]{}"); | |
807 | Char *cp; | 807 | Char *cp; | |
808 | size_t delta, i, count; | 808 | size_t delta, i, count; | |
809 | Char o_ch, c_ch; | 809 | Char o_ch, c_ch; | |
810 | 810 | |||
811 | *el->el_line.lastchar = '\0'; /* just in case */ | 811 | *el->el_line.lastchar = '\0'; /* just in case */ | |
812 | 812 | |||
813 | i = Strcspn(el->el_line.cursor, match_chars); | 813 | i = Strcspn(el->el_line.cursor, match_chars); | |
814 | o_ch = el->el_line.cursor[i]; | 814 | o_ch = el->el_line.cursor[i]; | |
815 | if (o_ch == 0) | 815 | if (o_ch == 0) | |
816 | return CC_ERROR; | 816 | return CC_ERROR; | |
817 | delta = Strchr(match_chars, o_ch) - match_chars; | 817 | delta = Strchr(match_chars, o_ch) - match_chars; | |
@@ -838,103 +838,103 @@ vi_match(EditLine *el, Int c) | @@ -838,103 +838,103 @@ vi_match(EditLine *el, Int c) | |||
838 | el->el_line.cursor++; | 838 | el->el_line.cursor++; | |
839 | cv_delfini(el); | 839 | cv_delfini(el); | |
840 | return CC_REFRESH; | 840 | return CC_REFRESH; | |
841 | } | 841 | } | |
842 | return CC_CURSOR; | 842 | return CC_CURSOR; | |
843 | } | 843 | } | |
844 | 844 | |||
845 | /* vi_undo_line(): | 845 | /* vi_undo_line(): | |
846 | * Vi undo all changes to line | 846 | * Vi undo all changes to line | |
847 | * [U] | 847 | * [U] | |
848 | */ | 848 | */ | |
849 | protected el_action_t | 849 | protected el_action_t | |
850 | /*ARGSUSED*/ | 850 | /*ARGSUSED*/ | |
851 | vi_undo_line(EditLine *el, Int c) | 851 | vi_undo_line(EditLine *el, Int c __attribute__((__unused__))) | |
852 | { | 852 | { | |
853 | 853 | |||
854 | cv_undo(el); | 854 | cv_undo(el); | |
855 | return hist_get(el); | 855 | return hist_get(el); | |
856 | } | 856 | } | |
857 | 857 | |||
858 | /* vi_to_column(): | 858 | /* vi_to_column(): | |
859 | * Vi go to specified column | 859 | * Vi go to specified column | |
860 | * [|] | 860 | * [|] | |
861 | * NB netbsd vi goes to screen column 'n', posix says nth character | 861 | * NB netbsd vi goes to screen column 'n', posix says nth character | |
862 | */ | 862 | */ | |
863 | protected el_action_t | 863 | protected el_action_t | |
864 | /*ARGSUSED*/ | 864 | /*ARGSUSED*/ | |
865 | vi_to_column(EditLine *el, Int c) | 865 | vi_to_column(EditLine *el, Int c __attribute__((__unused__))) | |
866 | { | 866 | { | |
867 | 867 | |||
868 | el->el_line.cursor = el->el_line.buffer; | 868 | el->el_line.cursor = el->el_line.buffer; | |
869 | el->el_state.argument--; | 869 | el->el_state.argument--; | |
870 | return ed_next_char(el, 0); | 870 | return ed_next_char(el, 0); | |
871 | } | 871 | } | |
872 | 872 | |||
873 | /* vi_yank_end(): | 873 | /* vi_yank_end(): | |
874 | * Vi yank to end of line | 874 | * Vi yank to end of line | |
875 | * [Y] | 875 | * [Y] | |
876 | */ | 876 | */ | |
877 | protected el_action_t | 877 | protected el_action_t | |
878 | /*ARGSUSED*/ | 878 | /*ARGSUSED*/ | |
879 | vi_yank_end(EditLine *el, Int c) | 879 | vi_yank_end(EditLine *el, Int c __attribute__((__unused__))) | |
880 | { | 880 | { | |
881 | 881 | |||
882 | cv_yank(el, el->el_line.cursor, | 882 | cv_yank(el, el->el_line.cursor, | |
883 | (int)(el->el_line.lastchar - el->el_line.cursor)); | 883 | (int)(el->el_line.lastchar - el->el_line.cursor)); | |
884 | return CC_REFRESH; | 884 | return CC_REFRESH; | |
885 | } | 885 | } | |
886 | 886 | |||
887 | /* vi_yank(): | 887 | /* vi_yank(): | |
888 | * Vi yank | 888 | * Vi yank | |
889 | * [y] | 889 | * [y] | |
890 | */ | 890 | */ | |
891 | protected el_action_t | 891 | protected el_action_t | |
892 | /*ARGSUSED*/ | 892 | /*ARGSUSED*/ | |
893 | vi_yank(EditLine *el, Int c) | 893 | vi_yank(EditLine *el, Int c __attribute__((__unused__))) | |
894 | { | 894 | { | |
895 | 895 | |||
896 | return cv_action(el, YANK); | 896 | return cv_action(el, YANK); | |
897 | } | 897 | } | |
898 | 898 | |||
899 | /* vi_comment_out(): | 899 | /* vi_comment_out(): | |
900 | * Vi comment out current command | 900 | * Vi comment out current command | |
901 | * [#] | 901 | * [#] | |
902 | */ | 902 | */ | |
903 | protected el_action_t | 903 | protected el_action_t | |
904 | /*ARGSUSED*/ | 904 | /*ARGSUSED*/ | |
905 | vi_comment_out(EditLine *el, Int c) | 905 | vi_comment_out(EditLine *el, Int c __attribute__((__unused__))) | |
906 | { | 906 | { | |
907 | 907 | |||
908 | el->el_line.cursor = el->el_line.buffer; | 908 | el->el_line.cursor = el->el_line.buffer; | |
909 | c_insert(el, 1); | 909 | c_insert(el, 1); | |
910 | *el->el_line.cursor = '#'; | 910 | *el->el_line.cursor = '#'; | |
911 | re_refresh(el); | 911 | re_refresh(el); | |
912 | return ed_newline(el, 0); | 912 | return ed_newline(el, 0); | |
913 | } | 913 | } | |
914 | 914 | |||
915 | /* vi_alias(): | 915 | /* vi_alias(): | |
916 | * Vi include shell alias | 916 | * Vi include shell alias | |
917 | * [@] | 917 | * [@] | |
918 | * NB: posix implies that we should enter insert mode, however | 918 | * NB: posix implies that we should enter insert mode, however | |
919 | * this is against historical precedent... | 919 | * this is against historical precedent... | |
920 | */ | 920 | */ | |
921 | #ifdef __weak_reference | 921 | #ifdef __weak_reference | |
922 | __weakref_visible char *my_get_alias_text(const char *) | 922 | __weakref_visible char *my_get_alias_text(const char *) | |
923 | __weak_reference(get_alias_text); | 923 | __weak_reference(get_alias_text); | |
924 | #endif | 924 | #endif | |
925 | protected el_action_t | 925 | protected el_action_t | |
926 | /*ARGSUSED*/ | 926 | /*ARGSUSED*/ | |
927 | vi_alias(EditLine *el, Int c) | 927 | vi_alias(EditLine *el, Int c __attribute__((__unused__))) | |
928 | { | 928 | { | |
929 | #ifdef __weak_reference | 929 | #ifdef __weak_reference | |
930 | char alias_name[3]; | 930 | char alias_name[3]; | |
931 | char *alias_text; | 931 | char *alias_text; | |
932 | 932 | |||
933 | if (my_get_alias_text == 0) { | 933 | if (my_get_alias_text == 0) { | |
934 | return CC_ERROR; | 934 | return CC_ERROR; | |
935 | } | 935 | } | |
936 | 936 | |||
937 | alias_name[0] = '_'; | 937 | alias_name[0] = '_'; | |
938 | alias_name[2] = 0; | 938 | alias_name[2] = 0; | |
939 | if (el_getc(el, &alias_name[1]) != 1) | 939 | if (el_getc(el, &alias_name[1]) != 1) | |
940 | return CC_ERROR; | 940 | return CC_ERROR; | |
@@ -944,27 +944,27 @@ vi_alias(EditLine *el, Int c) | @@ -944,27 +944,27 @@ vi_alias(EditLine *el, Int c) | |||
944 | FUN(el,push)(el, ct_decode_string(alias_text, &el->el_scratch)); | 944 | FUN(el,push)(el, ct_decode_string(alias_text, &el->el_scratch)); | |
945 | return CC_NORM; | 945 | return CC_NORM; | |
946 | #else | 946 | #else | |
947 | return CC_ERROR; | 947 | return CC_ERROR; | |
948 | #endif | 948 | #endif | |
949 | } | 949 | } | |
950 | 950 | |||
951 | /* vi_to_history_line(): | 951 | /* vi_to_history_line(): | |
952 | * Vi go to specified history file line. | 952 | * Vi go to specified history file line. | |
953 | * [G] | 953 | * [G] | |
954 | */ | 954 | */ | |
955 | protected el_action_t | 955 | protected el_action_t | |
956 | /*ARGSUSED*/ | 956 | /*ARGSUSED*/ | |
957 | vi_to_history_line(EditLine *el, Int c) | 957 | vi_to_history_line(EditLine *el, Int c __attribute__((__unused__))) | |
958 | { | 958 | { | |
959 | int sv_event_no = el->el_history.eventno; | 959 | int sv_event_no = el->el_history.eventno; | |
960 | el_action_t rval; | 960 | el_action_t rval; | |
961 | 961 | |||
962 | 962 | |||
963 | if (el->el_history.eventno == 0) { | 963 | if (el->el_history.eventno == 0) { | |
964 | (void) Strncpy(el->el_history.buf, el->el_line.buffer, | 964 | (void) Strncpy(el->el_history.buf, el->el_line.buffer, | |
965 | EL_BUFSIZ); | 965 | EL_BUFSIZ); | |
966 | el->el_history.last = el->el_history.buf + | 966 | el->el_history.last = el->el_history.buf + | |
967 | (el->el_line.lastchar - el->el_line.buffer); | 967 | (el->el_line.lastchar - el->el_line.buffer); | |
968 | } | 968 | } | |
969 | 969 | |||
970 | /* Lack of a 'count' means oldest, not 1 */ | 970 | /* Lack of a 'count' means oldest, not 1 */ | |
@@ -989,27 +989,27 @@ vi_to_history_line(EditLine *el, Int c) | @@ -989,27 +989,27 @@ vi_to_history_line(EditLine *el, Int c) | |||
989 | } | 989 | } | |
990 | rval = hist_get(el); | 990 | rval = hist_get(el); | |
991 | if (rval == CC_ERROR) | 991 | if (rval == CC_ERROR) | |
992 | el->el_history.eventno = sv_event_no; | 992 | el->el_history.eventno = sv_event_no; | |
993 | return rval; | 993 | return rval; | |
994 | } | 994 | } | |
995 | 995 | |||
996 | /* vi_histedit(): | 996 | /* vi_histedit(): | |
997 | * Vi edit history line with vi | 997 | * Vi edit history line with vi | |
998 | * [v] | 998 | * [v] | |
999 | */ | 999 | */ | |
1000 | protected el_action_t | 1000 | protected el_action_t | |
1001 | /*ARGSUSED*/ | 1001 | /*ARGSUSED*/ | |
1002 | vi_histedit(EditLine *el, Int c) | 1002 | vi_histedit(EditLine *el, Int c __attribute__((__unused__))) | |
1003 | { | 1003 | { | |
1004 | int fd; | 1004 | int fd; | |
1005 | pid_t pid; | 1005 | pid_t pid; | |
1006 | ssize_t st; | 1006 | ssize_t st; | |
1007 | int status; | 1007 | int status; | |
1008 | char tempfile[] = "/tmp/histedit.XXXXXXXXXX"; | 1008 | char tempfile[] = "/tmp/histedit.XXXXXXXXXX"; | |
1009 | char *cp; | 1009 | char *cp; | |
1010 | size_t len; | 1010 | size_t len; | |
1011 | Char *line; | 1011 | Char *line; | |
1012 | 1012 | |||
1013 | if (el->el_state.doingarg) { | 1013 | if (el->el_state.doingarg) { | |
1014 | if (vi_to_history_line(el, 0) == CC_ERROR) | 1014 | if (vi_to_history_line(el, 0) == CC_ERROR) | |
1015 | return CC_ERROR; | 1015 | return CC_ERROR; | |
@@ -1076,27 +1076,27 @@ vi_histedit(EditLine *el, Int c) | @@ -1076,27 +1076,27 @@ vi_histedit(EditLine *el, Int c) | |||
1076 | unlink(tempfile); | 1076 | unlink(tempfile); | |
1077 | /* return CC_REFRESH; */ | 1077 | /* return CC_REFRESH; */ | |
1078 | return ed_newline(el, 0); | 1078 | return ed_newline(el, 0); | |
1079 | } | 1079 | } | |
1080 | 1080 | |||
1081 | /* vi_history_word(): | 1081 | /* vi_history_word(): | |
1082 | * Vi append word from previous input line | 1082 | * Vi append word from previous input line | |
1083 | * [_] | 1083 | * [_] | |
1084 | * Who knows where this one came from! | 1084 | * Who knows where this one came from! | |
1085 | * '_' in vi means 'entire current line', so 'cc' is a synonym for 'c_' | 1085 | * '_' in vi means 'entire current line', so 'cc' is a synonym for 'c_' | |
1086 | */ | 1086 | */ | |
1087 | protected el_action_t | 1087 | protected el_action_t | |
1088 | /*ARGSUSED*/ | 1088 | /*ARGSUSED*/ | |
1089 | vi_history_word(EditLine *el, Int c) | 1089 | vi_history_word(EditLine *el, Int c __attribute__((__unused__))) | |
1090 | { | 1090 | { | |
1091 | const Char *wp = HIST_FIRST(el); | 1091 | const Char *wp = HIST_FIRST(el); | |
1092 | const Char *wep, *wsp; | 1092 | const Char *wep, *wsp; | |
1093 | int len; | 1093 | int len; | |
1094 | Char *cp; | 1094 | Char *cp; | |
1095 | const Char *lim; | 1095 | const Char *lim; | |
1096 | 1096 | |||
1097 | if (wp == NULL) | 1097 | if (wp == NULL) | |
1098 | return CC_ERROR; | 1098 | return CC_ERROR; | |
1099 | 1099 | |||
1100 | wep = wsp = 0; | 1100 | wep = wsp = 0; | |
1101 | do { | 1101 | do { | |
1102 | while (Isspace(*wp)) | 1102 | while (Isspace(*wp)) | |
@@ -1126,27 +1126,27 @@ vi_history_word(EditLine *el, Int c) | @@ -1126,27 +1126,27 @@ vi_history_word(EditLine *el, Int c) | |||
1126 | *cp++ = *wsp++; | 1126 | *cp++ = *wsp++; | |
1127 | el->el_line.cursor = cp; | 1127 | el->el_line.cursor = cp; | |
1128 | 1128 | |||
1129 | el->el_map.current = el->el_map.key; | 1129 | el->el_map.current = el->el_map.key; | |
1130 | return CC_REFRESH; | 1130 | return CC_REFRESH; | |
1131 | } | 1131 | } | |
1132 | 1132 | |||
1133 | /* vi_redo(): | 1133 | /* vi_redo(): | |
1134 | * Vi redo last non-motion command | 1134 | * Vi redo last non-motion command | |
1135 | * [.] | 1135 | * [.] | |
1136 | */ | 1136 | */ | |
1137 | protected el_action_t | 1137 | protected el_action_t | |
1138 | /*ARGSUSED*/ | 1138 | /*ARGSUSED*/ | |
1139 | vi_redo(EditLine *el, Int c) | 1139 | vi_redo(EditLine *el, Int c __attribute__((__unused__))) | |
1140 | { | 1140 | { | |
1141 | c_redo_t *r = &el->el_chared.c_redo; | 1141 | c_redo_t *r = &el->el_chared.c_redo; | |
1142 | 1142 | |||
1143 | if (!el->el_state.doingarg && r->count) { | 1143 | if (!el->el_state.doingarg && r->count) { | |
1144 | el->el_state.doingarg = 1; | 1144 | el->el_state.doingarg = 1; | |
1145 | el->el_state.argument = r->count; | 1145 | el->el_state.argument = r->count; | |
1146 | } | 1146 | } | |
1147 | 1147 | |||
1148 | el->el_chared.c_vcmd.pos = el->el_line.cursor; | 1148 | el->el_chared.c_vcmd.pos = el->el_line.cursor; | |
1149 | el->el_chared.c_vcmd.action = r->action; | 1149 | el->el_chared.c_vcmd.action = r->action; | |
1150 | if (r->pos != r->buf) { | 1150 | if (r->pos != r->buf) { | |
1151 | if (r->pos + 1 > r->lim) | 1151 | if (r->pos + 1 > r->lim) | |
1152 | /* sanity */ | 1152 | /* sanity */ |