Ticket #388: get_locale.sh

File get_locale.sh, 411 bytes (added by slyfox, 15 years ago)

locale detector

Line 
1#!/bin/sh
2
3tmp_name=`mktemp "/tmp/locale_test_XXXXXXXXXXXXXXXX"`
4tmp_c_file=$tmp_name.c
5tmp_bin_file=$tmp_name.elf
6
7cat > "$tmp_c_file" << EOF
8#include <stdio.h>
9#include <locale.h>
10#include <langinfo.h>
11
12int main()
13{
14    setlocale (LC_ALL, "");
15    printf ("CODESET: '%s'\n", nl_langinfo (CODESET));
16    return 0;
17}
18EOF
19
20gcc $tmp_c_file -o $tmp_bin_file
21$tmp_bin_file
22rm -f $tmp_c_file $tmp_bin_file $tmp_name