version 1.17, 2018/01/25 22:48:42 |
version 1.18, 2018/10/19 23:05:35 |
|
|
#! /bin/bash |
#! /bin/bash |
# |
# |
|
# Ask the user about the time zone, and output the resulting TZ value to stdout. |
|
# Interact with the user via stderr and stdin. |
|
# |
# $NetBSD$ |
# $NetBSD$ |
# |
# |
PKGVERSION='(tzcode) ' |
PKGVERSION='(tzcode) ' |
TZVERSION=see_Makefile |
TZVERSION=see_Makefile |
REPORT_BUGS_TO=tz@iana.org |
REPORT_BUGS_TO=tz@iana.org |
|
|
# Ask the user about the time zone, and output the resulting TZ value to stdout. |
|
# Interact with the user via stderr and stdin. |
|
|
|
# Contributed by Paul Eggert. This file is in the public domain. |
# Contributed by Paul Eggert. This file is in the public domain. |
|
|
# Porting notes: |
# Porting notes: |
Line 57 location_limit=10 |
|
Line 57 location_limit=10 |
|
zonetabtype=zone1970 |
zonetabtype=zone1970 |
|
|
usage="Usage: tzselect [--version] [--help] [-c COORD] [-n LIMIT] |
usage="Usage: tzselect [--version] [--help] [-c COORD] [-n LIMIT] |
Select a time zone interactively. |
Select a timezone interactively. |
|
|
Options: |
Options: |
|
|
|
|
eval ' |
eval ' |
doselect '"$quoted_continents"' \ |
doselect '"$quoted_continents"' \ |
"coord - I want to use geographical coordinates." \ |
"coord - I want to use geographical coordinates." \ |
"TZ - I want to specify the time zone using the Posix TZ format." |
"TZ - I want to specify the timezone using the Posix TZ format." |
continent=$select_result |
continent=$select_result |
case $continent in |
case $continent in |
Americas) continent=America;; |
Americas) continent=America;; |
|
|
while |
while |
echo >&2 'Please enter the desired value' \ |
echo >&2 'Please enter the desired value' \ |
'of the TZ environment variable.' |
'of the TZ environment variable.' |
echo >&2 'For example, AEST-10 is a zone named AEST' \ |
echo >&2 'For example, AEST-10 is abbreviated' \ |
'that is 10 hours' |
'AEST and is 10 hours' |
echo >&2 'ahead (east) of Greenwich,' \ |
echo >&2 'ahead (east) of Greenwich,' \ |
'with no daylight saving time.' |
'with no daylight saving time.' |
read TZ |
read TZ |
|
|
exit 0 |
exit 0 |
}' |
}' |
do |
do |
say >&2 "'$TZ' is not a conforming Posix time zone string." |
say >&2 "'$TZ' is not a conforming Posix timezone string." |
done |
done |
TZ_for_date=$TZ;; |
TZ_for_date=$TZ;; |
*) |
*) |
|
|
BEGIN { FS = "\t" } |
BEGIN { FS = "\t" } |
{ print $NF } |
{ print $NF } |
'` |
'` |
echo >&2 'Please select one of the following' \ |
echo >&2 'Please select one of the following timezones,' \ |
'time zone regions,' |
|
echo >&2 'listed roughly in increasing order' \ |
echo >&2 'listed roughly in increasing order' \ |
"of distance from $coord". |
"of distance from $coord". |
doselect $regions |
doselect $regions |
|
|
esac |
esac |
|
|
|
|
# Get list of names of time zone rule regions in the country. |
# Get list of timezones in the country. |
regions=`$AWK \ |
regions=`$AWK \ |
-v country="$country" \ |
-v country="$country" \ |
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \ |
-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \ |
|
|
# If there's more than one region, ask the user which one. |
# If there's more than one region, ask the user which one. |
case $regions in |
case $regions in |
*"$newline"*) |
*"$newline"*) |
echo >&2 'Please select one of the following' \ |
echo >&2 'Please select one of the following timezones.' |
'time zone regions.' |
|
doselect $regions |
doselect $regions |
region=$select_result;; |
region=$select_result;; |
*) |
*) |