From owner-freebsd-i18n Fri Sep 1 7:51: 4 2000 Delivered-To: freebsd-i18n@freebsd.org Received: from mx.globalone.ru (mx.globalone.ru [194.84.254.251]) by hub.freebsd.org (Postfix) with ESMTP id 5089237B42C for ; Fri, 1 Sep 2000 07:51:01 -0700 (PDT) Received: from hq.globalone.ru (hq.globalone.ru [172.16.38.5]) by mx.globalone.ru (8.9.3/8.9.3) with ESMTP id SAA19617 for ; Fri, 1 Sep 2000 18:50:59 +0400 Received: from host205.spb.in.rosprin.ru ([172.17.13.205]) by hq.globalone.ru (Netscape Messaging Server 4.15) with SMTP id G07QPU00.UL4 for ; Fri, 1 Sep 2000 18:53:54 +0400 Message-ID: <34d701c01424$4a2e4b60$cd0d11ac@host205.spb.in.rosprin.ru> Reply-To: "Alexander Voropay" From: "Alexander Voropay" To: Subject: Re: Request for review: locale aliases support for libc Date: Fri, 1 Sep 2000 18:52:03 +0400 MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 4.72.3110.5 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3 Sender: owner-freebsd-i18n@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Alexey Zelkin wrote: >I am trying to realize "is requested locale physicaly present on this system" >or it's just an alias. Currently I am just testing presence of >/usr/share/locale/$requested_locale/LC_CTYPE and make decision depends >on stat(2) return value. AFAIK, the presense of any forms of locale "aliasing" does not comply current POSIX specifications : string=setlocale(LC_xxx, "language_TERRITORY.Codeset"); should returns _THE_SAME_ locale name _as requested_. Try this on "aliased" and "non aliased" locales. (JFYI: It fails on any "aliased" locales on glibc2.) ==lct.c====== #include #include #include main (int argc, char *argv[]) { char * reqlcname; char * gotlcname; if (argc != 2){ printf("Usage: lct language[_TERRITORY[.Codeset]]\n"); exit (1); }; reqlcname=argv[1]; printf("Trying to set LC_CTYPE=%s\n",reqlcname); gotlcname=setlocale(LC_CTYPE, reqlcname); /* ALL MAGIK IS HERE */ if ( !gotlcname) { printf ("There is no locale '%s' in your system.\n",reqlcname); exit (1); } else { printf("I've got LC_CTYPE=%s\n",gotlcname); if ( strcmp(gotlcname, reqlcname)) printf("I can't set REQUIRED locale !\n"); else printf("Great! All OK.\n"); }; } ============= -- -=AV=- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-i18n" in the body of the message