Cygwin: add newgrp release notes
[newlib-cygwin.git] / winsup / cygwin / linux-locale-helpers / fetch-lc-def-codesets-from-linux
blob9bb0533418ed7f0bcb9863ca08a5e1001d6ec8f9
1 #!/bin/bash
3 cat <<-EOF
4 /* This struct of default codesets has been generated by fetching
5 locale data from a Linux system using $(rpm -q glibc | head -1) on $(date +%F) */
6 struct default_codeset_t
8 const char *locale;
9 const char *codeset;
10 } default_codeset[] =
12 EOF
13 locale -a | \
14 awk '{
15 if ( index ($1, "_") == 0 ) next # No aliases
16 if ( index ($1, ".") > 0 ) next # No explicit codesets
17 locale = $1
18 cmd = "LC_CTYPE=" locale " locale -ck LC_CTYPE | grep charmap"
19 cmd | getline codeset
20 codeset = gensub (/charmap="(.*)"/, "\\1", 1, codeset)
21 codeset = gensub (/BIG5.*/, "BIG5", 1, codeset);
22 printf " { \"%s\", \"%s\" },\n", locale, codeset;
24 echo "};"
25 ) > lc_def_codesets.h