From a0841dfa1e1a7ebdd8d29188ce7b304c67daa42d Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Sat, 8 Mar 2014 21:22:18 +0200 Subject: Some new helper files added. --- helpers/quoteconvert2.sh | 49 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100755 helpers/quoteconvert2.sh (limited to 'helpers/quoteconvert2.sh') diff --git a/helpers/quoteconvert2.sh b/helpers/quoteconvert2.sh new file mode 100755 index 00000000..e33a4d05 --- /dev/null +++ b/helpers/quoteconvert2.sh @@ -0,0 +1,49 @@ +#!/bin/sh + +# quoteconvert2.sh --- test locale dependent output of numbers +# Michal Jaegermann, michal@harddata.com, 2014/Mar/1 + +#AWK="../gawk" +SCRIPT=`basename $0` + +if [ "$AWK" = "" ] +then + echo $0: You must set AWK >&2 + exit 1 +fi + +# The last entry on this list represents "a locale with a typo". + +llist=" +C +en_US +en_US.utf8 +de_DE +de_DE.utf8 +fr_FR +fr_FR.utf8 +pt_PT +pt_PT.utf8 +pt_BR +pt_BR.utf8 +ru_RU +ru_RU.utf8 +pl_PX +" + +error=0 +for lc in $llist ; do + wanted=`LC_ALL=$lc locale -c LC_NUMERIC 2>/dev/null | \ + $AWK 'NR == 2 { decimal_point = $0 } + NR == 3 { thousands_sep = $0 } + END { printf("123%s456%s789%s15\n", + thousands_sep, thousands_sep, decimal_point)}'` + got=`LC_ALL=$lc $AWK "BEGIN {printf(\"%'.2f\n\",123456789.15)}"` + if [ "$wanted" != "$got" ] ; then + echo "$lc - unexpected output $got instead of $wanted" + error=1 + fi +done + +[ "$error" = 0 ] && echo ok || echo bummer +exit $error -- cgit v1.2.3 From 1e956e9f38bc43bb68bd88a286fa7c6a66af2503 Mon Sep 17 00:00:00 2001 From: "Arnold D. Robbins" Date: Mon, 10 Mar 2014 22:17:08 +0200 Subject: Improvement in helpers/quoteconvert2.sh. --- helpers/quoteconvert2.sh | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'helpers/quoteconvert2.sh') diff --git a/helpers/quoteconvert2.sh b/helpers/quoteconvert2.sh index e33a4d05..63750a37 100755 --- a/helpers/quoteconvert2.sh +++ b/helpers/quoteconvert2.sh @@ -17,17 +17,17 @@ fi llist=" C en_US -en_US.utf8 +en_US.UTF-8 de_DE -de_DE.utf8 +de_DE.UTF-8 fr_FR -fr_FR.utf8 +fr_FR.UTF-8 pt_PT -pt_PT.utf8 +pt_PT.UTF-8 pt_BR -pt_BR.utf8 +pt_BR.UTF-8 ru_RU -ru_RU.utf8 +ru_RU.UTF-8 pl_PX " -- cgit v1.2.3