Clean up cruft made visible by the unifdefing:
* remove setlocale() calls
* remove write-only variable AsciiOnly
* remove now unused string constants STRLANG, STRLC_CTYPE
* remove hardcoded support for ISO8859-1
OK?
Index: char.c
===================================================================
RCS file: /cvs/src/bin/csh/char.c,v
retrieving revision 1.5
diff -u -p -r1.5 char.c
--- char.c 26 Oct 2015 15:01:15 -0000 1.5
+++ char.c 26 Oct 2015 15:27:45 -0000
@@ -130,101 +130,8 @@ unsigned short _cmap[256] = {
_META|_CMD, 0, 0, _CTR,
/****************************************************************/
-/* 128 - 255 The below is supposedly ISO 8859/1 */
+/* 128 - 255 */
/****************************************************************/
-/* (undef) (undef) (undef) (undef) */
- _CTR, _CTR, _CTR, _CTR,
-
-/* (undef) (undef) (undef) (undef) */
- _CTR, _CTR, _CTR, _CTR,
-
-/* (undef) (undef) (undef) (undef) */
- _CTR, _CTR, _CTR, _CTR,
-
-/* (undef) (undef) (undef) (undef) */
- _CTR, _CTR, _CTR, _CTR,
-
-/* (undef) (undef) (undef) (undef) */
- _CTR, _CTR, _CTR, _CTR,
-
-/* (undef) (undef) (undef) (undef) */
- _CTR, _CTR, _CTR, _CTR,
-
-/* (undef) (undef) (undef) (undef) */
- _CTR, _CTR, _CTR, _CTR,
-
-/* (undef) (undef) (undef) (undef) */
- _CTR, _CTR, _CTR, _CTR,
-
-/* nobreakspace exclamdown cent sterling */
- _SP, 0, 0, 0,
-
-/* currency yen brokenbar section */
- 0, 0, 0, 0,
-
-/* diaeresis copyright ordfeminine guillemotleft */
- 0, 0, 0, 0,
-
-/* notsign hyphen registered macron */
- 0, 0, 0, 0,
-
-/* degree plusminus twosuperior threesuperior */
- 0, 0, 0, 0,
-
-/* acute mu paragraph periodcentered */
- 0, 0, 0, 0,
-
-/* cedilla onesuperior masculine guillemotright */
- 0, 0, 0, 0,
-
-/* onequarter onehalf threequarters questiondown */
- 0, 0, 0, 0,
-
-/* Agrave Aacute Acircumflex Atilde */
- _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
-
-/* Adiaeresis Aring AE Ccedilla */
- _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
-
-/* Egrave Eacute Ecircumflex Ediaeresis */
- _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
-
-/* Igrave Iacute Icircumflex Idiaeresis */
- _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
-
-/* ETH Ntilde Ograve Oacute */
- _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
-
-/* Ocircumflex Otilde Odiaeresis multiply */
- _LET|_UP, _LET|_UP, _LET|_UP, 0,
-
-/* Ooblique Ugrave Uacute Ucircumflex */
- _LET|_UP, _LET|_UP, _LET|_UP, _LET|_UP,
-
-/* Udiaeresis Yacute THORN ssharp */
- _LET|_UP, _LET|_UP, _LET|_UP, _LET|_LOW,
-
-/* agrave aacute acircumflex atilde */
- _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
-
-/* adiaeresis aring ae ccedilla */
- _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
-
-/* egrave eacute ecircumflex ediaeresis */
- _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
-
-/* igrave iacute icircumflex idiaeresis */
- _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
-
-/* eth ntilde ograve oacute */
- _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
-
-/* ocircumflex otilde odiaeresis division */
- _LET|_LOW, _LET|_LOW, _LET|_LOW, 0,
-
-/* oslash ugrave uacute ucircumflex */
- _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
-
-/* udiaeresis yacute thorn ydiaeresis */
- _LET|_LOW, _LET|_LOW, _LET|_LOW, _LET|_LOW,
+/* (undef) ... */
+ 0,
};
Index: const.c
===================================================================
RCS file: /cvs/src/bin/csh/const.c,v
retrieving revision 1.7
diff -u -p -r1.7 const.c
--- const.c 17 Jun 2015 03:48:21 -0000 1.7
+++ const.c 26 Oct 2015 15:27:45 -0000
@@ -39,8 +39,6 @@
Char STR0[] = { '0', '\0' };
Char STR1[] = { '1', '\0' };
Char STRHOME[] = { 'H', 'O', 'M', 'E', '\0' };
-Char STRLANG[] = { 'L', 'A', 'N', 'G', '\0' };
-Char STRLC_CTYPE[] = { 'L', 'C', '_', 'C', 'T', 'Y', 'P', 'E' ,'\0' };
Char STRLOGNAME[] = { 'L', 'O', 'G', 'N', 'A', 'M', 'E', '\0' };
Char STRLbrace[] = { '{', '\0' };
Char STRLparen[] = { '(', '\0' };
Index: csh.c
===================================================================
RCS file: /cvs/src/bin/csh/csh.c,v
retrieving revision 1.31
diff -u -p -r1.31 csh.c
--- csh.c 26 Oct 2015 15:01:15 -0000 1.31
+++ csh.c 26 Oct 2015 15:27:46 -0000
@@ -155,22 +155,10 @@ main(int argc, char *argv[])
if (loginsh)
(void) time(&chktim);
- AsciiOnly = 1;
-
- (void) setlocale(LC_ALL, "");
-
if (pledge("stdio rpath wpath cpath fattr getpw proc exec tty",
NULL) == -1)
perror("pledge");
- {
- int k;
-
- for (k = 0200; k <= 0377 && !Isprint(k); k++)
- continue;
- AsciiOnly = k > 0377;
- }
-
/*
* Move the descriptors to safe places. The variable didfds is 0 while we
* have only FSH* to work with. When didfds is true, we have 0,1,2 and
@@ -1247,10 +1235,6 @@ vis_fputc(int ch, FILE *fp)
if (ch & QUOTE)
return fputc(ch & TRIM, fp);
- /*
- * XXX: When we are in AsciiOnly we want all characters >= 0200 to
- * be encoded, but currently there is no way in vis to do that.
- */
(void) vis(uenc, ch & TRIM, VIS_NOSLASH, 0);
return fputs(uenc, fp);
}
Index: csh.h
===================================================================
RCS file: /cvs/src/bin/csh/csh.h,v
retrieving revision 1.23
diff -u -p -r1.23 csh.h
--- csh.h 26 Oct 2015 15:01:15 -0000 1.23
+++ csh.h 26 Oct 2015 15:27:46 -0000
@@ -193,8 +193,6 @@ sig_t parterm; /* Parents terminate ca
#define QUOTE 0100000U /* 16nth char bit used for 'ing */
#define TRIM 0077777 /* Mask to strip quote bit */
-int AsciiOnly; /* If set only 7 bits is expected in characters
*/
-
/*
* Each level of input has a buffered input structure.
* There are one or more blocks of buffered input for each level,
Index: func.c
===================================================================
RCS file: /cvs/src/bin/csh/func.c,v
retrieving revision 1.30
diff -u -p -r1.30 func.c
--- func.c 26 Oct 2015 15:01:15 -0000 1.30
+++ func.c 26 Oct 2015 15:27:46 -0000
@@ -917,14 +917,6 @@ dosetenv(Char **v, struct command *t)
importpath(lp);
dohash(NULL, NULL);
}
- else if (eq(vp, STRLANG) || eq(vp, STRLC_CTYPE)) {
- int k;
-
- (void) setlocale(LC_ALL, "");
- for (k = 0200; k <= 0377 && !Isprint(k); k++)
- continue;
- AsciiOnly = k > 0377;
- }
xfree(lp);
}
@@ -959,14 +951,6 @@ dounsetenv(Char **v, struct command *t)
if (!Gmatch(name, *v))
continue;
maxi = 1;
- if (eq(name, STRLANG) || eq(name, STRLC_CTYPE)) {
- int k;
-
- (void) setlocale(LC_ALL, "");
- for (k = 0200; k <= 0377 && !Isprint(k); k++)
- continue;
- AsciiOnly = k > 0377;
- }
/*
* Delete name, and start again cause the environment changes
*/
Index: str.c
===================================================================
RCS file: /cvs/src/bin/csh/str.c,v
retrieving revision 1.17
diff -u -p -r1.17 str.c
--- str.c 26 Oct 2015 15:01:15 -0000 1.17
+++ str.c 26 Oct 2015 15:27:46 -0000
@@ -399,10 +399,6 @@ vis_str(Char *cp)
sdst = xreallocarray(sdst, n, sizeof(char));
dstsize = n;
}
- /*
- * XXX: When we are in AsciiOnly we want all characters >= 0200 to
- * be encoded, but currently there is no way in vis to do that.
- */
(void) strnvis(sdst, short2str(cp), dstsize, VIS_NOSLASH);
return (sdst);
}
--
Christian "naddy" Weisgerber [email protected]