portability fixes.

This commit is contained in:
christos 2004-01-17 17:57:40 +00:00
parent f0177aeba6
commit c8d67a7da2
5 changed files with 34 additions and 17 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: read.c,v 1.30 2003/10/18 23:48:42 christos Exp $ */ /* $NetBSD: read.c,v 1.31 2004/01/17 17:57:40 christos Exp $ */
/*- /*-
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93"; static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
#else #else
__RCSID("$NetBSD: read.c,v 1.30 2003/10/18 23:48:42 christos Exp $"); __RCSID("$NetBSD: read.c,v 1.31 2004/01/17 17:57:40 christos Exp $");
#endif #endif
#endif /* not lint && not SCCSID */ #endif /* not lint && not SCCSID */
@ -508,7 +508,7 @@ el_gets(EditLine *el, int *nread)
el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) { el->el_chared.c_redo.pos < el->el_chared.c_redo.lim) {
if (cmdnum == VI_DELETE_PREV_CHAR && if (cmdnum == VI_DELETE_PREV_CHAR &&
el->el_chared.c_redo.pos != el->el_chared.c_redo.buf el->el_chared.c_redo.pos != el->el_chared.c_redo.buf
&& isprint(el->el_chared.c_redo.pos[-1])) && isprint((unsigned char)el->el_chared.c_redo.pos[-1]))
el->el_chared.c_redo.pos--; el->el_chared.c_redo.pos--;
else else
*el->el_chared.c_redo.pos++ = ch; *el->el_chared.c_redo.pos++ = ch;
@ -553,7 +553,7 @@ el_gets(EditLine *el, int *nread)
if ((el->el_flags & UNBUFFERED) == 0) if ((el->el_flags & UNBUFFERED) == 0)
num = 0; num = 0;
else if (num == -1) { else if (num == -1) {
*el->el_line.lastchar++ = CTRL('d'); *el->el_line.lastchar++ = CONTROL('d');
el->el_line.cursor = el->el_line.lastchar; el->el_line.cursor = el->el_line.lastchar;
num = 1; num = 1;
} }

View File

@ -1,4 +1,4 @@
/* $NetBSD: readline.c,v 1.44 2003/12/05 13:37:48 lukem Exp $ */ /* $NetBSD: readline.c,v 1.45 2004/01/17 17:57:40 christos Exp $ */
/*- /*-
* Copyright (c) 1997 The NetBSD Foundation, Inc. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -38,7 +38,7 @@
#include "config.h" #include "config.h"
#if !defined(lint) && !defined(SCCSID) #if !defined(lint) && !defined(SCCSID)
__RCSID("$NetBSD: readline.c,v 1.44 2003/12/05 13:37:48 lukem Exp $"); __RCSID("$NetBSD: readline.c,v 1.45 2004/01/17 17:57:40 christos Exp $");
#endif /* not lint && not SCCSID */ #endif /* not lint && not SCCSID */
#include <sys/types.h> #include <sys/types.h>
@ -61,10 +61,10 @@ __RCSID("$NetBSD: readline.c,v 1.44 2003/12/05 13:37:48 lukem Exp $");
#ifdef HAVE_ALLOCA_H #ifdef HAVE_ALLOCA_H
#include <alloca.h> #include <alloca.h>
#endif #endif
#include "histedit.h"
#include "readline/readline.h"
#include "el.h" #include "el.h"
#include "fcns.h" /* for EL_NUM_FCNS */ #include "fcns.h" /* for EL_NUM_FCNS */
#include "histedit.h"
#include "readline/readline.h"
/* for rl_complete() */ /* for rl_complete() */
#define TAB '\r' #define TAB '\r'

View File

@ -1,4 +1,4 @@
/* $NetBSD: readline.h,v 1.10 2003/10/27 22:26:35 christos Exp $ */ /* $NetBSD: readline.h,v 1.11 2004/01/17 17:57:40 christos Exp $ */
/*- /*-
* Copyright (c) 1997 The NetBSD Foundation, Inc. * Copyright (c) 1997 The NetBSD Foundation, Inc.
@ -71,7 +71,9 @@ typedef KEYMAP_ENTRY *Keymap;
#ifndef CTRL #ifndef CTRL
#include <sys/ioctl.h> #include <sys/ioctl.h>
#if !defined(__sun__) && !defined(__hpux__)
#include <sys/ttydefaults.h> #include <sys/ttydefaults.h>
#endif
#ifndef CTRL #ifndef CTRL
#define CTRL(c) ((c) & 037) #define CTRL(c) ((c) & 037)
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: sys.h,v 1.8 2003/08/07 16:44:33 agc Exp $ */ /* $NetBSD: sys.h,v 1.9 2004/01/17 17:57:40 christos Exp $ */
/*- /*-
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -48,6 +48,16 @@
# define __attribute__(A) # define __attribute__(A)
#endif #endif
#ifndef __BEGIN_DECLS
# ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
# else
# define __BEGIN_DECLS
# define __END_DECLS
# endif
#endif
#ifndef public #ifndef public
# define public /* Externally visible functions/variables */ # define public /* Externally visible functions/variables */
#endif #endif

View File

@ -1,4 +1,4 @@
/* $NetBSD: term.c,v 1.38 2003/09/14 21:48:55 christos Exp $ */ /* $NetBSD: term.c,v 1.39 2004/01/17 17:57:40 christos Exp $ */
/*- /*-
* Copyright (c) 1992, 1993 * Copyright (c) 1992, 1993
@ -37,7 +37,7 @@
#if 0 #if 0
static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95"; static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
#else #else
__RCSID("$NetBSD: term.c,v 1.38 2003/09/14 21:48:55 christos Exp $"); __RCSID("$NetBSD: term.c,v 1.39 2004/01/17 17:57:40 christos Exp $");
#endif #endif
#endif /* not lint && not SCCSID */ #endif /* not lint && not SCCSID */
@ -941,8 +941,11 @@ term_set(EditLine *el, const char *term)
/* Get the size */ /* Get the size */
Val(T_co) = tgetnum("co"); Val(T_co) = tgetnum("co");
Val(T_li) = tgetnum("li"); Val(T_li) = tgetnum("li");
for (t = tstr; t->name != NULL; t++) for (t = tstr; t->name != NULL; t++) {
term_alloc(el, t, tgetstr(t->name, &area)); /* XXX: some systems tgetstr needs non const */
term_alloc(el, t, tgetstr(strchr(t->name, *t->name),
&area));
}
} }
if (Val(T_co) < 2) if (Val(T_co) < 2)
@ -1424,7 +1427,7 @@ term_echotc(EditLine *el, int argc __attribute__((__unused__)),
} }
(void) fprintf(el->el_outfile, fmtd, 0); (void) fprintf(el->el_outfile, fmtd, 0);
#else #else
(void) fprintf(el->el_outfile, fmtd, el->el_tty.t_speed); (void) fprintf(el->el_outfile, fmtd, (int)el->el_tty.t_speed);
#endif #endif
return (0); return (0);
} else if (strcmp(*argv, "rows") == 0 || strcmp(*argv, "lines") == 0) { } else if (strcmp(*argv, "rows") == 0 || strcmp(*argv, "lines") == 0) {
@ -1443,8 +1446,10 @@ term_echotc(EditLine *el, int argc __attribute__((__unused__)),
scap = el->el_term.t_str[t - tstr]; scap = el->el_term.t_str[t - tstr];
break; break;
} }
if (t->name == NULL) if (t->name == NULL) {
scap = tgetstr(*argv, &area); /* XXX: some systems tgetstr needs non const */
scap = tgetstr(strchr(*argv, **argv), &area);
}
if (!scap || scap[0] == '\0') { if (!scap || scap[0] == '\0') {
if (!silent) if (!silent)
(void) fprintf(el->el_errfile, (void) fprintf(el->el_errfile,