From 5f2a1d653696ec5457bfd044f0ebcd873bfc3c80 Mon Sep 17 00:00:00 2001 From: peter Date: Sun, 11 Aug 2013 20:03:12 +0000 Subject: Update nvi-1.79 to 2.1.1-4334a8297f This is the gsoc-2011 project to clean up and backport multibyte support from other nvi forks in a form we can use. USE_WIDECHAR is on unless building for the rescue crunchgen. This should allow editing in the native locale encoding. USE_ICONV depends on make.conf having 'WITH_ICONV=YES' for now. This adds the ability to do things like edit a KOI8-R file while having $LANG set to (say) en_US.UTF-8. iconv is used to transcode the characters for display. Other points: * It uses gencat and catopen/etc instead of homegrown msg catalog stuff. * A lot of stuff has been trimmed out, eg: the perl and tcl bindings which we could never use in base anyway. * It uses ncursesw when in widechar mode. This could be interesting. GSoC info: http://www.google-melange.com/gsoc/proposal/review/google/gsoc2011/zy/1 Repo at: https://github.com/lichray/nvi2 Obtained from: Zhihao Yuan --- contrib/nvi/ex/ex_bang.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) (limited to 'contrib/nvi/ex/ex_bang.c') diff --git a/contrib/nvi/ex/ex_bang.c b/contrib/nvi/ex/ex_bang.c index 25f3f77..4b6f75e 100644 --- a/contrib/nvi/ex/ex_bang.c +++ b/contrib/nvi/ex/ex_bang.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "@(#)ex_bang.c 10.33 (Berkeley) 9/23/96"; +static const char sccsid[] = "$Id: ex_bang.c,v 10.36 2001/06/25 15:19:14 skimo Exp $"; #endif /* not lint */ #include @@ -47,9 +47,7 @@ static const char sccsid[] = "@(#)ex_bang.c 10.33 (Berkeley) 9/23/96"; * PUBLIC: int ex_bang __P((SCR *, EXCMD *)); */ int -ex_bang(sp, cmdp) - SCR *sp; - EXCMD *cmdp; +ex_bang(SCR *sp, EXCMD *cmdp) { enum filtertype ftype; ARGS *ap; @@ -58,6 +56,8 @@ ex_bang(sp, cmdp) recno_t lno; int rval; const char *msg; + char *np; + size_t nlen; ap = cmdp->argv[0]; if (ap->len == 0) { @@ -69,7 +69,7 @@ ex_bang(sp, cmdp) exp = EXP(sp); if (exp->lastbcomm != NULL) free(exp->lastbcomm); - if ((exp->lastbcomm = strdup(ap->bp)) == NULL) { + if ((exp->lastbcomm = v_wstrdup(sp, ap->bp, ap->len)) == NULL) { msgq(sp, M_SYSERR, NULL); return (1); } @@ -88,7 +88,7 @@ ex_bang(sp, cmdp) if (F_ISSET(sp, SC_VI)) vs_update(sp, "!", ap->bp); else { - (void)ex_printf(sp, "!%s\n", ap->bp); + (void)ex_printf(sp, "!"WS"\n", ap->bp); (void)ex_fflush(sp); } } @@ -112,8 +112,9 @@ ex_bang(sp, cmdp) NULL); /* If we're still in a vi screen, move out explicitly. */ + INT2CHAR(sp, ap->bp, ap->len+1, np, nlen); (void)ex_exec_proc(sp, - cmdp, ap->bp, msg, !F_ISSET(sp, SC_EX | SC_SCR_EXWROTE)); + cmdp, np, msg, !F_ISSET(sp, SC_EX | SC_SCR_EXWROTE)); } /* -- cgit v1.1