[arch-commits] Commit in vi/trunk (PKGBUILD c_locale.patch widechar.patch)

Tobias Kieslich tobias at archlinux.org
Thu Jun 25 05:36:31 UTC 2009


    Date: Thursday, June 25, 2009 @ 01:36:30
  Author: tobias
Revision: 43543

upgpkg: vi 1.81.6-2

Added:
  vi/trunk/c_locale.patch
  vi/trunk/widechar.patch
Modified:
  vi/trunk/PKGBUILD

----------------+
 PKGBUILD       |    9 ++++---
 c_locale.patch |   30 ++++++++++++++++++++++++
 widechar.patch |   67 +++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 102 insertions(+), 4 deletions(-)

Modified: PKGBUILD
===================================================================
--- PKGBUILD	2009-06-25 05:00:23 UTC (rev 43542)
+++ PKGBUILD	2009-06-25 05:36:30 UTC (rev 43543)
@@ -5,7 +5,7 @@
 pkgname=vi
 _pkgname=nvi
 pkgver=1.81.6
-pkgrel=1
+pkgrel=2
 pkgdesc='A reimplementation of the ex/vi text editors with unicode support.'
 arch=('i686' 'x86_64')
 url='http://www.kotnet.org/~skimo/nvi/'
@@ -15,12 +15,13 @@
 depends=('bash' 'db')
 options=(!libtool force)
 source=(http://www.kotnet.org/~skimo/nvi/devel/${_pkgname}-${pkgver}.tar.bz2 \
-        db47-hack.patch)
-md5sums=('88d1e23115ee9f2961186b62e55f5704' 'f9dd0ee3b00e1a9915c49acc5a241a6d')
+        db47-hack.patch widechar.patch c_locale.patch)
 
 build() {
   cd ${srcdir}/${_pkgname}-${pkgver}/
-  patch -p1 <../db47-hack.patch
+  patch -p1 -i../db47-hack.patch || return 1
+  patch -Np1 -i ../widechar.patch || return 1
+  patch -Np1 -i ../c_locale.patch || return 1
   cd ./build.unix
   ../dist/configure --prefix=/usr --program-prefix= --enable-widechar
   make || return 1

Added: c_locale.patch
===================================================================
--- c_locale.patch	                        (rev 0)
+++ c_locale.patch	2009-06-25 05:36:30 UTC (rev 43543)
@@ -0,0 +1,30 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 27support_C_locale.dpatch by  <hesso at pool.math.tu-berlin.de>
+##
+## DP: Allow users to edit 8-bit files even under LC_CTYPE=C.
+
+ at DPATCH@
+--- nvi-1.81.6.orig/common/conv.c	2007-11-18 17:41:42.000000000 +0100
++++ nvi-1.81.6/common/conv.c	2009-03-09 16:45:37.812022582 +0100
+@@ -322,11 +322,16 @@
+     else {
+ 	setlocale(LC_ALL, "");
+ #ifdef USE_WIDECHAR
+-	sp->conv.sys2int = cs_char2int;
+-	sp->conv.int2sys = cs_int2char;
+-	sp->conv.file2int = fe_char2int;
+-	sp->conv.int2file = fe_int2char;
+-	sp->conv.input2int = ie_char2int;
++	if (!strcmp(LANGCODESET, "ANSI_X3.4-1968")) {
++	    sp->conv.file2int = sp->conv.input2int = sp->conv.sys2int = raw2int;
++	    sp->conv.int2sys = sp->conv.int2file = int2raw;
++	} else {
++	    sp->conv.sys2int = cs_char2int;
++	    sp->conv.int2sys = cs_int2char;
++	    sp->conv.file2int = fe_char2int;
++	    sp->conv.int2file = fe_int2char;
++	    sp->conv.input2int = ie_char2int;
++	}
+ #endif
+ #ifdef USE_ICONV
+ 	o_set(sp, O_FILEENCODING, OS_STRDUP, nl_langinfo(CODESET), 0);

Added: widechar.patch
===================================================================
--- widechar.patch	                        (rev 0)
+++ widechar.patch	2009-06-25 05:36:30 UTC (rev 43543)
@@ -0,0 +1,67 @@
+#! /bin/sh /usr/share/dpatch/dpatch-run
+## 13widechar_horrors.dpatch by  <hesso at pool.math.tu-berlin.de>
+##
+## DP: This patch tries to cope with the fact that widechar support
+## DP: in nvi is at best rudimentary.
+## DP: Hunk 1)
+## DP: * Due to "ch = *t", this code is not wide-char aware, so
+## DP:   cast the value to a proper type so the KEY_ macros make
+## DP:   the right choice.
+## DP: Hunk 2)
+## DP: * Printing of the in-/decreased number back into the screen
+## DP:   buffer is not widechar-aware, either. Add a dirty fix.
+## DP:   Cf. #497349.
+
+ at DPATCH@
+--- nvi-1.81.6.orig/vi/vs_msg.c	2007-11-18 17:41:42.000000000 +0100
++++ nvi-1.81.6/vi/vs_msg.c	2009-03-01 14:51:08.211414132 +0100
+@@ -472,10 +472,10 @@
+ 			 */
+ 			if (ch == '\t')
+ 				ch = ' ';
+-			chlen = KEY_LEN(sp, ch);
++			chlen = KEY_LEN(sp, (unsigned char)ch);
+ 			if (cbp + chlen >= ecbp)
+ 				FLUSH;
+-			for (kp = KEY_NAME(sp, ch); chlen--;)
++			for (kp = KEY_NAME(sp, (unsigned char)ch); chlen--;)
+ 				*cbp++ = *kp++;
+ 		}
+ 		if (cbp > cbuf)
+--- nvi-1.81.6.orig/vi/v_increment.c	2007-11-18 17:41:42.000000000 +0100
++++ nvi-1.81.6/vi/v_increment.c	2009-03-01 15:12:50.950415874 +0100
+@@ -57,7 +57,7 @@
+ 	long change, ltmp, lval;
+ 	size_t beg, blen, end, len, nlen, wlen;
+ 	int base, isempty, rval;
+-	char *ntype, nbuf[100];
++	char *ntype, nbuf[100 * sizeof(CHAR_T)];
+ 	CHAR_T *bp, *p, *t;
+ 
+ 	/* Validate the operator. */
+@@ -202,7 +202,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 = snprintf(nbuf, sizeof(nbuf)/sizeof(CHAR_T), ntype, lval);
+ 	} else {
+ 		if ((nret = nget_uslong(sp, &ulval, t, NULL, base)) != NUM_OK)
+ 			goto err;
+@@ -224,7 +224,15 @@
+ 		if (base == 16)
+ 			wlen -= 2;
+ 
+-		nlen = snprintf(nbuf, sizeof(nbuf), ntype, wlen, ulval);
++		nlen = snprintf(nbuf, sizeof(nbuf)/sizeof(CHAR_T), ntype, wlen, ulval);
++	}
++
++	/* Inflate the printed char buffer to CHAR_T elements if necessary */
++	if (sizeof(CHAR_T) > sizeof(char)) {
++		int nlen_inflate;
++		for (nlen_inflate = nlen; nlen_inflate >= 0; nlen_inflate--) {
++			((CHAR_T *)nbuf)[nlen_inflate] = nbuf[nlen_inflate];
++		}
+ 	}
+ 
+ 	/* Build the new line. */




More information about the arch-commits mailing list