summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd C. Miller <millert@cvs.openbsd.org>1997-06-29 23:40:54 +0000
committerTodd C. Miller <millert@cvs.openbsd.org>1997-06-29 23:40:54 +0000
commit3e4f4b93f7d647dd203b0057e2d02aa2d523b3a5 (patch)
tree726b35055d01abe036a817850f37a627dab42db1
parent73e3215c3918f21ebe935bf879071e6dbf6c842a (diff)
Updates from NetBSD (christos@netbsd.org)
* Portability fixes: __const -> const BADSIG -> SIG_ERR int flags -> u_int flags #if __STDC__ -> #ifdef __STDC__ * Don't allow CSWTCH to interfere with CSUSP on __SVR4 systems. * Return -1 if the terminal set operation resulted in dumb terminal settings. * Handle properly the case where the last line in the sourced file does not have a trailing '\n'. From Jeffrey C Honig. * editrc -> editline in editline(3)
-rw-r--r--lib/libedit/Makefile7
-rw-r--r--lib/libedit/editrc.56
-rw-r--r--lib/libedit/el.c17
-rw-r--r--lib/libedit/histedit.h18
-rw-r--r--lib/libedit/history.c12
-rw-r--r--lib/libedit/read.c14
-rw-r--r--lib/libedit/search.c6
-rw-r--r--lib/libedit/sig.c10
-rw-r--r--lib/libedit/tty.c8
-rw-r--r--lib/libedit/tty.h15
10 files changed, 61 insertions, 52 deletions
diff --git a/lib/libedit/Makefile b/lib/libedit/Makefile
index 6880d1ed6f9..800ae586525 100644
--- a/lib/libedit/Makefile
+++ b/lib/libedit/Makefile
@@ -1,11 +1,10 @@
-# $OpenBSD: Makefile,v 1.5 1997/04/27 20:56:10 millert Exp $
+# $OpenBSD: Makefile,v 1.6 1997/06/29 23:40:46 millert Exp $
# from: @(#)Makefile 8.1 (Berkeley) 6/4/93
LIB= edit
-OSRCS= chared.c common.c el.c emacs.c hist.c key.c map.c parse.c \
- prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c \
- help.c fcns.c
+OSRCS= chared.c common.c el.c emacs.c fcns.c hist.c key.c map.c parse.c \
+ prompt.c read.c refresh.c search.c sig.c term.c tty.c vi.c help.c
MAN= editline.3 editrc.5
diff --git a/lib/libedit/editrc.5 b/lib/libedit/editrc.5
index 892b75333f6..ea3da760442 100644
--- a/lib/libedit/editrc.5
+++ b/lib/libedit/editrc.5
@@ -1,5 +1,5 @@
-.\" $OpenBSD: editrc.5,v 1.2 1997/03/14 05:12:45 millert Exp $
-.\" $NetBSD: editrc.5,v 1.3 1997/01/11 09:57:06 lukem Exp $
+.\" $OpenBSD: editrc.5,v 1.3 1997/06/29 23:40:47 millert Exp $
+.\" $NetBSD: editrc.5,v 1.4 1997/04/24 20:20:31 christos Exp $
.\"
.\" Copyright (c) 1997 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -286,7 +286,7 @@ in the chosen set.
.Xr termcap 5
.Sh AUTHORS
The
-.Nm
+.Nm editline
library was written by Christos Zoulas,
and this manual was written by Luke Mewburn,
with some sections inspired by
diff --git a/lib/libedit/el.c b/lib/libedit/el.c
index 6df947c4901..11710f6c84e 100644
--- a/lib/libedit/el.c
+++ b/lib/libedit/el.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: el.c,v 1.5 1997/03/14 05:12:45 millert Exp $ */
-/* $NetBSD: el.c,v 1.3 1997/01/17 01:03:33 lukem Exp $ */
+/* $OpenBSD: el.c,v 1.6 1997/06/29 23:40:48 millert Exp $ */
+/* $NetBSD: el.c,v 1.6 1997/04/24 18:54:16 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
#else
-static char rcsid[] = "$OpenBSD: el.c,v 1.5 1997/03/14 05:12:45 millert Exp $";
+static char rcsid[] = "$OpenBSD: el.c,v 1.6 1997/06/29 23:40:48 millert Exp $";
#endif
#endif /* not lint && not SCCSID */
@@ -54,12 +54,11 @@ static char rcsid[] = "$OpenBSD: el.c,v 1.5 1997/03/14 05:12:45 millert Exp $";
#include <sys/param.h>
#include <string.h>
#include <stdlib.h>
-#if __STDC__
+#ifdef __STDC__
# include <stdarg.h>
#else
# include <varargs.h>
#endif
-#include <unistd.h>
#include "el.h"
/* el_init():
@@ -159,7 +158,7 @@ el_reset(el)
* set the editline parameters
*/
public int
-#if __STDC__
+#ifdef __STDC__
el_set(EditLine *el, int op, ...)
#else
el_set(va_alist)
@@ -168,7 +167,7 @@ el_set(va_alist)
{
va_list va;
int rv;
-#if __STDC__
+#ifdef __STDC__
va_start(va, op);
#else
EditLine *el;
@@ -311,7 +310,9 @@ el_source(el, fname)
return -1;
while ((ptr = fgetln(fp, &len)) != NULL) {
- ptr[len - 1] = '\0';
+ if (ptr[len - 1] == '\n')
+ --len;
+ ptr[len] = '\0';
if (parse_line(el, ptr) == -1) {
(void)fclose(fp);
return -1;
diff --git a/lib/libedit/histedit.h b/lib/libedit/histedit.h
index 9e29d30045a..7da08c8ed57 100644
--- a/lib/libedit/histedit.h
+++ b/lib/libedit/histedit.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: histedit.h,v 1.4 1997/03/14 05:12:50 millert Exp $ */
-/* $NetBSD: histedit.h,v 1.4 1997/01/14 04:17:24 lukem Exp $ */
+/* $OpenBSD: histedit.h,v 1.5 1997/06/29 23:40:49 millert Exp $ */
+/* $NetBSD: histedit.h,v 1.5 1997/04/11 17:52:45 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -57,9 +57,9 @@ typedef struct editline EditLine;
* For user-defined function interface
*/
typedef struct lineinfo {
- __const char *buffer;
- __const char *cursor;
- __const char *lastchar;
+ const char *buffer;
+ const char *cursor;
+ const char *lastchar;
} LineInfo;
@@ -88,7 +88,7 @@ void el_end __P((EditLine *));
/*
* Get a line, a character or push a string back in the input queue
*/
-__const char *el_gets __P((EditLine *, int *));
+const char *el_gets __P((EditLine *, int *));
int el_getc __P((EditLine *, char *));
void el_push __P((EditLine *, const char *));
@@ -135,7 +135,7 @@ void el_resize __P((EditLine *));
/*
* User-defined function interface.
*/
-__const LineInfo *el_line __P((EditLine *));
+const LineInfo *el_line __P((EditLine *));
int el_insertstr __P((EditLine *, char *));
void el_deletestr __P((EditLine *, int));
@@ -147,7 +147,7 @@ typedef struct history History;
typedef struct HistEvent {
int num;
- __const char *str;
+ const char *str;
} HistEvent;
/*
@@ -156,7 +156,7 @@ typedef struct HistEvent {
History * history_init __P((void));
void history_end __P((History *));
-__const HistEvent * history __P((History *, int, ...));
+const HistEvent * history __P((History *, int, ...));
#define H_FUNC 0 /* , UTSL */
#define H_EVENT 1 /* , const int); */
diff --git a/lib/libedit/history.c b/lib/libedit/history.c
index 23419ac571d..4155dd023c8 100644
--- a/lib/libedit/history.c
+++ b/lib/libedit/history.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: history.c,v 1.4 1997/03/14 05:12:51 millert Exp $ */
-/* $NetBSD: history.c,v 1.4 1997/01/23 14:02:45 mrg Exp $ */
+/* $OpenBSD: history.c,v 1.5 1997/06/29 23:40:49 millert Exp $ */
+/* $NetBSD: history.c,v 1.5 1997/04/11 17:52:46 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93";
#else
-static char rcsid[] = "$OpenBSD: history.c,v 1.4 1997/03/14 05:12:51 millert Exp $";
+static char rcsid[] = "$OpenBSD: history.c,v 1.5 1997/06/29 23:40:49 millert Exp $";
#endif
#endif /* not lint && not SCCSID */
@@ -52,7 +52,7 @@ static char rcsid[] = "$OpenBSD: history.c,v 1.4 1997/03/14 05:12:51 millert Exp
#include <string.h>
#include <stdlib.h>
-#if __STDC__
+#ifdef __STDC__
#include <stdarg.h>
#else
#include <varargs.h>
@@ -575,7 +575,7 @@ history_next_string(h, str)
* User interface to history functions.
*/
const HistEvent *
-#if __STDC__
+#ifdef __STDC__
history(History *h, int fun, ...)
#else
history(va_alist)
@@ -587,7 +587,7 @@ history(va_alist)
const char *str;
static HistEvent sev = { 0, "" };
-#if __STDC__
+#ifdef __STDC__
va_start(va, fun);
#else
History *h;
diff --git a/lib/libedit/read.c b/lib/libedit/read.c
index 5bfe0f7bb91..8061be9780b 100644
--- a/lib/libedit/read.c
+++ b/lib/libedit/read.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: read.c,v 1.4 1997/06/10 20:10:13 millert Exp $ */
-/* $NetBSD: read.c,v 1.3 1997/01/14 04:17:25 lukem Exp $ */
+/* $OpenBSD: read.c,v 1.5 1997/06/29 23:40:50 millert Exp $ */
+/* $NetBSD: read.c,v 1.4 1997/04/11 17:52:47 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
#else
-static char rcsid[] = "$OpenBSD: read.c,v 1.4 1997/06/10 20:10:13 millert Exp $";
+static char rcsid[] = "$OpenBSD: read.c,v 1.5 1997/06/29 23:40:50 millert Exp $";
#endif
#endif /* not lint && not SCCSID */
@@ -93,13 +93,17 @@ read__fixio(fd, e)
#ifdef EWOULDBLOCK
case EWOULDBLOCK:
-# define TRY_AGAIN
+# ifndef TRY_AGAIN
+# define TRY_AGAIN
+# endif
#endif /* EWOULDBLOCK */
#if defined(POSIX) && defined(EAGAIN)
# if defined(EWOULDBLOCK) && EWOULDBLOCK != EAGAIN
case EAGAIN:
-# define TRY_AGAIN
+# ifndef TRY_AGAIN
+# define TRY_AGAIN
+# endif
# endif /* EWOULDBLOCK && EWOULDBLOCK != EAGAIN */
#endif /* POSIX && EAGAIN */
diff --git a/lib/libedit/search.c b/lib/libedit/search.c
index 399b60ebde6..06976ae33fe 100644
--- a/lib/libedit/search.c
+++ b/lib/libedit/search.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: search.c,v 1.3 1997/03/14 05:13:01 millert Exp $ */
-/* $NetBSD: refresh.h,v 1.2 1997/01/11 06:48:08 lukem Exp $ */
+/* $OpenBSD: search.c,v 1.4 1997/06/29 23:40:51 millert Exp $ */
+/* $NetBSD: search.c,v 1.4 1997/01/23 14:02:47 mrg Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93";
#else
-static char rcsid[] = "$OpenBSD: search.c,v 1.3 1997/03/14 05:13:01 millert Exp $";
+static char rcsid[] = "$OpenBSD: search.c,v 1.4 1997/06/29 23:40:51 millert Exp $";
#endif
#endif /* not lint && not SCCSID */
diff --git a/lib/libedit/sig.c b/lib/libedit/sig.c
index 06a0d490ccd..3aeaab0938c 100644
--- a/lib/libedit/sig.c
+++ b/lib/libedit/sig.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: sig.c,v 1.4 1997/03/14 05:13:02 millert Exp $ */
-/* $NetBSD: sig.c,v 1.2 1997/01/11 06:48:10 lukem Exp $ */
+/* $OpenBSD: sig.c,v 1.5 1997/06/29 23:40:52 millert Exp $ */
+/* $NetBSD: sig.c,v 1.3 1997/04/11 17:52:48 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)sig.c 8.1 (Berkeley) 6/4/93";
#else
-static char rcsid[] = "$OpenBSD: sig.c,v 1.4 1997/03/14 05:13:02 millert Exp $";
+static char rcsid[] = "$OpenBSD: sig.c,v 1.5 1997/06/29 23:40:52 millert Exp $";
#endif
#endif /* not lint && not SCCSID */
@@ -128,7 +128,7 @@ sig_init(el)
el->el_signal = (sig_t *) el_malloc(SIGSIZE);
for (i = 0; sighdl[i] != -1; i++)
- el->el_signal[i] = BADSIG;
+ el->el_signal[i] = SIG_ERR;
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
@@ -192,7 +192,7 @@ sig_clr(el)
(void)sigprocmask(SIG_BLOCK, &nset, &oset);
for (i = 0; sighdl[i] != -1; i++)
- if (el->el_signal[i] != BADSIG)
+ if (el->el_signal[i] != SIG_ERR)
(void)signal(sighdl[i], el->el_signal[i]);
sel = NULL; /* we are going to die if the handler is called */
diff --git a/lib/libedit/tty.c b/lib/libedit/tty.c
index 69f12aec2ed..6178b5995c6 100644
--- a/lib/libedit/tty.c
+++ b/lib/libedit/tty.c
@@ -1,5 +1,5 @@
-/* $OpenBSD: tty.c,v 1.3 1997/03/14 05:13:09 millert Exp $ */
-/* $NetBSD: tty.c,v 1.2 1997/01/11 06:48:17 lukem Exp $ */
+/* $OpenBSD: tty.c,v 1.4 1997/06/29 23:40:52 millert Exp $ */
+/* $NetBSD: tty.c,v 1.3 1997/04/11 17:52:49 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93";
#else
-static char rcsid[] = "$OpenBSD: tty.c,v 1.3 1997/03/14 05:13:09 millert Exp $";
+static char rcsid[] = "$OpenBSD: tty.c,v 1.4 1997/06/29 23:40:52 millert Exp $";
#endif
#endif /* not lint && not SCCSID */
@@ -54,7 +54,7 @@ static char rcsid[] = "$OpenBSD: tty.c,v 1.3 1997/03/14 05:13:09 millert Exp $";
typedef struct ttymodes_t {
char *m_name;
- int m_value;
+ u_int m_value;
int m_type;
} ttymodes_t;
diff --git a/lib/libedit/tty.h b/lib/libedit/tty.h
index df99094648b..26ff4854013 100644
--- a/lib/libedit/tty.h
+++ b/lib/libedit/tty.h
@@ -1,5 +1,5 @@
-/* $OpenBSD: tty.h,v 1.3 1997/03/14 05:13:10 millert Exp $ */
-/* $NetBSD: tty.h,v 1.2 1997/01/11 06:48:18 lukem Exp $ */
+/* $OpenBSD: tty.h,v 1.4 1997/06/29 23:40:53 millert Exp $ */
+/* $NetBSD: tty.h,v 1.4 1997/04/11 21:38:02 christos Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -148,7 +148,12 @@
# endif /* IEXTEN != 0 */
#endif /* convex || __convex__ */
-
+/*
+ * So that we don't lose job control.
+ */
+#ifdef __SVR4
+# undef CSWTCH
+#endif
#ifndef _POSIX_VDISABLE
# define _POSIX_VDISABLE ((unsigned char) -1)
@@ -449,8 +454,8 @@
typedef struct {
char *t_name;
- int t_setmask;
- int t_clrmask;
+ u_int t_setmask;
+ u_int t_clrmask;
} ttyperm_t[NN_IO][M_NN];
typedef unsigned char ttychar_t[NN_IO][C_NCC];