public inbox for cygwin-cvs@sourceware.org help / color / mirror / Atom feed
From: Corinna Vinschen <corinna@sourceware.org> To: cygwin-cvs@sourceware.org Subject: [newlib-cygwin/main] Cygwin: fetch-lc-def-codesets-from-linux: fix locale name handling Date: Sun, 26 Feb 2023 19:15:06 +0000 (GMT) [thread overview] Message-ID: <20230226191506.52C5B3858D1E@sourceware.org> (raw) https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=5011c8cc48a22d9ccfc8d11a0f5cbfc0e5db73a6 commit 5011c8cc48a22d9ccfc8d11a0f5cbfc0e5db73a6 Author: Corinna Vinschen <corinna@vinschen.de> AuthorDate: Sun Feb 26 20:14:54 2023 +0100 Commit: Corinna Vinschen <corinna@vinschen.de> CommitDate: Sun Feb 26 20:14:54 2023 +0100 Cygwin: fetch-lc-def-codesets-from-linux: fix locale name handling As the former call to `locale -av' has the unwanted side effect to shorten the locale name to <= 15 chars, don't use it. Use `locale -a' instead and fetch the codeset from another call to `locale' for each locale. Signed-off-by: Corinna Vinschen <corinna@vinschen.de> 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[] = { EOF - locale -av | \ - awk '/^locale:/{ - if ( index ($2, "_") == 0 ) next # No aliases - if ( index ($2, ".") > 0 ) next # No explicit codesets - locale = gensub (/devanagar.*/, "devanagari", 1, $2); - } - /codeset/ { - if ( length (locale) == 0 ) next - codeset = gensub (/BIG5.*/, "BIG5", 1, $3); - printf " { \"%s\", \"%s\" },\n", locale, codeset; - locale = ""; - }' + locale -a | \ + awk '{ + if ( index ($1, "_") == 0 ) next # No aliases + if ( index ($1, ".") > 0 ) next # No explicit codesets + locale = $1 + cmd = "LC_CTYPE=" locale " locale -ck LC_CTYPE | grep charmap" + cmd | getline codeset + codeset = gensub (/charmap="(.*)"/, "\\1", 1, codeset) + codeset = gensub (/BIG5.*/, "BIG5", 1, codeset); + printf " { \"%s\", \"%s\" },\n", locale, codeset; + }' echo "};" ) > lc_def_codesets.h
reply other threads:[~2023-02-26 19:15 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20230226191506.52C5B3858D1E@sourceware.org \ --to=corinna@sourceware.org \ --cc=cygwin-cvs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).