Start removing the WIDECHAR ifdefs; building without it has stopped working
anyway. (Ingo Schwarze)
This commit is contained in:
parent
f4ab1bba27
commit
4e541d85ca
|
@ -1,9 +1,8 @@
|
|||
# $NetBSD: Makefile,v 1.56 2016/03/02 19:24:20 christos Exp $
|
||||
# $NetBSD: Makefile,v 1.57 2016/03/23 22:27:48 christos Exp $
|
||||
# @(#)Makefile 8.1 (Berkeley) 6/4/93
|
||||
|
||||
USE_SHLIBDIR= yes
|
||||
|
||||
WIDECHAR ?= yes
|
||||
WARNS?= 5
|
||||
LIB= edit
|
||||
|
||||
|
@ -36,11 +35,8 @@ MLINKS= editline.3 el_init.3 editline.3 el_end.3 editline.3 el_reset.3 \
|
|||
# For protection
|
||||
SRCS= editline.c readline.c tokenizer.c history.c
|
||||
|
||||
.if ${WIDECHAR} == "yes"
|
||||
SRCS += tokenizern.c historyn.c
|
||||
CLEANFILES+=tokenizern.c.tmp tokenizern.c historyn.c.tmp historyn.c
|
||||
CPPFLAGS+=-DWIDECHAR
|
||||
.endif
|
||||
|
||||
LIBEDITDIR?=${.CURDIR}
|
||||
|
||||
|
|
|
@ -1,6 +1,4 @@
|
|||
# $NetBSD: Makefile,v 1.6 2016/02/15 21:38:07 christos Exp $
|
||||
|
||||
WIDECHAR ?= yes
|
||||
# $NetBSD: Makefile,v 1.7 2016/03/23 22:27:48 christos Exp $
|
||||
|
||||
NOMAN=1
|
||||
PROG=wtc1
|
||||
|
@ -8,10 +6,6 @@ CPPFLAGS=-I${.CURDIR}/..
|
|||
LDADD+=-ledit -ltermlib
|
||||
DPADD+=${LIBEDIT} ${LIBTERMLIB}
|
||||
|
||||
.if "${WIDECHAR}" == "yes"
|
||||
CPPFLAGS+=-DWIDECHAR
|
||||
.endif
|
||||
|
||||
.ifdef DEBUG
|
||||
CPPFLAGS+=-DDEBUG
|
||||
.endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $ */
|
||||
/* $NetBSD: chartype.c,v 1.24 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
*/
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $");
|
||||
__RCSID("$NetBSD: chartype.c,v 1.24 2016/03/23 22:27:48 christos Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
#include <ctype.h>
|
||||
|
@ -42,7 +42,6 @@ __RCSID("$NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $");
|
|||
|
||||
#define CT_BUFSIZ ((size_t)1024)
|
||||
|
||||
#ifdef WIDECHAR
|
||||
protected int
|
||||
ct_conv_cbuff_resize(ct_buffer_t *conv, size_t csize)
|
||||
{
|
||||
|
@ -217,20 +216,6 @@ ct_mbrtowc(wchar_t *wc, const char *s, size_t n)
|
|||
return mbrtowc(wc, s, n, &mbs);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
size_t
|
||||
ct_mbrtowc(wchar_t *wc, const char *s, size_t n)
|
||||
if (s == NULL)
|
||||
return 0;
|
||||
if (n == 0)
|
||||
return (size_t)-2;
|
||||
if (wc != NULL)
|
||||
*wc = *s;
|
||||
return *s != '\0';
|
||||
}
|
||||
#endif
|
||||
|
||||
protected const Char *
|
||||
ct_visual_string(const Char *s)
|
||||
{
|
||||
|
@ -292,7 +277,6 @@ ct_visual_width(Char c)
|
|||
return 1; /* Hmm, this really need to be handled outside! */
|
||||
case CHTYPE_NL:
|
||||
return 0; /* Should this be 1 instead? */
|
||||
#ifdef WIDECHAR
|
||||
case CHTYPE_PRINT:
|
||||
return wcwidth(c);
|
||||
case CHTYPE_NONPRINT:
|
||||
|
@ -300,12 +284,6 @@ ct_visual_width(Char c)
|
|||
return 8; /* \U+12345 */
|
||||
else
|
||||
return 7; /* \U+1234 */
|
||||
#else
|
||||
case CHTYPE_PRINT:
|
||||
return 1;
|
||||
case CHTYPE_NONPRINT:
|
||||
return 4; /* \123 */
|
||||
#endif
|
||||
default:
|
||||
return 0; /* should not happen */
|
||||
}
|
||||
|
@ -338,7 +316,6 @@ ct_visual_char(Char *dst, size_t len, Char c)
|
|||
* so this is right */
|
||||
if ((ssize_t)len < ct_visual_width(c))
|
||||
return -1; /* insufficient space */
|
||||
#ifdef WIDECHAR
|
||||
*dst++ = '\\';
|
||||
*dst++ = 'U';
|
||||
*dst++ = '+';
|
||||
|
@ -350,13 +327,6 @@ ct_visual_char(Char *dst, size_t len, Char c)
|
|||
*dst++ = tohexdigit(((unsigned int) c >> 4) & 0xf);
|
||||
*dst = tohexdigit(((unsigned int) c ) & 0xf);
|
||||
return c > 0xffff ? 8 : 7;
|
||||
#else
|
||||
*dst++ = '\\';
|
||||
#define tooctaldigit(v) (Char)((v) + '0')
|
||||
*dst++ = tooctaldigit(((unsigned int) c >> 6) & 0x7);
|
||||
*dst++ = tooctaldigit(((unsigned int) c >> 3) & 0x7);
|
||||
*dst++ = tooctaldigit(((unsigned int) c ) & 0x7);
|
||||
#endif
|
||||
/*FALLTHROUGH*/
|
||||
/* these two should be handled outside this function */
|
||||
default: /* we should never hit the default */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: chartype.h,v 1.25 2016/03/07 00:05:20 christos Exp $ */
|
||||
/* $NetBSD: chartype.h,v 1.26 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -29,8 +29,7 @@
|
|||
#ifndef _h_chartype_f
|
||||
#define _h_chartype_f
|
||||
|
||||
|
||||
#ifdef WIDECHAR
|
||||
#ifndef NARROWCHAR
|
||||
|
||||
/* Ideally we should also test the value of the define to see if it
|
||||
* supports non-BMP code points without requiring UTF-16, but nothing
|
||||
|
@ -105,57 +104,24 @@ Width(wchar_t c)
|
|||
|
||||
#else /* NARROW */
|
||||
|
||||
#define ct_wctob(w) ((int)(w))
|
||||
#define ct_wctomb error
|
||||
#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))
|
||||
|
||||
#define Char char
|
||||
#define FUN(prefix,rest) prefix ## _ ## rest
|
||||
#define FUNW(type) type
|
||||
#define TYPE(type) type
|
||||
#define FSTR "%s"
|
||||
#define FSTARSTR "%.*s"
|
||||
#define STR(x) x
|
||||
#define UC(c) (unsigned char)(c)
|
||||
|
||||
#define Isalpha(x) isalpha((unsigned char)x)
|
||||
#define Isalnum(x) isalnum((unsigned char)x)
|
||||
#define Isgraph(x) isgraph((unsigned char)x)
|
||||
#define Isspace(x) isspace((unsigned char)x)
|
||||
#define Isdigit(x) isdigit((unsigned char)x)
|
||||
#define Iscntrl(x) iscntrl((unsigned char)x)
|
||||
#define Isprint(x) isprint((unsigned char)x)
|
||||
|
||||
#define Isupper(x) isupper((unsigned char)x)
|
||||
#define Islower(x) islower((unsigned char)x)
|
||||
#define Toupper(x) toupper((unsigned char)x)
|
||||
#define Tolower(x) tolower((unsigned char)x)
|
||||
|
||||
#define IsASCII(x) isascii((unsigned char)x)
|
||||
|
||||
#define Strlen(x) strlen(x)
|
||||
#define Strchr(s,c) strchr(s,c)
|
||||
#define Strrchr(s,c) strrchr(s,c)
|
||||
#define Strstr(s,v) strstr(s,v)
|
||||
#define Strdup(x) strdup(x)
|
||||
#define Strcpy(d,s) strcpy(d,s)
|
||||
#define Strncpy(d,s,n) strncpy(d,s,n)
|
||||
#define Strncat(d,s,n) strncat(d,s,n)
|
||||
|
||||
#define Strcmp(s,v) strcmp(s,v)
|
||||
#define Strncmp(s,v,n) strncmp(s,v,n)
|
||||
#define Strcspn(s,r) strcspn(s,r)
|
||||
|
||||
#define Strtol(p,e,b) strtol(p,e,b)
|
||||
|
||||
#define Width(c) 1
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef WIDECHAR
|
||||
#ifndef NARROWCHAR
|
||||
/*
|
||||
* Conversion buffer
|
||||
*/
|
||||
|
@ -189,11 +155,6 @@ protected size_t ct_enc_width(Char);
|
|||
#else
|
||||
#define ct_encode_string(s, b) (s)
|
||||
#define ct_decode_string(s, b) (s)
|
||||
#define ct_decode_argv(l, s, b) (s)
|
||||
#define ct_conv_cbuff_resize(b, s) ((s) == (0))
|
||||
#define ct_conv_wbuff_resize(b, s) ((s) == (0))
|
||||
#define ct_encode_char(d, l, s) (*d = s, 1)
|
||||
#define ct_free_argv(s)
|
||||
#endif
|
||||
|
||||
#ifndef NARROWCHAR
|
||||
|
|
|
@ -256,9 +256,6 @@
|
|||
/* Define to 1 if the system provides the SIZE_MAX constant */
|
||||
#define HAVE_SIZE_MAX 1
|
||||
|
||||
/* Define to 1 if you want wide-character code */
|
||||
/* #undef WIDECHAR */
|
||||
|
||||
/* Define to 1 if on MINIX. */
|
||||
/* #undef _MINIX */
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: el.c,v 1.83 2016/02/24 17:13:22 christos Exp $ */
|
||||
/* $NetBSD: el.c,v 1.84 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)el.c 8.2 (Berkeley) 1/3/94";
|
||||
#else
|
||||
__RCSID("$NetBSD: el.c,v 1.83 2016/02/24 17:13:22 christos Exp $");
|
||||
__RCSID("$NetBSD: el.c,v 1.84 2016/03/23 22:27:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
@ -47,13 +47,11 @@ __RCSID("$NetBSD: el.c,v 1.83 2016/02/24 17:13:22 christos Exp $");
|
|||
#include <sys/types.h>
|
||||
#include <sys/param.h>
|
||||
#include <ctype.h>
|
||||
#include <langinfo.h>
|
||||
#include <locale.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#ifdef WIDECHAR
|
||||
#include <locale.h>
|
||||
#include <langinfo.h>
|
||||
#endif
|
||||
|
||||
#include "el.h"
|
||||
#include "parse.h"
|
||||
|
@ -146,12 +144,10 @@ el_end(EditLine *el)
|
|||
sig_end(el);
|
||||
|
||||
el_free(el->el_prog);
|
||||
#ifdef WIDECHAR
|
||||
el_free(el->el_scratch.cbuff);
|
||||
el_free(el->el_scratch.wbuff);
|
||||
el_free(el->el_lgcyconv.cbuff);
|
||||
el_free(el->el_lgcyconv.wbuff);
|
||||
#endif
|
||||
el_free(el);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: el.h,v 1.34 2016/02/24 17:13:22 christos Exp $ */
|
||||
/* $NetBSD: el.h,v 1.35 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -133,11 +133,9 @@ struct editline {
|
|||
el_search_t el_search; /* Search stuff */
|
||||
el_signal_t el_signal; /* Signal handling stuff */
|
||||
el_read_t el_read; /* Character reading stuff */
|
||||
#ifdef WIDECHAR
|
||||
ct_buffer_t el_scratch; /* Scratch conversion buffer */
|
||||
ct_buffer_t el_lgcyconv; /* Buffer for legacy wrappers */
|
||||
LineInfo el_lgcylinfo; /* Legacy LineInfo buffer */
|
||||
#endif
|
||||
};
|
||||
|
||||
protected int el_editmode(EditLine *, int, const Char **);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: eln.c,v 1.28 2016/02/28 23:02:24 christos Exp $ */
|
||||
/* $NetBSD: eln.c,v 1.29 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 2009 The NetBSD Foundation, Inc.
|
||||
|
@ -27,7 +27,7 @@
|
|||
*/
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: eln.c,v 1.28 2016/02/28 23:02:24 christos Exp $");
|
||||
__RCSID("$NetBSD: eln.c,v 1.29 2016/03/23 22:27:48 christos Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
#include <errno.h>
|
||||
|
@ -58,7 +58,6 @@ el_getc(EditLine *el, char *cp)
|
|||
}
|
||||
|
||||
|
||||
#ifdef WIDECHAR
|
||||
public void
|
||||
el_push(EditLine *el, const char *str)
|
||||
{
|
||||
|
@ -389,4 +388,3 @@ el_insertstr(EditLine *el, const char *str)
|
|||
{
|
||||
return el_winsertstr(el, ct_decode_string(str, &el->el_lgcyconv));
|
||||
}
|
||||
#endif /* WIDECHAR */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hist.c,v 1.24 2016/02/16 22:53:14 christos Exp $ */
|
||||
/* $NetBSD: hist.c,v 1.25 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)hist.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: hist.c,v 1.24 2016/02/16 22:53:14 christos Exp $");
|
||||
__RCSID("$NetBSD: hist.c,v 1.25 2016/03/23 22:27:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
@ -212,7 +212,6 @@ hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz)
|
|||
return 1;
|
||||
}
|
||||
|
||||
#ifdef WIDECHAR
|
||||
protected wchar_t *
|
||||
hist_convert(EditLine *el, int fn, void *arg)
|
||||
{
|
||||
|
@ -222,4 +221,3 @@ hist_convert(EditLine *el, int fn, void *arg)
|
|||
return ct_decode_string((const char *)(const void *)ev.str,
|
||||
&el->el_scratch);
|
||||
}
|
||||
#endif
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: hist.h,v 1.18 2016/02/17 19:47:49 christos Exp $ */
|
||||
/* $NetBSD: hist.h,v 1.19 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -55,14 +55,9 @@ typedef struct el_history_t {
|
|||
#define HIST_FUN_INTERNAL(el, fn, arg) \
|
||||
((((*(el)->el_history.fun) ((el)->el_history.ref, &(el)->el_history.ev, \
|
||||
fn, arg)) == -1) ? NULL : (el)->el_history.ev.str)
|
||||
#ifdef WIDECHAR
|
||||
#define HIST_FUN(el, fn, arg) \
|
||||
(((el)->el_flags & NARROW_HISTORY) ? hist_convert(el, fn, arg) : \
|
||||
HIST_FUN_INTERNAL(el, fn, arg))
|
||||
#else
|
||||
#define HIST_FUN(el, fn, arg) HIST_FUN_INTERNAL(el, fn, arg)
|
||||
#endif
|
||||
|
||||
|
||||
#define HIST_NEXT(el) HIST_FUN(el, H_NEXT, NULL)
|
||||
#define HIST_FIRST(el) HIST_FUN(el, H_FIRST, NULL)
|
||||
|
@ -79,8 +74,6 @@ protected el_action_t hist_get(EditLine *);
|
|||
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 *);
|
||||
#endif
|
||||
|
||||
#endif /* _h_el_hist */
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: history.c,v 1.52 2016/02/17 19:47:49 christos Exp $ */
|
||||
/* $NetBSD: history.c,v 1.53 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)history.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: history.c,v 1.52 2016/02/17 19:47:49 christos Exp $");
|
||||
__RCSID("$NetBSD: history.c,v 1.53 2016/03/23 22:27:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
@ -738,7 +738,7 @@ history_load(TYPE(History) *h, const char *fname)
|
|||
char *ptr;
|
||||
int i = -1;
|
||||
TYPE(HistEvent) ev;
|
||||
#ifdef WIDECHAR
|
||||
#ifndef NARROWCHAR
|
||||
static ct_buffer_t conv;
|
||||
#endif
|
||||
|
||||
|
@ -795,7 +795,7 @@ history_save_fp(TYPE(History) *h, FILE *fp)
|
|||
size_t len, max_size;
|
||||
char *ptr;
|
||||
const char *str;
|
||||
#ifdef WIDECHAR
|
||||
#ifndef NARROWCHAR
|
||||
static ct_buffer_t conv;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: keymacro.c,v 1.14 2016/02/24 14:25:38 christos Exp $ */
|
||||
/* $NetBSD: keymacro.c,v 1.15 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)key.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: keymacro.c,v 1.14 2016/02/24 14:25:38 christos Exp $");
|
||||
__RCSID("$NetBSD: keymacro.c,v 1.15 2016/03/23 22:27:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
@ -218,10 +218,8 @@ keymacro_add(EditLine *el, const Char *key, keymacro_value_t *val, int ntype)
|
|||
protected void
|
||||
keymacro_clear(EditLine *el, el_action_t *map, const Char *in)
|
||||
{
|
||||
#ifdef WIDECHAR
|
||||
if (*in > N_KEYS) /* can't be in the map */
|
||||
return;
|
||||
#endif
|
||||
if ((map[(unsigned char)*in] == ED_SEQUENCE_LEAD_IN) &&
|
||||
((map == el->el_map.key &&
|
||||
el->el_map.alt[(unsigned char)*in] != ED_SEQUENCE_LEAD_IN) ||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
#!/bin/sh -
|
||||
# $NetBSD: makelist,v 1.24 2016/02/17 19:47:49 christos Exp $
|
||||
# $NetBSD: makelist,v 1.25 2016/03/23 22:27:48 christos Exp $
|
||||
#
|
||||
# Copyright (c) 1992, 1993
|
||||
# The Regents of the University of California. All rights reserved.
|
||||
|
@ -56,7 +56,6 @@ case $FLAG in
|
|||
-n)
|
||||
cat << _EOF
|
||||
#include "config.h"
|
||||
#undef WIDECHAR
|
||||
#define NARROWCHAR
|
||||
#include "${FILES}"
|
||||
_EOF
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: read.c,v 1.86 2016/03/02 19:24:20 christos Exp $ */
|
||||
/* $NetBSD: read.c,v 1.87 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)read.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: read.c,v 1.86 2016/03/02 19:24:20 christos Exp $");
|
||||
__RCSID("$NetBSD: read.c,v 1.87 2016/03/23 22:27:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
@ -58,7 +58,6 @@ __RCSID("$NetBSD: read.c,v 1.86 2016/03/02 19:24:20 christos Exp $");
|
|||
#define OKCMD -1 /* must be -1! */
|
||||
|
||||
private int read__fixio(int, int);
|
||||
private int read_preread(EditLine *);
|
||||
private int read_char(EditLine *, wchar_t *);
|
||||
private int read_getcmd(EditLine *, el_action_t *, Char *);
|
||||
private void read_pop(c_macro_t *);
|
||||
|
@ -184,38 +183,6 @@ read__fixio(int fd __attribute__((__unused__)), int e)
|
|||
}
|
||||
|
||||
|
||||
/* read_preread():
|
||||
* Try to read the stuff in the input queue;
|
||||
*/
|
||||
private int
|
||||
read_preread(EditLine *el)
|
||||
{
|
||||
int chrs = 0;
|
||||
|
||||
if (el->el_tty.t_mode == ED_IO)
|
||||
return 0;
|
||||
|
||||
#ifndef WIDECHAR
|
||||
/* FIONREAD attempts to buffer up multiple bytes, and to make that work
|
||||
* properly with partial wide/UTF-8 characters would need some careful work. */
|
||||
#ifdef FIONREAD
|
||||
(void) ioctl(el->el_infd, FIONREAD, &chrs);
|
||||
if (chrs > 0) {
|
||||
char buf[EL_BUFSIZ];
|
||||
|
||||
chrs = read(el->el_infd, buf,
|
||||
(size_t) MIN(chrs, EL_BUFSIZ - 1));
|
||||
if (chrs > 0) {
|
||||
buf[chrs] = '\0';
|
||||
el_push(el, buf);
|
||||
}
|
||||
}
|
||||
#endif /* FIONREAD */
|
||||
#endif
|
||||
return chrs > 0;
|
||||
}
|
||||
|
||||
|
||||
/* el_push():
|
||||
* Push a macro
|
||||
*/
|
||||
|
@ -267,11 +234,9 @@ read_getcmd(EditLine *el, el_action_t *cmdnum, Char *ch)
|
|||
el->el_state.metanext = 0;
|
||||
*ch |= meta;
|
||||
}
|
||||
#ifdef WIDECHAR
|
||||
if (*ch >= N_KEYS)
|
||||
cmd = ED_INSERT;
|
||||
else
|
||||
#endif
|
||||
cmd = el->el_map.current[(unsigned char) *ch];
|
||||
if (cmd == ED_SEQUENCE_LEAD_IN) {
|
||||
keymacro_value_t val;
|
||||
|
@ -407,11 +372,6 @@ el_wgetc(EditLine *el, wchar_t *cp)
|
|||
|
||||
terminal__flush(el);
|
||||
for (;;) {
|
||||
if (ma->level < 0) {
|
||||
if (!read_preread(el))
|
||||
break;
|
||||
}
|
||||
|
||||
if (ma->level < 0)
|
||||
break;
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: readline.c,v 1.126 2016/02/24 17:13:22 christos Exp $ */
|
||||
/* $NetBSD: readline.c,v 1.127 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1997 The NetBSD Foundation, Inc.
|
||||
|
@ -31,7 +31,7 @@
|
|||
|
||||
#include "config.h"
|
||||
#if !defined(lint) && !defined(SCCSID)
|
||||
__RCSID("$NetBSD: readline.c,v 1.126 2016/02/24 17:13:22 christos Exp $");
|
||||
__RCSID("$NetBSD: readline.c,v 1.127 2016/03/23 22:27:48 christos Exp $");
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
#include <sys/types.h>
|
||||
|
@ -1805,9 +1805,7 @@ _rl_completion_append_character_function(const char *dummy
|
|||
int
|
||||
rl_complete(int ignore __attribute__((__unused__)), int invoking_key)
|
||||
{
|
||||
#ifdef WIDECHAR
|
||||
static ct_buffer_t wbreak_conv, sprefix_conv;
|
||||
#endif
|
||||
char *breakchars;
|
||||
|
||||
if (h == NULL || e == NULL)
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: search.c,v 1.39 2016/02/24 14:25:38 christos Exp $ */
|
||||
/* $NetBSD: search.c,v 1.40 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)search.c 8.1 (Berkeley) 6/4/93";
|
||||
#else
|
||||
__RCSID("$NetBSD: search.c,v 1.39 2016/02/24 14:25:38 christos Exp $");
|
||||
__RCSID("$NetBSD: search.c,v 1.40 2016/03/23 22:27:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
@ -112,9 +112,7 @@ regerror(const char *msg)
|
|||
protected int
|
||||
el_match(const Char *str, const Char *pat)
|
||||
{
|
||||
#ifdef WIDECHAR
|
||||
static ct_buffer_t conv;
|
||||
#endif
|
||||
#if defined (REGEX)
|
||||
regex_t re;
|
||||
int rv;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: sys.h,v 1.23 2016/02/17 19:47:49 christos Exp $ */
|
||||
/* $NetBSD: sys.h,v 1.24 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -111,11 +111,6 @@ typedef unsigned int u_int32_t;
|
|||
#define REGEX /* Use POSIX.2 regular expression functions */
|
||||
#undef REGEXP /* Use UNIX V8 regular expression functions */
|
||||
|
||||
#ifndef WIDECHAR
|
||||
#define setlocale(c, l) /*LINTED*/NULL
|
||||
#define nl_langinfo(i) ""
|
||||
#endif
|
||||
|
||||
#if defined(__sun)
|
||||
extern int tgetent(char *, const char *);
|
||||
extern int tgetflag(char *);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* $NetBSD: terminal.c,v 1.24 2016/03/22 01:38:17 christos Exp $ */
|
||||
/* $NetBSD: terminal.c,v 1.25 2016/03/23 22:27:48 christos Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993
|
||||
|
@ -37,7 +37,7 @@
|
|||
#if 0
|
||||
static char sccsid[] = "@(#)term.c 8.2 (Berkeley) 4/30/95";
|
||||
#else
|
||||
__RCSID("$NetBSD: terminal.c,v 1.24 2016/03/22 01:38:17 christos Exp $");
|
||||
__RCSID("$NetBSD: terminal.c,v 1.25 2016/03/23 22:27:48 christos Exp $");
|
||||
#endif
|
||||
#endif /* not lint && not SCCSID */
|
||||
|
||||
|
@ -516,13 +516,11 @@ terminal_move_to_line(EditLine *el, int where)
|
|||
el->el_display[el->el_cursor.v][0] != '\0') {
|
||||
size_t h = (size_t)
|
||||
(el->el_terminal.t_size.h - 1);
|
||||
#ifdef WIDECHAR
|
||||
for (; h > 0 &&
|
||||
el->el_display[el->el_cursor.v][h] ==
|
||||
MB_FILL_CHAR;
|
||||
h--)
|
||||
continue;
|
||||
#endif
|
||||
/* move without newline */
|
||||
terminal_move_to_char(el, (int)h);
|
||||
terminal_overwrite(el, &el->el_display
|
||||
|
@ -596,11 +594,9 @@ mc_again:
|
|||
if (EL_CAN_TAB) {
|
||||
if ((el->el_cursor.h & 0370) !=
|
||||
(where & ~0x7)
|
||||
#ifdef WIDECHAR
|
||||
&& (el->el_display[
|
||||
el->el_cursor.v][where & 0370] !=
|
||||
MB_FILL_CHAR)
|
||||
#endif
|
||||
) {
|
||||
/* if not within tab stop */
|
||||
for (i =
|
||||
|
@ -688,11 +684,9 @@ terminal_overwrite(EditLine *el, const Char *cp, size_t n)
|
|||
if ((c = el->el_display[el->el_cursor.v]
|
||||
[el->el_cursor.h]) != '\0') {
|
||||
terminal_overwrite(el, &c, (size_t)1);
|
||||
#ifdef WIDECHAR
|
||||
while (el->el_display[el->el_cursor.v]
|
||||
[el->el_cursor.h] == MB_FILL_CHAR)
|
||||
el->el_cursor.h++;
|
||||
#endif
|
||||
} else {
|
||||
terminal__putc(el, ' ');
|
||||
el->el_cursor.h = 1;
|
||||
|
|
Loading…
Reference in New Issue