summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/libedit/Makefile8
-rw-r--r--lib/libedit/TEST/tc1.c12
-rw-r--r--lib/libedit/chared.c8
-rw-r--r--lib/libedit/chared.h5
-rw-r--r--lib/libedit/chartype.c10
-rw-r--r--lib/libedit/chartype.h12
-rw-r--r--lib/libedit/common.c24
-rw-r--r--lib/libedit/el.c10
-rw-r--r--lib/libedit/el.h10
-rw-r--r--lib/libedit/emacs.c6
-rw-r--r--lib/libedit/filecomplete.c17
-rw-r--r--lib/libedit/hist.c4
-rw-r--r--lib/libedit/hist.h6
-rw-r--r--lib/libedit/histedit.h17
-rw-r--r--lib/libedit/history.c10
-rw-r--r--lib/libedit/keymacro.c16
-rw-r--r--lib/libedit/makelist2
-rw-r--r--lib/libedit/map.c16
-rw-r--r--lib/libedit/parse.c9
-rw-r--r--lib/libedit/prompt.h6
-rw-r--r--lib/libedit/read.c9
-rw-r--r--lib/libedit/read.h6
-rw-r--r--lib/libedit/readline.c30
-rw-r--r--lib/libedit/readline/Makefile4
-rw-r--r--lib/libedit/readline/readline.h12
-rw-r--r--lib/libedit/refresh.c17
-rw-r--r--lib/libedit/search.c5
-rw-r--r--lib/libedit/sig.c3
-rw-r--r--lib/libedit/sys.h6
-rw-r--r--lib/libedit/terminal.c18
-rw-r--r--lib/libedit/tokenizer.c5
-rw-r--r--lib/libedit/tty.c8
-rw-r--r--lib/libedit/vi.c17
33 files changed, 178 insertions, 170 deletions
diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile
index 1fc5bdddfa3..44111a77bba 100644
--- a/lib/libedit/Makefile
+++ b/lib/libedit/Makefile
@@ -1,4 +1,4 @@
-# $OpenBSD: Makefile,v 1.15 2016/01/29 17:23:21 schwarze Exp $
+# $OpenBSD: Makefile,v 1.16 2016/03/20 23:48:27 schwarze Exp $
# $NetBSD: Makefile,v 1.41 2010/02/03 15:34:43 roy Exp $
# @(#)Makefile 8.1 (Berkeley) 6/4/93
@@ -54,12 +54,12 @@ CLEANFILES+=editline.c
CLEANFILES+=common.h.tmp editline.c.tmp emacs.h.tmp fcns.c.tmp fcns.h.tmp
CLEANFILES+=help.c.tmp help.h.tmp vi.h.tmp tc1.o tc1
CFLAGS+=-Wall
-CPPFLAGS+=-I. -I${LIBEDITDIR}
+CPPFLAGS+=-I. -I${LIBEDITDIR}
CPPFLAGS+=-I. -I${.CURDIR}
CPPFLAGS+=#-DDEBUG_TTY -DDEBUG_KEY -DDEBUG_READ -DDEBUG -DDEBUG_REFRESH
CPPFLAGS+=#-DDEBUG_PASTE -DDEBUG_EDIT
-AHDR=vi.h emacs.h common.h
+AHDR=vi.h emacs.h common.h
ASRC=${LIBEDITDIR}/vi.c ${LIBEDITDIR}/emacs.c ${LIBEDITDIR}/common.c
CLEANFILES+= ${AHDR} fcns.h help.h fcns.c help.c
@@ -112,7 +112,7 @@ historyn.c: makelist
tc1.o: ${LIBEDITDIR}/TEST/tc1.c
-tc1: libedit.a tc1.o
+tc1: libedit.a tc1.o
${CC} ${LDFLAGS} ${.ALLSRC} -o ${.TARGET} libedit.a ${LDADD} -lcurses
includes:
diff --git a/lib/libedit/TEST/tc1.c b/lib/libedit/TEST/tc1.c
index 0f0bc9a669b..e80c5b3d71b 100644
--- a/lib/libedit/TEST/tc1.c
+++ b/lib/libedit/TEST/tc1.c
@@ -37,15 +37,15 @@
/*
* test.c: A little test program
*/
-#include <stdio.h>
-#include <string.h>
-#include <signal.h>
#include <sys/wait.h>
#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
#include <dirent.h>
#include <locale.h>
+#include <signal.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#include "histedit.h"
@@ -145,7 +145,7 @@ main(int argc, char *argv[])
/* Add a user-defined function */
el_set(el, EL_ADDFN, "ed-complete", "Complete argument", complete);
- /* Bind tab to it */
+ /* Bind tab to it */
el_set(el, EL_BIND, "^I", "ed-complete", NULL);
/*
diff --git a/lib/libedit/chared.c b/lib/libedit/chared.c
index 120c5129c34..3948e31f267 100644
--- a/lib/libedit/chared.c
+++ b/lib/libedit/chared.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chared.c,v 1.19 2016/03/20 22:57:59 schwarze Exp $ */
+/* $OpenBSD: chared.c,v 1.20 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: chared.c,v 1.28 2009/12/30 22:37:40 christos Exp $ */
/*-
@@ -38,7 +38,9 @@
/*
* chared.c: Character editor utilities
*/
+#include <ctype.h>
#include <stdlib.h>
+#include <string.h>
#include "el.h"
#include "common.h"
@@ -518,7 +520,7 @@ ch_enlargebufs(EditLine *el, size_t addlen)
/* zero the newly added memory, leave old data in */
(void) memset(&newbuffer[sz], 0, (newsz - sz) * sizeof(*newbuffer));
-
+
oldbuf = el->el_line.buffer;
el->el_line.buffer = newbuffer;
@@ -567,7 +569,7 @@ ch_enlargebufs(EditLine *el, size_t addlen)
el->el_chared.c_redo.lim = newbuffer +
(el->el_chared.c_redo.lim - el->el_chared.c_redo.buf);
el->el_chared.c_redo.buf = newbuffer;
-
+
if (!hist_enlargebuf(el, sz, newsz))
return 0;
diff --git a/lib/libedit/chared.h b/lib/libedit/chared.h
index e8cf3dea6d1..91a26d974b8 100644
--- a/lib/libedit/chared.h
+++ b/lib/libedit/chared.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: chared.h,v 1.12 2016/03/20 22:57:59 schwarze Exp $ */
+/* $OpenBSD: chared.h,v 1.13 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: chared.h,v 1.20 2010/04/15 00:57:33 christos Exp $ */
/*-
@@ -41,9 +41,6 @@
#ifndef _h_el_chared
#define _h_el_chared
-#include <ctype.h>
-#include <string.h>
-
#define EL_MAXMACRO 10
/*
diff --git a/lib/libedit/chartype.c b/lib/libedit/chartype.c
index 29b001affb2..f06732113a1 100644
--- a/lib/libedit/chartype.c
+++ b/lib/libedit/chartype.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: chartype.c,v 1.7 2016/03/20 20:16:09 schwarze Exp $ */
+/* $OpenBSD: chartype.c,v 1.8 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: chartype.c,v 1.6 2011/07/28 00:48:21 christos Exp $ */
/*-
@@ -38,8 +38,12 @@
* chartype.c: character classification and meta information
*/
#include "config.h"
-#include "el.h"
+
+#include <ctype.h>
#include <stdlib.h>
+#include <string.h>
+
+#include "el.h"
#define CT_BUFSIZ 1024
@@ -55,7 +59,7 @@ ct_conv_buff_resize(ct_buffer_t *conv, size_t mincsize, size_t minwsize)
conv->csize = 0;
free(conv->cbuff);
conv->cbuff = NULL;
- } else
+ } else
conv->cbuff = p;
}
diff --git a/lib/libedit/chartype.h b/lib/libedit/chartype.h
index d69330aecdd..2e48c5472cb 100644
--- a/lib/libedit/chartype.h
+++ b/lib/libedit/chartype.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: chartype.h,v 1.9 2016/03/20 20:35:38 schwarze Exp $ */
+/* $OpenBSD: chartype.h,v 1.10 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: chartype.h,v 1.5 2010/04/15 00:55:57 christos Exp $ */
/*-
@@ -73,7 +73,7 @@
#define FUNW(type) type ## _w
#define TYPE(type) type ## W
#define FSTR "%ls"
-#define STR(x) L ## x
+#define STR(x) L ## x
#define UC(c) c
#define Isalpha(x) iswalpha(x)
#define Isalnum(x) iswalnum(x)
@@ -109,10 +109,10 @@
#else /* NARROW */
-size_t ct_mbrtowc(char *, const char *, size_t, void *);
+size_t ct_mbrtowc(char *, const char *, size_t, void *);
#define ct_wctob(w) ((int)(w))
#define ct_wctomb error
-#define ct_wctomb_reset
+#define ct_wctomb_reset
#define ct_wcstombs(a, b, c) (strncpy(a, b, c), strlen(a))
#define ct_mbstowcs(a, b, c) (strncpy(a, b, c), strlen(a))
@@ -121,7 +121,7 @@ size_t ct_mbrtowc(char *, const char *, size_t, void *);
#define FUNW(type) type
#define TYPE(type) type
#define FSTR "%s"
-#define STR(x) x
+#define STR(x) x
#define UC(c) (unsigned char)(c)
#define Isalpha(x) isalpha((unsigned char)x)
@@ -208,7 +208,7 @@ protected size_t ct_enc_width(Char);
#define VISUAL_WIDTH_MAX 8
/* The terminal is thought of in terms of X columns by Y lines. In the cases
- * where a wide character takes up more than one column, the adjacent
+ * where a wide character takes up more than one column, the adjacent
* occupied column entries will contain this faux character. */
#define MB_FILL_CHAR ((Char)-1)
diff --git a/lib/libedit/common.c b/lib/libedit/common.c
index 47a6ca152ef..16becf93c24 100644
--- a/lib/libedit/common.c
+++ b/lib/libedit/common.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: common.c,v 1.13 2016/03/20 23:24:18 schwarze Exp $ */
+/* $OpenBSD: common.c,v 1.14 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: common.c,v 1.24 2009/12/30 22:37:40 christos Exp $ */
/*-
@@ -38,6 +38,9 @@
/*
* common.c: Common Editor functions
*/
+#include <ctype.h>
+#include <string.h>
+
#include "el.h"
#include "common.h"
#include "parse.h"
@@ -446,7 +449,7 @@ ed_unassigned(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_sigint(EditLine *el __attribute__((__unused__)),
+ed_tty_sigint(EditLine *el __attribute__((__unused__)),
wint_t c __attribute__((__unused__)))
{
@@ -460,7 +463,7 @@ ed_tty_sigint(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
+ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
wint_t c __attribute__((__unused__)))
{
@@ -474,7 +477,7 @@ ed_tty_dsusp(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
+ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
wint_t c __attribute__((__unused__)))
{
@@ -488,7 +491,7 @@ ed_tty_flush_output(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
+ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
wint_t c __attribute__((__unused__)))
{
@@ -502,7 +505,7 @@ ed_tty_sigquit(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
+ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
wint_t c __attribute__((__unused__)))
{
@@ -516,7 +519,7 @@ ed_tty_sigtstp(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
+ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
wint_t c __attribute__((__unused__)))
{
@@ -530,7 +533,7 @@ ed_tty_stop_output(EditLine *el __attribute__((__unused__)),
*/
protected el_action_t
/*ARGSUSED*/
-ed_tty_start_output(EditLine *el __attribute__((__unused__)),
+ed_tty_start_output(EditLine *el __attribute__((__unused__)),
wint_t c __attribute__((__unused__)))
{
@@ -595,7 +598,7 @@ ed_clear_screen(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_redisplay(EditLine *el __attribute__((__unused__)),
+ed_redisplay(EditLine *el __attribute__((__unused__)),
wint_t c __attribute__((__unused__)))
{
@@ -623,7 +626,7 @@ ed_start_over(EditLine *el, wint_t c __attribute__((__unused__)))
*/
protected el_action_t
/*ARGSUSED*/
-ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
+ed_sequence_lead_in(EditLine *el __attribute__((__unused__)),
wint_t c __attribute__((__unused__)))
{
@@ -657,7 +660,6 @@ ed_prev_history(EditLine *el, wint_t c __attribute__((__unused__)))
if (hist_get(el) == CC_ERROR) {
if (el->el_map.type == MAP_VI) {
el->el_history.eventno = sv_event;
-
}
beep = 1;
/* el->el_history.eventno was fixed by first call */
diff --git a/lib/libedit/el.c b/lib/libedit/el.c
index 68b56dbd264..b4e542d3507 100644
--- a/lib/libedit/el.c
+++ b/lib/libedit/el.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: el.c,v 1.27 2016/03/20 22:57:59 schwarze Exp $ */
+/* $OpenBSD: el.c,v 1.28 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: el.c,v 1.61 2011/01/27 23:11:40 christos Exp $ */
/*-
@@ -39,11 +39,11 @@
* el.c: EditLine interface functions
*/
#include <sys/types.h>
-#include <string.h>
-#include <stdlib.h>
-#include <stdarg.h>
#include <ctype.h>
#include <limits.h>
+#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
#ifdef WIDECHAR
#include <locale.h>
#include <langinfo.h>
@@ -415,7 +415,7 @@ FUN(el,get)(EditLine *el, int op, ...)
char *argv[20];
int i;
- for (i = 1; i < (int)(sizeof(argv) / sizeof(argv[0])); i++)
+ for (i = 1; i < (int)(sizeof(argv) / sizeof(argv[0])); i++)
if ((argv[i] = va_arg(ap, char *)) == NULL)
break;
diff --git a/lib/libedit/el.h b/lib/libedit/el.h
index 7a0d25247b0..38b31fd8223 100644
--- a/lib/libedit/el.h
+++ b/lib/libedit/el.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: el.h,v 1.15 2016/03/20 23:24:18 schwarze Exp $ */
-/* $NetBSD: el.h,v 1.21 2009/12/31 15:58:26 christos Exp $ */
+/* $OpenBSD: el.h,v 1.16 2016/03/20 23:48:27 schwarze Exp $ */
+/* $NetBSD: el.h,v 1.33 2016/02/17 19:47:49 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -49,8 +49,6 @@
#include "histedit.h"
#include "chartype.h"
-#include <stdio.h>
-#include <sys/types.h>
#define EL_BUFSIZ 1024 /* Maximum line size */
@@ -70,7 +68,7 @@ typedef struct coord_t { /* Position on the screen */
} coord_t;
typedef struct el_line_t {
- Char *buffer; /* Input line */
+ Char *buffer; /* Input line */
Char *cursor; /* Cursor position */
Char *lastchar; /* Last character */
const Char *limit; /* Max position */
@@ -85,7 +83,7 @@ typedef struct el_state_t {
int argument; /* Numeric argument */
int metanext; /* Is the next char a meta char */
el_action_t lastcmd; /* Previous command */
- el_action_t thiscmd; /* this command */
+ el_action_t thiscmd; /* this command */
Char thisch; /* char that generated it */
} el_state_t;
diff --git a/lib/libedit/emacs.c b/lib/libedit/emacs.c
index 66972a6c3b6..567dcf4b277 100644
--- a/lib/libedit/emacs.c
+++ b/lib/libedit/emacs.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: emacs.c,v 1.13 2016/03/20 22:57:59 schwarze Exp $ */
-/* $NetBSD: emacs.c,v 1.31 2016/02/16 19:08:41 christos Exp $ */
+/* $OpenBSD: emacs.c,v 1.14 2016/03/20 23:48:27 schwarze Exp $ */
+/* $NetBSD: emacs.c,v 1.32 2016/02/16 22:53:14 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -38,6 +38,8 @@
/*
* emacs.c: Emacs functions
*/
+#include <ctype.h>
+
#include "el.h"
#include "emacs.h"
diff --git a/lib/libedit/filecomplete.c b/lib/libedit/filecomplete.c
index 68b99ae2496..82f69099efd 100644
--- a/lib/libedit/filecomplete.c
+++ b/lib/libedit/filecomplete.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: filecomplete.c,v 1.8 2016/03/20 22:57:59 schwarze Exp $ */
+/* $OpenBSD: filecomplete.c,v 1.9 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: filecomplete.c,v 1.22 2010/12/02 04:42:46 dholland Exp $ */
/*-
@@ -34,16 +34,15 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <stdio.h>
#include <dirent.h>
-#include <string.h>
+#include <errno.h>
+#include <fcntl.h>
+#include <limits.h>
#include <pwd.h>
-#include <ctype.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
-#include <limits.h>
-#include <errno.h>
-#include <fcntl.h>
#include "el.h"
#include "filecomplete.h"
@@ -442,7 +441,7 @@ fn_complete(EditLine *el,
(int)(cur_off - len), cur_off);
} else
matches = 0;
- if (!attempted_completion_function ||
+ if (!attempted_completion_function ||
(over != NULL && !*over && !matches))
matches = completion_matches(
ct_encode_string(temp, &el->el_scratch), complet_func);
@@ -491,7 +490,7 @@ fn_complete(EditLine *el,
}
/* matches[1] through matches[i-1] are available */
matches_num = i - 1;
-
+
/* newline to get on next line from command line */
(void)fprintf(el->el_outfile, "\n");
diff --git a/lib/libedit/hist.c b/lib/libedit/hist.c
index cc181453f98..209281c8e9a 100644
--- a/lib/libedit/hist.c
+++ b/lib/libedit/hist.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: hist.c,v 1.12 2016/01/30 17:32:52 schwarze Exp $ */
+/* $OpenBSD: hist.c,v 1.13 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: hist.c,v 1.17 2009/12/30 23:54:52 christos Exp $ */
/*-
@@ -39,6 +39,8 @@
* hist.c: History access functions
*/
#include <stdlib.h>
+#include <string.h>
+
#include "el.h"
/* hist_init():
diff --git a/lib/libedit/hist.h b/lib/libedit/hist.h
index 5065743d86e..dc4eb0ae4c8 100644
--- a/lib/libedit/hist.h
+++ b/lib/libedit/hist.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: hist.h,v 1.11 2016/03/20 22:57:59 schwarze Exp $ */
-/* $NetBSD: hist.h,v 1.17 2016/02/16 15:53:48 christos Exp $ */
+/* $OpenBSD: hist.h,v 1.12 2016/03/20 23:48:27 schwarze Exp $ */
+/* $NetBSD: hist.h,v 1.18 2016/02/17 19:47:49 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -81,7 +81,7 @@ protected int hist_set(EditLine *, hist_fun_t, void *);
protected int hist_command(EditLine *, int, const Char **);
protected int hist_enlargebuf(EditLine *, size_t, size_t);
#ifdef WIDECHAR
-protected wchar_t *hist_convert(EditLine *, int, void *);
+protected wchar_t *hist_convert(EditLine *, int, void *);
#endif
#endif /* _h_el_hist */
diff --git a/lib/libedit/histedit.h b/lib/libedit/histedit.h
index 909e685dc9e..cb65ba7fb05 100644
--- a/lib/libedit/histedit.h
+++ b/lib/libedit/histedit.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: histedit.h,v 1.13 2016/01/30 17:32:52 schwarze Exp $ */
+/* $OpenBSD: histedit.h,v 1.14 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: histedit.h,v 1.46 2010/04/15 00:50:03 christos Exp $ */
/*-
@@ -129,7 +129,7 @@ unsigned char _el_fn_complete(EditLine *, int);
* For operations that support set or set/get, the argument types listed are for
* the "set" operation. For "get", each listed type must be a pointer.
* E.g. EL_EDITMODE takes an int when set, but an int* when get.
- *
+ *
* Operations that only support "get" have the correct argument types listed.
*/
#define EL_PROMPT 0 /* , prompt_func); set/get */
@@ -142,7 +142,7 @@ unsigned char _el_fn_complete(EditLine *, int);
#define EL_ECHOTC 7 /* , const Char *, ..., NULL); set */
#define EL_SETTY 8 /* , const Char *, ..., NULL); set */
#define EL_ADDFN 9 /* , const Char *, const Char, set */
- /* el_func_t); */
+ /* el_func_t); */
#define EL_HIST 10 /* , hist_fun_t, const void *); set */
#define EL_EDITMODE 11 /* , int); set/get */
#define EL_RPROMPT 12 /* , prompt_func); set/get */
@@ -249,21 +249,10 @@ int tok_str(Tokenizer *, const char *,
/*
* Begin Wide Character Support
*/
-#ifdef __linux__
-/* Apparently we need _GNU_SOURCE defined to get access to wcsdup on Linux */
-#ifndef _GNU_SOURCE
-#define _GNU_SOURCE
-#endif
-#endif
-
#include <wchar.h>
#include <wctype.h>
/*
- * Wide character versions
- */
-
-/*
* ==== Editing ====
*/
typedef struct lineinfow {
diff --git a/lib/libedit/history.c b/lib/libedit/history.c
index 2131fb518e0..ed318bf6179 100644
--- a/lib/libedit/history.c
+++ b/lib/libedit/history.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: history.c,v 1.22 2016/03/20 22:09:24 schwarze Exp $ */
+/* $OpenBSD: history.c,v 1.23 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: history.c,v 1.37 2010/01/03 18:27:10 christos Exp $ */
/*-
@@ -38,15 +38,15 @@
/*
* hist.c: TYPE(History) access functions
*/
-#include <string.h>
-#include <stdlib.h>
+#include <sys/stat.h>
#include <stdarg.h>
+#include <stdlib.h>
+#include <string.h>
#ifdef HAVE_VIS_H
#include <vis.h>
#else
#include "np/vis.h"
#endif
-#include <sys/stat.h>
static const char hist_cookie[] = "_HiStOrY_V2_\n";
@@ -432,7 +432,7 @@ history_def_del(void *p, TYPE(HistEvent) *ev __attribute__((__unused__)),
*/
/* ARGSUSED */
private void
-history_def_delete(history_t *h,
+history_def_delete(history_t *h,
TYPE(HistEvent) *ev __attribute__((__unused__)), hentry_t *hp)
{
HistEventPrivate *evp = (void *)&hp->ev;
diff --git a/lib/libedit/keymacro.c b/lib/libedit/keymacro.c
index 17da167575c..4cfcb04191c 100644
--- a/lib/libedit/keymacro.c
+++ b/lib/libedit/keymacro.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: keymacro.c,v 1.6 2016/03/20 20:35:38 schwarze Exp $ */
-/* $NetBSD: key.c,v 1.23 2009/12/30 22:37:40 christos Exp $ */
+/* $OpenBSD: keymacro.c,v 1.7 2016/03/20 23:48:27 schwarze Exp $ */
+/* $NetBSD: keymacro.c,v 1.13 2016/02/17 19:47:49 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -57,8 +57,8 @@
* 1) It is not possible to have one key that is a
* substr of another.
*/
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
#include "el.h"
@@ -67,10 +67,10 @@
* linked list of these node elements
*/
struct keymacro_node_t {
- Char ch; /* single character of key */
+ Char ch; /* single character of key */
int type; /* node type */
keymacro_value_t val; /* command code or pointer to str, */
- /* if this is a leaf */
+ /* if this is a leaf */
struct keymacro_node_t *next; /* ptr to next char of this key */
struct keymacro_node_t *sibling;/* ptr to another key with same prefix*/
};
@@ -269,7 +269,7 @@ keymacro_print(EditLine *el, const Char *key)
/* node_trav():
* recursively traverses node in tree until match or mismatch is
- * found. May read in more characters.
+ * found. May read in more characters.
*/
private int
node_trav(EditLine *el, keymacro_node_t *ptr, Char *ch, keymacro_value_t *val)
@@ -306,7 +306,7 @@ node_trav(EditLine *el, keymacro_node_t *ptr, Char *ch, keymacro_value_t *val)
/* node__try():
- * Find a node that matches *str or allocate a new one
+ * Find a node that matches *str or allocate a new one
*/
private int
node__try(EditLine *el, keymacro_node_t *ptr, const Char *str,
@@ -587,7 +587,7 @@ keymacro_kprint(EditLine *el, const Char *key, keymacro_value_t *val, int ntype)
case XK_STR:
case XK_EXE:
(void) keymacro__decode_str(val->str, unparsbuf,
- sizeof(unparsbuf),
+ sizeof(unparsbuf),
ntype == XK_STR ? "\"\"" : "[]");
(void) fprintf(el->el_outfile, fmt,
ct_encode_string(key, &el->el_scratch), unparsbuf);
diff --git a/lib/libedit/makelist b/lib/libedit/makelist
index 872f38e8fe3..556e2d0cd38 100644
--- a/lib/libedit/makelist
+++ b/lib/libedit/makelist
@@ -60,7 +60,7 @@ case $FLAG in
#include "${FILES}"
_EOF
;;
-
+
-h)
set - `echo $FILES | sed -e 's/\\./_/g'`
hdr="_h_`basename $1`"
diff --git a/lib/libedit/map.c b/lib/libedit/map.c
index 71c50f71fa7..3c53980059e 100644
--- a/lib/libedit/map.c
+++ b/lib/libedit/map.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: map.c,v 1.18 2016/03/20 22:57:59 schwarze Exp $ */
+/* $OpenBSD: map.c,v 1.19 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: map.c,v 1.25 2009/12/30 22:37:40 christos Exp $ */
/*-
@@ -38,7 +38,9 @@
/*
* map.c: Editor function definitions
*/
+#include <ctype.h>
#include <stdlib.h>
+#include <string.h>
#include "el.h"
#include "help.h"
@@ -1152,7 +1154,7 @@ map_print_some_keys(EditLine *el, el_action_t *map, wint_t first, wint_t last)
lastbuf[1] = 0;
if (map[first] == ED_UNASSIGNED) {
if (first == last) {
- (void) keymacro__decode_str(firstbuf, unparsbuf,
+ (void) keymacro__decode_str(firstbuf, unparsbuf,
sizeof(unparsbuf), STRQQ);
(void) fprintf(el->el_outfile,
"%-15s-> is undefined\n", unparsbuf);
@@ -1163,14 +1165,14 @@ map_print_some_keys(EditLine *el, el_action_t *map, wint_t first, wint_t last)
for (bp = el->el_map.help; bp < ep; bp++) {
if (bp->func == map[first]) {
if (first == last) {
- (void) keymacro__decode_str(firstbuf, unparsbuf,
+ (void) keymacro__decode_str(firstbuf, unparsbuf,
sizeof(unparsbuf), STRQQ);
(void) fprintf(el->el_outfile, "%-15s-> " FSTR "\n",
unparsbuf, bp->name);
} else {
- (void) keymacro__decode_str(firstbuf, unparsbuf,
+ (void) keymacro__decode_str(firstbuf, unparsbuf,
sizeof(unparsbuf), STRQQ);
- (void) keymacro__decode_str(lastbuf, extrabuf,
+ (void) keymacro__decode_str(lastbuf, extrabuf,
sizeof(extrabuf), STRQQ);
(void) fprintf(el->el_outfile,
"%-4s to %-7s-> " FSTR "\n",
@@ -1181,14 +1183,14 @@ map_print_some_keys(EditLine *el, el_action_t *map, wint_t first, wint_t last)
}
#ifdef MAP_DEBUG
if (map == el->el_map.key) {
- (void) keymacro__decode_str(firstbuf, unparsbuf,
+ (void) keymacro__decode_str(firstbuf, unparsbuf,
sizeof(unparsbuf), STRQQ);
(void) fprintf(el->el_outfile,
"BUG!!! %s isn't bound to anything.\n", unparsbuf);
(void) fprintf(el->el_outfile, "el->el_map.key[%d] == %d\n",
first, el->el_map.key[first]);
} else {
- (void) keymacro__decode_str(firstbuf, unparsbuf,
+ (void) keymacro__decode_str(firstbuf, unparsbuf,
sizeof(unparsbuf), STRQQ);
(void) fprintf(el->el_outfile,
"BUG!!! %s isn't bound to anything.\n", unparsbuf);
diff --git a/lib/libedit/parse.c b/lib/libedit/parse.c
index 75f352e3d3e..1cf6524de1f 100644
--- a/lib/libedit/parse.c
+++ b/lib/libedit/parse.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: parse.c,v 1.16 2016/03/20 22:57:59 schwarze Exp $ */
-/* $NetBSD: parse.c,v 1.23 2009/12/30 22:37:40 christos Exp $ */
+/* $OpenBSD: parse.c,v 1.17 2016/03/20 23:48:27 schwarze Exp $ */
+/* $NetBSD: parse.c,v 1.35 2016/02/17 19:47:49 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -49,6 +49,7 @@
* setty
*/
#include <stdlib.h>
+#include <string.h>
#include "el.h"
#include "parse.h"
@@ -57,9 +58,9 @@ private const struct {
const Char *name;
int (*func)(EditLine *, int, const Char **);
} cmds[] = {
- { STR("bind"), map_bind },
+ { STR("bind"), map_bind },
{ STR("echotc"), terminal_echotc },
- { STR("edit"), el_editmode },
+ { STR("edit"), el_editmode },
{ STR("history"), hist_command },
{ STR("telltc"), terminal_telltc },
{ STR("settc"), terminal_settc },
diff --git a/lib/libedit/prompt.h b/lib/libedit/prompt.h
index 92043e05dc1..077b61bcd4c 100644
--- a/lib/libedit/prompt.h
+++ b/lib/libedit/prompt.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: prompt.h,v 1.8 2016/03/20 22:57:59 schwarze Exp $ */
-/* $NetBSD: prompt.h,v 1.12 2016/02/16 15:53:48 christos Exp $ */
+/* $OpenBSD: prompt.h,v 1.9 2016/03/20 23:48:27 schwarze Exp $ */
+/* $NetBSD: prompt.h,v 1.13 2016/02/17 19:47:49 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -47,7 +47,7 @@ typedef struct el_prompt_t {
el_pfunc_t p_func; /* Function to return the prompt */
coord_t p_pos; /* position in the line after prompt */
Char p_ignore; /* character to start/end literal */
- int p_wide;
+ int p_wide;
} el_prompt_t;
protected void prompt_print(EditLine *, int);
diff --git a/lib/libedit/read.c b/lib/libedit/read.c
index 2feace6ddb4..8cfb0236627 100644
--- a/lib/libedit/read.c
+++ b/lib/libedit/read.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: read.c,v 1.24 2016/03/20 20:16:09 schwarze Exp $ */
+/* $OpenBSD: read.c,v 1.25 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: read.c,v 1.57 2010/07/21 18:18:52 christos Exp $ */
/*-
@@ -39,11 +39,14 @@
* read.c: Clean this junk up! This is horrible code.
* Terminal read functions
*/
+#include <ctype.h>
#include <errno.h>
#include <fcntl.h>
-#include <unistd.h>
-#include <stdlib.h>
#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
#include "el.h"
#define OKCMD -1 /* must be -1! */
diff --git a/lib/libedit/read.h b/lib/libedit/read.h
index b0a7aaf113f..ca23f5b681b 100644
--- a/lib/libedit/read.h
+++ b/lib/libedit/read.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: read.h,v 1.3 2010/06/30 00:05:35 nicm Exp $ */
-/* $NetBSD: read.h,v 1.7 2009/12/30 22:37:40 christos Exp $ */
+/* $OpenBSD: read.h,v 1.4 2016/03/20 23:48:27 schwarze Exp $ */
+/* $NetBSD: read.h,v 1.8 2016/02/17 19:47:49 christos Exp $ */
/*-
* Copyright (c) 2001 The NetBSD Foundation, Inc.
@@ -41,7 +41,7 @@ typedef int (*el_rfunc_t)(EditLine *, Char *);
typedef struct el_read_t {
el_rfunc_t read_char; /* Function to read a character */
} el_read_t;
-
+
protected int read_init(EditLine *);
protected void read_prepare(EditLine *);
protected void read_finish(EditLine *);
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c
index fbb74e17fec..25b3fb34d7a 100644
--- a/lib/libedit/readline.c
+++ b/lib/libedit/readline.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: readline.c,v 1.17 2016/03/20 22:57:59 schwarze Exp $ */
+/* $OpenBSD: readline.c,v 1.18 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: readline.c,v 1.91 2010/08/28 15:44:59 christos Exp $ */
/*-
@@ -34,18 +34,18 @@
#include <sys/types.h>
#include <sys/stat.h>
-#include <stdint.h>
-#include <stdio.h>
-#include <dirent.h>
-#include <string.h>
-#include <pwd.h>
#include <ctype.h>
-#include <stdlib.h>
-#include <unistd.h>
-#include <limits.h>
+#include <dirent.h>
#include <errno.h>
#include <fcntl.h>
+#include <limits.h>
+#include <pwd.h>
#include <setjmp.h>
+#include <stdint.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
#ifdef HAVE_VIS_H
#include <vis.h>
#else
@@ -255,7 +255,7 @@ rl_set_prompt(const char *prompt)
if (!prompt)
prompt = "";
- if (rl_prompt != NULL && strcmp(rl_prompt, prompt) == 0)
+ if (rl_prompt != NULL && strcmp(rl_prompt, prompt) == 0)
return 0;
if (rl_prompt)
free(rl_prompt);
@@ -349,7 +349,7 @@ rl_initialize(void)
"ReadLine compatible suspend function",
_el_rl_tstp);
el_set(e, EL_BIND, "^Z", "rl_tstp", NULL);
-
+
/* read settings from configuration file */
el_source(e, NULL);
@@ -1939,7 +1939,7 @@ rl_callback_read_char()
}
}
-void
+void
rl_callback_handler_install(const char *prompt, VCPFunction *linefunc)
{
if (e == NULL) {
@@ -1948,9 +1948,9 @@ rl_callback_handler_install(const char *prompt, VCPFunction *linefunc)
(void)rl_set_prompt(prompt);
rl_linefunc = linefunc;
el_set(e, EL_UNBUFFERED, 1);
-}
+}
-void
+void
rl_callback_handler_remove(void)
{
el_set(e, EL_UNBUFFERED, 0);
@@ -2150,7 +2150,7 @@ rl_completion_matches(const char *str, rl_compentry_func_t *fun)
list[0][min] = '\0';
}
return list;
-
+
out:
free(list);
return NULL;
diff --git a/lib/libedit/readline/Makefile b/lib/libedit/readline/Makefile
index 770325a0769..3ee8f4766a0 100644
--- a/lib/libedit/readline/Makefile
+++ b/lib/libedit/readline/Makefile
@@ -1,5 +1,5 @@
-# $OpenBSD: Makefile,v 1.1 2003/10/31 08:42:24 otto Exp $
-# $NetBSD: Makefile,v 1.7 2003/08/03 09:23:15 lukem Exp $
+# $OpenBSD: Makefile,v 1.2 2016/03/20 23:48:27 schwarze Exp $
+# $NetBSD: Makefile,v 1.7 2003/08/03 09:23:15 lukem Exp $
NOOBJ= # defined
diff --git a/lib/libedit/readline/readline.h b/lib/libedit/readline/readline.h
index 138e189ad10..f0a2fd94a7a 100644
--- a/lib/libedit/readline/readline.h
+++ b/lib/libedit/readline/readline.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: readline.h,v 1.6 2015/01/13 08:33:12 reyk Exp $ */
+/* $OpenBSD: readline.h,v 1.7 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: readline.h,v 1.31 2010/08/04 20:29:18 christos Exp $ */
/*-
@@ -55,7 +55,7 @@ typedef void *histdata_t;
typedef struct _hist_entry {
const char *line;
- histdata_t data;
+ histdata_t data;
} HIST_ENTRY;
typedef struct _keymap_entry {
@@ -89,7 +89,7 @@ typedef KEYMAP_ENTRY *Keymap;
#define RUBOUT 0x7f
#define ABORT_CHAR CTRL('G')
-#define RL_READLINE_VERSION 0x0402
+#define RL_READLINE_VERSION 0x0402
#define RL_PROMPT_START_IGNORE '\1'
#define RL_PROMPT_END_IGNORE '\2'
@@ -98,7 +98,7 @@ typedef KEYMAP_ENTRY *Keymap;
extern "C" {
#endif
extern const char *rl_library_version;
-extern int rl_readline_version;
+extern int rl_readline_version;
extern char *rl_readline_name;
extern FILE *rl_instream;
extern FILE *rl_outstream;
@@ -196,10 +196,10 @@ int rl_add_defun(const char *, Function *, int);
HISTORY_STATE *history_get_history_state(void);
void rl_get_screen_size(int *, int *);
void rl_set_screen_size(int, int);
-char *rl_filename_completion_function (const char *, int);
+char *rl_filename_completion_function (const char *, int);
int _rl_abort_internal(void);
int _rl_qsort_string_compare(char **, char **);
-char **rl_completion_matches(const char *, rl_compentry_func_t *);
+char **rl_completion_matches(const char *, rl_compentry_func_t *);
void rl_forced_update_display(void);
int rl_set_prompt(const char *);
int rl_on_new_line(void);
diff --git a/lib/libedit/refresh.c b/lib/libedit/refresh.c
index fbe4984d234..bbd4f2f2cf6 100644
--- a/lib/libedit/refresh.c
+++ b/lib/libedit/refresh.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: refresh.c,v 1.13 2016/03/20 20:35:38 schwarze Exp $ */
-/* $NetBSD: refresh.c,v 1.37 2011/07/29 23:44:45 christos Exp $ */
+/* $OpenBSD: refresh.c,v 1.14 2016/03/20 23:48:27 schwarze Exp $ */
+/* $NetBSD: refresh.c,v 1.44 2016/02/17 19:47:49 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -39,9 +39,8 @@
* refresh.c: Lower level screen refreshing functions
*/
#include <stdio.h>
-#include <ctype.h>
-#include <unistd.h>
#include <string.h>
+#include <unistd.h>
#include "el.h"
@@ -58,7 +57,7 @@ private void re__copy_and_pad(Char *, const Char *, size_t);
#ifdef DEBUG_REFRESH
private void re_printstr(EditLine *, const char *, char *, char *);
#define __F el->el_errfile
-#define ELRE_ASSERT(a, b, c) do \
+#define ELRE_ASSERT(a, b, c) do \
if (/*CONSTCOND*/ a) { \
(void) fprintf b; \
c; \
@@ -104,7 +103,7 @@ re_nextline(EditLine *el)
for(i = 1; i < lins; i++)
el->el_vdisplay[i - 1] = el->el_vdisplay[i];
- firstline[0] = '\0'; /* empty the string */
+ firstline[0] = '\0'; /* empty the string */
el->el_vdisplay[i - 1] = firstline;
} else
el->el_refresh.r_cursor.v++;
@@ -186,7 +185,7 @@ re_putc(EditLine *el, wint_t c, int shift)
/* re_refresh():
* draws the new virtual screen image from the current input
- * line, then goes line-by-line changing the real image to the new
+ * line, then goes line-by-line changing the real image to the new
* virtual image. The routine to re-draw a line can be replaced
* easily in hopes of a smarter one being placed there.
*/
@@ -445,7 +444,7 @@ re__strncopy(Char *a, Char *b, size_t n)
* in order to make sure that we have cleared the previous contents of
* the line. fx and sx is the number of characters inserted or deleted
* in the first or second diff, diff is the difference between the
- * number of characters between the new and old line.
+ * number of characters between the new and old line.
*/
private void
re_clear_eol(EditLine *el, int fx, int sx, int diff)
@@ -1071,7 +1070,7 @@ re_fastputc(EditLine *el, wint_t c)
if (el->el_cursor.v + 1 >= el->el_terminal.t_size.v) {
int i, lins = el->el_terminal.t_size.v;
Char *firstline = el->el_display[0];
-
+
for(i = 1; i < lins; i++)
el->el_display[i - 1] = el->el_display[i];
diff --git a/lib/libedit/search.c b/lib/libedit/search.c
index 1316dd6ae2c..d824175e82e 100644
--- a/lib/libedit/search.c
+++ b/lib/libedit/search.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: search.c,v 1.18 2016/03/20 22:57:59 schwarze Exp $ */
-/* $NetBSD: search.c,v 1.37 2016/02/16 19:08:41 christos Exp $ */
+/* $OpenBSD: search.c,v 1.19 2016/03/20 23:48:27 schwarze Exp $ */
+/* $NetBSD: search.c,v 1.38 2016/02/16 22:53:14 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -39,6 +39,7 @@
* search.c: History and character search functions
*/
#include <stdlib.h>
+#include <string.h>
#if defined(REGEX)
#include <regex.h>
#elif defined(REGEXP)
diff --git a/lib/libedit/sig.c b/lib/libedit/sig.c
index fd925ac6351..8dcd5b9caef 100644
--- a/lib/libedit/sig.c
+++ b/lib/libedit/sig.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sig.c,v 1.17 2016/03/20 22:57:59 schwarze Exp $ */
+/* $OpenBSD: sig.c,v 1.18 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: sig.c,v 1.24 2016/02/16 19:08:41 christos Exp $ */
/*-
@@ -40,6 +40,7 @@
* our policy is to trap all signals, set a good state
* and pass the ball to our caller.
*/
+#include <errno.h>
#include <stdlib.h>
#include "el.h"
diff --git a/lib/libedit/sys.h b/lib/libedit/sys.h
index d8681ea2aee..129547f86b7 100644
--- a/lib/libedit/sys.h
+++ b/lib/libedit/sys.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: sys.h,v 1.14 2016/03/20 22:09:24 schwarze Exp $ */
+/* $OpenBSD: sys.h,v 1.15 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: sys.h,v 1.13 2009/12/30 22:37:40 christos Exp $ */
/*-
@@ -58,7 +58,7 @@
# define __END_DECLS
# endif
#endif
-
+
#ifndef public
# define public /* Externally visible functions/variables */
#endif
@@ -97,7 +97,7 @@ ssize_t getline(char **line, size_t *len, FILE *fp);
#undef REGEXP /* Use UNIX V8 regular expression functions */
#ifndef WIDECHAR
-#define setlocale(c, l) /*LINTED*/NULL
+#define setlocale(c, l) /*LINTED*/NULL
#define nl_langinfo(i) ""
#endif
diff --git a/lib/libedit/terminal.c b/lib/libedit/terminal.c
index 0c4b5152a57..22602ce19f4 100644
--- a/lib/libedit/terminal.c
+++ b/lib/libedit/terminal.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: terminal.c,v 1.8 2016/03/20 21:25:27 schwarze Exp $ */
+/* $OpenBSD: terminal.c,v 1.9 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: terminal.c,v 1.17 2016/02/15 15:35:03 christos Exp $ */
/*-
@@ -40,12 +40,14 @@
* We have to declare a static variable here, since the
* termcap putchar routine does not take an argument!
*/
-#include <stdio.h>
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <limits.h>
#include <signal.h>
-#include <string.h>
+#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <unistd.h>
-#include <limits.h>
#ifdef HAVE_TERMCAP_H
#include <termcap.h>
#endif
@@ -59,8 +61,6 @@
#if defined(HAVE_TERM_H) && !defined(__sun)
#include <term.h>
#endif
-#include <sys/types.h>
-#include <sys/ioctl.h>
#ifdef _REENTRANT
#include <pthread.h>
@@ -478,7 +478,7 @@ terminal_free_display(EditLine *el)
/* terminal_move_to_line():
* move to line <where> (first line == 0)
- * as efficiently as possible
+ * as efficiently as possible
*/
protected void
terminal_move_to_line(EditLine *el, int where)
@@ -594,7 +594,7 @@ mc_again:
i < (where & ~0x7);
i += 8)
terminal__putc(el,
- '\t');
+ '\t');
/* then tab over */
el->el_cursor.h = where & ~0x7;
}
@@ -1276,7 +1276,7 @@ terminal_writec(EditLine *el, wint_t c)
*/
protected int
/*ARGSUSED*/
-terminal_telltc(EditLine *el, int argc __attribute__((__unused__)),
+terminal_telltc(EditLine *el, int argc __attribute__((__unused__)),
const Char **argv __attribute__((__unused__)))
{
const struct termcapstr *t;
diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c
index 69335828fa3..6a026654eaf 100644
--- a/lib/libedit/tokenizer.c
+++ b/lib/libedit/tokenizer.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tokenizer.c,v 1.16 2016/03/20 21:04:15 schwarze Exp $ */
+/* $OpenBSD: tokenizer.c,v 1.17 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: tokenizer.c,v 1.23 2016/02/15 15:37:20 christos Exp $ */
/*-
@@ -39,8 +39,9 @@
/*
* tokenize.c: Bourne shell like tokenizer
*/
-#include <string.h>
#include <stdlib.h>
+#include <string.h>
+
#include "histedit.h"
#include "chartype.h"
diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c
index 97e338c04c7..dd3fed61ea2 100644
--- a/lib/libedit/tty.c
+++ b/lib/libedit/tty.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: tty.c,v 1.20 2016/03/20 22:57:59 schwarze Exp $ */
+/* $OpenBSD: tty.c,v 1.21 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: tty.c,v 1.34 2011/01/27 23:11:40 christos Exp $ */
/*-
@@ -40,8 +40,10 @@
*/
#include <assert.h>
#include <errno.h>
-#include <unistd.h> /* for isatty */
+#include <stdlib.h> /* for abort */
+#include <string.h>
#include <strings.h> /* for ffs */
+#include <unistd.h> /* for isatty */
#include "el.h"
#include "parse.h"
@@ -964,7 +966,7 @@ tty_update_char(EditLine *el, int mode, int c) {
/* tty_rawmode():
- * Set terminal into 1 character at a time mode.
+ * Set terminal into 1 character at a time mode.
*/
protected int
tty_rawmode(EditLine *el)
diff --git a/lib/libedit/vi.c b/lib/libedit/vi.c
index aed99136334..ec3c726dd47 100644
--- a/lib/libedit/vi.c
+++ b/lib/libedit/vi.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: vi.c,v 1.17 2016/03/20 22:57:59 schwarze Exp $ */
+/* $OpenBSD: vi.c,v 1.18 2016/03/20 23:48:27 schwarze Exp $ */
/* $NetBSD: vi.c,v 1.33 2011/02/17 16:44:48 joerg Exp $ */
/*-
@@ -34,14 +34,17 @@
*/
#include "config.h"
-#include <stdlib.h>
-#include <unistd.h>
-#include <limits.h>
-#include <sys/wait.h>
/*
* vi.c: Vi mode commands.
*/
+#include <sys/wait.h>
+#include <ctype.h>
+#include <limits.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
#include "el.h"
#include "common.h"
#include "emacs.h"
@@ -576,7 +579,7 @@ vi_zero(EditLine *el, wint_t c)
/* vi_delete_prev_char():
- * Vi move to previous character (backspace)
+ * Vi move to previous character (backspace)
* [^H] in insert mode only
*/
protected el_action_t
@@ -976,7 +979,7 @@ vi_to_history_line(EditLine *el, wint_t c __attribute__((__unused__)))
el->el_history.eventno = 1;
if (hist_get(el) == CC_ERROR)
return CC_ERROR;
- el->el_history.eventno = 1 + el->el_history.ev.num
+ el->el_history.eventno = 1 + el->el_history.ev.num
- el->el_state.argument;
if (el->el_history.eventno < 0) {
el->el_history.eventno = sv_event_no;