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_usage.c | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) (limited to 'contrib/nvi/ex/ex_usage.c') diff --git a/contrib/nvi/ex/ex_usage.c b/contrib/nvi/ex/ex_usage.c index cddf7a6..9a20ce1 100644 --- a/contrib/nvi/ex/ex_usage.c +++ b/contrib/nvi/ex/ex_usage.c @@ -10,7 +10,7 @@ #include "config.h" #ifndef lint -static const char sccsid[] = "@(#)ex_usage.c 10.13 (Berkeley) 5/3/96"; +static const char sccsid[] = "$Id: ex_usage.c,v 10.16 2011/12/21 19:26:48 zy Exp $"; #endif /* not lint */ #include @@ -34,9 +34,7 @@ static const char sccsid[] = "@(#)ex_usage.c 10.13 (Berkeley) 5/3/96"; * PUBLIC: int ex_help __P((SCR *, EXCMD *)); */ int -ex_help(sp, cmdp) - SCR *sp; - EXCMD *cmdp; +ex_help(SCR *sp, EXCMD *cmdp) { (void)ex_puts(sp, "To see the list of vi commands, enter \":viusage\"\n"); @@ -57,30 +55,28 @@ ex_help(sp, cmdp) * PUBLIC: int ex_usage __P((SCR *, EXCMD *)); */ int -ex_usage(sp, cmdp) - SCR *sp; - EXCMD *cmdp; +ex_usage(SCR *sp, EXCMD *cmdp) { ARGS *ap; EXCMDLIST const *cp; int newscreen; - char *name, *p, nb[MAXCMDNAMELEN + 5]; + CHAR_T *name, *p, nb[MAXCMDNAMELEN + 5]; switch (cmdp->argc) { case 1: ap = cmdp->argv[0]; - if (isupper(ap->bp[0])) { + if (ISUPPER(ap->bp[0])) { newscreen = 1; - ap->bp[0] = tolower(ap->bp[0]); + ap->bp[0] = TOLOWER(ap->bp[0]); } else newscreen = 0; for (cp = cmds; cp->name != NULL && - memcmp(ap->bp, cp->name, ap->len); ++cp); + MEMCMP(ap->bp, cp->name, ap->len); ++cp); if (cp->name == NULL || - newscreen && !F_ISSET(cp, E_NEWSCREEN)) { + (newscreen && !F_ISSET(cp, E_NEWSCREEN))) { if (newscreen) - ap->bp[0] = toupper(ap->bp[0]); - (void)ex_printf(sp, "The %.*s command is unknown\n", + ap->bp[0] = TOUPPER(ap->bp[0]); + (void)ex_printf(sp, "The "WVS" command is unknown\n", (int)ap->len, ap->bp); } else { (void)ex_printf(sp, @@ -112,10 +108,10 @@ ex_usage(sp, cmdp) * room, they're all short names. */ if (cp == &cmds[C_SCROLL]) - name = "^D"; + name = L("^D"); else if (F_ISSET(cp, E_NEWSCREEN)) { nb[0] = '['; - nb[1] = toupper(cp->name[0]); + nb[1] = TOUPPER(cp->name[0]); nb[2] = cp->name[0]; nb[3] = ']'; for (name = cp->name + 1, @@ -124,7 +120,7 @@ ex_usage(sp, cmdp) } else name = cp->name; (void)ex_printf(sp, - "%*s: %s\n", MAXCMDNAMELEN, name, cp->help); + WVS": %s\n", MAXCMDNAMELEN, name, cp->help); } break; default: @@ -140,9 +136,7 @@ ex_usage(sp, cmdp) * PUBLIC: int ex_viusage __P((SCR *, EXCMD *)); */ int -ex_viusage(sp, cmdp) - SCR *sp; - EXCMD *cmdp; +ex_viusage(SCR *sp, EXCMD *cmdp) { GS *gp; VIKEYS const *kp; -- cgit v1.1