Project

General

Profile

Bug #2924 ยป patch-dfbsd-cat-vflag.txt

remove isprint check & switch setlocale() to use LC_ALL - sevan, 07/11/2016 07:17 AM

 
1
diff --git a/bin/cat/cat.c b/bin/cat/cat.c
2
index a2aff71..449f12e 100644
3
--- a/bin/cat/cat.c
4
+++ b/bin/cat/cat.c
5
@@ -77,7 +77,7 @@ main(int argc, char **argv)
6
 {
7
 	int ch;
8
 
9
-	setlocale(LC_CTYPE, "");
10
+	setlocale(LC_ALL, "");
11
 
12
 	while ((ch = getopt(argc, argv, "benstuv")) != -1)
13
 		switch (ch) {
14
@@ -206,7 +206,7 @@ cook_cat(FILE *fp)
15
 				continue;
16
 			}
17
 		} else if (vflag) {
18
-			if (!isascii(ch) && !isprint(ch)) {
19
+			if (!isascii(ch)) {
20
 				if (putchar('M') == EOF || putchar('-') == EOF)
21
 					break;
22
 				ch = toascii(ch);
    (1-1/1)