Date: Thu, 4 Sep 1997 06:24:46 -0700 (PDT) From: odip@bionet.nsc.ru To: freebsd-gnats-submit@FreeBSD.ORG Subject: bin/4466: Locale bug in /usr/bin/write Message-ID: <199709041324.GAA27103@hub.freebsd.org> Resent-Message-ID: <199709041330.GAA27427@hub.freebsd.org>
next in thread | raw e-mail | index | archive | help
>Number: 4466 >Category: bin >Synopsis: Locale bug in /usr/bin/write >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Sep 4 06:30:00 PDT 1997 >Last-Modified: >Originator: Dmitry Grigorovich >Organization: Institute of Cytology and Genetics, Russia >Release: FreeBSD 2.2-970618-RELENG >Environment: FreeBSD elemental.bionet.nsc.ru 2.2-970618-RELENG FreeBSD 2.2-970618-RELENG #0: Tue Sep 2 17:15:16 NSS 1997 root@elemental.bionet.nsc.ru:/usr/src/sys/compile/ODIP i386 >Description: The program /usr/bin/write not setup locale information, and when print some native specific symbols ( with codes in range 0x80-0xFF ) it prints next three codes: 'M', '-', char&~0x80, because function isprint(char) on such symbols is false ! >How-To-Repeat: Try setup native locale, e.g. KOI8-R then write to self some native symbols and you see problem ! >Fix: #### patch /usr/src/usr.bin/write/write.c #### --- write.c.orig Sat Oct 26 22:29:24 1996 +++ write.c Thu Sep 4 20:03:00 1997 @@ -56,6 +56,8 @@ #include <stdio.h> #include <string.h> +#include <locale.h> + extern int errno; main(argc, argv) @@ -68,6 +70,8 @@ int msgsok, myttyfd; char tty[MAXPATHLEN], *mytty, *ttyname(); void done(); + + (void)setlocale(LC_CTYPE, ""); /* check that sender has write enabled */ if (isatty(fileno(stdin))) >Audit-Trail: >Unformatted:
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199709041324.GAA27103>