diff options
author | peter <peter@FreeBSD.org> | 2013-08-11 20:03:12 +0000 |
---|---|---|
committer | peter <peter@FreeBSD.org> | 2013-08-11 20:03:12 +0000 |
commit | 5f2a1d653696ec5457bfd044f0ebcd873bfc3c80 (patch) | |
tree | 7c1ae67d07b93aea05bfea51c590c1112b65042b /contrib/nvi/ex/ex_bang.c | |
parent | 324febaf01918418f99998aa5537126ac98c9df0 (diff) | |
download | FreeBSD-src-5f2a1d653696ec5457bfd044f0ebcd873bfc3c80.zip FreeBSD-src-5f2a1d653696ec5457bfd044f0ebcd873bfc3c80.tar.gz |
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 <lichray@gmail.com>
Diffstat (limited to 'contrib/nvi/ex/ex_bang.c')
-rw-r--r-- | contrib/nvi/ex/ex_bang.c | 15 |
1 files changed, 8 insertions, 7 deletions
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 <sys/types.h> @@ -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)); } /* |