Fix broken charclass handling
Add setlocale LC_CTYPE
This commit is contained in:
parent
d2be861745
commit
199482ead7
@ -151,17 +151,29 @@ typedef struct {
|
||||
} CLASS;
|
||||
|
||||
static CLASS classes[] = {
|
||||
#undef isalnum
|
||||
{ "alnum", isalnum, },
|
||||
#undef isalpha
|
||||
{ "alpha", isalpha, },
|
||||
#undef isblank
|
||||
{ "blank", isblank, },
|
||||
#undef iscntrl
|
||||
{ "cntrl", iscntrl, },
|
||||
#undef isdigit
|
||||
{ "digit", isdigit, },
|
||||
#undef isgraph
|
||||
{ "graph", isgraph, },
|
||||
#undef islower
|
||||
{ "lower", islower, },
|
||||
#undef isprint
|
||||
{ "print", isprint, },
|
||||
#undef ispunct
|
||||
{ "punct", ispunct, },
|
||||
#undef isspace
|
||||
{ "space", isspace, },
|
||||
#undef isupper
|
||||
{ "upper", isupper, },
|
||||
#undef isxdigit
|
||||
{ "xdigit", isxdigit, },
|
||||
};
|
||||
|
||||
@ -279,9 +291,6 @@ genseq(s)
|
||||
s->state = s->cnt ? SEQUENCE : INFINITE;
|
||||
}
|
||||
|
||||
/* Use the #defines isXXX() here, DON'T use them above. */
|
||||
#include <ctype.h>
|
||||
|
||||
/*
|
||||
* Translate \??? into a character. Up to 3 octal digits, if no digits either
|
||||
* an escape code or a literal character.
|
||||
|
@ -41,6 +41,7 @@ static char copyright[] =
|
||||
static char sccsid[] = "@(#)tr.c 8.1 (Berkeley) 6/6/93";
|
||||
#endif /* not lint */
|
||||
|
||||
#include <locale.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -96,6 +97,8 @@ main(argc, argv)
|
||||
register int ch, cnt, lastch, *p;
|
||||
int cflag, dflag, sflag, isstring2;
|
||||
|
||||
(void) setlocale(LC_CTYPE, "");
|
||||
|
||||
cflag = dflag = sflag = 0;
|
||||
while ((ch = getopt(argc, argv, "cds")) != EOF)
|
||||
switch((char)ch) {
|
||||
|
Loading…
Reference in New Issue
Block a user