Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/finger Obey the locale settings of the user when dec...



details:   https://anonhg.NetBSD.org/src/rev/380e1f8fe360
branches:  trunk
changeset: 535135:380e1f8fe360
user:      kim <kim%NetBSD.org@localhost>
date:      Sun Aug 11 03:59:31 2002 +0000

description:
Obey the locale settings of the user when deciding what characters are
valid for output.  If something bad gets printed, either the locale
settings for the user (or output terminal) are wrong, or the LC_CTYPE
definitions on the system are invalid.

diffstat:

 usr.bin/finger/lprint.c |  10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)

diffs (38 lines):

diff -r 031dc9593ba4 -r 380e1f8fe360 usr.bin/finger/lprint.c
--- a/usr.bin/finger/lprint.c   Sun Aug 11 03:39:21 2002 +0000
+++ b/usr.bin/finger/lprint.c   Sun Aug 11 03:59:31 2002 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: lprint.c,v 1.14 2002/08/05 08:04:03 tron Exp $ */
+/*     $NetBSD: lprint.c,v 1.15 2002/08/11 03:59:31 kim Exp $  */
 
 /*
  * Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
 #if 0
 static char sccsid[] = "@(#)lprint.c   8.3 (Berkeley) 4/28/95";
 #else
-__RCSID( "$NetBSD: lprint.c,v 1.14 2002/08/05 08:04:03 tron Exp $");
+__RCSID( "$NetBSD: lprint.c,v 1.15 2002/08/11 03:59:31 kim Exp $");
 #endif
 #endif /* not lint */
 
@@ -338,7 +338,7 @@
                if (cnt <= 1) {
                        (void)printf("%s: ", header);
                        for (p = tbuf, cnt = nr; cnt--; ++p)
-                               vputc(lastc = *p);
+                               vputc(lastc = (unsigned char)*p);
                        if (lastc != '\n')
                                (void)putchar('\n');
                        (void)close(fd);
@@ -364,6 +364,10 @@
 {
        char visout[5], *s2;
 
+       if ((isprint(ch)) || (isspace(ch))) {
+           (void)putchar(ch);
+           return;
+       }
        ch = toascii(ch);
        vis(visout, ch, VIS_SAFE|VIS_NOSLASH, 0);
        for (s2 = visout; *s2; s2++)



Home | Main Index | Thread Index | Old Index