Module Name:    src
Committed By:   christos
Date:           Thu Jan 19 02:42:53 UTC 2012

Modified Files:
        src/bin/csh: char.c char.h

Log Message:
PR/45856: Bernhard "Burnhard" Riedel: Infinite loop on   input. Sending
char 160 in the input to csh, lead it to an infinite loop, because tcsh tables
counted this as a space character, but the word logic switch does not. Change
that character tables, so that this does not count as a spacing character
anymore, by syncing the table with the one from tcsh.


To generate a diff of this commit:
cvs rdiff -u -r1.9 -r1.10 src/bin/csh/char.c
cvs rdiff -u -r1.8 -r1.9 src/bin/csh/char.h

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

Modified files:

Index: src/bin/csh/char.c
diff -u src/bin/csh/char.c:1.9 src/bin/csh/char.c:1.10
--- src/bin/csh/char.c:1.9	Thu Aug  7 05:05:03 2003
+++ src/bin/csh/char.c	Wed Jan 18 21:42:53 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: char.c,v 1.9 2003/08/07 09:05:03 agc Exp $ */
+/* $NetBSD: char.c,v 1.10 2012/01/19 02:42:53 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -34,209 +34,210 @@
 #if 0
 static char sccsid[] = "@(#)char.c	8.1 (Berkeley) 5/31/93";
 #else
-__RCSID("$NetBSD: char.c,v 1.9 2003/08/07 09:05:03 agc Exp $");
+__RCSID("$NetBSD: char.c,v 1.10 2012/01/19 02:42:53 christos Exp $");
 #endif
 #endif /* not lint */
 
 #include "char.h"
 
