summaryrefslogtreecommitdiff
path: root/usr.bin
diff options
context:
space:
mode:
authorOtto Moerbeek <otto@cvs.openbsd.org>2003-10-31 08:48:17 +0000
committerOtto Moerbeek <otto@cvs.openbsd.org>2003-10-31 08:48:17 +0000
commit94d0072cb5856c2cb998567132dcf66cbcac9fba (patch)
tree02059687cccd68c5564a59aa524b5dbdd0745b37 /usr.bin
parent86b4ccfc14fc81f13dd7a4cb9129ccea185dc317 (diff)
New libedit api changes.
Tested by djm@, mouring@, jmc@. ok deraadt@
Diffstat (limited to 'usr.bin')
-rw-r--r--usr.bin/cdio/cdio.c11
-rw-r--r--usr.bin/ftp/main.c11
-rw-r--r--usr.bin/ftp/util.c10
-rw-r--r--usr.bin/pmdb/clit.c21
4 files changed, 23 insertions, 30 deletions
diff --git a/usr.bin/cdio/cdio.c b/usr.bin/cdio/cdio.c
index 167bf24806d..1066fe9152a 100644
--- a/usr.bin/cdio/cdio.c
+++ b/usr.bin/cdio/cdio.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: cdio.c,v 1.30 2003/06/10 22:20:45 deraadt Exp $ */
+/* $OpenBSD: cdio.c,v 1.31 2003/10/31 08:47:31 otto Exp $ */
/* Copyright (c) 1995 Serge V. Vakulenko
* All rights reserved.
@@ -1242,6 +1242,7 @@ input(int *cmd)
char *buf;
int siz = 0;
char *p;
+ HistEvent hev;
do {
if ((buf = (char *) el_gets(el, &siz)) == NULL || !siz) {
@@ -1250,7 +1251,7 @@ input(int *cmd)
return (0);
}
if (strlen(buf) > 1)
- history(hist, H_ENTER, buf);
+ history(hist, &hev, H_ENTER, buf);
p = parse(buf, cmd);
} while (!p);
return (p);
@@ -1359,10 +1360,12 @@ prompt(void)
void
switch_el(void)
{
+ HistEvent hev;
+
if (el == NULL && hist == NULL) {
- el = el_init(__progname, stdin, stdout);
+ el = el_init(__progname, stdin, stdout, stderr);
hist = history_init();
- history(hist, H_EVENT, 100);
+ history(hist, &hev, H_SETSIZE, 100);
el_set(el, EL_HIST, history, hist);
el_set(el, EL_EDITOR, "emacs");
el_set(el, EL_PROMPT, prompt);
diff --git a/usr.bin/ftp/main.c b/usr.bin/ftp/main.c
index 1b03784d8f2..e94e175cb9e 100644
--- a/usr.bin/ftp/main.c
+++ b/usr.bin/ftp/main.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: main.c,v 1.54 2003/07/02 21:04:10 deraadt Exp $ */
+/* $OpenBSD: main.c,v 1.55 2003/10/31 08:47:31 otto Exp $ */
/* $NetBSD: main.c,v 1.24 1997/08/18 10:20:26 lukem Exp $ */
/*
@@ -69,7 +69,7 @@ static char copyright[] =
#if 0
static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 10/9/94";
#else
-static char rcsid[] = "$OpenBSD: main.c,v 1.54 2003/07/02 21:04:10 deraadt Exp $";
+static char rcsid[] = "$OpenBSD: main.c,v 1.55 2003/10/31 08:47:31 otto Exp $";
#endif
#endif /* not lint */
@@ -386,6 +386,9 @@ cmdscanner(top)
{
struct cmd *c;
int num;
+#ifndef SMALL
+ HistEvent hev;
+#endif
if (!top
#ifndef SMALL
@@ -433,7 +436,7 @@ cmdscanner(top)
}
memcpy(line, buf, (size_t)num);
line[num] = '\0';
- history(hist, H_ENTER, buf);
+ history(hist, &hev, H_ENTER, buf);
}
#endif /* !SMALL */
@@ -453,7 +456,7 @@ cmdscanner(top)
* them will not elicit an error.
*/
if (editing &&
- el_parse(el, margc, margv) != 0)
+ el_parse(el, margc, (const char **)margv) != 0)
#endif /* !SMALL */
fputs("?Invalid command.\n", ttyout);
continue;
diff --git a/usr.bin/ftp/util.c b/usr.bin/ftp/util.c
index 25bd5922f89..2a1eaf33990 100644
--- a/usr.bin/ftp/util.c
+++ b/usr.bin/ftp/util.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: util.c,v 1.35 2003/06/03 02:56:08 millert Exp $ */
+/* $OpenBSD: util.c,v 1.36 2003/10/31 08:47:31 otto Exp $ */
/* $NetBSD: util.c,v 1.12 1997/08/18 10:20:27 lukem Exp $ */
/*-
@@ -71,7 +71,7 @@
*/
#ifndef lint
-static char rcsid[] = "$OpenBSD: util.c,v 1.35 2003/06/03 02:56:08 millert Exp $";
+static char rcsid[] = "$OpenBSD: util.c,v 1.36 2003/10/31 08:47:31 otto Exp $";
#endif /* not lint */
/*
@@ -937,10 +937,12 @@ alarmtimer(wait)
void
controlediting()
{
+ HistEvent hev;
+
if (editing && el == NULL && hist == NULL) {
- el = el_init(__progname, stdin, ttyout); /* init editline */
+ el = el_init(__progname, stdin, ttyout, stderr); /* init editline */
hist = history_init(); /* init the builtin history */
- history(hist, H_EVENT, 100); /* remember 100 events */
+ history(hist, &hev, H_SETSIZE, 100); /* remember 100 events */
el_set(el, EL_HIST, history, hist); /* use history */
el_set(el, EL_EDITOR, "emacs"); /* default editor is emacs */
diff --git a/usr.bin/pmdb/clit.c b/usr.bin/pmdb/clit.c
index 10cce14ed65..249710f5d12 100644
--- a/usr.bin/pmdb/clit.c
+++ b/usr.bin/pmdb/clit.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clit.c,v 1.4 2002/08/09 02:23:48 aaron Exp $ */
+/* $OpenBSD: clit.c,v 1.5 2003/10/31 08:47:31 otto Exp $ */
/*
* Copyright (c) 2002 Artur Grabowski <art@openbsd.org>
* All rights reserved.
@@ -136,9 +136,7 @@ void *
cmdinit(struct clit *cmds, int ncmds)
{
struct clitenv *env;
-#ifdef __NetBSD__
HistEvent ev;
-#endif
if ((env = malloc(sizeof(*env))) == NULL)
err(1, "Can't init cmd interpreter.");
@@ -147,17 +145,10 @@ cmdinit(struct clit *cmds, int ncmds)
env->ncmds = ncmds;
env->hist = history_init();
-#ifdef __NetBSD__
history(env->hist, &ev, H_SETSIZE, 100);
-#else
- history(env->hist, H_EVENT, 100);
-#endif
-#ifdef __NetBSD__
env->el = el_init(__progname, stdin, stdout, stderr);
-#else
- env->el = el_init(__progname, stdin, stdout);
-#endif
+
el_set(env->el, EL_EDITOR, "emacs");
el_set(env->el, EL_PROMPT, prompt);
el_set(env->el, EL_HIST, history, env->hist);
@@ -203,17 +194,11 @@ cmdloop(void *arg)
struct clit *cmdp;
char **ap;
int argc, res;
-#ifdef __NetBSD__
HistEvent ev;
-#endif
memset(argv, 0, sizeof(char *) * maxargs);
-#ifdef __NetBSD__
history(hist, &ev, H_ENTER, elline);
-#else
- history(hist, H_ENTER, elline);
-#endif
orgline = line = strdup(elline);
if (line == NULL)
@@ -237,7 +222,7 @@ cmdloop(void *arg)
/*
* Editline commands.
*/
- if (el_parse(el, argc, argv) != -1)
+ if (el_parse(el, argc, (const char **)argv) != -1)
goto cmdout;
if ((res = name_to_cmd(argv[0], env->cmds, env->ncmds,