diff options
Diffstat (limited to 'lib/libedit/chartype.c')
-rw-r--r-- | lib/libedit/chartype.c | 35 |
1 files changed, 5 insertions, 30 deletions
diff --git a/lib/libedit/chartype.c b/lib/libedit/chartype.c index 9cb54ac11a7b..c240c8ca3c1c 100644 --- a/lib/libedit/chartype.c +++ b/lib/libedit/chartype.c @@ -1,4 +1,4 @@ -/* $NetBSD: chartype.c,v 1.23 2016/02/28 23:02:24 christos Exp $ */ +/* $NetBSD: chartype.c,v 1.12 2015/02/22 02:16:19 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -31,16 +31,13 @@ */ #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.12 2015/02/22 02:16:19 christos Exp $"); #endif /* not lint && not SCCSID */ #include <sys/cdefs.h> __FBSDID("$FreeBSD$"); -#include <ctype.h> -#include <stdlib.h> -#include <string.h> - #include "el.h" +#include <stdlib.h> #define CT_BUFSIZ ((size_t)1024) @@ -71,7 +68,7 @@ ct_conv_wbuff_resize(ct_buffer_t *conv, size_t wsize) { void *p; - if (wsize <= conv->wsize) + if (wsize <= conv->wsize) return 0; conv->wsize = wsize; @@ -209,28 +206,6 @@ ct_encode_char(char *dst, size_t len, Char c) } return l; } - -size_t -ct_mbrtowc(wchar_t *wc, const char *s, size_t n) -{ - mbstate_t mbs; - /* This only works because UTF-8 is stateless */ - memset(&mbs, 0, sizeof(mbs)); - 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 * @@ -354,7 +329,7 @@ ct_visual_char(Char *dst, size_t len, Char c) return c > 0xffff ? 8 : 7; #else *dst++ = '\\'; -#define tooctaldigit(v) (Char)((v) + '0') +#define tooctaldigit(v) ((v) + '0') *dst++ = tooctaldigit(((unsigned int) c >> 6) & 0x7); *dst++ = tooctaldigit(((unsigned int) c >> 3) & 0x7); *dst++ = tooctaldigit(((unsigned int) c ) & 0x7); |