* NEWS: Mention this. * tzselect.ksh (CUNEIFORM_SIGN_URU_TIMES_KI): New variable. This uses $'...' if available, which avoids an awk invocation in the typical case when Bash is used. $'...' is available in ksh93, bash-2.0 (1996), and any shell conforming to POSIX.1-2024. (translit): Use it. --- NEWS | 3 ++- tzselect.ksh | 12 +++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/NEWS b/NEWS index 92984445..6b71212c 100644 --- a/NEWS +++ b/NEWS @@ -61,7 +61,8 @@ Unreleased, experimental changes -DSUPPORT_POSIX2008 to CFLAGS. tzselect now assumes POSIX.2-1992 or later, as practical porting - targets now all support this. + targets now all support this. Also, tzselect uses some features + from POSIX.1-2024 if available. Changes to build procedure diff --git a/tzselect.ksh b/tzselect.ksh index b1625b03..811645c2 100644 --- a/tzselect.ksh +++ b/tzselect.ksh @@ -163,11 +163,13 @@ esac # translit=true to try transliteration. # This is false if U+12345 CUNEIFORM SIGN URU TIMES KI has length 1 -# which means awk (and presumably the shell) do not need transliteration. -if $AWK 'BEGIN { u12345 = "\360\222\215\205"; exit length(u12345) == 1 }'; then - translit=true -else - translit=false +# which means the shell and (presumably) awk do not need transliteration. +# It is true if the byte string has some other length in characters, or +# if this is a POSIX.1-2017 or earlier shell that does not support $'...'. +CUNEIFORM_SIGN_URU_TIMES_KI=$'\360\222\215\205' +if test ${#CUNEIFORM_SIGN_URU_TIMES_KI} = 1 +then translit=false +else translit=true fi # Read into shell variable $1 the contents of file $2. -- 2.45.1