From owner-freebsd-bugs Wed Jul 10 23:50:10 2002 Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 281A637B400 for ; Wed, 10 Jul 2002 23:50:04 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D9B5E43E31 for ; Wed, 10 Jul 2002 23:50:03 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g6B6o3JU040341 for ; Wed, 10 Jul 2002 23:50:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g6B6o366040340; Wed, 10 Jul 2002 23:50:03 -0700 (PDT) Date: Wed, 10 Jul 2002 23:50:03 -0700 (PDT) Message-Id: <200207110650.g6B6o366040340@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Gennady Proskurin Subject: Re: bin/35812: strings(1) does'n print russian characters Reply-To: Gennady Proskurin Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/35812; it has been noted by GNATS. From: Gennady Proskurin To: Jonathan Chen Cc: freebsd-gnats-submit@FreeBSD.org, "."@babolo.ru Subject: Re: bin/35812: strings(1) does'n print russian characters Date: Thu, 11 Jul 2002 10:37:28 +0400 Hello, Jonathan. On Sun, Jul 07, 2002 at 12:50:06PM -0400, Jonathan Chen wrote: > > Gennady Proskurin writes: > > [...] > - putchar((char)ch); > + putchar((unsigned char)ch); > > I do not believe the type-casting is necessary, since putchar() takes an > int. Casting to unsigned char (or just char for that matter) would break > wchar too. Please try replacing putchar(...) with simply putchar(ch) and > let me know if that works. > > > "."@babolo.ru writes: > [...] > - if (ISSTR(ch)) { > + if (ISSTR(ch) & 0xff) { > [...] > - while ((ch = getch()) != EOF && ISSTR(ch)) > + while ((ch = getch()) != EOF && ISSTR(ch & 0xff > > The first diff here appears to be wrong, you probably meant (ch & 0xff) > instead of what you have. Nevertheless, I don't think either of these > changes are necessary, since all the functions in ISSTR are able to take > integers as well. > > Please try strings with only the typecast removal change. Let me know of > this works, and I'll commit it. If not, something else is probably > broken... This patches are for /usr/libexec/aout/strings, which works fine with locale without any patches ;). Sorry for false alarm :( /usr/libexec/elf/strings manpage says that it prints "printable" chars, but in fact it prints chars that printable only in C locale, because it uses libiberty for detect printable chars, and isprint macro from libiberty is documented as locale-independent. I think it should be mentioned in elf/strings manpage that it doesn't depend on locale to not confuse users. > > -Jon > -- Gennady To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message