From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 2155) id 52C5B3858D1E; Sun, 26 Feb 2023 19:15:06 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 52C5B3858D1E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1677438906; bh=4mdtwBb0vTURsDfrjV4achwl7ZivE4BYIw74Kqqvsfo=; h=From:To:Subject:Date:From; b=cBneak5efjG9vnLbtoRYtONlbDQbfFFLfYRTRUVmzPNwz0zJGBnOWhzduSSNpNgEB jpowG2Em2XSNzwTDwI10ISiLNMNJbCFG87yHJmCY3Q+Vv+++9dgSrYuJe45p2ZhZIo iZY9Ug+5VBv8fgdvn5v3d+YMXMF9NvwdV2tv4+Q4= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Corinna Vinschen To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: fetch-lc-def-codesets-from-linux: fix locale name handling X-Act-Checkin: newlib-cygwin X-Git-Author: Corinna Vinschen X-Git-Refname: refs/heads/main X-Git-Oldrev: abd81bc01fb715768eb00d18124205b72fba35da X-Git-Newrev: 5011c8cc48a22d9ccfc8d11a0f5cbfc0e5db73a6 Message-Id: <20230226191506.52C5B3858D1E@sourceware.org> Date: Sun, 26 Feb 2023 19:15:06 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dnewlib-cygwin.git;h=3D5011c8cc48a= 22d9ccfc8d11a0f5cbfc0e5db73a6 commit 5011c8cc48a22d9ccfc8d11a0f5cbfc0e5db73a6 Author: Corinna Vinschen AuthorDate: Sun Feb 26 20:14:54 2023 +0100 Commit: Corinna Vinschen CommitDate: Sun Feb 26 20:14:54 2023 +0100 Cygwin: fetch-lc-def-codesets-from-linux: fix locale name handling =20 As the former call to `locale -av' has the unwanted side effect to shorten the locale name to <=3D 15 chars, don't use it. Use `locale -a' instead and fetch the codeset from another call to `locale' for each locale. =20 Signed-off-by: Corinna Vinschen Diff: --- .../fetch-lc-def-codesets-from-linux | 23 +++++++++++-------= ---- 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/winsup/cygwin/linux-locale-helpers/fetch-lc-def-codesets-from-= linux b/winsup/cygwin/linux-locale-helpers/fetch-lc-def-codesets-from-linux index 2a6f6cca2a90..9bb0533418ed 100755 --- a/winsup/cygwin/linux-locale-helpers/fetch-lc-def-codesets-from-linux +++ b/winsup/cygwin/linux-locale-helpers/fetch-lc-def-codesets-from-linux @@ -10,17 +10,16 @@ } default_codeset[] =3D { EOF - locale -av | \ - awk '/^locale:/{ - if ( index ($2, "_") =3D=3D 0 ) next # No aliases - if ( index ($2, ".") > 0 ) next # No explicit codesets - locale =3D gensub (/devanagar.*/, "devanagari", 1, $2); - } - /codeset/ { - if ( length (locale) =3D=3D 0 ) next - codeset =3D gensub (/BIG5.*/, "BIG5", 1, $3); - printf " { \"%s\", \"%s\" },\n", locale, codeset; - locale =3D ""; - }' + locale -a | \ + awk '{ + if ( index ($1, "_") =3D=3D 0 ) next # No aliases + if ( index ($1, ".") > 0 ) next # No explicit codesets + locale =3D $1 + cmd =3D "LC_CTYPE=3D" locale " locale -ck LC_CTYPE | grep charmap" + cmd | getline codeset + codeset =3D gensub (/charmap=3D"(.*)"/, "\\1", 1, codeset) + codeset =3D gensub (/BIG5.*/, "BIG5", 1, codeset); + printf " { \"%s\", \"%s\" },\n", locale, codeset; + }' echo "};" ) > lc_def_codesets.h