Module Name: src Committed By: christos Date: Mon Apr 11 00:50:13 UTC 2016
Modified Files: src/lib/libedit: chared.c chared.h chartype.c chartype.h common.c el.c el.h eln.c emacs.c filecomplete.c filecomplete.h hist.c hist.h history.c keymacro.c keymacro.h map.c map.h parse.c parse.h prompt.c prompt.h read.c refresh.c search.c search.h terminal.c terminal.h tokenizer.c tty.c tty.h vi.c Log Message: Char -> wchar_t from Ingo Schwarze. To generate a diff of this commit: cvs rdiff -u -r1.51 -r1.52 src/lib/libedit/chared.c cvs rdiff -u -r1.27 -r1.28 src/lib/libedit/chared.h src/lib/libedit/hist.c \ src/lib/libedit/terminal.c cvs rdiff -u -r1.25 -r1.26 src/lib/libedit/chartype.c \ src/lib/libedit/tokenizer.c cvs rdiff -u -r1.28 -r1.29 src/lib/libedit/chartype.h cvs rdiff -u -r1.42 -r1.43 src/lib/libedit/common.c \ src/lib/libedit/filecomplete.c src/lib/libedit/search.c cvs rdiff -u -r1.86 -r1.87 src/lib/libedit/el.c cvs rdiff -u -r1.35 -r1.36 src/lib/libedit/el.h cvs rdiff -u -r1.31 -r1.32 src/lib/libedit/eln.c cvs rdiff -u -r1.33 -r1.34 src/lib/libedit/emacs.c cvs rdiff -u -r1.9 -r1.10 src/lib/libedit/filecomplete.h cvs rdiff -u -r1.20 -r1.21 src/lib/libedit/hist.h cvs rdiff -u -r1.54 -r1.55 src/lib/libedit/history.c cvs rdiff -u -r1.17 -r1.18 src/lib/libedit/keymacro.c cvs rdiff -u -r1.3 -r1.4 src/lib/libedit/keymacro.h cvs rdiff -u -r1.45 -r1.46 src/lib/libedit/map.c cvs rdiff -u -r1.10 -r1.11 src/lib/libedit/map.h cvs rdiff -u -r1.36 -r1.37 src/lib/libedit/parse.c cvs rdiff -u -r1.7 -r1.8 src/lib/libedit/parse.h src/lib/libedit/terminal.h cvs rdiff -u -r1.23 -r1.24 src/lib/libedit/prompt.c cvs rdiff -u -r1.13 -r1.14 src/lib/libedit/prompt.h cvs rdiff -u -r1.89 -r1.90 src/lib/libedit/read.c cvs rdiff -u -r1.47 -r1.48 src/lib/libedit/refresh.c cvs rdiff -u -r1.12 -r1.13 src/lib/libedit/search.h cvs rdiff -u -r1.61 -r1.62 src/lib/libedit/tty.c cvs rdiff -u -r1.19 -r1.20 src/lib/libedit/tty.h cvs rdiff -u -r1.58 -r1.59 src/lib/libedit/vi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/lib/libedit/chared.c diff -u src/lib/libedit/chared.c:1.51 src/lib/libedit/chared.c:1.52 --- src/lib/libedit/chared.c:1.51 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/chared.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: chared.c,v 1.51 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: chared.c,v 1.52 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)chared.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: chared.c,v 1.51 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: chared.c,v 1.52 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -84,7 +84,7 @@ cv_undo(EditLine *el) * Save yank/delete data for paste */ protected void -cv_yank(EditLine *el, const Char *ptr, int size) +cv_yank(EditLine *el, const wchar_t *ptr, int size) { c_kill_t *k = &el->el_chared.c_kill; @@ -99,7 +99,7 @@ cv_yank(EditLine *el, const Char *ptr, i protected void c_insert(EditLine *el, int num) { - Char *cp; + wchar_t *cp; if (el->el_line.lastchar + num >= el->el_line.limit) { if (!ch_enlargebufs(el, (size_t)num)) @@ -131,7 +131,7 @@ c_delafter(EditLine *el, int num) } if (num > 0) { - Char *cp; + wchar_t *cp; for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) *cp = cp[num]; @@ -147,7 +147,7 @@ c_delafter(EditLine *el, int num) protected void c_delafter1(EditLine *el) { - Char *cp; + wchar_t *cp; for (cp = el->el_line.cursor; cp <= el->el_line.lastchar; cp++) *cp = cp[1]; @@ -172,7 +172,7 @@ c_delbefore(EditLine *el, int num) } if (num > 0) { - Char *cp; + wchar_t *cp; for (cp = el->el_line.cursor - num; cp <= el->el_line.lastchar; @@ -190,7 +190,7 @@ c_delbefore(EditLine *el, int num) protected void c_delbefore1(EditLine *el) { - Char *cp; + wchar_t *cp; for (cp = el->el_line.cursor - 1; cp <= el->el_line.lastchar; cp++) *cp = cp[1]; @@ -236,8 +236,8 @@ cv__isWord(wint_t p) /* c__prev_word(): * Find the previous word */ -protected Char * -c__prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t)) +protected wchar_t * +c__prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t)) { p--; @@ -260,8 +260,8 @@ c__prev_word(Char *p, Char *low, int n, /* c__next_word(): * Find the next word */ -protected Char * -c__next_word(Char *p, Char *high, int n, int (*wtest)(wint_t)) +protected wchar_t * +c__next_word(wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t)) { while (n--) { while ((p < high) && !(*wtest)(*p)) @@ -278,8 +278,9 @@ c__next_word(Char *p, Char *high, int n, /* cv_next_word(): * Find the next word vi style */ -protected Char * -cv_next_word(EditLine *el, Char *p, Char *high, int n, int (*wtest)(wint_t)) +protected wchar_t * +cv_next_word(EditLine *el, wchar_t *p, wchar_t *high, int n, + int (*wtest)(wint_t)) { int test; @@ -307,8 +308,8 @@ cv_next_word(EditLine *el, Char *p, Char /* cv_prev_word(): * Find the previous word vi style */ -protected Char * -cv_prev_word(Char *p, Char *low, int n, int (*wtest)(wint_t)) +protected wchar_t * +cv_prev_word(wchar_t *p, wchar_t *low, int n, int (*wtest)(wint_t)) { int test; @@ -371,8 +372,8 @@ cv_delfini(EditLine *el) /* cv__endword(): * Go to the end of this word according to vi */ -protected Char * -cv__endword(Char *p, Char *high, int n, int (*wtest)(wint_t)) +protected wchar_t * +cv__endword(wchar_t *p, wchar_t *high, int n, int (*wtest)(wint_t)) { int test; @@ -504,7 +505,7 @@ protected int ch_enlargebufs(EditLine *el, size_t addlen) { size_t sz, newsz; - Char *newbuffer, *oldbuf, *oldkbuf; + wchar_t *newbuffer, *oldbuf, *oldkbuf; sz = (size_t)(el->el_line.limit - el->el_line.buffer + EL_LEAVE); newsz = sz * 2; @@ -614,7 +615,7 @@ ch_end(EditLine *el) * Insert string at cursorI */ public int -el_winsertstr(EditLine *el, const Char *s) +el_winsertstr(EditLine *el, const wchar_t *s) { size_t len; @@ -673,11 +674,10 @@ out: * Get a string */ protected int -c_gets(EditLine *el, Char *buf, const Char *prompt) +c_gets(EditLine *el, wchar_t *buf, const wchar_t *prompt) { - wchar_t wch; ssize_t len; - Char *cp = el->el_line.buffer, ch; + wchar_t *cp = el->el_line.buffer, ch; if (prompt) { len = (ssize_t)wcslen(prompt); @@ -692,12 +692,11 @@ c_gets(EditLine *el, Char *buf, const Ch el->el_line.lastchar = cp + 1; re_refresh(el); - if (el_wgetc(el, &wch) != 1) { + if (el_wgetc(el, &ch) != 1) { ed_end_of_file(el, 0); len = -1; break; } - ch = (Char)wch; switch (ch) { @@ -742,7 +741,7 @@ c_gets(EditLine *el, Char *buf, const Ch protected int c_hpos(EditLine *el) { - Char *ptr; + wchar_t *ptr; /* * Find how many characters till the beginning of this line. Index: src/lib/libedit/chared.h diff -u src/lib/libedit/chared.h:1.27 src/lib/libedit/chared.h:1.28 --- src/lib/libedit/chared.h:1.27 Tue Feb 16 17:53:14 2016 +++ src/lib/libedit/chared.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: chared.h,v 1.27 2016/02/16 22:53:14 christos Exp $ */ +/* $NetBSD: chared.h,v 1.28 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -58,7 +58,7 @@ typedef struct c_macro_t { int level; int offset; - Char **macro; + wchar_t **macro; } c_macro_t; /* @@ -67,16 +67,16 @@ typedef struct c_macro_t { typedef struct c_undo_t { ssize_t len; /* length of saved line */ int cursor; /* position of saved cursor */ - Char *buf; /* full saved text */ + wchar_t *buf; /* full saved text */ } c_undo_t; /* redo for vi */ typedef struct c_redo_t { - Char *buf; /* redo insert key sequence */ - Char *pos; - Char *lim; + wchar_t *buf; /* redo insert key sequence */ + wchar_t *pos; + wchar_t *lim; el_action_t cmd; /* command to redo */ - Char ch; /* char that invoked it */ + wchar_t ch; /* char that invoked it */ int count; int action; /* from cv_action() */ } c_redo_t; @@ -86,16 +86,16 @@ typedef struct c_redo_t { */ typedef struct c_vcmd_t { int action; - Char *pos; + wchar_t *pos; } c_vcmd_t; /* * Kill buffer for emacs */ typedef struct c_kill_t { - Char *buf; - Char *last; - Char *mark; + wchar_t *buf; + wchar_t *last; + wchar_t *mark; } c_kill_t; typedef void (*el_zfunc_t)(EditLine *, void *); @@ -138,20 +138,21 @@ typedef struct el_chared_t { protected int cv__isword(wint_t); protected int cv__isWord(wint_t); protected void cv_delfini(EditLine *); -protected Char *cv__endword(Char *, Char *, int, int (*)(wint_t)); +protected wchar_t *cv__endword(wchar_t *, wchar_t *, int, int (*)(wint_t)); protected int ce__isword(wint_t); protected void cv_undo(EditLine *); -protected void cv_yank(EditLine *, const Char *, int); -protected Char *cv_next_word(EditLine*, Char *, Char *, int, int (*)(wint_t)); -protected Char *cv_prev_word(Char *, Char *, int, int (*)(wint_t)); -protected Char *c__next_word(Char *, Char *, int, int (*)(wint_t)); -protected Char *c__prev_word(Char *, Char *, int, int (*)(wint_t)); +protected void cv_yank(EditLine *, const wchar_t *, int); +protected wchar_t *cv_next_word(EditLine*, wchar_t *, wchar_t *, int, + int (*)(wint_t)); +protected wchar_t *cv_prev_word(wchar_t *, wchar_t *, int, int (*)(wint_t)); +protected wchar_t *c__next_word(wchar_t *, wchar_t *, int, int (*)(wint_t)); +protected wchar_t *c__prev_word(wchar_t *, wchar_t *, int, int (*)(wint_t)); protected void c_insert(EditLine *, int); protected void c_delbefore(EditLine *, int); protected void c_delbefore1(EditLine *); protected void c_delafter(EditLine *, int); protected void c_delafter1(EditLine *); -protected int c_gets(EditLine *, Char *, const Char *); +protected int c_gets(EditLine *, wchar_t *, const wchar_t *); protected int c_hpos(EditLine *); protected int ch_init(EditLine *); Index: src/lib/libedit/hist.c diff -u src/lib/libedit/hist.c:1.27 src/lib/libedit/hist.c:1.28 --- src/lib/libedit/hist.c:1.27 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/hist.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: hist.c,v 1.27 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: hist.c,v 1.28 2016/04/11 00:50:13 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.27 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: hist.c,v 1.28 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -99,7 +99,7 @@ hist_set(EditLine *el, hist_fun_t fun, v protected el_action_t hist_get(EditLine *el) { - const Char *hp; + const wchar_t *hp; int h; if (el->el_history.eventno == 0) { /* if really the current line */ @@ -156,9 +156,9 @@ hist_get(EditLine *el) * process a history command */ protected int -hist_command(EditLine *el, int argc, const Char **argv) +hist_command(EditLine *el, int argc, const wchar_t **argv) { - const Char *str; + const wchar_t *str; int num; HistEventW ev; @@ -196,7 +196,7 @@ protected int /*ARGSUSED*/ hist_enlargebuf(EditLine *el, size_t oldsz, size_t newsz) { - Char *newbuf; + wchar_t *newbuf; newbuf = el_realloc(el->el_history.buf, newsz * sizeof(*newbuf)); if (!newbuf) Index: src/lib/libedit/terminal.c diff -u src/lib/libedit/terminal.c:1.27 src/lib/libedit/terminal.c:1.28 --- src/lib/libedit/terminal.c:1.27 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/terminal.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: terminal.c,v 1.27 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: terminal.c,v 1.28 2016/04/11 00:50:13 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.27 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: terminal.c,v 1.28 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -426,7 +426,7 @@ private int terminal_alloc_display(EditLine *el) { int i; - Char **b; + wchar_t **b; coord_t *c = &el->el_terminal.t_size; b = el_malloc(sizeof(*b) * (size_t)(c->v + 1)); @@ -471,8 +471,8 @@ done: private void terminal_free_display(EditLine *el) { - Char **b; - Char **bufp; + wchar_t **b; + wchar_t **bufp; b = el->el_display; el->el_display = NULL; @@ -654,7 +654,7 @@ mc_again: * Assumes MB_FILL_CHARs are present to keep the column count correct */ protected void -terminal_overwrite(EditLine *el, const Char *cp, size_t n) +terminal_overwrite(EditLine *el, const wchar_t *cp, size_t n) { if (n == 0) return; @@ -680,7 +680,7 @@ terminal_overwrite(EditLine *el, const C if (EL_HAS_MAGIC_MARGINS) { /* force the wrap to avoid the "magic" * situation */ - Char c; + wchar_t c; if ((c = el->el_display[el->el_cursor.v] [el->el_cursor.h]) != '\0') { terminal_overwrite(el, &c, (size_t)1); @@ -744,7 +744,7 @@ terminal_deletechars(EditLine *el, int n * Assumes MB_FILL_CHARs are present to keep column count correct */ protected void -terminal_insertwrite(EditLine *el, Char *cp, int num) +terminal_insertwrite(EditLine *el, wchar_t *cp, int num) { if (num <= 0) return; @@ -1056,18 +1056,18 @@ private void terminal_reset_arrow(EditLine *el) { funckey_t *arrow = el->el_terminal.t_fkey; - static const Char strA[] = {033, '[', 'A', '\0'}; - static const Char strB[] = {033, '[', 'B', '\0'}; - static const Char strC[] = {033, '[', 'C', '\0'}; - static const Char strD[] = {033, '[', 'D', '\0'}; - static const Char strH[] = {033, '[', 'H', '\0'}; - static const Char strF[] = {033, '[', 'F', '\0'}; - static const Char stOA[] = {033, 'O', 'A', '\0'}; - static const Char stOB[] = {033, 'O', 'B', '\0'}; - static const Char stOC[] = {033, 'O', 'C', '\0'}; - static const Char stOD[] = {033, 'O', 'D', '\0'}; - static const Char stOH[] = {033, 'O', 'H', '\0'}; - static const Char stOF[] = {033, 'O', 'F', '\0'}; + static const wchar_t strA[] = L"\033[A"; + static const wchar_t strB[] = L"\033[B"; + static const wchar_t strC[] = L"\033[C"; + static const wchar_t strD[] = L"\033[D"; + static const wchar_t strH[] = L"\033[H"; + static const wchar_t strF[] = L"\033[F"; + static const wchar_t stOA[] = L"\033OA"; + static const wchar_t stOB[] = L"\033OB"; + static const wchar_t stOC[] = L"\033OC"; + static const wchar_t stOD[] = L"\033OD"; + static const wchar_t stOH[] = L"\033OH"; + static const wchar_t stOF[] = L"\033OF"; keymacro_add(el, strA, &arrow[A_K_UP].fun, arrow[A_K_UP].type); keymacro_add(el, strB, &arrow[A_K_DN].fun, arrow[A_K_DN].type); @@ -1103,7 +1103,7 @@ terminal_reset_arrow(EditLine *el) * Set an arrow key binding */ protected int -terminal_set_arrow(EditLine *el, const Char *name, keymacro_value_t *fun, +terminal_set_arrow(EditLine *el, const wchar_t *name, keymacro_value_t *fun, int type) { funckey_t *arrow = el->el_terminal.t_fkey; @@ -1123,7 +1123,7 @@ terminal_set_arrow(EditLine *el, const C * Clear an arrow key binding */ protected int -terminal_clear_arrow(EditLine *el, const Char *name) +terminal_clear_arrow(EditLine *el, const wchar_t *name) { funckey_t *arrow = el->el_terminal.t_fkey; int i; @@ -1141,7 +1141,7 @@ terminal_clear_arrow(EditLine *el, const * Print the arrow key bindings */ protected void -terminal_print_arrow(EditLine *el, const Char *name) +terminal_print_arrow(EditLine *el, const wchar_t *name) { int i; funckey_t *arrow = el->el_terminal.t_fkey; @@ -1176,8 +1176,8 @@ terminal_bind_arrow(EditLine *el) terminal_reset_arrow(el); for (i = 0; i < A_K_NKEYS; i++) { - Char wt_str[VISUAL_WIDTH_MAX]; - Char *px; + wchar_t wt_str[VISUAL_WIDTH_MAX]; + wchar_t *px; size_t n; p = el->el_terminal.t_str[arrow[i].key]; @@ -1253,7 +1253,7 @@ terminal__putc(EditLine *el, wint_t c) ssize_t i; if (c == (wint_t)MB_FILL_CHAR) return 0; - i = ct_encode_char(buf, (size_t)MB_LEN_MAX, (Char)c); + i = ct_encode_char(buf, (size_t)MB_LEN_MAX, c); if (i <= 0) return (int)i; buf[i] = '\0'; @@ -1276,8 +1276,8 @@ terminal__flush(EditLine *el) protected void terminal_writec(EditLine *el, wint_t c) { - Char visbuf[VISUAL_WIDTH_MAX +1]; - ssize_t vcnt = ct_visual_char(visbuf, VISUAL_WIDTH_MAX, (Char)c); + wchar_t visbuf[VISUAL_WIDTH_MAX +1]; + ssize_t vcnt = ct_visual_char(visbuf, VISUAL_WIDTH_MAX, c); if (vcnt < 0) vcnt = 0; visbuf[vcnt] = '\0'; @@ -1292,7 +1292,7 @@ terminal_writec(EditLine *el, wint_t c) protected int /*ARGSUSED*/ terminal_telltc(EditLine *el, int argc __attribute__((__unused__)), - const Char **argv __attribute__((__unused__))) + const wchar_t **argv __attribute__((__unused__))) { const struct termcapstr *t; char **ts; @@ -1334,7 +1334,7 @@ terminal_telltc(EditLine *el, int argc _ protected int /*ARGSUSED*/ terminal_settc(EditLine *el, int argc __attribute__((__unused__)), - const Char **argv) + const wchar_t **argv) { const struct termcapstr *ts; const struct termcapval *tv; @@ -1467,10 +1467,10 @@ terminal_gettc(EditLine *el, int argc __ protected int /*ARGSUSED*/ terminal_echotc(EditLine *el, int argc __attribute__((__unused__)), - const Char **argv) + const wchar_t **argv) { char *cap, *scap; - Char *ep; + wchar_t *ep; int arg_need, arg_cols, arg_rows; int verbose = 0, silent = 0; char *area; Index: src/lib/libedit/chartype.c diff -u src/lib/libedit/chartype.c:1.25 src/lib/libedit/chartype.c:1.26 --- src/lib/libedit/chartype.c:1.25 Sat Apr 9 14:43:17 2016 +++ src/lib/libedit/chartype.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: chartype.c,v 1.25 2016/04/09 18:43:17 christos Exp $ */ +/* $NetBSD: chartype.c,v 1.26 2016/04/11 00:50:13 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.25 2016/04/09 18:43:17 christos Exp $"); +__RCSID("$NetBSD: chartype.c,v 1.26 2016/04/11 00:50:13 christos Exp $"); #endif /* not lint && not SCCSID */ #include <ctype.h> @@ -86,7 +86,7 @@ ct_conv_wbuff_resize(ct_buffer_t *conv, public char * -ct_encode_string(const Char *s, ct_buffer_t *conv) +ct_encode_string(const wchar_t *s, ct_buffer_t *conv) { char *dst; ssize_t used; @@ -115,7 +115,7 @@ ct_encode_string(const Char *s, ct_buffe return conv->cbuff; } -public Char * +public wchar_t * ct_decode_string(const char *s, ct_buffer_t *conv) { size_t len; @@ -136,13 +136,13 @@ ct_decode_string(const char *s, ct_buffe } -protected Char ** +protected wchar_t ** ct_decode_argv(int argc, const char *argv[], ct_buffer_t *conv) { size_t bufspace; int i; - Char *p; - Char **wargv; + wchar_t *p; + wchar_t **wargv; ssize_t bytes; /* Make sure we have enough space in the conversion buffer to store all @@ -177,7 +177,7 @@ ct_decode_argv(int argc, const char *arg protected size_t -ct_enc_width(Char c) +ct_enc_width(wchar_t c) { /* UTF-8 encoding specific values */ if (c < 0x80) @@ -193,7 +193,7 @@ ct_enc_width(Char c) } protected ssize_t -ct_encode_char(char *dst, size_t len, Char c) +ct_encode_char(char *dst, size_t len, wchar_t c) { ssize_t l = 0; if (len < ct_enc_width(c)) @@ -207,13 +207,13 @@ ct_encode_char(char *dst, size_t len, Ch return l; } -protected const Char * -ct_visual_string(const Char *s) +protected const wchar_t * +ct_visual_string(const wchar_t *s) { - static Char *buff = NULL; + static wchar_t *buff = NULL; static size_t buffsize = 0; void *p; - Char *dst; + wchar_t *dst; ssize_t used = 0; if (!s) @@ -258,7 +258,7 @@ out: protected int -ct_visual_width(Char c) +ct_visual_width(wchar_t c) { int t = ct_chr_class(c); switch (t) { @@ -282,7 +282,7 @@ ct_visual_width(Char c) protected ssize_t -ct_visual_char(Char *dst, size_t len, Char c) +ct_visual_char(wchar_t *dst, size_t len, wchar_t c) { int t = ct_chr_class(c); switch (t) { @@ -329,7 +329,7 @@ ct_visual_char(Char *dst, size_t len, Ch protected int -ct_chr_class(Char c) +ct_chr_class(wchar_t c) { if (c == '\t') return CHTYPE_TAB; Index: src/lib/libedit/tokenizer.c diff -u src/lib/libedit/tokenizer.c:1.25 src/lib/libedit/tokenizer.c:1.26 --- src/lib/libedit/tokenizer.c:1.25 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/tokenizer.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tokenizer.c,v 1.25 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: tokenizer.c,v 1.26 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)tokenizer.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: tokenizer.c,v 1.25 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: tokenizer.c,v 1.26 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -68,12 +68,14 @@ typedef enum { #define tok_realloc(a, b) realloc(a, b) #ifdef NARROWCHAR +#define Char char #define FUN(prefix, rest) prefix ## _ ## rest #define TYPE(type) type #define STR(x) x #define Strchr(s, c) strchr(s, c) #define tok_strdup(s) strdup(s) #else +#define Char wchar_t #define FUN(prefix, rest) prefix ## _w ## rest #define TYPE(type) type ## W #define STR(x) L ## x Index: src/lib/libedit/chartype.h diff -u src/lib/libedit/chartype.h:1.28 src/lib/libedit/chartype.h:1.29 --- src/lib/libedit/chartype.h:1.28 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/chartype.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: chartype.h,v 1.28 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: chartype.h,v 1.29 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 2009 The NetBSD Foundation, Inc. @@ -51,40 +51,33 @@ #warning Build environment does not support non-BMP characters #endif -#define Char wchar_t -#else /* NARROW */ -#define Char char -#endif - - -#ifndef NARROWCHAR /* * Conversion buffer */ typedef struct ct_buffer_t { char *cbuff; size_t csize; - Char *wbuff; + wchar_t *wbuff; size_t wsize; } ct_buffer_t; #define ct_encode_string __ct_encode_string /* Encode a wide-character string and return the UTF-8 encoded result. */ -public char *ct_encode_string(const Char *, ct_buffer_t *); +public char *ct_encode_string(const wchar_t *, ct_buffer_t *); #define ct_decode_string __ct_decode_string /* Decode a (multi)?byte string and return the wide-character string result. */ -public Char *ct_decode_string(const char *, ct_buffer_t *); +public wchar_t *ct_decode_string(const char *, ct_buffer_t *); /* Decode a (multi)?byte argv string array. * The pointer returned must be free()d when done. */ -protected Char **ct_decode_argv(int, const char *[], ct_buffer_t *); +protected wchar_t **ct_decode_argv(int, const char *[], ct_buffer_t *); /* Resizes the conversion buffer(s) if needed. */ protected int ct_conv_cbuff_resize(ct_buffer_t *, size_t); protected int ct_conv_wbuff_resize(ct_buffer_t *, size_t); -protected ssize_t ct_encode_char(char *, size_t, Char); -protected size_t ct_enc_width(Char); +protected ssize_t ct_encode_char(char *, size_t, wchar_t); +protected size_t ct_enc_width(wchar_t); #else #define ct_encode_string(s, b) (s) @@ -103,20 +96,20 @@ protected size_t ct_enc_width(Char); /* The terminal is thought of in terms of X columns by Y lines. In the cases * where a wide character takes up more than one column, the adjacent * occupied column entries will contain this faux character. */ -#define MB_FILL_CHAR ((Char)-1) +#define MB_FILL_CHAR ((wchar_t)-1) /* Visual width of character c, taking into account ^? , \0177 and \U+nnnnn * style visual expansions. */ -protected int ct_visual_width(Char); +protected int ct_visual_width(wchar_t); /* Turn the given character into the appropriate visual format, matching * the width given by ct_visual_width(). Returns the number of characters used - * up, or -1 if insufficient space. Buffer length is in count of Char's. */ -protected ssize_t ct_visual_char(Char *, size_t, Char); + * up, or -1 if insufficient space. Buffer length is in count of wchar_t's. */ +protected ssize_t ct_visual_char(wchar_t *, size_t, wchar_t); /* Convert the given string into visual format, using the ct_visual_char() * function. Uses a static buffer, so not threadsafe. */ -protected const Char *ct_visual_string(const Char *); +protected const wchar_t *ct_visual_string(const wchar_t *); /* printable character, use ct_visual_width() to find out display width */ @@ -130,7 +123,7 @@ protected const Char *ct_visual_string(c /* non-printable character */ #define CHTYPE_NONPRINT (-4) /* classification of character c, as one of the above defines */ -protected int ct_chr_class(Char c); +protected int ct_chr_class(wchar_t c); #endif #endif /* _chartype_f */ Index: src/lib/libedit/common.c diff -u src/lib/libedit/common.c:1.42 src/lib/libedit/common.c:1.43 --- src/lib/libedit/common.c:1.42 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/common.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: common.c,v 1.42 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: common.c,v 1.43 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)common.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: common.c,v 1.42 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: common.c,v 1.43 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -91,14 +91,14 @@ ed_insert(EditLine *el, wint_t c) || el->el_line.cursor >= el->el_line.lastchar) c_insert(el, 1); - *el->el_line.cursor++ = (Char)c; + *el->el_line.cursor++ = c; re_fastaddc(el); /* fast refresh for one char. */ } else { if (el->el_state.inputmode != MODE_REPLACE_1) c_insert(el, el->el_state.argument); while (count-- && el->el_line.cursor < el->el_line.lastchar) - *el->el_line.cursor++ = (Char)c; + *el->el_line.cursor++ = c; re_refresh(el); } @@ -117,7 +117,7 @@ protected el_action_t /*ARGSUSED*/ ed_delete_prev_word(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *cp, *p, *kp; + wchar_t *cp, *p, *kp; if (el->el_line.cursor == el->el_line.buffer) return CC_ERROR; @@ -192,7 +192,7 @@ protected el_action_t /*ARGSUSED*/ ed_kill_line(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *kp, *cp; + wchar_t *kp, *cp; cp = el->el_line.cursor; kp = el->el_chared.c_kill.buf; @@ -270,7 +270,7 @@ ed_transpose_chars(EditLine *el, wint_t /* must have at least two chars entered */ c = el->el_line.cursor[-2]; el->el_line.cursor[-2] = el->el_line.cursor[-1]; - el->el_line.cursor[-1] = (Char)c; + el->el_line.cursor[-1] = c; return CC_REFRESH; } else return CC_ERROR; @@ -285,7 +285,7 @@ protected el_action_t /*ARGSUSED*/ ed_next_char(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *lim = el->el_line.lastchar; + wchar_t *lim = el->el_line.lastchar; if (el->el_line.cursor >= lim || (el->el_line.cursor == lim - 1 && @@ -708,7 +708,7 @@ protected el_action_t /*ARGSUSED*/ ed_search_prev_history(EditLine *el, wint_t c __attribute__((__unused__))) { - const Char *hp; + const wchar_t *hp; int h; int found = 0; @@ -776,7 +776,7 @@ protected el_action_t /*ARGSUSED*/ ed_search_next_history(EditLine *el, wint_t c __attribute__((__unused__))) { - const Char *hp; + const wchar_t *hp; int h; int found = 0; @@ -830,7 +830,7 @@ protected el_action_t /*ARGSUSED*/ ed_prev_line(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *ptr; + wchar_t *ptr; int nchars = c_hpos(el); /* @@ -873,7 +873,7 @@ protected el_action_t /*ARGSUSED*/ ed_next_line(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *ptr; + wchar_t *ptr; int nchars = c_hpos(el); /* @@ -907,7 +907,7 @@ protected el_action_t /*ARGSUSED*/ ed_command(EditLine *el, wint_t c __attribute__((__unused__))) { - Char tmpbuf[EL_BUFSIZ]; + wchar_t tmpbuf[EL_BUFSIZ]; int tmplen; tmplen = c_gets(el, tmpbuf, L"\n: "); Index: src/lib/libedit/filecomplete.c diff -u src/lib/libedit/filecomplete.c:1.42 src/lib/libedit/filecomplete.c:1.43 --- src/lib/libedit/filecomplete.c:1.42 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/filecomplete.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: filecomplete.c,v 1.42 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: filecomplete.c,v 1.43 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -31,7 +31,7 @@ #include "config.h" #if !defined(lint) && !defined(SCCSID) -__RCSID("$NetBSD: filecomplete.c,v 1.42 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: filecomplete.c,v 1.43 2016/04/11 00:50:13 christos Exp $"); #endif /* not lint && not SCCSID */ #include <sys/types.h> @@ -49,9 +49,7 @@ __RCSID("$NetBSD: filecomplete.c,v 1.42 #include "el.h" #include "filecomplete.h" -static const Char break_chars[] = { ' ', '\t', '\n', '"', '\\', '\'', '`', '@', - '$', '>', '<', '=', ';', '|', '&', '{', '(', '\0' }; - +static const wchar_t break_chars[] = L" \t\n\"\\'`@$><=;|&{("; /********************************/ /* completion functions */ @@ -410,14 +408,14 @@ int fn_complete(EditLine *el, char *(*complet_func)(const char *, int), char **(*attempted_completion_function)(const char *, int, int), - const Char *word_break, const Char *special_prefixes, + const wchar_t *word_break, const wchar_t *special_prefixes, const char *(*app_func)(const char *), size_t query_items, int *completion_type, int *over, int *point, int *end) { const LineInfoW *li; - Char *temp; + wchar_t *temp; char **matches; - const Char *ctemp; + const wchar_t *ctemp; size_t len; int what_to_do = '\t'; int retval = CC_NORM; Index: src/lib/libedit/search.c diff -u src/lib/libedit/search.c:1.42 src/lib/libedit/search.c:1.43 --- src/lib/libedit/search.c:1.42 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/search.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: search.c,v 1.42 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: search.c,v 1.43 2016/04/11 00:50:13 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.42 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: search.c,v 1.43 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -110,7 +110,7 @@ regerror(const char *msg) * Return if string matches pattern */ protected int -el_match(const Char *str, const Char *pat) +el_match(const wchar_t *str, const wchar_t *pat) { static ct_buffer_t conv; #if defined (REGEX) @@ -157,7 +157,7 @@ el_match(const Char *str, const Char *pa * return True if the pattern matches the prefix */ protected int -c_hmatch(EditLine *el, const Char *str) +c_hmatch(EditLine *el, const wchar_t *str) { #ifdef SDEBUG (void) fprintf(el->el_errfile, "match `%s' with `%s'\n", @@ -206,13 +206,11 @@ c_setpat(EditLine *el) protected el_action_t ce_inc_search(EditLine *el, int dir) { - static const Char STRfwd[] = {'f', 'w', 'd', '\0'}, - STRbck[] = {'b', 'c', 'k', '\0'}; - static Char pchar = ':';/* ':' = normal, '?' = failed */ - static Char endcmd[2] = {'\0', '\0'}; - Char *ocursor = el->el_line.cursor, oldpchar = pchar, ch; - const Char *cp; - wchar_t wch; + static const wchar_t STRfwd[] = L"fwd", STRbck[] = L"bck"; + static wchar_t pchar = L':'; /* ':' = normal, '?' = failed */ + static wchar_t endcmd[2] = {'\0', '\0'}; + wchar_t *ocursor = el->el_line.cursor, oldpchar = pchar, ch; + const wchar_t *cp; el_action_t ret = CC_NORM; @@ -251,11 +249,9 @@ ce_inc_search(EditLine *el, int dir) *el->el_line.lastchar = '\0'; re_refresh(el); - if (el_wgetc(el, &wch) != 1) + if (el_wgetc(el, &ch) != 1) return ed_end_of_file(el, 0); - ch = (Char)wch; - switch (el->el_map.current[(unsigned char) ch]) { case ED_INSERT: case ED_DIGIT: @@ -457,8 +453,8 @@ ce_inc_search(EditLine *el, int dir) protected el_action_t cv_search(EditLine *el, int dir) { - Char ch; - Char tmpbuf[EL_BUFSIZ]; + wchar_t ch; + wchar_t tmpbuf[EL_BUFSIZ]; ssize_t tmplen; #ifdef ANCHOR @@ -531,9 +527,9 @@ cv_search(EditLine *el, int dir) protected el_action_t ce_search_line(EditLine *el, int dir) { - Char *cp = el->el_line.cursor; - Char *pattern = el->el_search.patbuf; - Char oc, *ocp; + wchar_t *cp = el->el_line.cursor; + wchar_t *pattern = el->el_search.patbuf; + wchar_t oc, *ocp; #ifdef ANCHOR ocp = &pattern[1]; oc = *ocp; @@ -599,7 +595,7 @@ cv_repeat_srch(EditLine *el, wint_t c) protected el_action_t cv_csearch(EditLine *el, int direction, wint_t ch, int count, int tflag) { - Char *cp; + wchar_t *cp; if (ch == 0) return CC_ERROR; @@ -610,7 +606,7 @@ cv_csearch(EditLine *el, int direction, } /* Save for ';' and ',' commands */ - el->el_search.chacha = (Char)ch; + el->el_search.chacha = ch; el->el_search.chadir = direction; el->el_search.chatflg = (char)tflag; Index: src/lib/libedit/el.c diff -u src/lib/libedit/el.c:1.86 src/lib/libedit/el.c:1.87 --- src/lib/libedit/el.c:1.86 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/el.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: el.c,v 1.86 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: el.c,v 1.87 2016/04/11 00:50:13 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.86 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: el.c,v 1.87 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -205,7 +205,7 @@ el_wset(EditLine *el, int op, ...) el_pfunc_t p = va_arg(ap, el_pfunc_t); int c = va_arg(ap, int); - rv = prompt_set(el, p, (Char)c, op, 1); + rv = prompt_set(el, p, (wchar_t)c, op, 1); break; } @@ -214,7 +214,7 @@ el_wset(EditLine *el, int op, ...) break; case EL_EDITOR: - rv = map_set_editor(el, va_arg(ap, Char *)); + rv = map_set_editor(el, va_arg(ap, wchar_t *)); break; case EL_SIGNAL: @@ -230,11 +230,11 @@ el_wset(EditLine *el, int op, ...) case EL_ECHOTC: case EL_SETTY: { - const Char *argv[20]; + const wchar_t *argv[20]; int i; for (i = 1; i < (int)__arraycount(argv); i++) - if ((argv[i] = va_arg(ap, Char *)) == NULL) + if ((argv[i] = va_arg(ap, wchar_t *)) == NULL) break; switch (op) { @@ -273,8 +273,8 @@ el_wset(EditLine *el, int op, ...) case EL_ADDFN: { - Char *name = va_arg(ap, Char *); - Char *help = va_arg(ap, Char *); + wchar_t *name = va_arg(ap, wchar_t *); + wchar_t *help = va_arg(ap, wchar_t *); el_func_t func = va_arg(ap, el_func_t); rv = map_addfunc(el, name, help, func); @@ -401,14 +401,14 @@ el_wget(EditLine *el, int op, ...) case EL_PROMPT_ESC: case EL_RPROMPT_ESC: { el_pfunc_t *p = va_arg(ap, el_pfunc_t *); - Char *c = va_arg(ap, Char *); + wchar_t *c = va_arg(ap, wchar_t *); rv = prompt_get(el, p, c, op); break; } case EL_EDITOR: - rv = map_get_editor(el, va_arg(ap, const Char **)); + rv = map_get_editor(el, va_arg(ap, const wchar_t **)); break; case EL_SIGNAL: @@ -512,7 +512,7 @@ el_source(EditLine *el, const char *fnam ssize_t slen; char *ptr; char *path = NULL; - const Char *dptr; + const wchar_t *dptr; int error = 0; fp = NULL; @@ -610,9 +610,9 @@ el_beep(EditLine *el) */ protected int /*ARGSUSED*/ -el_editmode(EditLine *el, int argc, const Char **argv) +el_editmode(EditLine *el, int argc, const wchar_t **argv) { - const Char *how; + const wchar_t *how; if (argv == NULL || argc != 2 || argv[1] == NULL) return -1; Index: src/lib/libedit/el.h diff -u src/lib/libedit/el.h:1.35 src/lib/libedit/el.h:1.36 --- src/lib/libedit/el.h:1.35 Wed Mar 23 18:27:48 2016 +++ src/lib/libedit/el.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: el.h,v 1.35 2016/03/23 22:27:48 christos Exp $ */ +/* $NetBSD: el.h,v 1.36 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -66,10 +66,10 @@ typedef struct coord_t { /* Position on } coord_t; typedef struct el_line_t { - Char *buffer; /* Input line */ - Char *cursor; /* Cursor position */ - Char *lastchar; /* Last character */ - const Char *limit; /* Max position */ + wchar_t *buffer; /* Input line */ + wchar_t *cursor; /* Cursor position */ + wchar_t *lastchar; /* Last character */ + const wchar_t *limit; /* Max position */ } el_line_t; /* @@ -82,7 +82,7 @@ typedef struct el_state_t { int metanext; /* Is the next char a meta char */ el_action_t lastcmd; /* Previous command */ el_action_t thiscmd; /* this command */ - Char thisch; /* char that generated it */ + wchar_t thisch; /* char that generated it */ } el_state_t; /* @@ -106,7 +106,7 @@ typedef struct el_state_t { #include "read.h" struct editline { - Char *el_prog; /* the program name */ + wchar_t *el_prog; /* the program name */ FILE *el_infile; /* Stdio stuff */ FILE *el_outfile; /* Stdio stuff */ FILE *el_errfile; /* Stdio stuff */ @@ -116,8 +116,8 @@ struct editline { int el_flags; /* Various flags. */ int el_errno; /* Local copy of errno */ coord_t el_cursor; /* Cursor location */ - Char **el_display; /* Real screen image = what is there */ - Char **el_vdisplay; /* Virtual screen image = what we see */ + wchar_t **el_display; /* Real screen image = what is there */ + wchar_t **el_vdisplay; /* Virtual screen image = what we see */ void *el_data; /* Client data */ el_line_t el_line; /* The current line information */ el_state_t el_state; /* Current editor state */ @@ -138,7 +138,7 @@ struct editline { LineInfo el_lgcylinfo; /* Legacy LineInfo buffer */ }; -protected int el_editmode(EditLine *, int, const Char **); +protected int el_editmode(EditLine *, int, const wchar_t **); #ifdef DEBUG #define EL_ABORT(a) do { \ Index: src/lib/libedit/eln.c diff -u src/lib/libedit/eln.c:1.31 src/lib/libedit/eln.c:1.32 --- src/lib/libedit/eln.c:1.31 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/eln.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: eln.c,v 1.31 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: eln.c,v 1.32 2016/04/11 00:50:13 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.31 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: eln.c,v 1.32 2016/04/11 00:50:13 christos Exp $"); #endif /* not lint && not SCCSID */ #include <errno.h> @@ -365,7 +365,7 @@ el_line(EditLine *el) const LineInfoW *winfo = el_wline(el); LineInfo *info = &el->el_lgcylinfo; size_t offset; - const Char *p; + const wchar_t *p; info->buffer = ct_encode_string(winfo->buffer, &el->el_lgcyconv); Index: src/lib/libedit/emacs.c diff -u src/lib/libedit/emacs.c:1.33 src/lib/libedit/emacs.c:1.34 --- src/lib/libedit/emacs.c:1.33 Sat Apr 9 14:43:17 2016 +++ src/lib/libedit/emacs.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: emacs.c,v 1.33 2016/04/09 18:43:17 christos Exp $ */ +/* $NetBSD: emacs.c,v 1.34 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)emacs.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: emacs.c,v 1.33 2016/04/09 18:43:17 christos Exp $"); +__RCSID("$NetBSD: emacs.c,v 1.34 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -93,7 +93,7 @@ protected el_action_t /*ARGSUSED*/ em_delete_next_word(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *cp, *p, *kp; + wchar_t *cp, *p, *kp; if (el->el_line.cursor == el->el_line.lastchar) return CC_ERROR; @@ -122,7 +122,7 @@ protected el_action_t /*ARGSUSED*/ em_yank(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *kp, *cp; + wchar_t *kp, *cp; if (el->el_chared.c_kill.last == el->el_chared.c_kill.buf) return CC_NORM; @@ -158,7 +158,7 @@ protected el_action_t /*ARGSUSED*/ em_kill_line(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *kp, *cp; + wchar_t *kp, *cp; cp = el->el_line.buffer; kp = el->el_chared.c_kill.buf; @@ -180,7 +180,7 @@ protected el_action_t /*ARGSUSED*/ em_kill_region(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *kp, *cp; + wchar_t *kp, *cp; if (!el->el_chared.c_kill.mark) return CC_ERROR; @@ -213,7 +213,7 @@ protected el_action_t /*ARGSUSED*/ em_copy_region(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *kp, *cp; + wchar_t *kp, *cp; if (!el->el_chared.c_kill.mark) return CC_ERROR; @@ -247,7 +247,7 @@ em_gosmacs_transpose(EditLine *el, wint_ /* must have at least two chars entered */ c = el->el_line.cursor[-2]; el->el_line.cursor[-2] = el->el_line.cursor[-1]; - el->el_line.cursor[-1] = (Char)c; + el->el_line.cursor[-1] = c; return CC_REFRESH; } else return CC_ERROR; @@ -287,7 +287,7 @@ protected el_action_t /*ARGSUSED*/ em_upper_case(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *cp, *ep; + wchar_t *cp, *ep; ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); @@ -311,7 +311,7 @@ protected el_action_t /*ARGSUSED*/ em_capitol_case(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *cp, *ep; + wchar_t *cp, *ep; ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); @@ -343,7 +343,7 @@ protected el_action_t /*ARGSUSED*/ em_lower_case(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *cp, *ep; + wchar_t *cp, *ep; ep = c__next_word(el->el_line.cursor, el->el_line.lastchar, el->el_state.argument, ce__isword); @@ -381,7 +381,7 @@ protected el_action_t /*ARGSUSED*/ em_exchange_mark(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *cp; + wchar_t *cp; cp = el->el_line.cursor; el->el_line.cursor = el->el_chared.c_kill.mark; @@ -442,7 +442,7 @@ protected el_action_t /*ARGSUSED*/ em_copy_prev_word(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *cp, *oldc, *dp; + wchar_t *cp, *oldc, *dp; if (el->el_line.cursor == el->el_line.buffer) return CC_ERROR; Index: src/lib/libedit/filecomplete.h diff -u src/lib/libedit/filecomplete.h:1.9 src/lib/libedit/filecomplete.h:1.10 --- src/lib/libedit/filecomplete.h:1.9 Wed Dec 30 17:37:40 2009 +++ src/lib/libedit/filecomplete.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: filecomplete.h,v 1.9 2009/12/30 22:37:40 christos Exp $ */ +/* $NetBSD: filecomplete.h,v 1.10 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1997 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ int fn_complete(EditLine *, char *(*)(const char *, int), char **(*)(const char *, int, int), - const Char *, const Char *, const char *(*)(const char *), size_t, + const wchar_t *, const wchar_t *, const char *(*)(const char *), size_t, int *, int *, int *, int *); void fn_display_match_list(EditLine *, char **, size_t, size_t); Index: src/lib/libedit/hist.h diff -u src/lib/libedit/hist.h:1.20 src/lib/libedit/hist.h:1.21 --- src/lib/libedit/hist.h:1.20 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/hist.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: hist.h,v 1.20 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: hist.h,v 1.21 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -43,9 +43,9 @@ typedef int (*hist_fun_t)(void *, HistEventW *, int, ...); typedef struct el_history_t { - Char *buf; /* The history buffer */ + wchar_t *buf; /* The history buffer */ size_t sz; /* Size of history buffer */ - Char *last; /* The last character */ + wchar_t *last; /* The last character */ int eventno; /* Event we are looking for */ void *ref; /* Argument for history fcns */ hist_fun_t fun; /* Event access */ @@ -72,7 +72,7 @@ protected int hist_init(EditLine *); protected void hist_end(EditLine *); 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_command(EditLine *, int, const wchar_t **); protected int hist_enlargebuf(EditLine *, size_t, size_t); protected wchar_t *hist_convert(EditLine *, int, void *); Index: src/lib/libedit/history.c diff -u src/lib/libedit/history.c:1.54 src/lib/libedit/history.c:1.55 --- src/lib/libedit/history.c:1.54 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/history.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: history.c,v 1.54 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: history.c,v 1.55 2016/04/11 00:50:13 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.54 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: history.c,v 1.55 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -58,6 +58,7 @@ static const char hist_cookie[] = "_HiSt #ifdef NARROWCHAR +#define Char char #define FUN(prefix, rest) prefix ## _ ## rest #define FUNW(type) type #define TYPE(type) type @@ -72,6 +73,7 @@ static const char hist_cookie[] = "_HiSt #else +#define Char wchar_t #define FUN(prefix, rest) prefix ## _w ## rest #define FUNW(type) type ## _w #define TYPE(type) type ## W Index: src/lib/libedit/keymacro.c diff -u src/lib/libedit/keymacro.c:1.17 src/lib/libedit/keymacro.c:1.18 --- src/lib/libedit/keymacro.c:1.17 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/keymacro.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: keymacro.c,v 1.17 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: keymacro.c,v 1.18 2016/04/11 00:50:13 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.17 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: keymacro.c,v 1.18 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -73,7 +73,7 @@ __RCSID("$NetBSD: keymacro.c,v 1.17 2016 * linked list of these node elements */ struct keymacro_node_t { - Char ch; /* single character of key */ + wchar_t ch; /* single character of key */ int type; /* node type */ keymacro_value_t val; /* command code or pointer to str, */ /* if this is a leaf */ @@ -81,16 +81,16 @@ struct keymacro_node_t { struct keymacro_node_t *sibling;/* ptr to another key with same prefix*/ }; -private int node_trav(EditLine *, keymacro_node_t *, Char *, +private int node_trav(EditLine *, keymacro_node_t *, wchar_t *, keymacro_value_t *); -private int node__try(EditLine *, keymacro_node_t *, const Char *, - keymacro_value_t *, int); +private int node__try(EditLine *, keymacro_node_t *, + const wchar_t *, keymacro_value_t *, int); private keymacro_node_t *node__get(wint_t); private void node__free(keymacro_node_t *); private void node__put(EditLine *, keymacro_node_t *); private int node__delete(EditLine *, keymacro_node_t **, - const Char *); -private int node_lookup(EditLine *, const Char *, + const wchar_t *); +private int node_lookup(EditLine *, const wchar_t *, keymacro_node_t *, size_t); private int node_enum(EditLine *, keymacro_node_t *, size_t); @@ -142,7 +142,7 @@ keymacro_map_cmd(EditLine *el, int cmd) * Associate str with a key value */ protected keymacro_value_t * -keymacro_map_str(EditLine *el, Char *str) +keymacro_map_str(EditLine *el, wchar_t *str) { el->el_keymacro.val.str = str; @@ -174,7 +174,7 @@ keymacro_reset(EditLine *el) * The last character read is returned in *ch. */ protected int -keymacro_get(EditLine *el, Char *ch, keymacro_value_t *val) +keymacro_get(EditLine *el, wchar_t *ch, keymacro_value_t *val) { return node_trav(el, el->el_keymacro.map, ch, val); @@ -188,7 +188,8 @@ keymacro_get(EditLine *el, Char *ch, key * command, an out str or a unix command. */ protected void -keymacro_add(EditLine *el, const Char *key, keymacro_value_t *val, int ntype) +keymacro_add(EditLine *el, const wchar_t *key, keymacro_value_t *val, + int ntype) { if (key[0] == '\0') { @@ -216,7 +217,7 @@ keymacro_add(EditLine *el, const Char *k * */ protected void -keymacro_clear(EditLine *el, el_action_t *map, const Char *in) +keymacro_clear(EditLine *el, el_action_t *map, const wchar_t *in) { if (*in > N_KEYS) /* can't be in the map */ return; @@ -234,7 +235,7 @@ keymacro_clear(EditLine *el, el_action_t * they exists. */ protected int -keymacro_delete(EditLine *el, const Char *key) +keymacro_delete(EditLine *el, const wchar_t *key) { if (key[0] == '\0') { @@ -255,7 +256,7 @@ keymacro_delete(EditLine *el, const Char * Print entire el->el_keymacro.map if null */ protected void -keymacro_print(EditLine *el, const Char *key) +keymacro_print(EditLine *el, const wchar_t *key) { /* do nothing if el->el_keymacro.map is empty and null key specified */ @@ -276,20 +277,19 @@ keymacro_print(EditLine *el, const Char * found. May read in more characters. */ private int -node_trav(EditLine *el, keymacro_node_t *ptr, Char *ch, keymacro_value_t *val) +node_trav(EditLine *el, keymacro_node_t *ptr, wchar_t *ch, + keymacro_value_t *val) { - wchar_t wc; if (ptr->ch == *ch) { /* match found */ if (ptr->next) { /* key not complete so get next char */ - if (el_wgetc(el, &wc) != 1) {/* if EOF or error */ + if (el_wgetc(el, ch) != 1) {/* if EOF or error */ val->cmd = ED_END_OF_FILE; return XK_CMD; /* PWP: Pretend we just read an end-of-file */ } - *ch = (Char)wc; return node_trav(el, ptr->next, ch, val); } else { *val = ptr->val; @@ -315,7 +315,7 @@ node_trav(EditLine *el, keymacro_node_t * Find a node that matches *str or allocate a new one */ private int -node__try(EditLine *el, keymacro_node_t *ptr, const Char *str, +node__try(EditLine *el, keymacro_node_t *ptr, const wchar_t *str, keymacro_value_t *val, int ntype) { @@ -378,7 +378,7 @@ node__try(EditLine *el, keymacro_node_t * Delete node that matches str */ private int -node__delete(EditLine *el, keymacro_node_t **inptr, const Char *str) +node__delete(EditLine *el, keymacro_node_t **inptr, const wchar_t *str) { keymacro_node_t *ptr; keymacro_node_t *prev_ptr = NULL; @@ -465,7 +465,7 @@ node__get(wint_t ch) ptr = el_malloc(sizeof(*ptr)); if (ptr == NULL) return NULL; - ptr->ch = (Char)ch; + ptr->ch = ch; ptr->type = XK_NOD; ptr->val.str = NULL; ptr->next = NULL; @@ -488,7 +488,8 @@ node__free(keymacro_node_t *k) * Print if last node */ private int -node_lookup(EditLine *el, const Char *str, keymacro_node_t *ptr, size_t cnt) +node_lookup(EditLine *el, const wchar_t *str, keymacro_node_t *ptr, + size_t cnt) { ssize_t used; @@ -583,7 +584,8 @@ node_enum(EditLine *el, keymacro_node_t * function specified by val */ protected void -keymacro_kprint(EditLine *el, const Char *key, keymacro_value_t *val, int ntype) +keymacro_kprint(EditLine *el, const wchar_t *key, keymacro_value_t *val, + int ntype) { el_bindings_t *fp; char unparsbuf[EL_BUFSIZ]; @@ -634,10 +636,11 @@ keymacro_kprint(EditLine *el, const Char * Make a printable version of the ey */ protected size_t -keymacro__decode_str(const Char *str, char *buf, size_t len, const char *sep) +keymacro__decode_str(const wchar_t *str, char *buf, size_t len, + const char *sep) { char *b = buf, *eb = b + len; - const Char *p; + const wchar_t *p; b = buf; if (sep[0] != '\0') { @@ -649,8 +652,8 @@ keymacro__decode_str(const Char *str, ch goto add_endsep; } for (p = str; *p != 0; p++) { - Char dbuf[VISUAL_WIDTH_MAX]; - Char *p2 = dbuf; + wchar_t dbuf[VISUAL_WIDTH_MAX]; + wchar_t *p2 = dbuf; ssize_t l = ct_visual_char(dbuf, VISUAL_WIDTH_MAX, *p); while (l-- > 0) { ssize_t n = ct_encode_char(b, (size_t)(eb - b), *p2++); Index: src/lib/libedit/keymacro.h diff -u src/lib/libedit/keymacro.h:1.3 src/lib/libedit/keymacro.h:1.4 --- src/lib/libedit/keymacro.h:1.3 Fri Jan 29 14:59:11 2016 +++ src/lib/libedit/keymacro.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: keymacro.h,v 1.3 2016/01/29 19:59:11 christos Exp $ */ +/* $NetBSD: keymacro.h,v 1.4 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -42,13 +42,13 @@ typedef union keymacro_value_t { el_action_t cmd; /* If it is a command the # */ - Char *str; /* If it is a string... */ + wchar_t *str; /* If it is a string... */ } keymacro_value_t; typedef struct keymacro_node_t keymacro_node_t; typedef struct el_keymacro_t { - Char *buf; /* Key print buffer */ + wchar_t *buf; /* Key print buffer */ keymacro_node_t *map; /* Key map */ keymacro_value_t val; /* Local conversion buffer */ } el_keymacro_t; @@ -61,16 +61,17 @@ typedef struct el_keymacro_t { protected int keymacro_init(EditLine *); protected void keymacro_end(EditLine *); protected keymacro_value_t *keymacro_map_cmd(EditLine *, int); -protected keymacro_value_t *keymacro_map_str(EditLine *, Char *); +protected keymacro_value_t *keymacro_map_str(EditLine *, wchar_t *); protected void keymacro_reset(EditLine *); -protected int keymacro_get(EditLine *, Char *, keymacro_value_t *); -protected void keymacro_add(EditLine *, const Char *, keymacro_value_t *, int); -protected void keymacro_clear(EditLine *, el_action_t *, const Char *); -protected int keymacro_delete(EditLine *, const Char *); -protected void keymacro_print(EditLine *, const Char *); -protected void keymacro_kprint(EditLine *, const Char *, keymacro_value_t *, - int); -protected size_t keymacro__decode_str(const Char *, char *, size_t, +protected int keymacro_get(EditLine *, wchar_t *, keymacro_value_t *); +protected void keymacro_add(EditLine *, const wchar_t *, + keymacro_value_t *, int); +protected void keymacro_clear(EditLine *, el_action_t *, const wchar_t *); +protected int keymacro_delete(EditLine *, const wchar_t *); +protected void keymacro_print(EditLine *, const wchar_t *); +protected void keymacro_kprint(EditLine *, const wchar_t *, + keymacro_value_t *, int); +protected size_t keymacro__decode_str(const wchar_t *, char *, size_t, const char *); #endif /* _h_el_keymacro */ Index: src/lib/libedit/map.c diff -u src/lib/libedit/map.c:1.45 src/lib/libedit/map.c:1.46 --- src/lib/libedit/map.c:1.45 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/map.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: map.c,v 1.45 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: map.c,v 1.46 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)map.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: map.c,v 1.45 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: map.c,v 1.46 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -52,7 +52,7 @@ __RCSID("$NetBSD: map.c,v 1.45 2016/04/1 #include "help.h" #include "parse.h" -private void map_print_key(EditLine *, el_action_t *, const Char *); +private void map_print_key(EditLine *, el_action_t *, const wchar_t *); private void map_print_some_keys(EditLine *, el_action_t *, wint_t, wint_t); private void map_print_all_keys(EditLine *); private void map_init_nls(EditLine *); @@ -981,7 +981,7 @@ map_init_nls(EditLine *el) private void map_init_meta(EditLine *el) { - Char buf[3]; + wchar_t buf[3]; int i; el_action_t *map = el->el_map.key; el_action_t *alt = el->el_map.alt; @@ -999,7 +999,7 @@ map_init_meta(EditLine *el) } else map = alt; } - buf[0] = (Char) i; + buf[0] = (wchar_t)i; buf[2] = 0; for (i = 0200; i <= 0377; i++) switch (map[i]) { @@ -1053,7 +1053,7 @@ protected void map_init_emacs(EditLine *el) { int i; - Char buf[3]; + wchar_t buf[3]; el_action_t *key = el->el_map.key; el_action_t *alt = el->el_map.alt; const el_action_t *emacs = el->el_map.emacs; @@ -1084,7 +1084,7 @@ map_init_emacs(EditLine *el) * Set the editor */ protected int -map_set_editor(EditLine *el, Char *editor) +map_set_editor(EditLine *el, wchar_t *editor) { if (wcscmp(editor, L"emacs") == 0) { @@ -1103,7 +1103,7 @@ map_set_editor(EditLine *el, Char *edito * Retrieve the editor */ protected int -map_get_editor(EditLine *el, const Char **editor) +map_get_editor(EditLine *el, const wchar_t **editor) { if (editor == NULL) @@ -1124,7 +1124,7 @@ map_get_editor(EditLine *el, const Char * Print the function description for 1 key */ private void -map_print_key(EditLine *el, el_action_t *map, const Char *in) +map_print_key(EditLine *el, el_action_t *map, const wchar_t *in) { char outbuf[EL_BUFSIZ]; el_bindings_t *bp, *ep; @@ -1150,12 +1150,12 @@ private void map_print_some_keys(EditLine *el, el_action_t *map, wint_t first, wint_t last) { el_bindings_t *bp, *ep; - Char firstbuf[2], lastbuf[2]; + wchar_t firstbuf[2], lastbuf[2]; char unparsbuf[EL_BUFSIZ], extrabuf[EL_BUFSIZ]; - firstbuf[0] = (Char)first; + firstbuf[0] = first; firstbuf[1] = 0; - lastbuf[0] = (Char)last; + lastbuf[0] = last; lastbuf[1] = 0; if (map[first] == ED_UNASSIGNED) { if (first == last) { @@ -1246,15 +1246,15 @@ map_print_all_keys(EditLine *el) * Add/remove/change bindings */ protected int -map_bind(EditLine *el, int argc, const Char **argv) +map_bind(EditLine *el, int argc, const wchar_t **argv) { el_action_t *map; int ntype, rem; - const Char *p; - Char inbuf[EL_BUFSIZ]; - Char outbuf[EL_BUFSIZ]; - const Char *in = NULL; - Char *out; + const wchar_t *p; + wchar_t inbuf[EL_BUFSIZ]; + wchar_t outbuf[EL_BUFSIZ]; + const wchar_t *in = NULL; + wchar_t *out; el_bindings_t *bp, *ep; int cmd; int key; @@ -1398,7 +1398,8 @@ map_bind(EditLine *el, int argc, const C * add a user defined function */ protected int -map_addfunc(EditLine *el, const Char *name, const Char *help, el_func_t func) +map_addfunc(EditLine *el, const wchar_t *name, const wchar_t *help, + el_func_t func) { void *p; size_t nf = el->el_map.nfunc + 1; Index: src/lib/libedit/map.h diff -u src/lib/libedit/map.h:1.10 src/lib/libedit/map.h:1.11 --- src/lib/libedit/map.h:1.10 Sun Jul 6 14:15:34 2014 +++ src/lib/libedit/map.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: map.h,v 1.10 2014/07/06 18:15:34 christos Exp $ */ +/* $NetBSD: map.h,v 1.11 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,9 +41,9 @@ #define _h_el_map typedef struct el_bindings_t { /* for the "bind" shell command */ - const Char *name; /* function name for bind command */ + const wchar_t *name; /* function name for bind command */ int func; /* function numeric value */ - const Char *description; /* description of function */ + const wchar_t *description; /* description of function */ } el_bindings_t; @@ -65,13 +65,14 @@ typedef struct el_map_t { #define N_KEYS 256 -protected int map_bind(EditLine *, int, const Char **); +protected int map_bind(EditLine *, int, const wchar_t **); protected int map_init(EditLine *); protected void map_end(EditLine *); protected void map_init_vi(EditLine *); protected void map_init_emacs(EditLine *); -protected int map_set_editor(EditLine *, Char *); -protected int map_get_editor(EditLine *, const Char **); -protected int map_addfunc(EditLine *, const Char *, const Char *, el_func_t); +protected int map_set_editor(EditLine *, wchar_t *); +protected int map_get_editor(EditLine *, const wchar_t **); +protected int map_addfunc(EditLine *, const wchar_t *, const wchar_t *, + el_func_t); #endif /* _h_el_map */ Index: src/lib/libedit/parse.c diff -u src/lib/libedit/parse.c:1.36 src/lib/libedit/parse.c:1.37 --- src/lib/libedit/parse.c:1.36 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/parse.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.36 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: parse.c,v 1.37 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)parse.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: parse.c,v 1.36 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: parse.c,v 1.37 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -61,8 +61,8 @@ __RCSID("$NetBSD: parse.c,v 1.36 2016/04 #include "parse.h" private const struct { - const Char *name; - int (*func)(EditLine *, int, const Char **); + const wchar_t *name; + int (*func)(EditLine *, int, const wchar_t **); } cmds[] = { { L"bind", map_bind }, { L"echotc", terminal_echotc }, @@ -79,9 +79,9 @@ private const struct { * Parse a line and dispatch it */ protected int -parse_line(EditLine *el, const Char *line) +parse_line(EditLine *el, const wchar_t *line) { - const Char **argv; + const wchar_t **argv; int argc; TokenizerW *tok; @@ -97,16 +97,16 @@ parse_line(EditLine *el, const Char *lin * Command dispatcher */ public int -el_wparse(EditLine *el, int argc, const Char *argv[]) +el_wparse(EditLine *el, int argc, const wchar_t *argv[]) { - const Char *ptr; + const wchar_t *ptr; int i; if (argc < 1) return -1; ptr = wcschr(argv[0], L':'); if (ptr != NULL) { - Char *tprog; + wchar_t *tprog; size_t l; if (ptr == argv[0]) @@ -139,9 +139,9 @@ el_wparse(EditLine *el, int argc, const * the appropriate character or -1 if the escape is not valid */ protected int -parse__escape(const Char **ptr) +parse__escape(const wchar_t **ptr) { - const Char *p; + const wchar_t *p; wint_t c; p = *ptr; @@ -179,8 +179,8 @@ parse__escape(const Char **ptr) case 'U': /* Unicode \U+xxxx or \U+xxxxx format */ { int i; - const Char hex[] = L"0123456789ABCDEF"; - const Char *h; + const wchar_t hex[] = L"0123456789ABCDEF"; + const wchar_t *h; ++p; if (*p++ != '+') return -1; @@ -238,10 +238,10 @@ parse__escape(const Char **ptr) /* parse__string(): * Parse the escapes from in and put the raw string out */ -protected Char * -parse__string(Char *out, const Char *in) +protected wchar_t * +parse__string(wchar_t *out, const wchar_t *in) { - Char *rv = out; + wchar_t *rv = out; int n; for (;;) @@ -254,7 +254,7 @@ parse__string(Char *out, const Char *in) case '^': if ((n = parse__escape(&in)) == -1) return NULL; - *out++ = (Char)n; + *out++ = (wchar_t)n; break; case 'M': @@ -277,7 +277,7 @@ parse__string(Char *out, const Char *in) * or -1 if one is not found */ protected int -parse_cmd(EditLine *el, const Char *cmd) +parse_cmd(EditLine *el, const wchar_t *cmd) { el_bindings_t *b = el->el_map.help; size_t i; Index: src/lib/libedit/parse.h diff -u src/lib/libedit/parse.h:1.7 src/lib/libedit/parse.h:1.8 --- src/lib/libedit/parse.h:1.7 Wed Dec 30 17:37:40 2009 +++ src/lib/libedit/parse.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.h,v 1.7 2009/12/30 22:37:40 christos Exp $ */ +/* $NetBSD: parse.h,v 1.8 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -40,9 +40,9 @@ #ifndef _h_el_parse #define _h_el_parse -protected int parse_line(EditLine *, const Char *); -protected int parse__escape(const Char **); -protected Char *parse__string(Char *, const Char *); -protected int parse_cmd(EditLine *, const Char *); +protected int parse_line(EditLine *, const wchar_t *); +protected int parse__escape(const wchar_t **); +protected wchar_t *parse__string(wchar_t *, const wchar_t *); +protected int parse_cmd(EditLine *, const wchar_t *); #endif /* _h_el_parse */ Index: src/lib/libedit/terminal.h diff -u src/lib/libedit/terminal.h:1.7 src/lib/libedit/terminal.h:1.8 --- src/lib/libedit/terminal.h:1.7 Tue Feb 16 10:53:48 2016 +++ src/lib/libedit/terminal.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: terminal.h,v 1.7 2016/02/16 15:53:48 christos Exp $ */ +/* $NetBSD: terminal.h,v 1.8 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,7 +41,7 @@ #define _h_el_terminal typedef struct { /* Symbolic function key bindings */ - const Char *name; /* name of the key */ + const wchar_t *name; /* name of the key */ int key; /* Index in termcap table */ keymacro_value_t fun; /* Function bound to it */ int type; /* Type of function */ @@ -83,8 +83,8 @@ typedef struct { protected void terminal_move_to_line(EditLine *, int); protected void terminal_move_to_char(EditLine *, int); protected void terminal_clear_EOL(EditLine *, int); -protected void terminal_overwrite(EditLine *, const Char *, size_t); -protected void terminal_insertwrite(EditLine *, Char *, int); +protected void terminal_overwrite(EditLine *, const wchar_t *, size_t); +protected void terminal_insertwrite(EditLine *, wchar_t *, int); protected void terminal_deletechars(EditLine *, int); protected void terminal_clear_screen(EditLine *); protected void terminal_beep(EditLine *); @@ -92,16 +92,17 @@ protected int terminal_change_size(EditL protected int terminal_get_size(EditLine *, int *, int *); protected int terminal_init(EditLine *); protected void terminal_bind_arrow(EditLine *); -protected void terminal_print_arrow(EditLine *, const Char *); -protected int terminal_clear_arrow(EditLine *, const Char *); -protected int terminal_set_arrow(EditLine *, const Char *, keymacro_value_t *, int); +protected void terminal_print_arrow(EditLine *, const wchar_t *); +protected int terminal_clear_arrow(EditLine *, const wchar_t *); +protected int terminal_set_arrow(EditLine *, const wchar_t *, + keymacro_value_t *, int); protected void terminal_end(EditLine *); protected void terminal_get(EditLine *, const char **); protected int terminal_set(EditLine *, const char *); -protected int terminal_settc(EditLine *, int, const Char **); +protected int terminal_settc(EditLine *, int, const wchar_t **); protected int terminal_gettc(EditLine *, int, char **); -protected int terminal_telltc(EditLine *, int, const Char **); -protected int terminal_echotc(EditLine *, int, const Char **); +protected int terminal_telltc(EditLine *, int, const wchar_t **); +protected int terminal_echotc(EditLine *, int, const wchar_t **); protected void terminal_writec(EditLine *, wint_t); protected int terminal__putc(EditLine *, wint_t); protected void terminal__flush(EditLine *); Index: src/lib/libedit/prompt.c diff -u src/lib/libedit/prompt.c:1.23 src/lib/libedit/prompt.c:1.24 --- src/lib/libedit/prompt.c:1.23 Tue Feb 16 10:53:48 2016 +++ src/lib/libedit/prompt.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: prompt.c,v 1.23 2016/02/16 15:53:48 christos Exp $ */ +/* $NetBSD: prompt.c,v 1.24 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)prompt.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: prompt.c,v 1.23 2016/02/16 15:53:48 christos Exp $"); +__RCSID("$NetBSD: prompt.c,v 1.24 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -47,17 +47,17 @@ __RCSID("$NetBSD: prompt.c,v 1.23 2016/0 #include <stdio.h> #include "el.h" -private Char *prompt_default(EditLine *); -private Char *prompt_default_r(EditLine *); +private wchar_t *prompt_default(EditLine *); +private wchar_t *prompt_default_r(EditLine *); /* prompt_default(): * Just a default prompt, in case the user did not provide one */ -private Char * +private wchar_t * /*ARGSUSED*/ prompt_default(EditLine *el __attribute__((__unused__))) { - static Char a[3] = {'?', ' ', '\0'}; + static wchar_t a[3] = L"? "; return a; } @@ -66,11 +66,11 @@ prompt_default(EditLine *el __attribute_ /* prompt_default_r(): * Just a default rprompt, in case the user did not provide one */ -private Char * +private wchar_t * /*ARGSUSED*/ prompt_default_r(EditLine *el __attribute__((__unused__))) { - static Char a[1] = {'\0'}; + static wchar_t a[1] = L""; return a; } @@ -83,7 +83,7 @@ protected void prompt_print(EditLine *el, int op) { el_prompt_t *elp; - Char *p; + wchar_t *p; int ignore = 0; if (op == EL_PROMPT) @@ -146,7 +146,7 @@ prompt_end(EditLine *el __attribute__((_ * Install a prompt printing function */ protected int -prompt_set(EditLine *el, el_pfunc_t prf, Char c, int op, int wide) +prompt_set(EditLine *el, el_pfunc_t prf, wchar_t c, int op, int wide) { el_prompt_t *p; @@ -178,7 +178,7 @@ prompt_set(EditLine *el, el_pfunc_t prf, * Retrieve the prompt printing function */ protected int -prompt_get(EditLine *el, el_pfunc_t *prf, Char *c, int op) +prompt_get(EditLine *el, el_pfunc_t *prf, wchar_t *c, int op) { el_prompt_t *p; Index: src/lib/libedit/prompt.h diff -u src/lib/libedit/prompt.h:1.13 src/lib/libedit/prompt.h:1.14 --- src/lib/libedit/prompt.h:1.13 Wed Feb 17 14:47:49 2016 +++ src/lib/libedit/prompt.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: prompt.h,v 1.13 2016/02/17 19:47:49 christos Exp $ */ +/* $NetBSD: prompt.h,v 1.14 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -40,18 +40,18 @@ #ifndef _h_el_prompt #define _h_el_prompt -typedef Char *(*el_pfunc_t)(EditLine *); +typedef wchar_t *(*el_pfunc_t)(EditLine *); typedef struct el_prompt_t { el_pfunc_t p_func; /* Function to return the prompt */ coord_t p_pos; /* position in the line after prompt */ - Char p_ignore; /* character to start/end literal */ + wchar_t p_ignore; /* character to start/end literal */ int p_wide; } el_prompt_t; protected void prompt_print(EditLine *, int); -protected int prompt_set(EditLine *, el_pfunc_t, Char, int, int); -protected int prompt_get(EditLine *, el_pfunc_t *, Char *, int); +protected int prompt_set(EditLine *, el_pfunc_t, wchar_t, int, int); +protected int prompt_get(EditLine *, el_pfunc_t *, wchar_t *, int); protected int prompt_init(EditLine *); protected void prompt_end(EditLine *); Index: src/lib/libedit/read.c diff -u src/lib/libedit/read.c:1.89 src/lib/libedit/read.c:1.90 --- src/lib/libedit/read.c:1.89 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/read.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: read.c,v 1.89 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: read.c,v 1.90 2016/04/11 00:50:13 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.89 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: read.c,v 1.90 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -59,7 +59,7 @@ __RCSID("$NetBSD: read.c,v 1.89 2016/04/ private int read__fixio(int, int); private int read_char(EditLine *, wchar_t *); -private int read_getcmd(EditLine *, el_action_t *, Char *); +private int read_getcmd(EditLine *, el_action_t *, wchar_t *); private void read_pop(c_macro_t *); /* read_init(): @@ -187,7 +187,7 @@ read__fixio(int fd __attribute__((__unus * Push a macro */ public void -el_wpush(EditLine *el, const Char *str) +el_wpush(EditLine *el, const wchar_t *str) { c_macro_t *ma = &el->el_chared.c_macro; @@ -207,20 +207,18 @@ el_wpush(EditLine *el, const Char *str) * Character values > 255 are not looked up in the map, but inserted. */ private int -read_getcmd(EditLine *el, el_action_t *cmdnum, Char *ch) +read_getcmd(EditLine *el, el_action_t *cmdnum, wchar_t *ch) { - static const Char meta = (Char)0x80; + static const wchar_t meta = (wchar_t)0x80; el_action_t cmd; - wchar_t wc; int num; el->el_errno = 0; do { - if ((num = el_wgetc(el, &wc)) != 1) {/* if EOF or error */ + if ((num = el_wgetc(el, ch)) != 1) {/* if EOF or error */ el->el_errno = num == 0 ? 0 : errno; return 0; /* not OKCMD */ } - *ch = (Char)wc; #ifdef KANJI if ((*ch & meta)) { @@ -441,14 +439,14 @@ read_finish(EditLine *el) sig_clr(el); } -public const Char * +public const wchar_t * el_wgets(EditLine *el, int *nread) { int retval; el_action_t cmdnum = 0; int num; /* how many chars we have read at NL */ wchar_t wc; - Char ch, *cp; + wchar_t ch, *cp; int crlf = 0; int nrb; #ifdef FIONREAD @@ -464,7 +462,7 @@ el_wgets(EditLine *el, int *nread) cp = el->el_line.buffer; while ((num = (*el->el_read.read_char)(el, &wc)) == 1) { - *cp = (Char)wc; + *cp = wc; /* make sure there is space for next character */ if (cp + 1 >= el->el_line.limit) { idx = (size_t)(cp - el->el_line.buffer); @@ -517,7 +515,7 @@ el_wgets(EditLine *el, int *nread) terminal__flush(el); while ((num = (*el->el_read.read_char)(el, &wc)) == 1) { - *cp = (Char)wc; + *cp = wc; /* make sure there is space next character */ if (cp + 1 >= el->el_line.limit) { idx = (size_t)(cp - el->el_line.buffer); Index: src/lib/libedit/refresh.c diff -u src/lib/libedit/refresh.c:1.47 src/lib/libedit/refresh.c:1.48 --- src/lib/libedit/refresh.c:1.47 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/refresh.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: refresh.c,v 1.47 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: refresh.c,v 1.48 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)refresh.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: refresh.c,v 1.47 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: refresh.c,v 1.48 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -52,16 +52,16 @@ __RCSID("$NetBSD: refresh.c,v 1.47 2016/ private void re_nextline(EditLine *); private void re_addc(EditLine *, wint_t); -private void re_update_line(EditLine *, Char *, Char *, int); -private void re_insert (EditLine *, Char *, int, int, Char *, int); -private void re_delete(EditLine *, Char *, int, int, int); +private void re_update_line(EditLine *, wchar_t *, wchar_t *, int); +private void re_insert (EditLine *, wchar_t *, int, int, wchar_t *, int); +private void re_delete(EditLine *, wchar_t *, int, int, int); private void re_fastputc(EditLine *, wint_t); private void re_clear_eol(EditLine *, int, int, int); -private void re__strncopy(Char *, Char *, size_t); -private void re__copy_and_pad(Char *, const Char *, size_t); +private void re__strncopy(wchar_t *, wchar_t *, size_t); +private void re__copy_and_pad(wchar_t *, const wchar_t *, size_t); #ifdef DEBUG_REFRESH -private void re_printstr(EditLine *, const char *, Char *, Char *); +private void re_printstr(EditLine *, const char *, wchar_t *, wchar_t *); #define __F el->el_errfile #define ELRE_ASSERT(a, b, c) do \ if (/*CONSTCOND*/ a) { \ @@ -75,7 +75,7 @@ private void re_printstr(EditLine *, con * Print a string on the debugging pty */ private void -re_printstr(EditLine *el, const char *str, Char *f, Char *t) +re_printstr(EditLine *el, const char *str, wchar_t *f, wchar_t *t) { ELRE_DEBUG(1, (__F, "%s:\"", str)); @@ -104,7 +104,7 @@ re_nextline(EditLine *el) */ if (el->el_refresh.r_cursor.v + 1 >= el->el_terminal.t_size.v) { int i, lins = el->el_terminal.t_size.v; - Char *firstline = el->el_vdisplay[0]; + wchar_t *firstline = el->el_vdisplay[0]; for(i = 1; i < lins; i++) el->el_vdisplay[i - 1] = el->el_vdisplay[i]; @@ -126,7 +126,7 @@ re_nextline(EditLine *el) private void re_addc(EditLine *el, wint_t c) { - switch (ct_chr_class((Char)c)) { + switch (ct_chr_class(c)) { case CHTYPE_TAB: /* expand the tab */ for (;;) { re_putc(el, ' ', 1); @@ -145,9 +145,9 @@ re_addc(EditLine *el, wint_t c) re_putc(el, c, 1); break; default: { - Char visbuf[VISUAL_WIDTH_MAX]; + wchar_t visbuf[VISUAL_WIDTH_MAX]; ssize_t i, n = - ct_visual_char(visbuf, VISUAL_WIDTH_MAX, (Char)c); + ct_visual_char(visbuf, VISUAL_WIDTH_MAX, c); for (i = 0; n-- > 0; ++i) re_putc(el, visbuf[i], 1); break; @@ -171,7 +171,7 @@ re_putc(EditLine *el, wint_t c, int shif re_putc(el, ' ', 1); el->el_vdisplay[el->el_refresh.r_cursor.v] - [el->el_refresh.r_cursor.h] = (Char)c; + [el->el_refresh.r_cursor.h] = c; /* assumes !shift is only used for single-column chars */ i = w; while (--i > 0) @@ -201,7 +201,7 @@ protected void re_refresh(EditLine *el) { int i, rhdiff; - Char *cp, *st; + wchar_t *cp, *st; coord_t cur; #ifdef notyet size_t termsz; @@ -360,9 +360,9 @@ re_goto_bottom(EditLine *el) private void /*ARGSUSED*/ re_insert(EditLine *el __attribute__((__unused__)), - Char *d, int dat, int dlen, Char *s, int num) + wchar_t *d, int dat, int dlen, wchar_t *s, int num) { - Char *a, *b; + wchar_t *a, *b; if (num <= 0) return; @@ -411,9 +411,9 @@ re_insert(EditLine *el __attribute__((__ private void /*ARGSUSED*/ re_delete(EditLine *el __attribute__((__unused__)), - Char *d, int dat, int dlen, int num) + wchar_t *d, int dat, int dlen, int num) { - Char *a, *b; + wchar_t *a, *b; if (num <= 0) return; @@ -443,7 +443,7 @@ re_delete(EditLine *el __attribute__((__ * Like strncpy without padding. */ private void -re__strncopy(Char *a, Char *b, size_t n) +re__strncopy(wchar_t *a, wchar_t *b, size_t n) { while (n-- && *b) @@ -502,11 +502,11 @@ new: eddie> Oh, my little buggy says to #define MIN_END_KEEP 4 private void -re_update_line(EditLine *el, Char *old, Char *new, int i) +re_update_line(EditLine *el, wchar_t *old, wchar_t *new, int i) { - Char *o, *n, *p, c; - Char *ofd, *ols, *oe, *nfd, *nls, *ne; - Char *osb, *ose, *nsb, *nse; + wchar_t *o, *n, *p, c; + wchar_t *ofd, *ols, *oe, *nfd, *nls, *ne; + wchar_t *osb, *ose, *nsb, *nse; int fx, sx; size_t len; @@ -972,7 +972,7 @@ re_update_line(EditLine *el, Char *old, * Copy string and pad with spaces */ private void -re__copy_and_pad(Char *dst, const Char *src, size_t width) +re__copy_and_pad(wchar_t *dst, const wchar_t *src, size_t width) { size_t i; @@ -995,7 +995,7 @@ re__copy_and_pad(Char *dst, const Char * protected void re_refresh_cursor(EditLine *el) { - Char *cp; + wchar_t *cp; int h, v, th, w; if (el->el_line.cursor >= el->el_line.lastchar) { @@ -1058,12 +1058,12 @@ re_refresh_cursor(EditLine *el) private void re_fastputc(EditLine *el, wint_t c) { - int w = wcwidth((Char)c); + int w = wcwidth(c); while (w > 1 && el->el_cursor.h + w > el->el_terminal.t_size.h) re_fastputc(el, ' '); terminal__putc(el, c); - el->el_display[el->el_cursor.v][el->el_cursor.h++] = (Char)c; + el->el_display[el->el_cursor.v][el->el_cursor.h++] = c; while (--w > 0) el->el_display[el->el_cursor.v][el->el_cursor.h++] = MB_FILL_CHAR; @@ -1080,7 +1080,7 @@ re_fastputc(EditLine *el, wint_t c) */ if (el->el_cursor.v + 1 >= el->el_terminal.t_size.v) { int i, lins = el->el_terminal.t_size.v; - Char *firstline = el->el_display[0]; + wchar_t *firstline = el->el_display[0]; for(i = 1; i < lins; i++) el->el_display[i - 1] = el->el_display[i]; @@ -1111,7 +1111,7 @@ re_fastputc(EditLine *el, wint_t c) protected void re_fastaddc(EditLine *el) { - Char c; + wchar_t c; int rhdiff; c = el->el_line.cursor[-1]; @@ -1135,9 +1135,9 @@ re_fastaddc(EditLine *el) break; case CHTYPE_ASCIICTL: case CHTYPE_NONPRINT: { - Char visbuf[VISUAL_WIDTH_MAX]; + wchar_t visbuf[VISUAL_WIDTH_MAX]; ssize_t i, n = - ct_visual_char(visbuf, VISUAL_WIDTH_MAX, (Char)c); + ct_visual_char(visbuf, VISUAL_WIDTH_MAX, c); for (i = 0; n-- > 0; ++i) re_fastputc(el, visbuf[i]); break; Index: src/lib/libedit/search.h diff -u src/lib/libedit/search.h:1.12 src/lib/libedit/search.h:1.13 --- src/lib/libedit/search.h:1.12 Tue Feb 16 10:53:48 2016 +++ src/lib/libedit/search.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: search.h,v 1.12 2016/02/16 15:53:48 christos Exp $ */ +/* $NetBSD: search.h,v 1.13 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -41,19 +41,19 @@ #define _h_el_search typedef struct el_search_t { - Char *patbuf; /* The pattern buffer */ + wchar_t *patbuf; /* The pattern buffer */ size_t patlen; /* Length of the pattern buffer */ int patdir; /* Direction of the last search */ int chadir; /* Character search direction */ - Char chacha; /* Character we are looking for */ + wchar_t chacha; /* Character we are looking for */ char chatflg; /* 0 if f, 1 if t */ } el_search_t; -protected int el_match(const Char *, const Char *); +protected int el_match(const wchar_t *, const wchar_t *); protected int search_init(EditLine *); protected void search_end(EditLine *); -protected int c_hmatch(EditLine *, const Char *); +protected int c_hmatch(EditLine *, const wchar_t *); protected void c_setpat(EditLine *); protected el_action_t ce_inc_search(EditLine *, int); protected el_action_t cv_search(EditLine *, int); Index: src/lib/libedit/tty.c diff -u src/lib/libedit/tty.c:1.61 src/lib/libedit/tty.c:1.62 --- src/lib/libedit/tty.c:1.61 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/tty.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tty.c,v 1.61 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: tty.c,v 1.62 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)tty.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: tty.c,v 1.61 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: tty.c,v 1.62 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -896,7 +896,7 @@ tty_bind_char(EditLine *el, int force) unsigned char *t_n = el->el_tty.t_c[ED_IO]; unsigned char *t_o = el->el_tty.t_ed.c_cc; - Char new[2], old[2]; + wchar_t new[2], old[2]; const ttymap_t *tp; el_action_t *map, *alt; const el_action_t *dmap, *dalt; @@ -913,8 +913,8 @@ tty_bind_char(EditLine *el, int force) } for (tp = tty_map; tp->nch != (wint_t)-1; tp++) { - new[0] = (Char)t_n[tp->nch]; - old[0] = (Char)t_o[tp->och]; + new[0] = (wchar_t)t_n[tp->nch]; + old[0] = (wchar_t)t_o[tp->och]; if (new[0] == old[0] && !force) continue; /* Put the old default binding back, and set the new binding */ @@ -1148,12 +1148,13 @@ tty_noquotemode(EditLine *el) */ protected int /*ARGSUSED*/ -tty_stty(EditLine *el, int argc __attribute__((__unused__)), const Char **argv) +tty_stty(EditLine *el, int argc __attribute__((__unused__)), + const wchar_t **argv) { const ttymodes_t *m; char x; int aflag = 0; - const Char *s, *d; + const wchar_t *s, *d; char name[EL_BUFSIZ]; struct termios *tios = &el->el_tty.t_ex; int z = EX_IO; @@ -1237,7 +1238,7 @@ tty_stty(EditLine *el, int argc __attrib return 0; } while (argv && (s = *argv++)) { - const Char *p; + const wchar_t *p; switch (*s) { case '+': case '-': Index: src/lib/libedit/tty.h diff -u src/lib/libedit/tty.h:1.19 src/lib/libedit/tty.h:1.20 --- src/lib/libedit/tty.h:1.19 Sat Feb 27 13:13:21 2016 +++ src/lib/libedit/tty.h Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: tty.h,v 1.19 2016/02/27 18:13:21 christos Exp $ */ +/* $NetBSD: tty.h,v 1.20 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -458,7 +458,7 @@ typedef unsigned char ttychar_t[NN_IO][C protected int tty_init(EditLine *); protected void tty_end(EditLine *); -protected int tty_stty(EditLine *, int, const Char **); +protected int tty_stty(EditLine *, int, const wchar_t **); protected int tty_rawmode(EditLine *); protected int tty_cookedmode(EditLine *); protected int tty_quotemode(EditLine *); Index: src/lib/libedit/vi.c diff -u src/lib/libedit/vi.c:1.58 src/lib/libedit/vi.c:1.59 --- src/lib/libedit/vi.c:1.58 Sun Apr 10 20:22:48 2016 +++ src/lib/libedit/vi.c Sun Apr 10 20:50:13 2016 @@ -1,4 +1,4 @@ -/* $NetBSD: vi.c,v 1.58 2016/04/11 00:22:48 christos Exp $ */ +/* $NetBSD: vi.c,v 1.59 2016/04/11 00:50:13 christos Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -37,7 +37,7 @@ #if 0 static char sccsid[] = "@(#)vi.c 8.1 (Berkeley) 6/4/93"; #else -__RCSID("$NetBSD: vi.c,v 1.58 2016/04/11 00:22:48 christos Exp $"); +__RCSID("$NetBSD: vi.c,v 1.59 2016/04/11 00:50:13 christos Exp $"); #endif #endif /* not lint && not SCCSID */ @@ -648,7 +648,7 @@ protected el_action_t /*ARGSUSED*/ vi_kill_line_prev(EditLine *el, wint_t c __attribute__((__unused__))) { - Char *kp, *cp; + wchar_t *kp, *cp; cp = el->el_line.buffer; kp = el->el_chared.c_kill.buf; @@ -809,10 +809,10 @@ protected el_action_t /*ARGSUSED*/ vi_match(EditLine *el, wint_t c __attribute__((__unused__))) { - const Char match_chars[] = L"()[]{}"; - Char *cp; + const wchar_t match_chars[] = L"()[]{}"; + wchar_t *cp; size_t delta, i, count; - Char o_ch, c_ch; + wchar_t o_ch, c_ch; *el->el_line.lastchar = '\0'; /* just in case */ @@ -1006,7 +1006,7 @@ vi_histedit(EditLine *el, wint_t c __att char tempfile[] = "/tmp/histedit.XXXXXXXXXX"; char *cp = NULL; size_t len; - Char *line = NULL; + wchar_t *line = NULL; if (el->el_state.doingarg) { if (vi_to_history_line(el, 0) == CC_ERROR) @@ -1083,11 +1083,11 @@ protected el_action_t /*ARGSUSED*/ vi_history_word(EditLine *el, wint_t c __attribute__((__unused__))) { - const Char *wp = HIST_FIRST(el); - const Char *wep, *wsp; + const wchar_t *wp = HIST_FIRST(el); + const wchar_t *wep, *wsp; int len; - Char *cp; - const Char *lim; + wchar_t *cp; + const wchar_t *lim; if (wp == NULL) return CC_ERROR;