From owner-svn-soc-all@FreeBSD.ORG Wed Feb 8 16:14:53 2012 Return-Path: Delivered-To: svn-soc-all@FreeBSD.org Received: from socsvn.FreeBSD.org (unknown [IPv6:2001:4f8:fff6::2f]) by hub.freebsd.org (Postfix) with SMTP id 07DBD106566B for ; Wed, 8 Feb 2012 16:14:51 +0000 (UTC) (envelope-from zy@FreeBSD.org) Received: by socsvn.FreeBSD.org (sSMTP sendmail emulation); Wed, 08 Feb 2012 16:14:51 +0000 Date: Wed, 08 Feb 2012 16:14:51 +0000 From: zy@FreeBSD.org To: svn-soc-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Message-Id: <20120208161451.07DBD106566B@hub.freebsd.org> Cc: Subject: socsvn commit: r231490 - in soc2011/zy/nvi-iconv/head: contrib/nvi2 contrib/nvi2/build contrib/nvi2/cl contrib/nvi2/common contrib/nvi2/docs/man contrib/nvi2/ex contrib/nvi2/include contrib/nvi2/re... X-BeenThere: svn-soc-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: SVN commit messages for the entire Summer of Code repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 08 Feb 2012 16:14:53 -0000 Author: zy Date: Wed Feb 8 16:14:50 2012 New Revision: 231490 URL: http://svnweb.FreeBSD.org/socsvn/?view=rev&rev=231490 Log: Updates to git:27a8baf. Version 2.0.3 presents. * Immigrate from CIRCLEQ to TAILQ, from LIST to SLIST. * Display non-printable wide characters in Unicode escape sequences. * Merge some of the fixes from Sven (nvi-git). * Fix many regressions caused by wide characters (in 1.81.6). * Better understanding the difference between 8-bit/wide blanks. * Bind file name completion to be default. * Prefer ctags/cscope tag within the current file. Deleted: soc2011/zy/nvi-iconv/head/contrib/nvi2/build/distrib soc2011/zy/nvi-iconv/head/contrib/nvi2/include/ Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/README soc2011/zy/nvi-iconv/head/contrib/nvi2/build/CMakeLists.txt soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_main.c soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_read.c soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_screen.c soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_term.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/common.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/extern.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/gs.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/key.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/key.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/line.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/log.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/main.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/mark.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/mark.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/mem.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/msg.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/msg.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/multibyte.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/options.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/port.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/put.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/recover.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/screen.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/screen.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/seq.c soc2011/zy/nvi-iconv/head/contrib/nvi2/common/seq.h soc2011/zy/nvi-iconv/head/contrib/nvi2/common/util.c soc2011/zy/nvi-iconv/head/contrib/nvi2/docs/man/vi.1 soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex.h soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_append.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_args.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_argv.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_at.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_bang.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_cscope.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_display.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_edit.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_filter.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_global.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_init.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_move.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_print.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_read.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_screen.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_script.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_shell.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_source.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_subst.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_tag.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_txt.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_usage.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/ex_write.c soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/extern.h soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/tag.h soc2011/zy/nvi-iconv/head/contrib/nvi2/ex/version.h soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/cclass.h soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/cname.h soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/regcomp.c soc2011/zy/nvi-iconv/head/contrib/nvi2/regex/regerror.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/getc.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_at.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_ex.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_increment.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_itxt.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_screen.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_search.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_txt.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/v_word.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vi.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_line.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_msg.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_refresh.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_relative.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_smap.c soc2011/zy/nvi-iconv/head/contrib/nvi2/vi/vs_split.c soc2011/zy/nvi-iconv/head/rescue/rescue/Makefile soc2011/zy/nvi-iconv/head/usr.bin/vi/Makefile soc2011/zy/nvi-iconv/head/usr.bin/vi/config.h Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/README ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/README Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/README Wed Feb 8 16:14:50 2012 (r231490) @@ -1,6 +1,6 @@ -# $Id: README,v 8.157 2011/12/03 02:58:16 zy Exp $ +# $Id: README,v 8.159 2012/02/08 09:05:29 zy Exp $ -This is version 2.0.2 (2011-12-03) of nex/nvi, a reimplementation of the ex/vi +This is version 2.0.3 (2012-02-08) of nex/nvi, a reimplementation of the ex/vi text editors originally distributed as part of the Fourth Berkeley Software Distribution (4BSD), by the University of California, Berkeley. @@ -14,7 +14,6 @@ common ........ Code shared by ex and vi. docs .......... Ex/vi documentation, both current and historic. ex ............ Ex source code. - include ....... Replacement include files. regex ......... Modified regex library with wide character support. vi ............ Vi source code. Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/build/CMakeLists.txt ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/build/CMakeLists.txt Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/build/CMakeLists.txt Wed Feb 8 16:14:50 2012 (r231490) @@ -1,3 +1,4 @@ +# $Id: CMakeLists.txt,v 1.2 2011/12/27 01:40:00 zy Exp $ cmake_minimum_required(VERSION 2.6) project(nvi2) @@ -22,20 +23,48 @@ if(DEBUG) set(_arg_str "${CMAKE_C_FLAGS} -ansi -O0 -g" - "-fstrict-aliasing -Wstrict-aliasing" - "-Wformat" + "-Wall" + "-Wno-unused" + "-Wno-parentheses" + "-Wno-uninitialized" # meaningless without -O "-Wmissing-prototypes" - "-Wno-pointer-sign") + "-fstrict-aliasing -Wstrict-aliasing") join("${_arg_str}" CMAKE_C_FLAGS) else(DEBUG) set(_arg_str "${CMAKE_C_FLAGS} -ansi -O2" - "-Wuninitialized" - "-Wno-pointer-sign") + "-Wuninitialized") join("${_arg_str}" CMAKE_C_FLAGS) endif(DEBUG) # generate the public headers -execute_process(COMMAND ./distrib WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}) +add_custom_target(headers ALL DEPENDS + ../cl/extern.h ../common/extern.h ../ex/extern.h ../vi/extern.h + ../common/options_def.h ../ex/ex_def.h ../ex/version.h) + +set(extract_protos sed -n \"s/^ \\* PUBLIC: \\\(.*\\\)/\\1/p\") +set(extract_version sed -n + \"s/^.*version \\\([^\)]*\)\\\).*/\#define VI_VERSION \\\"\\1\\\"/p\") +add_custom_command(OUTPUT ../cl/extern.h + COMMAND sh -c '${extract_protos} ../cl/*.c > $@' + DEPENDS ../cl/*.c) +add_custom_command(OUTPUT ../common/extern.h + COMMAND sh -c '${extract_protos} ../common/*.c > $@' + DEPENDS ../common/*.c) +add_custom_command(OUTPUT ../ex/extern.h + COMMAND sh -c '${extract_protos} ../ex/*.c > $@' + DEPENDS ../ex/*.c) +add_custom_command(OUTPUT ../vi/extern.h + COMMAND sh -c '${extract_protos} ../vi/*.c > $@' + DEPENDS ../vi/*.c) +add_custom_command(OUTPUT ../common/options_def.h + COMMAND sh -c 'awk -f ../common/options.awk ../common/options.c > $@' + DEPENDS ../common/options.c) +add_custom_command(OUTPUT ../ex/ex_def.h + COMMAND sh -c 'awk -f ../ex/ex.awk ../ex/ex_cmd.c > $@' + DEPENDS ../ex/ex_cmd.c) +add_custom_command(OUTPUT ../ex/version.h + COMMAND sh -c '${extract_version} ../README > $@' + DEPENDS ../README) FILE(GLOB MAIN_SRCS ../cl/*.c ../common/*.c ../ex/*.c ../vi/*.c) FILE(GLOB REGEX_SRCS ../regex/reg*.c) @@ -58,20 +87,24 @@ int main(void) { flock(0, F_SETLK, 0); }" HAVE_LOCK_FCNTL) endif(NOT HAVE_LOCK_FLOCK) -include_directories(. .. ../include) +include_directories(. ..) check_include_files(ncursesw/ncurses.h HAVE_NCURSESW_NCURSES_H) check_include_files(ncurses.h HAVE_NCURSES_H) -# XXX CMakeCache.txt needs to be removed by hand +find_library(_curses_lib NAMES ncurses curses) +find_library(_cursesw_lib NAMES ncursesw cursesw) +mark_as_advanced(_curses_lib _cursesw_lib) + if(USE_WIDECHAR) - find_library(CURSES_LIBRARY NAMES ncursesw cursesw) + set(CURSES_LIBRARY ${_cursesw_lib}) # link to the wchar_t awared BSD libregex.a add_definitions(-D__REGEX_PRIVATE) include_directories(../regex) add_library(regex STATIC ${REGEX_SRCS}) else(USE_WIDECHAR) - find_library(CURSES_LIBRARY NAMES ncurses curses) + set(CURSES_LIBRARY ${_curses_lib}) + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-pointer-sign") endif(USE_WIDECHAR) if(USE_ICONV) Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_funcs.c Wed Feb 8 16:14:50 2012 (r231490) @@ -578,11 +578,9 @@ */ if (repaint || F_ISSET(clp, CL_LAYOUT)) { getyx(stdscr, y, x); - for (psp = sp; - psp != (void *)&sp->gp->dq; psp = psp->q.cqe_next) - for (tsp = psp->q.cqe_next; - tsp != (void *)&sp->gp->dq; - tsp = tsp->q.cqe_next) + for (psp = sp; psp != NULL; psp = TAILQ_NEXT(psp, q)) + for (tsp = TAILQ_NEXT(psp, q); tsp != NULL; + tsp = TAILQ_NEXT(tsp, q)) if (psp->roff == tsp->roff) { if (psp->coff + psp->cols + 1 == tsp->coff) cl_rdiv(psp); Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_main.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_main.c Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_main.c Wed Feb 8 16:14:50 2012 (r231490) @@ -154,6 +154,7 @@ if (clp->oname != NULL) free(clp->oname); free(clp); + free(OG_STR(gp, GO_TERM)); free(gp); #endif Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_read.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_read.c Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_read.c Wed Feb 8 16:14:50 2012 (r231490) @@ -54,7 +54,7 @@ struct timeval t, *tp; CL_PRIVATE *clp; size_t lines, columns; - int changed, nr; + int changed, nr = 0; CHAR_T *wp; size_t wlen; int rc; Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_screen.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_screen.c Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_screen.c Wed Feb 8 16:14:50 2012 (r231490) @@ -97,7 +97,7 @@ if (F_ISSET(sp, SC_SCR_VI)) { F_CLR(sp, SC_SCR_VI); - if (sp->q.cqe_next != (void *)&gp->dq) { + if (TAILQ_NEXT(sp, q) != NULL) { (void)wmove(win, RLNO(sp, sp->rows), 0); wclrtobot(win); } Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_term.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_term.c Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/cl/cl_term.c Wed Feb 8 16:14:50 2012 (r231490) @@ -168,7 +168,7 @@ * Rework any function key mappings that were set before the * screen was initialized. */ - for (qp = sp->gp->seqq.lh_first; qp != NULL; qp = qp->q.le_next) + SLIST_FOREACH(qp, sp->gp->seqq, q) if (F_ISSET(qp, SEQ_FUNCMAP)) (void)cl_pfmap(sp, qp->stype, qp->input, qp->ilen, qp->output, qp->olen); @@ -187,10 +187,12 @@ SEQ *qp, *nqp; /* Delete screen specific mappings. */ - for (qp = gp->seqq.lh_first; qp != NULL; qp = nqp) { - nqp = qp->q.le_next; - if (F_ISSET(qp, SEQ_SCREEN)) - (void)seq_mdel(qp); + for (qp = SLIST_FIRST(gp->seqq); qp != NULL; qp = nqp) { + nqp = SLIST_NEXT(qp, q); + if (F_ISSET(qp, SEQ_SCREEN)) { + SLIST_REMOVE_HEAD(gp->seqq, q); + (void)seq_free(qp); + } } return (0); } Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/common.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/common.h Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/common.h Wed Feb 8 16:14:50 2012 (r231490) @@ -50,7 +50,7 @@ typedef struct _text TEXT; /* Autoindent state. */ -typedef enum { C_NOTSET, C_CARATSET, C_NOCHANGE, C_ZEROSET } carat_t; +typedef enum { C_NOTSET, C_CARATSET, C_ZEROSET } carat_t; /* Busy message types. */ typedef enum { BUSY_ON = 1, BUSY_OFF, BUSY_UPDATE } busy_t; Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.c Wed Feb 8 16:14:50 2012 (r231490) @@ -12,7 +12,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: conv.c,v 2.33 2011/12/04 04:06:45 zy Exp $"; +static const char sccsid[] = "$Id: conv.c,v 2.35 2011/12/15 21:24:49 zy Exp $"; #endif /* not lint */ #include @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include #include #include @@ -30,14 +32,20 @@ #include "common.h" -#ifdef USE_ICONV -#include -#define LANGCODESET nl_langinfo(CODESET) -#else -#define LANGCODESET "" -#endif - -#include +/* + * codeset -- + * Get the locale encoding. + * + * PUBLIC: char * codeset __P((void)); + */ +char * +codeset(void) { + static char *cs; + + if (cs == NULL) + cs = nl_langinfo(CODESET); + return cs; +} #ifdef USE_WIDECHAR static int @@ -95,7 +103,7 @@ default_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen, CHAR_T **dst, iconv_t id) { - int i = 0, j; + size_t i = 0, j; CHAR_T **tostr = &cw->bp1.wc; size_t *blen = &cw->blen1; mbstate_t mbs; @@ -303,6 +311,8 @@ void conv_init (SCR *orig, SCR *sp) { + int i; + if (orig != NULL) MEMCPY(&sp->conv, &orig->conv, 1); else { @@ -344,21 +354,18 @@ #elif __linux__ setlocale(LC_CTYPE, ""); #endif -#ifdef USE_ICONV - o_set(sp, O_INPUTENCODING, OS_STRDUP, nl_langinfo(CODESET), 0); +#if defined(USE_WIDECHAR) && defined(USE_ICONV) + o_set(sp, O_INPUTENCODING, OS_STRDUP, codeset(), 0); #endif - sp->conv.id[IC_IE_CHAR2INT] = (iconv_t)-1; } - /* XXX - * Do not inherit file encoding from the old screen, - * but overwrite the fileencoding option in .exrc - */ -#ifdef USE_ICONV + + /* iconv descriptors must be distinct to screens. */ + for (i = 0; i <= IC_IE_TO_UTF16; ++i) + sp->conv.id[i] = (iconv_t)-1; +#if defined(USE_WIDECHAR) && defined(USE_ICONV) conv_enc(sp, O_INPUTENCODING, 0); - o_set(sp, O_FILEENCODING, OS_STRDUP, nl_langinfo(CODESET), 0); #endif - sp->conv.id[IC_FE_CHAR2INT] = (iconv_t)-1; - sp->conv.id[IC_FE_INT2CHAR] = (iconv_t)-1; + /* XXX Do not inherit fileencoding from the old screen. */ } /* @@ -382,22 +389,28 @@ iconv_close(*c2w); if (*w2c != (iconv_t)-1) iconv_close(*w2c); - if (strcasecmp(LANGCODESET, enc)) { - if ((*c2w = iconv_open(LANGCODESET, enc)) == (iconv_t)-1) + if (strcasecmp(codeset(), enc)) { + if ((*c2w = iconv_open(codeset(), enc)) == (iconv_t)-1) goto err; - if ((*w2c = iconv_open(enc, LANGCODESET)) == (iconv_t)-1) + if ((*w2c = iconv_open(enc, codeset())) == (iconv_t)-1) goto err; } else *c2w = *w2c = (iconv_t)-1; break; case O_INPUTENCODING: c2w = sp->conv.id + IC_IE_CHAR2INT; + w2c = sp->conv.id + IC_IE_TO_UTF16; if (!enc) enc = O_STR(sp, O_INPUTENCODING); if (*c2w != (iconv_t)-1) iconv_close(*c2w); - if (strcasecmp(LANGCODESET, enc)) { - if ((*c2w = iconv_open(LANGCODESET, enc)) == (iconv_t)-1) + if (*w2c != (iconv_t)-1) + iconv_close(*w2c); + if (strcasecmp(codeset(), enc)) { + if ((*c2w = iconv_open(codeset(), enc)) == (iconv_t)-1) goto err; } else *c2w = (iconv_t)-1; + /* UTF-16 can not be locale and can not be inputed. */ + if ((*w2c = iconv_open("utf-16be", enc)) == (iconv_t)-1) + goto err; break; } @@ -431,7 +444,7 @@ { #if defined(USE_WIDECHAR) && defined(USE_ICONV) int i; - for (i = 0; i <= IC_IE_CHAR2INT; ++i) + for (i = 0; i <= IC_IE_TO_UTF16; ++i) if (sp->conv.id[i] != (iconv_t)-1) iconv_close(sp->conv.id[i]); if (sp->cw.bp1.c != NULL) Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.h Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/conv.h Wed Feb 8 16:14:50 2012 (r231490) @@ -3,10 +3,12 @@ * The Regents of the University of California. All rights reserved. * Copyright (c) 1992, 1993, 1994, 1995, 1996 * Keith Bostic. All rights reserved. + * Copyright (c) 2011, 2012 + * Zhihao Yuan. All rights reserved. * * See the LICENSE file for redistribution information. * - * $Id: conv.h,v 2.29 2011/12/04 04:06:45 zy Exp $ + * $Id: conv.h,v 2.31 2011/12/14 14:58:15 zy Exp $ */ #ifdef USE_ICONV @@ -15,12 +17,17 @@ typedef int iconv_t; #endif +/* + * XXX + * We can not use MB_CUR_MAX here, since UTF-8 may report it as 6, but + * a sequence longer than 4 is deprecated by RFC 3629. + */ +#define KEY_NEEDSWIDE(sp, ch) \ + (INTISWIDE(ch) && KEY_LEN(sp, ch) <= 4) #define KEY_COL(sp, ch) \ - (INTISWIDE(ch) ? CHAR_WIDTH(sp, ch) > 0 ? CHAR_WIDTH(sp, ch) : \ - 1 : /* extra space */ \ - KEY_LEN(sp,ch)) + (KEY_NEEDSWIDE(sp, ch) ? CHAR_WIDTH(sp, ch) : KEY_LEN(sp, ch)) -enum { IC_FE_CHAR2INT, IC_FE_INT2CHAR, IC_IE_CHAR2INT }; +enum { IC_FE_CHAR2INT, IC_FE_INT2CHAR, IC_IE_CHAR2INT, IC_IE_TO_UTF16 }; struct _conv_win { union { @@ -41,5 +48,5 @@ char2wchar_t file2int; wchar2char_t int2file; char2wchar_t input2int; - iconv_t id[IC_IE_CHAR2INT + 1]; + iconv_t id[IC_IE_TO_UTF16 + 1]; }; Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.c Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.c Wed Feb 8 16:14:50 2012 (r231490) @@ -72,7 +72,7 @@ int flags) { CB *cbp; - CHAR_T name; + CHAR_T name = '\0'; recno_t lno; int append, copy_one, copy_def; @@ -106,7 +106,7 @@ copy_one = 1; cb_rotate(sp); } - if ((append = isupper(name)) == 1) { + if ((append = isupper(name))) { if (!copy_one) copy_def = 1; name = tolower(name); @@ -128,10 +128,10 @@ if (cbp == NULL) { CALLOC_RET(sp, cbp, CB *, 1, sizeof(CB)); cbp->name = name; - CIRCLEQ_INIT(&cbp->textq); - LIST_INSERT_HEAD(&sp->gp->cutq, cbp, q); + TAILQ_INIT(cbp->textq); + SLIST_INSERT_HEAD(sp->gp->cutq, cbp, q); } else if (!append) { - text_lfree(&cbp->textq); + text_lfree(cbp->textq); cbp->len = 0; cbp->flags = 0; } @@ -181,7 +181,7 @@ return (0); cut_line_err: - text_lfree(&cbp->textq); + text_lfree(cbp->textq); cbp->len = 0; cbp->flags = 0; return (1); @@ -194,42 +194,27 @@ static void cb_rotate(SCR *sp) { - CB *cbp, *del_cbp; + CB *cbp, *del_cbp = NULL, *pre_cbp = NULL; - del_cbp = NULL; - for (cbp = sp->gp->cutq.lh_first; cbp != NULL; cbp = cbp->q.le_next) + SLIST_FOREACH(cbp, sp->gp->cutq, q) { switch(cbp->name) { - case '1': - cbp->name = '2'; - break; - case '2': - cbp->name = '3'; - break; - case '3': - cbp->name = '4'; - break; - case '4': - cbp->name = '5'; - break; - case '5': - cbp->name = '6'; - break; - case '6': - cbp->name = '7'; - break; - case '7': - cbp->name = '8'; - break; - case '8': - cbp->name = '9'; + case '1': case '2': case '3': + case '4': case '5': case '6': + case '7': case '8': + cbp->name += 1; break; case '9': + if (cbp == SLIST_FIRST(sp->gp->cutq)) + SLIST_REMOVE_HEAD(sp->gp->cutq, q); + else + SLIST_REMOVE_AFTER(pre_cbp, q); del_cbp = cbp; break; } + pre_cbp = cbp; + } if (del_cbp != NULL) { - LIST_REMOVE(del_cbp, q); - text_lfree(&del_cbp->textq); + text_lfree(del_cbp->textq); free(del_cbp); } } @@ -272,7 +257,7 @@ } /* Append to the end of the cut buffer. */ - CIRCLEQ_INSERT_TAIL(&cbp->textq, tp, q); + TAILQ_INSERT_TAIL(cbp->textq, tp, q); cbp->len += tp->len; return (0); @@ -290,17 +275,17 @@ CB *cbp; /* Free cut buffer list. */ - while ((cbp = gp->cutq.lh_first) != NULL) { - if (cbp->textq.cqh_first != (void *)&cbp->textq) - text_lfree(&cbp->textq); - LIST_REMOVE(cbp, q); + while ((cbp = SLIST_FIRST(gp->cutq)) != NULL) { + if (!TAILQ_EMPTY(cbp->textq)) + text_lfree(cbp->textq); + SLIST_REMOVE_HEAD(gp->cutq, q); free(cbp); } /* Free default cut storage. */ cbp = &gp->dcb_store; - if (cbp->textq.cqh_first != (void *)&cbp->textq) - text_lfree(&cbp->textq); + if (!TAILQ_EMPTY(cbp->textq)) + text_lfree(cbp->textq); } /* @@ -346,8 +331,8 @@ { TEXT *tp; - while ((tp = headp->cqh_first) != (void *)headp) { - CIRCLEQ_REMOVE(headp, tp, q); + while ((tp = TAILQ_FIRST(headp)) != NULL) { + TAILQ_REMOVE(headp, tp, q); text_free(tp); } } Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.h Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/cut.h Wed Feb 8 16:14:50 2012 (r231490) @@ -10,12 +10,12 @@ */ typedef struct _texth TEXTH; /* TEXT list head structure. */ -CIRCLEQ_HEAD(_texth, _text); +TAILQ_HEAD(_texth, _text); /* Cut buffers. */ struct _cb { - LIST_ENTRY(_cb) q; /* Linked list of cut buffers. */ - TEXTH textq; /* Linked list of TEXT structures. */ + SLIST_ENTRY(_cb) q; /* Linked list of cut buffers. */ + TEXTH textq[1]; /* Linked list of TEXT structures. */ /* XXXX Needed ? Can non ascii-chars be cut buffer names ? */ CHAR_T name; /* Cut buffer name. */ size_t len; /* Total length of cut text. */ @@ -26,7 +26,7 @@ /* Lines/blocks of text. */ struct _text { /* Text: a linked list of lines. */ - CIRCLEQ_ENTRY(_text) q; /* Linked list of text structures. */ + TAILQ_ENTRY(_text) q; /* Linked list of text structures. */ CHAR_T *lb; /* Line buffer. */ size_t lb_len; /* Line buffer length. */ size_t len; /* Line length. */ @@ -66,8 +66,7 @@ #define CBNAME(sp, cbp, nch) { \ CHAR_T L__name; \ L__name = isupper(nch) ? tolower(nch) : (nch); \ - for (cbp = sp->gp->cutq.lh_first; \ - cbp != NULL; cbp = cbp->q.le_next) \ + SLIST_FOREACH(cbp, sp->gp->cutq, q) \ if (cbp->name == L__name) \ break; \ } Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/encoding.c Wed Feb 8 16:14:50 2012 (r231490) @@ -1,18 +1,20 @@ /*- - * Copyright (c) 2011 + * Copyright (c) 2011, 2012 * Zhihao Yuan. All rights reserved. * * See the LICENSE file for redistribution information. */ #ifndef lint -static const char sccsid[] = "$Id: encoding.c,v 1.3 2011/12/03 02:22:20 zy Exp $"; +static const char sccsid[] = "$Id: encoding.c,v 1.4 2011/12/13 19:40:52 zy Exp $"; #endif /* not lint */ #include int looks_utf8 __P((const char *, size_t)); int looks_utf16 __P((const char *, size_t)); +int decode_utf8 __P((const char *)); +int decode_utf16 __P((const char *, int)); #define F 0 /* character never appears in text */ #define T 1 /* character appears in plain ASCII text */ @@ -55,8 +57,9 @@ * PUBLIC: int looks_utf8 __P((const char *, size_t)); */ int -looks_utf8(const char *buf, size_t nbytes) +looks_utf8(const char *ibuf, size_t nbytes) { + const u_char *buf = (u_char*)ibuf; size_t i; int n; int gotone = 0, ctrl = 0; @@ -68,21 +71,21 @@ * still reject it if it uses weird control characters. */ - if (text_chars[(u_char)buf[i]] != T) + if (text_chars[buf[i]] != T) ctrl = 1; } else if ((buf[i] & 0x40) == 0) { /* 10xxxxxx never 1st byte */ return -1; } else { /* 11xxxxxx begins UTF-8 */ int following; - if ((buf[i] & 0x20) == 0) /* 110xxxxx */ - if (buf[i] > '\xC1') /* C0, C1 */ + if ((buf[i] & 0x20) == 0) /* 110xxxxx */ + if (buf[i] > 0xC1) /* C0, C1 */ following = 1; else return -1; else if ((buf[i] & 0x10) == 0) /* 1110xxxx */ following = 2; else if ((buf[i] & 0x08) == 0) /* 11110xxx */ - if (buf[i] < '\xF5') + if (buf[i] < 0xF5) following = 3; else return -1; /* F5, F6, F7 */ else @@ -115,8 +118,9 @@ * PUBLIC: int looks_utf16 __P((const char *, size_t)); */ int -looks_utf16(const char *buf, size_t nbytes) +looks_utf16(const char *ibuf, size_t nbytes) { + const u_char *buf = (u_char *)ibuf; int bigend; size_t i; unsigned int c; @@ -126,7 +130,7 @@ if (nbytes < 2) return 0; - bom = (u_char)buf[0] << 8 ^ (u_char)buf[1]; + bom = buf[0] << 8 ^ buf[1]; if (bom == 0xFFFE) bigend = 0; else if (bom == 0xFEFF) @@ -136,23 +140,23 @@ for (i = 2; i + 1 < nbytes; i += 2) { if (bigend) - c = (u_char)buf[i] << 8 ^ (u_char)buf[i + 1]; + c = buf[i] << 8 ^ buf[i + 1]; else - c = (u_char)buf[i] ^ (u_char)buf[i + 1] << 8; + c = buf[i] ^ buf[i + 1] << 8; if (!following) if (c < 0xD800 || c > 0xDFFF) - if (c < 128 && text_chars[(size_t)c] != T) + if (c < 128 && text_chars[c] != T) return 0; else following = 0; - else if (!(0xD800 <= c && c <= 0xDBFF)) + else if (c > 0xDBFF) return 0; else { following = 1; continue; } - else if (!(0xDC00 <= c && c <= 0xDFFF)) + else if (c < 0xDC00 || c > 0xDFFF) return 0; } @@ -163,3 +167,64 @@ #undef T #undef I #undef X + +/* + * decode_utf8 -- + * Decode a UTF-8 character from byte string to Unicode. + * Returns -1 if the first byte is a not UTF-8 leader. + * + * Based on RFC 3629, but without error detection. + * + * PUBLIC: int decode_utf8 __P((const char *)); + */ +int decode_utf8(const char *ibuf) { + const u_char *buf = (u_char *)ibuf; + int u = -1; + + if ((buf[0] & 0x80) == 0) + u = buf[0]; + else if ((buf[0] & 0x40) == 0); + else { + if ((buf[0] & 0x20) == 0) + u = (buf[0] ^ 0xC0) << 6 ^ (buf[1] ^ 0x80); + else if ((buf[0] & 0x10) == 0) + u = (buf[0] ^ 0xE0) << 12 ^ (buf[1] ^ 0x80) << 6 + ^ (buf[2] ^ 0x80); + else if (((buf[0] & 0x08) == 0)) + u = (buf[0] ^ 0xF0) << 18 ^ (buf[1] ^ 0x80) << 12 + ^ (buf[2] ^ 0x80) << 6 ^ (buf[3] ^ 0x80); + } + return u; +} + +/* + * decode_utf16 -- + * Decode a UTF-16 character from byte string to Unicode. + * Returns -1 if the first unsigned integer is invalid. + * + * No error detection on supplementary bytes. + * + * PUBLIC: int decode_utf16 __P((const char *, int)); + */ +int decode_utf16(const char* ibuf, int bigend) { + const u_char *buf = (u_char *)ibuf; + int u = -1; + unsigned int w1, w2; + + if (bigend) + w1 = buf[0] << 8 ^ buf[1]; + else + w1 = buf[0] ^ buf[1] << 8; + + if (w1 < 0xD800 || w1 > 0xDFFF) + u = w1; + else if (w1 > 0xDBFF); + else { + if (bigend) + w2 = buf[2] << 8 ^ buf[3]; + else + w2 = buf[2] ^ buf[3] << 8; + u = ((w1 ^ 0xD800) << 10 ^ (w2 ^ 0xDC00)) + 0x10000; + } + return u; +} Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.c Wed Feb 8 16:14:50 2012 (r231490) @@ -77,11 +77,10 @@ */ gp = sp->gp; if (name != NULL) - for (frp = gp->frefq.cqh_first; - frp != (void *)&gp->frefq; frp = frp->q.cqe_next) { + TAILQ_FOREACH(frp, gp->frefq, q) { if (frp->name == NULL) { - tfrp = frp->q.cqe_next; - CIRCLEQ_REMOVE(&gp->frefq, frp, q); + tfrp = TAILQ_NEXT(frp, q); + TAILQ_REMOVE(gp->frefq, frp, q); if (frp->name != NULL) free(frp->name); free(frp); @@ -110,7 +109,7 @@ } /* Append into the chain of file names. */ - CIRCLEQ_INSERT_TAIL(&gp->frefq, frp, q); + TAILQ_INSERT_TAIL(gp->frefq, frp, q); return (frp); } @@ -131,7 +130,7 @@ int flags) { EXF *ep; - RECNOINFO oinfo; + RECNOINFO oinfo = { 0 }; struct stat sb; size_t psize; int fd, exists, open_err, readonly; @@ -237,7 +236,6 @@ } /* Set up recovery. */ - memset(&oinfo, 0, sizeof(RECNOINFO)); oinfo.bval = '\n'; /* Always set. */ oinfo.psize = psize; oinfo.flags = F_ISSET(sp->gp, G_SNAPSHOT) ? R_SNAPSHOT : 0; @@ -672,7 +670,7 @@ free(frp->tname); frp->tname = NULL; if (F_ISSET(frp, FR_TMPFILE)) { - CIRCLEQ_REMOVE(&sp->gp->frefq, frp, q); + TAILQ_REMOVE(sp->gp->frefq, frp, q); if (frp->name != NULL) free(frp->name); free(frp); @@ -1106,7 +1104,7 @@ */ if (version) { GET_SPACE_GOTOC(sp, bp, blen, cmd.argv[0]->len * 2 + 50); - INT2SYS(sp, cmd.argv[0]->bp, cmd.argv[0]->len + 1, + INT2CHAR(sp, cmd.argv[0]->bp, cmd.argv[0]->len + 1, p, nlen); d = strdup(p); p = d; @@ -1132,7 +1130,7 @@ p = slash + 1; } if (dirp == NULL) { - INT2SYS(sp, cmd.argv[0]->bp, cmd.argv[0]->len + 1, + INT2CHAR(sp, cmd.argv[0]->bp, cmd.argv[0]->len + 1, estr, nlen); goto err; } @@ -1147,7 +1145,7 @@ wfname = bp; } else { bp = NULL; - INT2SYS(sp, cmd.argv[0]->bp, cmd.argv[0]->len + 1, + INT2CHAR(sp, cmd.argv[0]->bp, cmd.argv[0]->len + 1, wfname, nlen); } @@ -1256,19 +1254,25 @@ free(np); } } - if (st == 1) { + switch (st) { DBT key, data; recno_t lno; + case 1: key.data = &lno; key.size = sizeof(lno); if (!ep->db->seq(ep->db, &key, &data, R_LAST) && *(char*)data.data == '\0') ep->db->del(ep->db, &key, 0); o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-16le", 0); - } else if (st == 2) + break; + case 2: o_set(sp, O_FILEENCODING, OS_STRDUP, "utf-16be", 0); + break; + default: + /* Fallback to the locale encoding. */ + o_set(sp, O_FILEENCODING, OS_STRDUP, codeset(), 0); + } } - /* Fallback to locale encoding */ conv_enc(sp, O_FILEENCODING, 0); #endif Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.h Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/exf.h Wed Feb 8 16:14:50 2012 (r231490) @@ -32,7 +32,8 @@ MARK l_cursor; /* Log cursor position. */ dir_t lundo; /* Last undo direction. */ - LIST_HEAD(_markh, _lmark) marks;/* Linked list of file MARK's. */ + /* Linked list of file MARK's. */ + SLIST_HEAD(_markh, _lmark) marks[1]; /* * XXX Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/extern.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/extern.h Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/extern.h Wed Feb 8 16:14:50 2012 (r231490) @@ -1,3 +1,4 @@ +char * codeset __P((void)); void conv_init __P((SCR *, SCR *)); int conv_enc __P((SCR *, int, char *)); void conv_end __P((SCR *)); @@ -10,6 +11,8 @@ int del __P((SCR *, MARK *, MARK *, int)); int looks_utf8 __P((const char *, size_t)); int looks_utf16 __P((const char *, size_t)); +int decode_utf8 __P((const char *)); +int decode_utf16 __P((const char *, int)); FREF *file_add __P((SCR *, char *)); int file_init __P((SCR *, FREF *, char *, int)); int file_end __P((SCR *, EXF *, int)); @@ -23,7 +26,7 @@ int v_key_init __P((SCR *)); void v_key_ilookup __P((SCR *)); size_t v_key_len __P((SCR *, ARG_CHAR_T)); -u_char *v_key_name __P((SCR *, ARG_CHAR_T)); +char *v_key_name __P((SCR *, ARG_CHAR_T)); e_key_t v_key_val __P((SCR *, ARG_CHAR_T)); int v_event_push __P((SCR *, EVENT *, CHAR_T *, size_t, u_int)); int v_event_get __P((SCR *, EVENT *, int, u_int32_t)); @@ -109,7 +112,7 @@ int seq_set __P((SCR *, CHAR_T *, size_t, CHAR_T *, size_t, CHAR_T *, size_t, seq_t, int)); int seq_delete __P((SCR *, CHAR_T *, size_t, seq_t)); -int seq_mdel __P((SEQ *)); +int seq_free __P((SEQ *)); SEQ *seq_find __P((SCR *, SEQ **, EVENT *, CHAR_T *, size_t, seq_t, int *)); void seq_close __P((GS *)); Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/gs.h ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/gs.h Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/gs.h Wed Feb 8 16:14:50 2012 (r231490) @@ -19,7 +19,7 @@ * The read-only bit follows the file name, not the file itself. */ struct _fref { - CIRCLEQ_ENTRY(_fref) q; /* Linked list of file references. */ + TAILQ_ENTRY(_fref) q; /* Linked list of file references. */ char *name; /* File name. */ char *tname; /* Backing temporary file name. */ @@ -56,8 +56,8 @@ char *progname; /* Programe name. */ int id; /* Last allocated screen id. */ - CIRCLEQ_HEAD(_dqh, _scr) dq; /* Displayed screens. */ - CIRCLEQ_HEAD(_hqh, _scr) hq; /* Hidden screens. */ + TAILQ_HEAD(_dqh, _scr) dq[1]; /* Displayed screens. */ + TAILQ_HEAD(_hqh, _scr) hq[1]; /* Hidden screens. */ SCR *ccl_sp; /* Colon command-line screen. */ @@ -65,7 +65,7 @@ void *ip_private; /* IP support private area. */ /* File references. */ - CIRCLEQ_HEAD(_frefh, _fref) frefq; + TAILQ_HEAD(_frefh, _fref) frefq[1]; #define GO_COLUMNS 0 /* Global options: columns. */ #define GO_LINES 1 /* Global options: lines. */ @@ -74,7 +74,7 @@ OPTION opts[GO_TERM + 1]; DB *msg; /* Message catalog DB. */ - MSGH msgq; /* User message list. */ + MSGH msgq[1]; /* User message list. */ #define DEFAULT_NOPRINT '\1' /* Emergency non-printable character. */ int noprint; /* Cached, unprintable character. */ @@ -85,8 +85,9 @@ * Ex command structures (EXCMD). Defined here because ex commands * exist outside of any particular screen or file. */ -#define EXCMD_RUNNING(gp) ((gp)->ecq.lh_first->clen != 0) - LIST_HEAD(_excmdh, _excmd) ecq; /* Ex command linked list. */ +#define EXCMD_RUNNING(gp) (SLIST_FIRST((gp)->ecq)->clen != 0) + /* Ex command linked list. */ + SLIST_HEAD(_excmdh, _excmd) ecq[1]; EXCMD excmd; /* Default ex command structure. */ char *if_name; /* Current associated file. */ recno_t if_lno; /* Current associated line number. */ @@ -104,10 +105,10 @@ CB *dcbp; /* Default cut buffer pointer. */ CB dcb_store; /* Default cut buffer storage. */ - LIST_HEAD(_cuth, _cb) cutq; /* Linked list of cut buffers. */ + SLIST_HEAD(_cuth, _cb) cutq[1]; /* Linked list of cut buffers. */ #define MAX_BIT_SEQ 0x7f /* Max + 1 fast check character. */ - LIST_HEAD(_seqh, _seq) seqq; /* Linked list of maps, abbrevs. */ + SLIST_HEAD(_seqh, _seq) seqq[1];/* Linked list of maps, abbrevs. */ bitstr_t bit_decl(seqb, MAX_BIT_SEQ + 1); #define MAX_FAST_KEY 0xff /* Max fast check character.*/ @@ -118,7 +119,7 @@ (((ch) & ~MAX_FAST_KEY) == 0 ? \ sp->gp->cname[(unsigned char)ch].name : v_key_name(sp, ch)) struct { - u_char name[MAX_CHARACTER_COLUMNS + 1]; + char name[MAX_CHARACTER_COLUMNS + 1]; u_int8_t len; } cname[MAX_FAST_KEY + 1]; /* Fast lookup table. */ Modified: soc2011/zy/nvi-iconv/head/contrib/nvi2/common/key.c ============================================================================== --- soc2011/zy/nvi-iconv/head/contrib/nvi2/common/key.c Wed Feb 8 15:38:36 2012 (r231489) +++ soc2011/zy/nvi-iconv/head/contrib/nvi2/common/key.c Wed Feb 8 16:14:50 2012 (r231490) @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "$Id: key.c,v 10.51 2011/12/02 18:52:34 zy Exp $"; +static const char sccsid[] = "$Id: key.c,v 10.52 2011/12/12 23:38:51 zy Exp $"; #endif /* not lint */ #include @@ -218,31 +218,43 @@ * Return the string that will display the key. This routine * is the backup for the KEY_NAME() macro. * - * PUBLIC: u_char *v_key_name __P((SCR *, ARG_CHAR_T)); + * PUBLIC: char *v_key_name __P((SCR *, ARG_CHAR_T)); */ -u_char * +char * v_key_name( SCR *sp, ARG_CHAR_T ach) { static const char hexdigit[] = "0123456789abcdef"; static const char octdigit[] = "01234567"; - CHAR_T ch, mask; + int ch; size_t len; - int cnt, shift; char *chp; - ch = ach; *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***