Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/finger revert attempt to make finger locale-dependen...
details: https://anonhg.NetBSD.org/src/rev/a2798946b8c6
branches: trunk
changeset: 535468:a2798946b8c6
user: itojun <itojun%NetBSD.org@localhost>
date: Tue Aug 20 00:27:59 2002 +0000
description:
revert attempt to make finger locale-dependent. (1) locale dependent
daemon is a bad idea, (2) there's no standard in 8bit finger, (3) there's no
guarantee that finger/fingerd uses the same locale, (4) existing finger client
could scream. see tech-userlevel.
diffstat:
usr.bin/finger/finger.c | 9 ++-------
usr.bin/finger/lprint.c | 10 +++-------
usr.bin/finger/net.c | 20 ++++++++++----------
3 files changed, 15 insertions(+), 24 deletions(-)
diffs (127 lines):
diff -r bc79e82c6ab9 -r a2798946b8c6 usr.bin/finger/finger.c
--- a/usr.bin/finger/finger.c Mon Aug 19 23:23:22 2002 +0000
+++ b/usr.bin/finger/finger.c Tue Aug 20 00:27:59 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: finger.c,v 1.18 2002/08/10 16:10:46 kim Exp $ */
+/* $NetBSD: finger.c,v 1.19 2002/08/20 00:27:59 itojun Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -56,7 +56,7 @@
#if 0
static char sccsid[] = "@(#)finger.c 8.5 (Berkeley) 5/4/95";
#else
-__RCSID("$NetBSD: finger.c,v 1.18 2002/08/10 16:10:46 kim Exp $");
+__RCSID("$NetBSD: finger.c,v 1.19 2002/08/20 00:27:59 itojun Exp $");
#endif
#endif /* not lint */
@@ -87,8 +87,6 @@
#include <time.h>
#include <unistd.h>
-#include <locale.h>
-
#include "utmpentry.h"
#include "finger.h"
@@ -111,9 +109,6 @@
{
int ch;
- /* Allow user's locale settings to affect character output. */
- (void *) setlocale(LC_CTYPE, "");
-
oflag = 1; /* default to old "office" behavior */
while ((ch = getopt(argc, argv, "lmpshog")) != -1)
diff -r bc79e82c6ab9 -r a2798946b8c6 usr.bin/finger/lprint.c
--- a/usr.bin/finger/lprint.c Mon Aug 19 23:23:22 2002 +0000
+++ b/usr.bin/finger/lprint.c Tue Aug 20 00:27:59 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: lprint.c,v 1.15 2002/08/11 03:59:31 kim Exp $ */
+/* $NetBSD: lprint.c,v 1.16 2002/08/20 00:27:59 itojun 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.15 2002/08/11 03:59:31 kim Exp $");
+__RCSID( "$NetBSD: lprint.c,v 1.16 2002/08/20 00:27:59 itojun 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 = (unsigned char)*p);
+ vputc(lastc = *p);
if (lastc != '\n')
(void)putchar('\n');
(void)close(fd);
@@ -364,10 +364,6 @@
{
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++)
diff -r bc79e82c6ab9 -r a2798946b8c6 usr.bin/finger/net.c
--- a/usr.bin/finger/net.c Mon Aug 19 23:23:22 2002 +0000
+++ b/usr.bin/finger/net.c Tue Aug 20 00:27:59 2002 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: net.c,v 1.16 2002/08/10 16:10:46 kim Exp $ */
+/* $NetBSD: net.c,v 1.17 2002/08/20 00:28:00 itojun Exp $ */
/*
* Copyright (c) 1989, 1993
@@ -41,7 +41,7 @@
#if 0
static char sccsid[] = "@(#)net.c 8.4 (Berkeley) 4/28/95";
#else
-__RCSID("$NetBSD: net.c,v 1.16 2002/08/10 16:10:46 kim Exp $");
+__RCSID("$NetBSD: net.c,v 1.17 2002/08/20 00:28:00 itojun Exp $");
#endif
#endif /* not lint */
@@ -131,25 +131,25 @@
* Read from the remote system; once we're connected, we assume some
* data. If none arrives, we hang until the user interrupts.
*
- * If we see a <CR> * followed by a newline character, only output
- * one newline.
+ * If we see a <CR> or a <CR> with the high bit set, treat it as
+ * a newline; if followed by a newline character, only output one
+ * newline.
*
- * If a character isn't printable and it isn't a space, we strip the
- * 8th bit and set the 7th bit. Every ASCII character with bit 7 set
- * is printable.
+ * Otherwise, all high bits are stripped; if it isn't printable and
+ * it isn't a space, we can simply set the 7th bit. Every ASCII
+ * character with bit 7 set is printable.
*/
if ((fp = fdopen(s, "r")) != NULL)
while ((c = getc(fp)) != EOF) {
+ c &= 0x7f;
if (c == '\r') {
if (lastc == '\r') /* ^M^M - skip dupes */
continue;
c = '\n';
lastc = '\r';
} else {
- if (!isprint(c) && !isspace(c)) {
- c &= 0x7f;
+ if (!isprint(c) && !isspace(c))
c |= 0x40;
- }
if (lastc != '\r' || c != '\n')
lastc = c;
else {
Home |
Main Index |
Thread Index |
Old Index