mirror of
https://frontier.innolan.net/rainlance/amiga-tz.git
synced 2025-11-22 18:51:04 +00:00
tzselect: work around an old BusyBox awk bug
Patch by Patrick 'P. J.' McDermott in <http://mm.icann.org/pipermail/tz/2013-October/020444.html>. * tzselect.ksh: Replace awk -F options with FS assignments. Before version 1.21.0, BusyBox awk didn't unescape the argument to the -F option. As a result, tzselect couldn't parse tables with such versions of BusyBox awk. See <https://bugs.busybox.net/show_bug.cgi?id=5126> and <http://git.busybox.net/busybox/commit?id=ea664dd>. * NEWS: Document this.
This commit is contained in:
5
NEWS
5
NEWS
@ -11,8 +11,9 @@ Unreleased, experimental changes
|
|||||||
Changes affecting API
|
Changes affecting API
|
||||||
|
|
||||||
The 'tzselect' command no longer requires the 'select' command,
|
The 'tzselect' command no longer requires the 'select' command,
|
||||||
and should now work with /bin/sh on more platforms. (Thanks to
|
and should now work with /bin/sh on more platforms. It also works
|
||||||
Patrick 'P. J.' McDermott for reporting the problem.)
|
around a bug in BusyBox awk before version 1.21.0. (Thanks to
|
||||||
|
Patrick 'P. J.' McDermott.)
|
||||||
|
|
||||||
Changes affecting the build procedure
|
Changes affecting the build procedure
|
||||||
|
|
||||||
|
|||||||
12
tzselect.ksh
12
tzselect.ksh
@ -259,7 +259,8 @@ while
|
|||||||
echo >&2 'Please select a continent, ocean, "coord", or "TZ".'
|
echo >&2 'Please select a continent, ocean, "coord", or "TZ".'
|
||||||
|
|
||||||
quoted_continents=`
|
quoted_continents=`
|
||||||
$AWK -F'\t' '
|
$AWK '
|
||||||
|
BEGIN { FS = "\t" }
|
||||||
/^[^#]/ {
|
/^[^#]/ {
|
||||||
entry = substr($3, 1, index($3, "/") - 1)
|
entry = substr($3, 1, index($3, "/") - 1)
|
||||||
if (entry == "America")
|
if (entry == "America")
|
||||||
@ -347,10 +348,11 @@ while
|
|||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
# Get list of names of countries in the continent or ocean.
|
# Get list of names of countries in the continent or ocean.
|
||||||
countries=`$AWK -F'\t' \
|
countries=`$AWK \
|
||||||
-v continent="$continent" \
|
-v continent="$continent" \
|
||||||
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
|
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
|
||||||
'
|
'
|
||||||
|
BEGIN { FS = "\t" }
|
||||||
/^#/ { next }
|
/^#/ { next }
|
||||||
$3 ~ ("^" continent "/") {
|
$3 ~ ("^" continent "/") {
|
||||||
if (!cc_seen[$1]++) cc_list[++ccs] = $1
|
if (!cc_seen[$1]++) cc_list[++ccs] = $1
|
||||||
@ -383,11 +385,12 @@ while
|
|||||||
|
|
||||||
|
|
||||||
# Get list of names of time zone rule regions in the country.
|
# Get list of names of time zone rule regions in the country.
|
||||||
regions=`$AWK -F'\t' \
|
regions=`$AWK \
|
||||||
-v country="$country" \
|
-v country="$country" \
|
||||||
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
|
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
|
||||||
'
|
'
|
||||||
BEGIN {
|
BEGIN {
|
||||||
|
FS = "\t"
|
||||||
cc = country
|
cc = country
|
||||||
while (getline <TZ_COUNTRY_TABLE) {
|
while (getline <TZ_COUNTRY_TABLE) {
|
||||||
if ($0 !~ /^#/ && country == $2) {
|
if ($0 !~ /^#/ && country == $2) {
|
||||||
@ -412,12 +415,13 @@ while
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
# Determine TZ from country and region.
|
# Determine TZ from country and region.
|
||||||
TZ=`$AWK -F'\t' \
|
TZ=`$AWK \
|
||||||
-v country="$country" \
|
-v country="$country" \
|
||||||
-v region="$region" \
|
-v region="$region" \
|
||||||
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
|
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
|
||||||
'
|
'
|
||||||
BEGIN {
|
BEGIN {
|
||||||
|
FS = "\t"
|
||||||
cc = country
|
cc = country
|
||||||
while (getline <TZ_COUNTRY_TABLE) {
|
while (getline <TZ_COUNTRY_TABLE) {
|
||||||
if ($0 !~ /^#/ && country == $2) {
|
if ($0 !~ /^#/ && country == $2) {
|
||||||
|
|||||||
Reference in New Issue
Block a user