diff options
author | Andrey A. Chernov <ache@FreeBSD.org> | 1996-09-30 15:45:36 +0000 |
---|---|---|
committer | Andrey A. Chernov <ache@FreeBSD.org> | 1996-09-30 15:45:36 +0000 |
commit | 3043192bc61ac3d77c7eaa2f9a690c73733c49ba (patch) | |
tree | c5bd50cd39ff3f7c959e0fabecb660743af35761 /bin/cat/cat.c | |
parent | 4347915c167599bd4a07b251fe024c2d36115aa1 (diff) | |
download | src-test2-3043192bc61ac3d77c7eaa2f9a690c73733c49ba.tar.gz src-test2-3043192bc61ac3d77c7eaa2f9a690c73733c49ba.zip |
Activate LC_CTYPE locale and additionly use !isprint() for 8bit characters
Notes
Notes:
svn path=/head/; revision=18578
Diffstat (limited to 'bin/cat/cat.c')
-rw-r--r-- | bin/cat/cat.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/bin/cat/cat.c b/bin/cat/cat.c index 1e8be46f4a9b..73d77ef91e19 100644 --- a/bin/cat/cat.c +++ b/bin/cat/cat.c @@ -33,7 +33,7 @@ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF * SUCH DAMAGE. * - * $Id: cat.c,v 1.3 1995/10/03 12:46:37 bde Exp $ + * $Id: cat.c,v 1.4 1996/09/28 21:19:27 imp Exp $ */ #ifndef lint @@ -53,6 +53,7 @@ static char sccsid[] = "@(#)cat.c 8.2 (Berkeley) 4/27/95"; #include <err.h> #include <errno.h> #include <fcntl.h> +#include <locale.h> #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -75,6 +76,8 @@ main(argc, argv) extern int optind; int ch; + setlocale(LC_CTYPE, ""); + while ((ch = getopt(argc, argv, "benstuv")) != EOF) switch (ch) { case 'b': @@ -179,7 +182,7 @@ cook_buf(fp) continue; } } else if (vflag) { - if (!isascii(ch)) { + if (!isascii(ch) && !isprint(ch)) { if (putchar('M') == EOF || putchar('-') == EOF) break; ch = toascii(ch); |