Module Name:    src
Committed By:   aymeric
Date:           Tue Aug 11 21:28:02 UTC 2009

Modified Files:
        src/dist/nvi/common: multibyte.h
        src/dist/nvi/vi: v_increment.c

Log Message:
. adding STRCHR variants to common/multibyte.h for the benefit of
. making #+ and #- work again in vi/v_increment.c


To generate a diff of this commit:
cvs rdiff -u -r1.3 -r1.4 src/dist/nvi/common/multibyte.h
cvs rdiff -u -r1.3 -r1.4 src/dist/nvi/vi/v_increment.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/dist/nvi/common/multibyte.h
diff -u src/dist/nvi/common/multibyte.h:1.3 src/dist/nvi/common/multibyte.h:1.4
--- src/dist/nvi/common/multibyte.h:1.3	Sun Apr 12 14:47:51 2009
+++ src/dist/nvi/common/multibyte.h	Tue Aug 11 21:28:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: multibyte.h,v 1.3 2009/04/12 14:47:51 tnozaki Exp $ */
+/*	$NetBSD: multibyte.h,v 1.4 2009/08/11 21:28:02 aymeric Exp $ */
 
 #ifndef MULTIBYTE_H
 #define MULTIBYTE_H
@@ -24,6 +24,7 @@
 #define STRPBRK		wcspbrk
 #define TOUPPER		towupper
 #define STRSET		wmemset
+#define STRCHR		wcschr
 
 #define L(ch)		L ## ch
 
@@ -41,6 +42,7 @@
 #define STRPBRK		strpbrk
 #define TOUPPER		toupper
 #define STRSET		memset
+#define STRCHR		strchr
 
 #define L(ch)		ch
 

Index: src/dist/nvi/vi/v_increment.c
diff -u src/dist/nvi/vi/v_increment.c:1.3 src/dist/nvi/vi/v_increment.c:1.4
--- src/dist/nvi/vi/v_increment.c:1.3	Sun Jan 18 03:45:50 2009
+++ src/dist/nvi/vi/v_increment.c	Tue Aug 11 21:28:02 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: v_increment.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
+/*	$NetBSD: v_increment.c,v 1.4 2009/08/11 21:28:02 aymeric Exp $ */
 
 /*-
  * Copyright (c) 1992, 1993, 1994
@@ -30,17 +30,17 @@
 #include "../common/common.h"
 #include "vi.h"
 
-static const char * const fmt[] = {
+static const CHAR_T * const fmt[] = {
 #define	DEC	0
-	"%ld",
+	L("%ld"),
 #define	SDEC	1
-	"%+ld",
+	L("%+ld"),
 #define	HEXC	2
-	"0X%0*lX",
+	L("0X%0*lX"),
 #define	HEXL	3
-	"0x%0*lx",
+	L("0x%0*lx"),
 #define	OCTAL	4
-	"%#0*lo",
+	L("%#0*lo"),
 };
 
 static void inc_err __P((SCR *, enum nresult));
@@ -59,8 +59,8 @@
 	long ltmp, lval;
 	size_t beg, blen, end, len, nlen, wlen;
 	int base, isempty, rval;
-	const char *ntype;
-	char nbuf[100];
+	const CHAR_T *ntype;
+	CHAR_T nbuf[100];
 	CHAR_T *bp, *p, *t;
 
 	/* Validate the operator. */
@@ -102,7 +102,7 @@
 	}
 
 #undef	ishex
-#define	ishex(c)	(isdigit(c) || strchr("abcdefABCDEF", c))
+#define	ishex(c)	(isdigit(c) || STRCHR(L("abcdefABCDEF"), c))
 #undef	isoctal
 #define	isoctal(c)	(isdigit(c) && (c) != '8' && (c) != '9')
 
@@ -206,7 +206,7 @@
 		/* If we cross 0, signed numbers lose their sign. */
 		if (lval == 0 && ntype == fmt[SDEC])
 			ntype = fmt[DEC];
-		nlen = snprintf(nbuf, sizeof(nbuf), ntype, lval);
+		nlen = SPRINTF(nbuf, sizeof(nbuf), ntype, lval);
 	} else {
 		if ((nret = nget_uslong(sp, &ulval, t, NULL, base)) != NUM_OK)
 			goto err;
@@ -228,7 +228,7 @@
 		if (base == 16)
 			wlen -= 2;
 
-		nlen = snprintf(nbuf, sizeof(nbuf), ntype, wlen, ulval);
+		nlen = SPRINTF(nbuf, sizeof(nbuf), ntype, wlen, ulval);
 	}
 
 	/* Build the new line. */

Reply via email to