+/* on default same as original map */
 unsigned short _cmap[256] = {
-/*	nul		soh		stx		etx	*/
+/*	  0 nul		  1 soh		  2 stx		  3 etx	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	eot		enq		ack		bel	*/
+/*	  4 eot		  5 enq		  6 ack		  7 bel	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	bs		ht		nl		vt	*/
+/*	  8 bs		  9 ht		 10 nl		 11 vt	*/
 	_CTR,		_CTR|_SP|_META,	_CTR|_NL|_META,	_CTR,
 
-/*	np		cr		so		si	*/
+/*	 12 np		 13 cr		 14 so		 15 si	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	dle		dc1		dc2		dc3	*/
+/*	 16 dle		 17 dc1		 18 dc2		 19 dc3	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	dc4		nak		syn		etb	*/
+/*	 20 dc4		 21 nak		 22 syn		 23 etb	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	can		em		sub		esc	*/
+/*	 24 can		 25 em		 26 sub		 27 esc	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	fs		gs		rs		us	*/
+/*	 28 fs		 29 gs		 30 rs		 31 us	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	sp		!		"		#	*/
-	_SP|_META,	0,		_QF,		_META,
+/*	 32 sp		 33 !		 34 "		 35 #	*/
+	_SP|_META,	_PUN,		_QF|_PUN,	_META|_PUN,
 
-/*	$		%		&		'	*/
-	_DOL,		0,		_META|_CMD,	_QF,
+/*	 36 $		 37 %		 38 &		 39 '	*/
+	_DOL|_PUN,	_PUN,		_META|_CMD|_PUN,_QF|_PUN,
 
-/*	(		)		*		+	*/
-	_META|_CMD,	_META,		_GLOB,		0,
+/*	 40 (		 41 )		 42 *		 43 +	*/
+	_META|_CMD|_PUN,_META|_PUN,	_GLOB|_PUN,	_PUN,
 
-/*	,		-		.		/	*/
-	0,		0,		0,		0,
+/*	 44 ,		 45 -		 46 .		 47 /	*/
+	_PUN,		_PUN,		_PUN,		_PUN,
 
-/*	0		1		2		3	*/
+/*	 48 0		 49 1		 50 2		 51 3	*/
 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
 
-/*	4		5		6		7	*/
+/*	 52 4		 53 5		 54 6		 55 7	*/
 	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,	_DIG|_XD,
 
-/*	8		9		:		;	*/
-	_DIG|_XD,	_DIG|_XD,	0,		_META|_CMD,
+/*	 56 8		 57 9		 58 :		 59 ;	*/
+	_DIG|_XD,	_DIG|_XD,	_PUN,		_META|_CMD|_PUN,
 
-/*	<		=		>		?	*/
-	_META,		0,		_META,		_GLOB,
+/*	 60 <		 61 =		 62 >		 63 ?	*/
+	_META|_PUN,	_PUN,		_META|_PUN,	_GLOB|_PUN,
 
-/*	@		A		B		C	*/
-	0,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
+/*	 64 @		 65 A		 66 B		 67 C	*/
+	_PUN,		_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,
 
-/*	D		E		F		G	*/
+/*	 68 D		 69 E		 70 F		 71 G	*/
 	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP|_XD,	_LET|_UP,
 
-/*	H		I		J		K	*/
+/*	 72 H		 73 I		 74 J		 75 K	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	L		M		N		O	*/
+/*	 76 L		 77 M		 78 N		 79 O	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	P		Q		R		S	*/
+/*	 80 P		 81 Q		 82 R		 83 S	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	T		U		V		W	*/
+/*	 84 T		 85 U		 86 V		 87 W	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	X		Y		Z		[	*/
-	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB,
+/*	 88 X		 89 Y		 90 Z		 91 [	*/
+	_LET|_UP,	_LET|_UP,	_LET|_UP,	_GLOB|_PUN,
 
-/*	\		]		^		_	*/
-	_ESC,		0,		0,		0,
+/*	 92 \		 93 ]		 94 ^		 95 _	*/
+	_ESC|_PUN,	_PUN,		_PUN,		_PUN,
 
-/*	`		a		b		c	*/
-  _QB|_GLOB|_META,	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW|_XD,
+/*	 96 `		 97 a		 98 b		 99 c	*/
+  _QB|_GLOB|_META|_PUN,	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW|_XD,
 
-/*	d		e		f		g	*/
+/*	100 d		101 e		102 f		103 g	*/
 	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW|_XD,	_LET|_LOW,
 
-/*	h		i		j		k	*/
+/*	104 h		105 i		106 j		107 k	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	l		m		n		o	*/
+/*	108 l		109 m		110 n		111 o	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	p		q		r		s	*/
+/*	112 p		113 q		114 r		115 s	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	t		u		v		w	*/
+/*	116 t		117 u		118 v		119 w	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	x		y		z		{	*/
-	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_GLOB,
+/*	120 x		121 y		122 z		123 {	*/
+	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_GLOB|_PUN,
 
-/*	|		}		~		del	*/
-	_META|_CMD,	0,		0,		_CTR,
+/*	124 |		125 }		126 ~		127 del	*/
+	_META|_CMD|_PUN,_PUN,		_PUN,		_CTR,
 
-#if defined(SHORT_STRINGS) && !defined(KANJI)
+#ifdef SHORT_STRINGS
 /****************************************************************/
 /* 128 - 255 The below is supposedly ISO 8859/1			*/
 /****************************************************************/
-/*	(undef)		(undef)		(undef)		(undef)		*/
+/*	128 (undef)	129 (undef)	130 (undef)	131 (undef)	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	(undef)		(undef)		(undef)		(undef)		*/
+/*	132 (undef)	133 (undef)	134 (undef)	135 (undef)	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	(undef)		(undef)		(undef)		(undef)		*/
+/*	136 (undef)	137 (undef)	138 (undef)	139 (undef)	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	(undef)		(undef)		(undef)		(undef)		*/
+/*	140 (undef)	141 (undef)	142 (undef)	143 (undef)	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	(undef)		(undef)		(undef)		(undef)		*/
+/*	144 (undef)	145 (undef)	146 (undef)	147 (undef)	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	(undef)		(undef)		(undef)		(undef)		*/
+/*	148 (undef)	149 (undef)	150 (undef)	151 (undef)	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	(undef)		(undef)		(undef)		(undef)		*/
+/*	152 (undef)	153 (undef)	154 (undef)	155 (undef)	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	(undef)		(undef)		(undef)		(undef)		*/
+/*	156 (undef)	157 (undef)	158 (undef)	159 (undef)	*/
 	_CTR,		_CTR,		_CTR,		_CTR,
 
-/*	nobreakspace	exclamdown	cent		sterling	*/
-	_SP,		0,		0,		0,
+/*	160 nobreakspace 161 exclamdown	162 cent	163 sterling	*/
+	_PUN, /* XXX */	_PUN,		_PUN,		_PUN,
 
-/*	currency	yen		brokenbar	section		*/
-	0,		0,		0,		0,
+/*	164 currency	165 yen		166 brokenbar	167 section	*/
+	_PUN,		_PUN,		_PUN,		_PUN,
 
-/*	diaeresis	copyright	ordfeminine	guillemotleft	*/
-	0,		0,		0,		0,
+/*	168 diaeresis	169 copyright	170 ordfeminine	171 guillemotleft*/
+	_PUN,		_PUN,		_PUN,		_PUN,
 
-/*	notsign		hyphen		registered	macron		*/
-	0,		0,		0,		0,
+/*	172 notsign	173 hyphen	174 registered	175 macron	*/
+	_PUN,		_PUN,		_PUN,		_PUN,
 
-/*	degree		plusminus	twosuperior	threesuperior	*/
-	0,		0,		0,		0,
+/*	176 degree	177 plusminus	178 twosuperior	179 threesuperior*/
+	_PUN,		_PUN,		_PUN,		_PUN,
 
-/*	acute		mu		paragraph	periodcentered	*/
-	0,		0,		0,		0,
+/*	180 acute	181 mu 		182 paragraph	183 periodcentered*/
+	_PUN,		_PUN, /*XXX*/	_PUN,		_PUN,
 
-/*	cedilla		onesuperior	masculine	guillemotright	*/
-	0,		0,		0,		0,
+/*	184 cedilla	185 onesuperior	186 masculine	187 guillemotright*/
+	_PUN,		_PUN,		_PUN,		_PUN,
 
-/*	onequarter	onehalf		threequarters	questiondown	*/
-	0,		0,		0,		0,
+/*	188 onequarter	189 onehalf	190 threequarters 191 questiondown*/
+	_PUN,		_PUN,		_PUN,		_PUN,
 
-/*	Agrave		Aacute		Acircumflex	Atilde		*/
+/*	192 Agrave	193 Aacute	194 Acircumflex	195 Atilde	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	Adiaeresis	Aring		AE		Ccedilla	*/
+/*	196 Adiaeresis	197 Aring	198 AE		199 Ccedilla	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	Egrave		Eacute		Ecircumflex	Ediaeresis	*/
+/*	200 Egrave	201 Eacute	202 Ecircumflex	203 Ediaeresis	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	Igrave		Iacute		Icircumflex	Idiaeresis	*/
+/*	204 Igrave	205 Iacute	206 Icircumflex	207 Idiaeresis	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	ETH		Ntilde		Ograve		Oacute		*/
+/*	208 ETH		209 Ntilde	210 Ograve	211 Oacute	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	Ocircumflex	Otilde		Odiaeresis	multiply	*/
-	_LET|_UP,	_LET|_UP,	_LET|_UP,	0,
+/*	212 Ocircumflex	213 Otilde	214 Odiaeresis	215 multiply	*/
+	_LET|_UP,	_LET|_UP,	_LET|_UP,	_PUN,
 
-/*	Ooblique	Ugrave		Uacute		Ucircumflex	*/
+/*	216 Ooblique	217 Ugrave	218 Uacute	219 Ucircumflex	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_UP,
 
-/*	Udiaeresis	Yacute		THORN		ssharp		*/
+/*	220 Udiaeresis	221 Yacute	222 THORN	223 ssharp	*/
 	_LET|_UP,	_LET|_UP,	_LET|_UP,	_LET|_LOW,
 
-/*	agrave		aacute		acircumflex	atilde		*/
+/*	224 agrave	225 aacute	226 acircumflex	227 atilde	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	adiaeresis	aring		ae		ccedilla	*/
+/*	228 adiaeresis	229 aring	230 ae		231 ccedilla	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	egrave		eacute		ecircumflex	ediaeresis	*/
+/*	232 egrave	233 eacute	234 ecircumflex	235 ediaeresis	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	igrave		iacute		icircumflex	idiaeresis	*/
+/*	236 igrave	237 iacute	238 icircumflex	239 idiaeresis	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	eth		ntilde		ograve		oacute		*/
+/*	240 eth		241 ntilde	242 ograve	243 oacute	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	ocircumflex	otilde		odiaeresis	division	*/
-	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	0,
+/*	244 ocircumflex	245 otilde	246 odiaeresis	247 division	*/
+	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_PUN,
 
-/*	oslash		ugrave		uacute		ucircumflex	*/
+/*	248 oslash	249 ugrave	250 uacute	251 ucircumflex	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
 
-/*	udiaeresis	yacute		thorn		ydiaeresis	*/
+/*	252 udiaeresis	253 yacute	254 thorn	255 ydiaeresis	*/
 	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,	_LET|_LOW,
-#endif /* SHORT_STRINGS && !KANJI */
+#endif /* SHORT_STRINGS */
 };
 
 #ifndef NLS

Index: src/bin/csh/char.h
diff -u src/bin/csh/char.h:1.8 src/bin/csh/char.h:1.9
--- src/bin/csh/char.h:1.8	Thu Aug  7 05:05:03 2003
+++ src/bin/csh/char.h	Wed Jan 18 21:42:53 2012
@@ -1,4 +1,4 @@
-/* $NetBSD: char.h,v 1.8 2003/08/07 09:05:03 agc Exp $ */
+/* $NetBSD: char.h,v 1.9 2012/01/19 02:42:53 christos Exp $ */
 
 /*-
  * Copyright (c) 1980, 1991, 1993
@@ -58,6 +58,7 @@ extern unsigned char _cmap_lower[], _cma
 #define	_XD 	0x1000		/* 0-9, a-f, A-F */
 #define	_CMD	0x2000		/* lex end of command chars, ;&(|` */
 #define _CTR	0x4000		/* control */
+#define _PUN	0x8000		/* punctuation */
 
 #define cmap(c, bits)	\
 	(((c) & QUOTE) ? 0 : (_cmap[(unsigned char)(c)] & (bits)))

Reply via email to