summaryrefslogtreecommitdiff
path: root/lib/libedit
diff options
context:
space:
mode:
authorchristos <christos@NetBSD.org>2002-03-18 16:00:50 +0000
committerchristos <christos@NetBSD.org>2002-03-18 16:00:50 +0000
commit0e0ac6b723c2e4e089e5ebcb438b4119aa52feab (patch)
tree2783049b91e3ef3a999a3d40318af39b874b8beb /lib/libedit
parentac992d6bf732747de0acd8210735c529ed158ddb (diff)
- constify; passes all gcc and lint strict checks.
- add config.h [Jason Evans], to create a portable version of libedit that can be easily compiled on other OS's.
Diffstat (limited to 'lib/libedit')
-rw-r--r--lib/libedit/TEST/test.c7
-rw-r--r--lib/libedit/chared.c8
-rw-r--r--lib/libedit/chared.h2
-rw-r--r--lib/libedit/common.c7
-rw-r--r--lib/libedit/el.c14
-rw-r--r--lib/libedit/el.h4
-rw-r--r--lib/libedit/emacs.c7
-rw-r--r--lib/libedit/hist.c9
-rw-r--r--lib/libedit/hist.h4
-rw-r--r--lib/libedit/histedit.h9
-rw-r--r--lib/libedit/history.c31
-rw-r--r--lib/libedit/key.c29
-rw-r--r--lib/libedit/key.h13
-rw-r--r--lib/libedit/map.c17
-rw-r--r--lib/libedit/map.h4
-rw-r--r--lib/libedit/parse.c17
-rw-r--r--lib/libedit/prompt.c7
-rw-r--r--lib/libedit/read.c12
-rw-r--r--lib/libedit/readline.c38
-rw-r--r--lib/libedit/readline/readline.h10
-rw-r--r--lib/libedit/refresh.c11
-rw-r--r--lib/libedit/search.c7
-rw-r--r--lib/libedit/sig.c7
-rw-r--r--lib/libedit/sys.h31
-rw-r--r--lib/libedit/term.c41
-rw-r--r--lib/libedit/term.h20
-rw-r--r--lib/libedit/tokenizer.c13
-rw-r--r--lib/libedit/tokenizer.h4
-rw-r--r--lib/libedit/tty.c17
-rw-r--r--lib/libedit/tty.h6
-rw-r--r--lib/libedit/vi.c7
31 files changed, 220 insertions, 193 deletions
diff --git a/lib/libedit/TEST/test.c b/lib/libedit/TEST/test.c
index 267cccf21da..dc499d9fbe6 100644
--- a/lib/libedit/TEST/test.c
+++ b/lib/libedit/TEST/test.c
@@ -1,4 +1,4 @@
-/* $NetBSD: test.c,v 1.9 2000/09/04 23:36:41 lukem Exp $ */
+/* $NetBSD: test.c,v 1.10 2002/03/18 16:01:02 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#ifndef lint
__COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
The Regents of the University of California. All rights reserved.\n");
@@ -46,14 +46,13 @@ __COPYRIGHT("@(#) Copyright (c) 1992, 1993\n\
#if 0
static char sccsid[] = "@(#)test.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: test.c,v 1.9 2000/09/04 23:36:41 lukem Exp $");
+__RCSID("$NetBSD: test.c,v 1.10 2002/03/18 16:01:02 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* test.c: A little test program
*/
-#include "sys.h"
#include <stdio.h>
#include <string.h>
#include <signal.h>
diff --git a/lib/libedit/chared.c b/lib/libedit/chared.c
index 790f8ffb9ae..8eaeb3b5469 100644
--- a/lib/libedit/chared.c
+++ b/lib/libedit/chared.c
@@ -1,4 +1,4 @@
-/* $NetBSD: chared.c,v 1.14 2001/05/17 01:02:17 christos Exp $ */
+/* $NetBSD: chared.c,v 1.15 2002/03/18 16:00:50 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,20 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: chared.c,v 1.14 2001/05/17 01:02:17 christos Exp $");
+__RCSID("$NetBSD: chared.c,v 1.15 2002/03/18 16:00:50 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* chared.c: Character editor utilities
*/
-#include "sys.h"
-
#include <stdlib.h>
#include "el.h"
diff --git a/lib/libedit/chared.h b/lib/libedit/chared.h
index a3daf9d1705..403eca01114 100644
--- a/lib/libedit/chared.h
+++ b/lib/libedit/chared.h
@@ -1,4 +1,4 @@
-/* $NetBSD: chared.h,v 1.7 2002/02/03 23:37:53 christos Exp $ */
+/* $NetBSD: chared.h,v 1.8 2002/03/18 16:00:51 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
diff --git a/lib/libedit/common.c b/lib/libedit/common.c
index dfb8a710d1b..a6821e93f63 100644
--- a/lib/libedit/common.c
+++ b/lib/libedit/common.c
@@ -1,4 +1,4 @@
-/* $NetBSD: common.c,v 1.10 2001/01/10 07:45:41 jdolecek Exp $ */
+/* $NetBSD: common.c,v 1.11 2002/03/18 16:00:51 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,19 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: common.c,v 1.10 2001/01/10 07:45:41 jdolecek Exp $");
+__RCSID("$NetBSD: common.c,v 1.11 2002/03/18 16:00:51 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* common.c: Common Editor functions
*/
-#include "sys.h"
#include "el.h"
/* ed_end_of_file():
diff --git a/lib/libedit/el.c b/lib/libedit/el.c
index 9a46b2c3a0d..567d39d933f 100644
--- a/lib/libedit/el.c
+++ b/lib/libedit/el.c
@@ -1,4 +1,4 @@
-/* $NetBSD: el.c,v 1.28 2002/02/03 23:37:19 christos Exp $ */
+/* $NetBSD: el.c,v 1.29 2002/03/18 16:00:52 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,20 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
-__RCSID("$NetBSD: el.c,v 1.28 2002/02/03 23:37:19 christos Exp $");
+__RCSID("$NetBSD: el.c,v 1.29 2002/03/18 16:00:52 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* el.c: EditLine interface functions
*/
-#include "sys.h"
-
#include <sys/types.h>
#include <sys/param.h>
#include <string.h>
@@ -180,7 +178,7 @@ el_set(EditLine *el, int op, ...)
case EL_ECHOTC:
case EL_SETTY:
{
- char *argv[20];
+ const char *argv[20];
int i;
for (i = 1; i < 20; i++)
@@ -411,7 +409,7 @@ el_source(EditLine *el, const char *fname)
fp = NULL;
if (fname == NULL) {
-#if 1 /* HAVE_ISSETUGID */
+#ifdef HAVE_ISSETUGID
static const char elpath[] = "/.editrc";
char path[MAXPATHLEN];
@@ -490,7 +488,7 @@ el_beep(EditLine *el)
*/
protected int
/*ARGSUSED*/
-el_editmode(EditLine *el, int argc, char **argv)
+el_editmode(EditLine *el, int argc, const char **argv)
{
const char *how;
diff --git a/lib/libedit/el.h b/lib/libedit/el.h
index 9e8f5e2608e..641081e8745 100644
--- a/lib/libedit/el.h
+++ b/lib/libedit/el.h
@@ -1,4 +1,4 @@
-/* $NetBSD: el.h,v 1.10 2001/10/09 13:50:30 christos Exp $ */
+/* $NetBSD: el.h,v 1.11 2002/03/18 16:00:52 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -134,7 +134,7 @@ struct editline {
el_read_t el_read; /* Character reading stuff */
};
-protected int el_editmode(EditLine *, int, char **);
+protected int el_editmode(EditLine *, int, const char **);
#ifdef DEBUG
#define EL_ABORT(a) (void) (fprintf(el->el_errfile, "%s, %d: ", \
diff --git a/lib/libedit/emacs.c b/lib/libedit/emacs.c
index cc18411ae6a..f520d024bb5 100644
--- a/lib/libedit/emacs.c
+++ b/lib/libedit/emacs.c
@@ -1,4 +1,4 @@
-/* $NetBSD: emacs.c,v 1.9 2001/01/10 07:45:41 jdolecek Exp $ */
+/* $NetBSD: emacs.c,v 1.10 2002/03/18 16:00:52 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,19 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: emacs.c,v 1.9 2001/01/10 07:45:41 jdolecek Exp $");
+__RCSID("$NetBSD: emacs.c,v 1.10 2002/03/18 16:00:52 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* emacs.c: Emacs functions
*/
-#include "sys.h"
#include "el.h"
/* em_delete_or_list():
diff --git a/lib/libedit/hist.c b/lib/libedit/hist.c
index 31589b825e8..094a2411b7a 100644
--- a/lib/libedit/hist.c
+++ b/lib/libedit/hist.c
@@ -1,4 +1,4 @@
-/* $NetBSD: hist.c,v 1.9 2001/05/17 01:02:17 christos Exp $ */
+/* $NetBSD: hist.c,v 1.10 2002/03/18 16:00:53 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,19 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: hist.c,v 1.9 2001/05/17 01:02:17 christos Exp $");
+__RCSID("$NetBSD: hist.c,v 1.10 2002/03/18 16:00:53 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* hist.c: History access functions
*/
-#include "sys.h"
#include <stdlib.h>
#include "el.h"
@@ -161,7 +160,7 @@ hist_get(EditLine *el)
*/
protected int
/*ARGSUSED*/
-hist_list(EditLine *el, int argc, char **argv)
+hist_list(EditLine *el, int argc, const char **argv)
{
const char *str;
diff --git a/lib/libedit/hist.h b/lib/libedit/hist.h
index 9023e612311..5fdccd08ed9 100644
--- a/lib/libedit/hist.h
+++ b/lib/libedit/hist.h
@@ -1,4 +1,4 @@
-/* $NetBSD: hist.h,v 1.6 2001/01/10 07:45:41 jdolecek Exp $ */
+/* $NetBSD: hist.h,v 1.7 2002/03/18 16:00:53 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -74,7 +74,7 @@ protected int hist_init(EditLine *);
protected void hist_end(EditLine *);
protected el_action_t hist_get(EditLine *);
protected int hist_set(EditLine *, hist_fun_t, ptr_t);
-protected int hist_list(EditLine *, int, char **);
+protected int hist_list(EditLine *, int, const char **);
protected int hist_enlargebuf(EditLine *, size_t, size_t);
#endif /* _h_el_hist */
diff --git a/lib/libedit/histedit.h b/lib/libedit/histedit.h
index 9bdebbdbd1f..28b01944bc4 100644
--- a/lib/libedit/histedit.h
+++ b/lib/libedit/histedit.h
@@ -1,4 +1,4 @@
-/* $NetBSD: histedit.h,v 1.18 2001/10/09 13:50:30 christos Exp $ */
+/* $NetBSD: histedit.h,v 1.19 2002/03/18 16:00:54 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -44,6 +44,9 @@
#ifndef _HISTEDIT_H_
#define _HISTEDIT_H_
+#define LIBEDIT_MAJOR 2
+#define LIBEDIT_MINOR 6
+
#include <sys/types.h>
#include <stdio.h>
@@ -90,7 +93,7 @@ void el_end(EditLine *);
*/
const char *el_gets(EditLine *, int *);
int el_getc(EditLine *, char *);
-void el_push(EditLine *, const char *);
+void el_push(EditLine *, char *);
/*
* Beep!
@@ -101,7 +104,7 @@ void el_beep(EditLine *);
* High level function internals control
* Parses argc, argv array and executes builtin editline commands
*/
-int el_parse(EditLine *, int, char **);
+int el_parse(EditLine *, int, const char **);
/*
* Low level editline access functions
diff --git a/lib/libedit/history.c b/lib/libedit/history.c
index d048898023e..f133d2eb05f 100644
--- a/lib/libedit/history.c
+++ b/lib/libedit/history.c
@@ -1,4 +1,4 @@
-/* $NetBSD: history.c,v 1.18 2001/09/29 17:52:10 jdolecek Exp $ */
+/* $NetBSD: history.c,v 1.19 2002/03/18 16:00:54 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,24 +36,26 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: history.c,v 1.18 2001/09/29 17:52:10 jdolecek Exp $");
+__RCSID("$NetBSD: history.c,v 1.19 2002/03/18 16:00:54 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* hist.c: History access functions
*/
-#include "sys.h"
-
#include <string.h>
#include <stdlib.h>
#include <stdarg.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";
@@ -92,6 +94,12 @@ struct history {
#define h_realloc(a, b) realloc((a), (b))
#define h_free(a) free(a)
+typedef struct {
+ int num;
+ char *str;
+} HistEventPrivate;
+
+
private int history_setsize(History *, HistEvent *, int);
private int history_getsize(History *, HistEvent *);
@@ -331,10 +339,11 @@ history_def_add(ptr_t p, HistEvent *ev, const char *str)
history_t *h = (history_t *) p;
size_t len;
char *s;
+ HistEventPrivate *evp = (void *)&h->cursor->ev;
if (h->cursor == &h->list)
return (history_def_enter(p, ev, str));
- len = strlen(h->cursor->ev.str) + strlen(str) + 1;
+ len = strlen(evp->str) + strlen(str) + 1;
s = (char *) h_malloc(len);
if (!s) {
he_seterrev(ev, _HE_MALLOC_FAILED);
@@ -342,9 +351,8 @@ history_def_add(ptr_t p, HistEvent *ev, const char *str)
}
(void) strlcpy(s, h->cursor->ev.str, len);
(void) strlcat(s, str, len);
- /* LINTED const cast */
- h_free((ptr_t) h->cursor->ev.str);
- h->cursor->ev.str = s;
+ h_free(evp->str);
+ evp->str = s;
*ev = h->cursor->ev;
return (0);
}
@@ -357,13 +365,12 @@ history_def_add(ptr_t p, HistEvent *ev, const char *str)
private void
history_def_delete(history_t *h, HistEvent *ev, hentry_t *hp)
{
-
+ HistEventPrivate *evp = (void *)&hp->ev;
if (hp == &h->list)
abort();
hp->prev->next = hp->next;
hp->next->prev = hp->prev;
- /* LINTED const cast */
- h_free((ptr_t) hp->ev.str);
+ h_free((ptr_t) evp->str);
h_free(hp);
h->cur--;
}
diff --git a/lib/libedit/key.c b/lib/libedit/key.c
index 716ffed1a44..e1e64e328ad 100644
--- a/lib/libedit/key.c
+++ b/lib/libedit/key.c
@@ -1,4 +1,4 @@
-/* $NetBSD: key.c,v 1.12 2001/05/17 01:02:17 christos Exp $ */
+/* $NetBSD: key.c,v 1.13 2002/03/18 16:00:55 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,12 +36,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: key.c,v 1.12 2001/05/17 01:02:17 christos Exp $");
+__RCSID("$NetBSD: key.c,v 1.13 2002/03/18 16:00:55 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -66,7 +66,6 @@ __RCSID("$NetBSD: key.c,v 1.12 2001/05/17 01:02:17 christos Exp $");
* 1) It is not possible to have one key that is a
* substr of another.
*/
-#include "sys.h"
#include <string.h>
#include <stdlib.h>
@@ -91,8 +90,9 @@ private int node__try(EditLine *, key_node_t *, const char *,
key_value_t *, int);
private key_node_t *node__get(int);
private void node__put(EditLine *, key_node_t *);
-private int node__delete(EditLine *, key_node_t **, char *);
-private int node_lookup(EditLine *, char *, key_node_t *, int);
+private int node__delete(EditLine *, key_node_t **, const char *);
+private int node_lookup(EditLine *, const char *, key_node_t *,
+ int);
private int node_enum(EditLine *, key_node_t *, int);
private int key__decode_char(char *, int, int);
@@ -219,7 +219,7 @@ key_add(EditLine *el, const char *key, key_value_t *val, int ntype)
*
*/
protected void
-key_clear(EditLine *el, el_action_t *map, char *in)
+key_clear(EditLine *el, el_action_t *map, const char *in)
{
if ((map[(unsigned char)*in] == ED_SEQUENCE_LEAD_IN) &&
@@ -236,7 +236,7 @@ key_clear(EditLine *el, el_action_t *map, char *in)
* they exists.
*/
protected int
-key_delete(EditLine *el, char *key)
+key_delete(EditLine *el, const char *key)
{
if (key[0] == '\0') {
@@ -257,7 +257,7 @@ key_delete(EditLine *el, char *key)
* Print entire el->el_key.map if null
*/
protected void
-key_print(EditLine *el, char *key)
+key_print(EditLine *el, const char *key)
{
/* do nothing if el->el_key.map is empty and null key specified */
@@ -376,7 +376,7 @@ node__try(EditLine *el, key_node_t *ptr, const char *str, key_value_t *val, int
* Delete node that matches str
*/
private int
-node__delete(EditLine *el, key_node_t **inptr, char *str)
+node__delete(EditLine *el, key_node_t **inptr, const char *str)
{
key_node_t *ptr;
key_node_t *prev_ptr = NULL;
@@ -478,7 +478,7 @@ node__get(int ch)
* Print if last node
*/
private int
-node_lookup(EditLine *el, char *str, key_node_t *ptr, int cnt)
+node_lookup(EditLine *el, const char *str, key_node_t *ptr, int cnt)
{
int ncnt;
@@ -568,7 +568,7 @@ node_enum(EditLine *el, key_node_t *ptr, int cnt)
* function specified by val
*/
protected void
-key_kprint(EditLine *el, char *key, key_value_t *val, int ntype)
+key_kprint(EditLine *el, const char *key, key_value_t *val, int ntype)
{
el_bindings_t *fp;
char unparsbuf[EL_BUFSIZ];
@@ -644,9 +644,10 @@ key__decode_char(char *buf, int cnt, int ch)
* Make a printable version of the ey
*/
protected char *
-key__decode_str(char *str, char *buf, char *sep)
+key__decode_str(const char *str, char *buf, const char *sep)
{
- char *b, *p;
+ char *b;
+ const char *p;
b = buf;
if (sep[0] != '\0')
diff --git a/lib/libedit/key.h b/lib/libedit/key.h
index 2212f4d5eb5..80d8626b894 100644
--- a/lib/libedit/key.h
+++ b/lib/libedit/key.h
@@ -1,4 +1,4 @@
-/* $NetBSD: key.h,v 1.5 2001/01/23 15:55:30 jdolecek Exp $ */
+/* $NetBSD: key.h,v 1.6 2002/03/18 16:00:55 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -69,10 +69,11 @@ protected key_value_t *key_map_str(EditLine *, char *);
protected void key_reset(EditLine *);
protected int key_get(EditLine *, char *, key_value_t *);
protected void key_add(EditLine *, const char *, key_value_t *, int);
-protected void key_clear(EditLine *, el_action_t *, char *);
-protected int key_delete(EditLine *, char *);
-protected void key_print(EditLine *, char *);
-protected void key_kprint(EditLine *, char *, key_value_t *, int);
-protected char *key__decode_str(char *, char *, char *);
+protected void key_clear(EditLine *, el_action_t *, const char *);
+protected int key_delete(EditLine *, const char *);
+protected void key_print(EditLine *, const char *);
+protected void key_kprint(EditLine *, const char *, key_value_t *,
+ int);
+protected char *key__decode_str(const char *, char *, const char *);
#endif /* _h_el_key */
diff --git a/lib/libedit/map.c b/lib/libedit/map.c
index f9fcfdf0d53..4187cb59763 100644
--- a/lib/libedit/map.c
+++ b/lib/libedit/map.c
@@ -1,4 +1,4 @@
-/* $NetBSD: map.c,v 1.14 2001/01/09 17:22:09 jdolecek Exp $ */
+/* $NetBSD: map.c,v 1.15 2002/03/18 16:00:55 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,25 +36,24 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: map.c,v 1.14 2001/01/09 17:22:09 jdolecek Exp $");
+__RCSID("$NetBSD: map.c,v 1.15 2002/03/18 16:00:55 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* map.c: Editor function definitions
*/
-#include "sys.h"
#include <stdlib.h>
#include "el.h"
#define N_KEYS 256
-private void map_print_key(EditLine *, el_action_t *, char *);
+private void map_print_key(EditLine *, el_action_t *, const char *);
private void map_print_some_keys(EditLine *, el_action_t *, int, int);
private void map_print_all_keys(EditLine *);
private void map_init_nls(EditLine *);
@@ -1127,7 +1126,7 @@ map_get_editor(EditLine *el, const char **editor)
* Print the function description for 1 key
*/
private void
-map_print_key(EditLine *el, el_action_t *map, char *in)
+map_print_key(EditLine *el, el_action_t *map, const char *in)
{
char outbuf[EL_BUFSIZ];
el_bindings_t *bp;
@@ -1240,14 +1239,14 @@ map_print_all_keys(EditLine *el)
* Add/remove/change bindings
*/
protected int
-map_bind(EditLine *el, int argc, char **argv)
+map_bind(EditLine *el, int argc, const char **argv)
{
el_action_t *map;
int ntype, rem;
- char *p;
+ const char *p;
char inbuf[EL_BUFSIZ];
char outbuf[EL_BUFSIZ];
- char *in = NULL;
+ const char *in = NULL;
char *out = NULL;
el_bindings_t *bp;
int cmd;
diff --git a/lib/libedit/map.h b/lib/libedit/map.h
index ed4b2537f65..3c9948ccf88 100644
--- a/lib/libedit/map.h
+++ b/lib/libedit/map.h
@@ -1,4 +1,4 @@
-/* $NetBSD: map.h,v 1.6 2001/01/09 17:22:09 jdolecek Exp $ */
+/* $NetBSD: map.h,v 1.7 2002/03/18 16:00:56 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -67,7 +67,7 @@ typedef struct el_map_t {
#define MAP_EMACS 0
#define MAP_VI 1
-protected int map_bind(EditLine *, int, char **);
+protected int map_bind(EditLine *, int, const char **);
protected int map_init(EditLine *);
protected void map_end(EditLine *);
protected void map_init_vi(EditLine *);
diff --git a/lib/libedit/parse.c b/lib/libedit/parse.c
index 3beeb1bbbde..0a34f0b15f2 100644
--- a/lib/libedit/parse.c
+++ b/lib/libedit/parse.c
@@ -1,4 +1,4 @@
-/* $NetBSD: parse.c,v 1.14 2001/01/23 15:55:30 jdolecek Exp $ */
+/* $NetBSD: parse.c,v 1.15 2002/03/18 16:00:56 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,12 +36,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: parse.c,v 1.14 2001/01/23 15:55:30 jdolecek Exp $");
+__RCSID("$NetBSD: parse.c,v 1.15 2002/03/18 16:00:56 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -58,14 +58,13 @@ __RCSID("$NetBSD: parse.c,v 1.14 2001/01/23 15:55:30 jdolecek Exp $");
* settc
* setty
*/
-#include "sys.h"
#include "el.h"
#include "tokenizer.h"
#include <stdlib.h>
private const struct {
- char *name;
- int (*func)(EditLine *, int, char **);
+ const char *name;
+ int (*func)(EditLine *, int, const char **);
} cmds[] = {
{ "bind", map_bind },
{ "echotc", term_echotc },
@@ -84,7 +83,7 @@ private const struct {
protected int
parse_line(EditLine *el, const char *line)
{
- char **argv;
+ const char **argv;
int argc;
Tokenizer *tok;
@@ -100,9 +99,9 @@ parse_line(EditLine *el, const char *line)
* Command dispatcher
*/
public int
-el_parse(EditLine *el, int argc, char *argv[])
+el_parse(EditLine *el, int argc, const char *argv[])
{
- char *ptr;
+ const char *ptr;
int i;
if (argc < 1)
diff --git a/lib/libedit/prompt.c b/lib/libedit/prompt.c
index b41ac5b56f0..5c069e17ae3 100644
--- a/lib/libedit/prompt.c
+++ b/lib/libedit/prompt.c
@@ -1,4 +1,4 @@
-/* $NetBSD: prompt.c,v 1.8 2001/01/10 07:45:41 jdolecek Exp $ */
+/* $NetBSD: prompt.c,v 1.9 2002/03/18 16:00:56 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,19 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)prompt.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: prompt.c,v 1.8 2001/01/10 07:45:41 jdolecek Exp $");
+__RCSID("$NetBSD: prompt.c,v 1.9 2002/03/18 16:00:56 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* prompt.c: Prompt printing functions
*/
-#include "sys.h"
#include <stdio.h>
#include "el.h"
diff --git a/lib/libedit/read.c b/lib/libedit/read.c
index 0103fb33597..ccd0a06e599 100644
--- a/lib/libedit/read.c
+++ b/lib/libedit/read.c
@@ -1,4 +1,4 @@
-/* $NetBSD: read.c,v 1.20 2001/09/27 19:29:50 christos Exp $ */
+/* $NetBSD: read.c,v 1.21 2002/03/18 16:00:57 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,12 +36,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: read.c,v 1.20 2001/09/27 19:29:50 christos Exp $");
+__RCSID("$NetBSD: read.c,v 1.21 2002/03/18 16:00:57 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -49,7 +49,6 @@ __RCSID("$NetBSD: read.c,v 1.20 2001/09/27 19:29:50 christos Exp $");
* read.c: Clean this junk up! This is horrible code.
* Terminal read functions
*/
-#include "sys.h"
#include <errno.h>
#include <unistd.h>
#include <stdlib.h>
@@ -217,14 +216,13 @@ read_preread(EditLine *el)
* Push a macro
*/
public void
-el_push(EditLine *el, const char *str)
+el_push(EditLine *el, char *str)
{
c_macro_t *ma = &el->el_chared.c_macro;
if (str != NULL && ma->level + 1 < EL_MAXMACRO) {
ma->level++;
- /* LINTED const cast */
- ma->macro[ma->level] = (char *) str;
+ ma->macro[ma->level] = str;
} else {
term_beep(el);
term__flush();
diff --git a/lib/libedit/readline.c b/lib/libedit/readline.c
index 66069762240..8dabb4319db 100644
--- a/lib/libedit/readline.c
+++ b/lib/libedit/readline.c
@@ -1,4 +1,4 @@
-/* $NetBSD: readline.c,v 1.19 2001/01/10 08:10:45 jdolecek Exp $ */
+/* $NetBSD: readline.c,v 1.20 2002/03/18 16:00:57 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -36,9 +36,9 @@
* POSSIBILITY OF SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
-__RCSID("$NetBSD: readline.c,v 1.19 2001/01/10 08:10:45 jdolecek Exp $");
+__RCSID("$NetBSD: readline.c,v 1.20 2002/03/18 16:00:57 christos Exp $");
#endif /* not lint && not SCCSID */
#include <sys/types.h>
@@ -53,7 +53,6 @@ __RCSID("$NetBSD: readline.c,v 1.19 2001/01/10 08:10:45 jdolecek Exp $");
#include <limits.h>
#include "histedit.h"
#include "readline/readline.h"
-#include "sys.h"
#include "el.h"
#include "fcns.h" /* for EL_NUM_FCNS */
@@ -66,7 +65,11 @@ __RCSID("$NetBSD: readline.c,v 1.19 2001/01/10 08:10:45 jdolecek Exp $");
/* readline compatibility stuff - look at readline sources/documentation */
/* to see what these variables mean */
const char *rl_library_version = "EditLine wrapper";
-char *rl_readline_name = "";
+static char empty[] = { '\0' };
+static char expand_chars[] = { ' ', '\t', '\n', '=', '(', '\0' };
+static char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', '$',
+ '>', '<', '=', ';', '|', '&', '{', '(', '\0' };
+char *rl_readline_name = empty;
FILE *rl_instream = NULL;
FILE *rl_outstream = NULL;
int rl_point = 0;
@@ -78,12 +81,12 @@ int history_length = 0;
int max_input_history = 0;
char history_expansion_char = '!';
char history_subst_char = '^';
-char *history_no_expand_chars = " \t\n=(";
+char *history_no_expand_chars = expand_chars;
Function *history_inhibit_expansion_function = NULL;
int rl_inhibit_completion = 0;
int rl_attempted_completion_over = 0;
-char *rl_basic_word_break_characters = " \t\n\"\\'`@$><=;|&{(";
+char *rl_basic_word_break_characters = break_chars;
char *rl_completer_word_break_characters = NULL;
char *rl_completer_quote_characters = NULL;
CPFunction *rl_completion_entry_function = NULL;
@@ -251,8 +254,8 @@ rl_initialize(void)
* and rl_line_buffer directly.
*/
li = el_line(e);
- /* LINTED const cast */
- rl_line_buffer = (char *) li->buffer;
+ /* a cheesy way to get rid of const cast. */
+ rl_line_buffer = memchr(li->buffer, *li->buffer, 1);
rl_point = rl_end = 0;
return (0);
@@ -269,6 +272,7 @@ readline(const char *prompt)
HistEvent ev;
int count;
const char *ret;
+ char *buf;
if (e == NULL || h == NULL)
rl_initialize();
@@ -284,23 +288,19 @@ readline(const char *prompt)
ret = el_gets(e, &count);
if (ret && count > 0) {
- char *foo;
int lastidx;
- foo = strdup(ret);
+ buf = strdup(ret);
lastidx = count - 1;
- if (foo[lastidx] == '\n')
- foo[lastidx] = '\0';
-
- ret = foo;
+ if (buf[lastidx] == '\n')
+ buf[lastidx] = '\0';
} else
- ret = NULL;
+ buf = NULL;
history(h, &ev, H_GETSIZE);
history_length = ev.num;
- /* LINTED const cast */
- return (char *) ret;
+ return buf;
}
/*
@@ -1374,9 +1374,7 @@ static int
_rl_qsort_string_compare(i1, i2)
const void *i1, *i2;
{
- /*LINTED const castaway*/
const char *s1 = ((const char **)i1)[0];
- /*LINTED const castaway*/
const char *s2 = ((const char **)i2)[0];
return strcasecmp(s1, s2);
diff --git a/lib/libedit/readline/readline.h b/lib/libedit/readline/readline.h
index cd59a4cc3b5..dac6e284f4a 100644
--- a/lib/libedit/readline/readline.h
+++ b/lib/libedit/readline/readline.h
@@ -1,4 +1,4 @@
-/* $NetBSD: readline.h,v 1.1 2001/01/05 21:15:50 jdolecek Exp $ */
+/* $NetBSD: readline.h,v 1.2 2002/03/18 16:01:03 christos Exp $ */
/*-
* Copyright (c) 1997 The NetBSD Foundation, Inc.
@@ -54,7 +54,9 @@ typedef struct _hist_entry {
} HIST_ENTRY;
/* global variables used by readline enabled applications */
-__BEGIN_DECLS
+#ifdef __cplusplus
+extern "C" {
+#endif
extern const char *rl_library_version;
extern char *rl_readline_name;
extern FILE *rl_instream;
@@ -109,6 +111,8 @@ void rl_display_match_list(char **, int, int);
int rl_insert(int, int);
void rl_reset_terminal(const char *);
int rl_bind_key(int, int (*)(int, int));
-__END_DECLS
+#ifdef __cplusplus
+}
+#endif
#endif /* _READLINE_H_ */
diff --git a/lib/libedit/refresh.c b/lib/libedit/refresh.c
index b2ef6e4f84b..935117741d9 100644
--- a/lib/libedit/refresh.c
+++ b/lib/libedit/refresh.c
@@ -1,4 +1,4 @@
-/* $NetBSD: refresh.c,v 1.17 2001/04/13 00:53:11 lukem Exp $ */
+/* $NetBSD: refresh.c,v 1.18 2002/03/18 16:00:58 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,19 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: refresh.c,v 1.17 2001/04/13 00:53:11 lukem Exp $");
+__RCSID("$NetBSD: refresh.c,v 1.18 2002/03/18 16:00:58 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* refresh.c: Lower level screen refreshing functions
*/
-#include "sys.h"
#include <stdio.h>
#include <ctype.h>
#include <unistd.h>
@@ -62,7 +61,7 @@ private void re_insert (EditLine *, char *, int, int, char *, int);
private void re_delete(EditLine *, char *, int, int, int);
private void re_fastputc(EditLine *, int);
private void re__strncopy(char *, char *, size_t);
-private void re__copy_and_pad(char *, char *, size_t);
+private void re__copy_and_pad(char *, const char *, size_t);
#ifdef DEBUG_REFRESH
private void re_printstr(EditLine *, char *, char *, char *);
@@ -908,7 +907,7 @@ re_update_line(EditLine *el, char *old, char *new, int i)
* Copy string and pad with spaces
*/
private void
-re__copy_and_pad(char *dst, char *src, size_t width)
+re__copy_and_pad(char *dst, const char *src, size_t width)
{
int i;
diff --git a/lib/libedit/search.c b/lib/libedit/search.c
index 20fefad87bd..7c1cb84ef11 100644
--- a/lib/libedit/search.c
+++ b/lib/libedit/search.c
@@ -1,4 +1,4 @@
-/* $NetBSD: search.c,v 1.11 2001/01/23 15:55:31 jdolecek Exp $ */
+/* $NetBSD: search.c,v 1.12 2002/03/18 16:00:58 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,19 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: search.c,v 1.11 2001/01/23 15:55:31 jdolecek Exp $");
+__RCSID("$NetBSD: search.c,v 1.12 2002/03/18 16:00:58 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* search.c: History and character search functions
*/
-#include "sys.h"
#include <stdlib.h>
#if defined(REGEX)
#include <regex.h>
diff --git a/lib/libedit/sig.c b/lib/libedit/sig.c
index d7db355de82..0acba124715 100644
--- a/lib/libedit/sig.c
+++ b/lib/libedit/sig.c
@@ -1,4 +1,4 @@
-/* $NetBSD: sig.c,v 1.8 2001/01/09 17:31:04 jdolecek Exp $ */
+/* $NetBSD: sig.c,v 1.9 2002/03/18 16:00:58 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,12 +36,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: sig.c,v 1.8 2001/01/09 17:31:04 jdolecek Exp $");
+__RCSID("$NetBSD: sig.c,v 1.9 2002/03/18 16:00:58 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -50,7 +50,6 @@ __RCSID("$NetBSD: sig.c,v 1.8 2001/01/09 17:31:04 jdolecek Exp $");
* our policy is to trap all signals, set a good state
* and pass the ball to our caller.
*/
-#include "sys.h"
#include "el.h"
#include <stdlib.h>
diff --git a/lib/libedit/sys.h b/lib/libedit/sys.h
index 6255a8d49a0..9970f18f8f2 100644
--- a/lib/libedit/sys.h
+++ b/lib/libedit/sys.h
@@ -1,4 +1,4 @@
-/* $NetBSD: sys.h,v 1.4 2000/09/04 22:06:32 lukem Exp $ */
+/* $NetBSD: sys.h,v 1.5 2002/03/18 16:00:59 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -57,8 +57,6 @@
/* When we want to hide everything */
#endif
-#include <sys/cdefs.h>
-
#ifndef _PTR_T
# define _PTR_T
typedef void *ptr_t;
@@ -71,6 +69,21 @@ typedef void *ioctl_t;
#include <stdio.h>
+#ifndef HAVE_STRLCAT
+#define strlcat libedit_strlcat
+size_t strlcat(char *dst, const char *src, size_t size);
+#endif
+
+#ifndef HAVE_STRLCPY
+#define strlcpy libedit_strlcpy
+size_t strlcpy(char *dst, const char *src, size_t size);
+#endif
+
+#ifndef HAVE_FGETLN
+#define fgetln libedit_fgetln
+char *fgetln(FILE *fp, size_t *len);
+#endif
+
#define REGEX /* Use POSIX.2 regular expression functions */
#undef REGEXP /* Use UNIX V8 regular expression functions */
@@ -83,11 +96,16 @@ typedef void (*sig_t)(int);
/*
* Broken hdrs.
*/
+extern int tgetent(const char *bp, char *name);
+extern int tgetflag(const char *id);
+extern int tgetnum(const char *id);
+extern char *tgetstr(const char *id, char **area);
+extern char *tgoto(const char *cap, int col, int row);
+extern int tputs(const char *str, int affcnt, int (*putc)(int));
extern char *getenv(const char *);
extern int fprintf(FILE *, const char *, ...);
extern int sigsetmask(int);
extern int sigblock(int);
-extern int ioctl(int, int, void *);
extern int fputc(int, FILE *);
extern int fgetc(FILE *);
extern int fflush(FILE *);
@@ -96,7 +114,6 @@ extern int toupper(int);
extern int errno, sys_nerr;
extern char *sys_errlist[];
extern void perror(const char *);
-extern int read(int, const char*, int);
# include <string.h>
# define strerror(e) sys_errlist[e]
# endif
@@ -107,4 +124,8 @@ extern ptr_t memset(ptr_t, int, size_t);
extern char *fgetline(FILE *, int *);
#endif
+#ifdef HAVE_SYS_CDEFS_H
+#include <sys/cdefs.h>
+#endif
+
#endif /* _h_sys */
diff --git a/lib/libedit/term.c b/lib/libedit/term.c
index 7b9d932e86b..d360abeee7b 100644
--- a/lib/libedit/term.c
+++ b/lib/libedit/term.c
@@ -1,4 +1,4 @@
-/* $NetBSD: term.c,v 1.34 2001/11/08 19:39:10 mycroft Exp $ */
+/* $NetBSD: term.c,v 1.35 2002/03/18 16:00:59 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,12 +36,12 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
#else
-__RCSID("$NetBSD: term.c,v 1.34 2001/11/08 19:39:10 mycroft Exp $");
+__RCSID("$NetBSD: term.c,v 1.35 2002/03/18 16:00:59 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
@@ -50,13 +50,24 @@ __RCSID("$NetBSD: term.c,v 1.34 2001/11/08 19:39:10 mycroft Exp $");
* We have to declare a static variable here, since the
* termcap putchar routine does not take an argument!
*/
-#include "sys.h"
#include <stdio.h>
#include <signal.h>
#include <string.h>
#include <stdlib.h>
#include <unistd.h>
+#ifdef HAVE_TERMCAP_H
#include <termcap.h>
+#endif
+#ifdef HAVE_CURSES_H
+#include <curses.h>
+#endif
+#ifdef HAVE_NCURSES_H
+#include <ncurses.h>
+#endif
+/* Solaris's term.h does horrid things. */
+#if (defined(HAVE_TERM_H) && !defined(SUNOS))
+#include <term.h>
+#endif
#include <sys/types.h>
#include <sys/ioctl.h>
@@ -261,7 +272,7 @@ private void term_setflags(EditLine *);
private int term_rebuffer_display(EditLine *);
private void term_free_display(EditLine *);
private int term_alloc_display(EditLine *);
-private void term_alloc(EditLine *, const struct termcapstr *, char *);
+private void term_alloc(EditLine *, const struct termcapstr *, const char *);
private void term_init_arrow(EditLine *);
private void term_reset_arrow(EditLine *);
@@ -369,7 +380,7 @@ term_end(EditLine *el)
* Maintain a string pool for termcap strings
*/
private void
-term_alloc(EditLine *el, const struct termcapstr *t, char *cap)
+term_alloc(EditLine *el, const struct termcapstr *t, const char *cap)
{
char termbuf[TC_BUFSIZE];
int tlen, clen;
@@ -657,7 +668,7 @@ mc_again:
* Overstrike num characters
*/
protected void
-term_overwrite(EditLine *el, char *cp, int n)
+term_overwrite(EditLine *el, const char *cp, int n)
{
if (n <= 0)
return; /* catch bugs */
@@ -870,7 +881,7 @@ term_clear_to_bottom(EditLine *el)
* Read in the terminal capabilities from the requested terminal
*/
protected int
-term_set(EditLine *el, char *term)
+term_set(EditLine *el, const char *term)
{
int i;
char buf[TC_BUFSIZE];
@@ -1101,7 +1112,7 @@ term_reset_arrow(EditLine *el)
* Set an arrow key binding
*/
protected int
-term_set_arrow(EditLine *el, char *name, key_value_t *fun, int type)
+term_set_arrow(EditLine *el, const char *name, key_value_t *fun, int type)
{
fkey_t *arrow = el->el_term.t_fkey;
int i;
@@ -1120,7 +1131,7 @@ term_set_arrow(EditLine *el, char *name, key_value_t *fun, int type)
* Clear an arrow key binding
*/
protected int
-term_clear_arrow(EditLine *el, char *name)
+term_clear_arrow(EditLine *el, const char *name)
{
fkey_t *arrow = el->el_term.t_fkey;
int i;
@@ -1138,7 +1149,7 @@ term_clear_arrow(EditLine *el, char *name)
* Print the arrow key bindings
*/
protected void
-term_print_arrow(EditLine *el, char *name)
+term_print_arrow(EditLine *el, const char *name)
{
int i;
fkey_t *arrow = el->el_term.t_fkey;
@@ -1235,7 +1246,7 @@ term__flush(void)
*/
protected int
/*ARGSUSED*/
-term_telltc(EditLine *el, int argc, char **argv)
+term_telltc(EditLine *el, int argc, const char **argv)
{
const struct termcapstr *t;
char **ts;
@@ -1270,11 +1281,11 @@ term_telltc(EditLine *el, int argc, char **argv)
*/
protected int
/*ARGSUSED*/
-term_settc(EditLine *el, int argc, char **argv)
+term_settc(EditLine *el, int argc, const char **argv)
{
const struct termcapstr *ts;
const struct termcapval *tv;
- char *what, *how;
+ const char *what, *how;
if (argv == NULL || argv[1] == NULL || argv[2] == NULL)
return (-1);
@@ -1346,7 +1357,7 @@ term_settc(EditLine *el, int argc, char **argv)
*/
protected int
/*ARGSUSED*/
-term_echotc(EditLine *el, int argc, char **argv)
+term_echotc(EditLine *el, int argc, const char **argv)
{
char *cap, *scap, *ep;
int arg_need, arg_cols, arg_rows;
diff --git a/lib/libedit/term.h b/lib/libedit/term.h
index 57b233262fd..47e08e84bf4 100644
--- a/lib/libedit/term.h
+++ b/lib/libedit/term.h
@@ -1,4 +1,4 @@
-/* $NetBSD: term.h,v 1.12 2001/01/04 15:56:32 christos Exp $ */
+/* $NetBSD: term.h,v 1.13 2002/03/18 16:01:00 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -47,7 +47,7 @@
#include "histedit.h"
typedef struct { /* Symbolic function key bindings */
- char *name; /* name of the key */
+ const char *name; /* name of the key */
int key; /* Index in termcap table */
key_value_t fun; /* Function bound to it */
int type; /* Type of function */
@@ -87,7 +87,7 @@ typedef struct {
protected void term_move_to_line(EditLine *, int);
protected void term_move_to_char(EditLine *, int);
protected void term_clear_EOL(EditLine *, int);
-protected void term_overwrite(EditLine *, char *, int);
+protected void term_overwrite(EditLine *, const char *, int);
protected void term_insertwrite(EditLine *, char *, int);
protected void term_deletechars(EditLine *, int);
protected void term_clear_screen(EditLine *);
@@ -96,14 +96,14 @@ protected int term_change_size(EditLine *, int, int);
protected int term_get_size(EditLine *, int *, int *);
protected int term_init(EditLine *);
protected void term_bind_arrow(EditLine *);
-protected void term_print_arrow(EditLine *, char *);
-protected int term_clear_arrow(EditLine *, char *);
-protected int term_set_arrow(EditLine *, char *, key_value_t *, int);
+protected void term_print_arrow(EditLine *, const char *);
+protected int term_clear_arrow(EditLine *, const char *);
+protected int term_set_arrow(EditLine *, const char *, key_value_t *, int);
protected void term_end(EditLine *);
-protected int term_set(EditLine *, char *);
-protected int term_settc(EditLine *, int, char **);
-protected int term_telltc(EditLine *, int, char **);
-protected int term_echotc(EditLine *, int, char **);
+protected int term_set(EditLine *, const char *);
+protected int term_settc(EditLine *, int, const char **);
+protected int term_telltc(EditLine *, int, const char **);
+protected int term_echotc(EditLine *, int, const char **);
protected int term__putc(int);
protected void term__flush(void);
diff --git a/lib/libedit/tokenizer.c b/lib/libedit/tokenizer.c
index 44f9431ce8e..f0de39bc9fb 100644
--- a/lib/libedit/tokenizer.c
+++ b/lib/libedit/tokenizer.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tokenizer.c,v 1.9 2002/01/31 02:27:31 christos Exp $ */
+/* $NetBSD: tokenizer.c,v 1.10 2002/03/18 16:01:00 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,19 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)tokenizer.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: tokenizer.c,v 1.9 2002/01/31 02:27:31 christos Exp $");
+__RCSID("$NetBSD: tokenizer.c,v 1.10 2002/03/18 16:01:00 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* tokenize.c: Bourne shell like tokenizer
*/
-#include "sys.h"
#include <string.h>
#include <stdlib.h>
#include "tokenizer.h"
@@ -170,7 +169,7 @@ tok_end(Tokenizer *tok)
* 0: Ok
*/
public int
-tok_line(Tokenizer *tok, const char *line, int *argc, char ***argv)
+tok_line(Tokenizer *tok, const char *line, int *argc, const char ***argv)
{
const char *ptr;
@@ -275,7 +274,7 @@ tok_line(Tokenizer *tok, const char *line, int *argc, char ***argv)
switch (tok->quote) {
case Q_none:
tok_finish(tok);
- *argv = tok->argv;
+ *argv = (const char **)tok->argv;
*argc = tok->argc;
return (0);
@@ -308,7 +307,7 @@ tok_line(Tokenizer *tok, const char *line, int *argc, char ***argv)
return (3);
}
tok_finish(tok);
- *argv = tok->argv;
+ *argv = (const char **)tok->argv;
*argc = tok->argc;
return (0);
diff --git a/lib/libedit/tokenizer.h b/lib/libedit/tokenizer.h
index 77589192132..7cc7a3346e4 100644
--- a/lib/libedit/tokenizer.h
+++ b/lib/libedit/tokenizer.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tokenizer.h,v 1.4 2000/09/04 22:06:33 lukem Exp $ */
+/* $NetBSD: tokenizer.h,v 1.5 2002/03/18 16:01:00 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -49,6 +49,6 @@ typedef struct tokenizer Tokenizer;
Tokenizer *tok_init(const char *);
void tok_reset(Tokenizer *);
void tok_end(Tokenizer *);
-int tok_line(Tokenizer *, const char *, int *, char ***);
+int tok_line(Tokenizer *, const char *, int *, const char ***);
#endif /* _h_tokenizer */
diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c
index ebc4fb4d587..256cf780bfa 100644
--- a/lib/libedit/tty.c
+++ b/lib/libedit/tty.c
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.c,v 1.15 2001/05/17 01:02:17 christos Exp $ */
+/* $NetBSD: tty.c,v 1.16 2002/03/18 16:01:01 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,19 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: tty.c,v 1.15 2001/05/17 01:02:17 christos Exp $");
+__RCSID("$NetBSD: tty.c,v 1.16 2002/03/18 16:01:01 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* tty.c: tty interface stuff
*/
-#include "sys.h"
#include "tty.h"
#include "el.h"
@@ -61,7 +60,7 @@ typedef struct ttymodes_t {
typedef struct ttymap_t {
int nch, och; /* Internal and termio rep of chars */
el_action_t bind[3]; /* emacs, vi, and vi-cmd */
-} ttymap_t;
+} ttymap_t;
private const ttyperm_t ttyperm = {
@@ -1042,13 +1041,13 @@ tty_noquotemode(EditLine *el)
*/
protected int
/*ARGSUSED*/
-tty_stty(EditLine *el, int argc, char **argv)
+tty_stty(EditLine *el, int argc, const char **argv)
{
const ttymodes_t *m;
- char x, *d;
+ char x;
int aflag = 0;
- char *s;
- char *name;
+ const char *s, *d;
+ const char *name;
int z = EX_IO;
if (argv == NULL)
diff --git a/lib/libedit/tty.h b/lib/libedit/tty.h
index e0f3f63a627..e9597fceb2b 100644
--- a/lib/libedit/tty.h
+++ b/lib/libedit/tty.h
@@ -1,4 +1,4 @@
-/* $NetBSD: tty.h,v 1.8 2000/09/04 22:06:33 lukem Exp $ */
+/* $NetBSD: tty.h,v 1.9 2002/03/18 16:01:01 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -453,7 +453,7 @@
#define MD_NN 5
typedef struct {
- char *t_name;
+ const char *t_name;
u_int t_setmask;
u_int t_clrmask;
} ttyperm_t[NN_IO][MD_NN];
@@ -462,7 +462,7 @@ typedef unsigned char ttychar_t[NN_IO][C_NCC];
protected int tty_init(EditLine *);
protected void tty_end(EditLine *);
-protected int tty_stty(EditLine *, int, char**);
+protected int tty_stty(EditLine *, int, const char **);
protected int tty_rawmode(EditLine *);
protected int tty_cookedmode(EditLine *);
protected int tty_quotemode(EditLine *);
diff --git a/lib/libedit/vi.c b/lib/libedit/vi.c
index b131db52cfa..5683c7de066 100644
--- a/lib/libedit/vi.c
+++ b/lib/libedit/vi.c
@@ -1,4 +1,4 @@
-/* $NetBSD: vi.c,v 1.8 2000/09/04 22:06:33 lukem Exp $ */
+/* $NetBSD: vi.c,v 1.9 2002/03/18 16:01:01 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -36,19 +36,18 @@
* SUCH DAMAGE.
*/
-#include <sys/cdefs.h>
+#include "config.h"
#if !defined(lint) && !defined(SCCSID)
#if 0
static char sccsid[] = "@(#)vi.c 8.1 (Berkeley) 6/4/93";
#else
-__RCSID("$NetBSD: vi.c,v 1.8 2000/09/04 22:06:33 lukem Exp $");
+__RCSID("$NetBSD: vi.c,v 1.9 2002/03/18 16:01:01 christos Exp $");
#endif
#endif /* not lint && not SCCSID */
/*
* vi.c: Vi mode commands.
*/
-#include "sys.h"
#include "el.h"
private el_action_t cv_action(EditLine *, int);