xref: /onnv-gate/usr/src/cmd/zic/tzselect.ksh (revision 1138:3eec486d02fb)
10Sstevel@tonic-gate#! /usr/bin/ksh
20Sstevel@tonic-gate#
3*1138Srobbin# Copyright 2005 Sun Microsystems, Inc.  All rights reserved.
4*1138Srobbin# Use is subject to license terms.
50Sstevel@tonic-gate#
60Sstevel@tonic-gate# ident	"%Z%%M%	%I%	%E% SMI"
70Sstevel@tonic-gate#
8*1138Srobbin# '@(#)tzselect.ksh	1.8'
90Sstevel@tonic-gate
100Sstevel@tonic-gate# Ask the user about the time zone, and output the resulting TZ value to stdout.
110Sstevel@tonic-gate# Interact with the user via stderr and stdin.
120Sstevel@tonic-gate
13*1138Srobbin# Contributed by Paul Eggert
140Sstevel@tonic-gate
150Sstevel@tonic-gate# Porting notes:
160Sstevel@tonic-gate#
170Sstevel@tonic-gate# This script requires several features of the Korn shell.
180Sstevel@tonic-gate# If your host lacks the Korn shell,
190Sstevel@tonic-gate# you can use either of the following free programs instead:
200Sstevel@tonic-gate#
210Sstevel@tonic-gate#	<a href=ftp://ftp.gnu.org/pub/gnu/>
220Sstevel@tonic-gate#	Bourne-Again shell (bash)
230Sstevel@tonic-gate#	</a>
240Sstevel@tonic-gate#
250Sstevel@tonic-gate#	<a href=ftp://ftp.cs.mun.ca/pub/pdksh/pdksh.tar.gz>
260Sstevel@tonic-gate#	Public domain ksh
270Sstevel@tonic-gate#	</a>
280Sstevel@tonic-gate#
290Sstevel@tonic-gate# This script also uses several features of modern awk programs.
300Sstevel@tonic-gate# If your host lacks awk, or has an old awk that does not conform to POSIX.2,
310Sstevel@tonic-gate# you can use either of the following free programs instead:
320Sstevel@tonic-gate#
330Sstevel@tonic-gate#	<a href=ftp://ftp.gnu.org/pub/gnu/>
340Sstevel@tonic-gate#	GNU awk (gawk)
350Sstevel@tonic-gate#	</a>
360Sstevel@tonic-gate#
370Sstevel@tonic-gate#	<a href=ftp://ftp.whidbey.net/pub/brennan/>
380Sstevel@tonic-gate#	mawk
390Sstevel@tonic-gate#	</a>
400Sstevel@tonic-gate
410Sstevel@tonic-gateAWK=/usr/bin/nawk
420Sstevel@tonic-gateGREP=/usr/bin/grep
430Sstevel@tonic-gateEXPR=/usr/bin/expr
440Sstevel@tonic-gateLOCALE=/usr/bin/locale
450Sstevel@tonic-gateSORT=/usr/bin/sort
460Sstevel@tonic-gatePRINTF=/usr/bin/printf
470Sstevel@tonic-gateDATE=/usr/bin/date
480Sstevel@tonic-gateGETTEXT=/usr/bin/gettext
490Sstevel@tonic-gate
500Sstevel@tonic-gateTZDIR=/usr/share/lib/zoneinfo
510Sstevel@tonic-gate
520Sstevel@tonic-gate# Messages
530Sstevel@tonic-gateERR_NO_SETUP="%s: time zone files are not set up correctly"
540Sstevel@tonic-gateINFO_LOCATION="Please identify a location so that time zone rules \
550Sstevel@tonic-gatecan be set correctly."
560Sstevel@tonic-gateINFO_SELECT_CONT="Please select a continent or ocean."
570Sstevel@tonic-gateINFO_POSIX="none - I want to specify the time zone using the POSIX \
580Sstevel@tonic-gateTZ format."
590Sstevel@tonic-gateWARN_ENTER_NUM="Please enter a number in range."
600Sstevel@tonic-gateINFO_ENTER_POSIX="Please enter the desired value of the TZ environment \
610Sstevel@tonic-gatevariable."
620Sstevel@tonic-gateINFO_POSIX_EX="For example, GST-10 is a zone named GST that is 10 hours \
630Sstevel@tonic-gateahead (east) of UTC."
640Sstevel@tonic-gateERR_INV_POSIX="\`%s\' is not a conforming POSIX time zone string."
650Sstevel@tonic-gateINFO_SELECT_CNTRY="Please select a country or region."
660Sstevel@tonic-gateINFO_SELECT_TZ="Please select one of the following time zone regions."
670Sstevel@tonic-gateINFO_EXTRA1="Local time is now:       %s"
680Sstevel@tonic-gateINFO_EXTRA2="Universal Time is now:   %s"
690Sstevel@tonic-gateINFO_INFO="The following information has been given:"
700Sstevel@tonic-gateINFO_TZ="Therefore TZ='%s' will be used."
710Sstevel@tonic-gateINFO_OK="Is the above information OK?"
720Sstevel@tonic-gateINFO_YES="Yes"
730Sstevel@tonic-gateINFO_NO="No"
740Sstevel@tonic-gateWARN_ENTER_YORN="Please enter 1 for Yes, or 2 for No."
750Sstevel@tonic-gateINFO_FINE="Here is the TZ value again, this time on standard output:"
760Sstevel@tonic-gate
770Sstevel@tonic-gate# I18n support
780Sstevel@tonic-gateTEXTDOMAINDIR=/usr/lib/locale; export TEXTDOMAINDIR
790Sstevel@tonic-gateTEXTDOMAIN=SUNW_OST_OSCMD; export TEXTDOMAIN
800Sstevel@tonic-gateDOMAIN2=SUNW_OST_ZONEINFO
810Sstevel@tonic-gate
820Sstevel@tonic-gate# Make sure the tables are readable.
830Sstevel@tonic-gateTZ_COUNTRY_TABLE=$TZDIR/tab/country.tab
840Sstevel@tonic-gateTZ_ZONE_TABLE=$TZDIR/tab/zone_sun.tab
850Sstevel@tonic-gatefor f in $TZ_COUNTRY_TABLE $TZ_ZONE_TABLE
860Sstevel@tonic-gatedo
870Sstevel@tonic-gate	<$f || {
880Sstevel@tonic-gate		$PRINTF >&2 "`$GETTEXT "$ERR_NO_SETUP"`\n"  $0
890Sstevel@tonic-gate		exit 1
900Sstevel@tonic-gate	}
910Sstevel@tonic-gatedone
920Sstevel@tonic-gate
930Sstevel@tonic-gatenewline='
940Sstevel@tonic-gate'
950Sstevel@tonic-gateIFS=$newline
960Sstevel@tonic-gate
970Sstevel@tonic-gate# For C locale, don't need to call gettext(1)
980Sstevel@tonic-gateloc_messages=`$LOCALE | $GREP LC_MESSAGES | $AWK -F"=" '{print $2}`
990Sstevel@tonic-gateif [ "$loc_messages" = "\"C\""  -o "$loc_messages" = "C" ]; then
1000Sstevel@tonic-gate	is_C=1
1010Sstevel@tonic-gateelse
1020Sstevel@tonic-gate	is_C=0
1030Sstevel@tonic-gatefi
1040Sstevel@tonic-gate
1050Sstevel@tonic-gateiafrica=`$GETTEXT $DOMAIN2 Africa`
1060Sstevel@tonic-gateiamerica=`$GETTEXT $DOMAIN2 Americas`
1070Sstevel@tonic-gateiantarctica=`$GETTEXT $DOMAIN2 Antarctica`
1080Sstevel@tonic-gateiarcticocean=`$GETTEXT $DOMAIN2 "Arctic Ocean"`
1090Sstevel@tonic-gateiasia=`$GETTEXT $DOMAIN2 Asia`
1100Sstevel@tonic-gateiatlanticocean=`$GETTEXT $DOMAIN2 "Atlantic Ocean"`
1110Sstevel@tonic-gateiaustralia=`$GETTEXT $DOMAIN2 Australia`
1120Sstevel@tonic-gateieurope=`$GETTEXT $DOMAIN2 Europe`
1130Sstevel@tonic-gateipacificocean=`$GETTEXT $DOMAIN2 "Pacific Ocean"`
1140Sstevel@tonic-gateiindianocean=`$GETTEXT $DOMAIN2 "Indian Ocean"`
1150Sstevel@tonic-gatenone=`$GETTEXT "$INFO_POSIX"`
1160Sstevel@tonic-gate
1170Sstevel@tonic-gate# Begin the main loop.  We come back here if the user wants to retry.
1180Sstevel@tonic-gatewhile
1190Sstevel@tonic-gate	$PRINTF >&2 "`$GETTEXT "$INFO_LOCATION"`\n"
1200Sstevel@tonic-gate
1210Sstevel@tonic-gate	continent=
1220Sstevel@tonic-gate	country=
1230Sstevel@tonic-gate	region=
1240Sstevel@tonic-gate
1250Sstevel@tonic-gate	# Ask the user for continent or ocean.
1260Sstevel@tonic-gate	$PRINTF >&2 "`$GETTEXT "$INFO_SELECT_CONT"`\n"
1270Sstevel@tonic-gate
1280Sstevel@tonic-gate	select continent in \
1290Sstevel@tonic-gate	    $iafrica \
1300Sstevel@tonic-gate	    $iamerica \
1310Sstevel@tonic-gate	    $iantarctica \
1320Sstevel@tonic-gate	    $iarcticocean \
1330Sstevel@tonic-gate	    $iasia \
1340Sstevel@tonic-gate	    $iatlanticocean \
1350Sstevel@tonic-gate	    $iaustralia \
1360Sstevel@tonic-gate	    $ieurope \
1370Sstevel@tonic-gate	    $iindianocean \
1380Sstevel@tonic-gate	    $ipacificocean \
1390Sstevel@tonic-gate	    $none
1400Sstevel@tonic-gate
1410Sstevel@tonic-gate	do
1420Sstevel@tonic-gate	    case $continent in
1430Sstevel@tonic-gate	    '')
1440Sstevel@tonic-gate		$PRINTF >&2 "`$GETTEXT "$WARN_ENTER_NUM"`\n";;
1450Sstevel@tonic-gate
1460Sstevel@tonic-gate	    ?*)
1470Sstevel@tonic-gate		case $continent in
1480Sstevel@tonic-gate	    $iafrica) continent=Africa;;
1490Sstevel@tonic-gate	    $iamerica) continent=America;;
1500Sstevel@tonic-gate	    $iantarctica) continent=Antarctica;;
1510Sstevel@tonic-gate	    $iarcticocean) continent=Arctic;;
1520Sstevel@tonic-gate	    $iasia) continent=Asia;;
1530Sstevel@tonic-gate	    $iatlanticocean) continent=Atlantic;;
1540Sstevel@tonic-gate	    $iaustralia) continent=Australia;;
1550Sstevel@tonic-gate	    $ieurope) continent=Europe;;
1560Sstevel@tonic-gate	    $iindianocean) continent=Indian;;
1570Sstevel@tonic-gate	    $ipacificocean) continent=Pacific;;
1580Sstevel@tonic-gate	    $none) continent=none;;
1590Sstevel@tonic-gate		esac
1600Sstevel@tonic-gate		break
1610Sstevel@tonic-gate	    esac
1620Sstevel@tonic-gate	done
1630Sstevel@tonic-gate	case $continent in
1640Sstevel@tonic-gate	'')
1650Sstevel@tonic-gate		exit 1;;
1660Sstevel@tonic-gate	none)
1670Sstevel@tonic-gate		# Ask the user for a POSIX TZ string.  Check that it conforms.
1680Sstevel@tonic-gate		while
1690Sstevel@tonic-gate			$PRINTF >&2 "`$GETTEXT "$INFO_ENTER_POSIX"`\n"
1700Sstevel@tonic-gate			$PRINTF >&2 "`$GETTEXT "$INFO_POSIX_EX"`\n"
1710Sstevel@tonic-gate
1720Sstevel@tonic-gate			read TZ
1730Sstevel@tonic-gate			env LC_ALL=C $AWK -v TZ="$TZ" 'BEGIN {
1740Sstevel@tonic-gate				tzname = "[^-+,0-9][^-+,0-9][^-+,0-9]+"
1750Sstevel@tonic-gate				time = "[0-2]?[0-9](:[0-5][0-9](:[0-5][0-9])?)?"
1760Sstevel@tonic-gate				offset = "[-+]?" time
1770Sstevel@tonic-gate				date = "(J?[0-9]+|M[0-9]+\.[0-9]+\.[0-9]+)"
1780Sstevel@tonic-gate				datetime = "," date "(/" time ")?"
1790Sstevel@tonic-gate				tzpattern = "^(:.*|" tzname offset "(" tzname \
1800Sstevel@tonic-gate				  "(" offset ")?(" datetime datetime ")?)?)$"
1810Sstevel@tonic-gate				if (TZ ~ tzpattern) exit 1
1820Sstevel@tonic-gate				exit 0
1830Sstevel@tonic-gate			}'
1840Sstevel@tonic-gate		do
1850Sstevel@tonic-gate			$PRINTF >&2 "`$GETTEXT "$ERR_INV_POSIX"`\n" $TZ
1860Sstevel@tonic-gate
1870Sstevel@tonic-gate		done
1880Sstevel@tonic-gate		TZ_for_date=$TZ;;
1890Sstevel@tonic-gate	*)
1900Sstevel@tonic-gate		# Get list of names of countries in the continent or ocean.
1910Sstevel@tonic-gate		countries=$($AWK -F'\t' \
1920Sstevel@tonic-gate			-v continent="$continent" \
1930Sstevel@tonic-gate			-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
1940Sstevel@tonic-gate		'
1950Sstevel@tonic-gate			/^#/ { next }
1960Sstevel@tonic-gate			$3 ~ ("^" continent "/") {
1970Sstevel@tonic-gate				if (!cc_seen[$1]++) cc_list[++ccs] = $1
1980Sstevel@tonic-gate			}
1990Sstevel@tonic-gate			END {
2000Sstevel@tonic-gate				while (getline <TZ_COUNTRY_TABLE) {
2010Sstevel@tonic-gate					if ($0 !~ /^#/) cc_name[$1] = $2
2020Sstevel@tonic-gate				}
2030Sstevel@tonic-gate				for (i = 1; i <= ccs; i++) {
2040Sstevel@tonic-gate					country = cc_list[i]
2050Sstevel@tonic-gate					if (cc_name[country]) {
2060Sstevel@tonic-gate					  country = cc_name[country]
2070Sstevel@tonic-gate					}
2080Sstevel@tonic-gate					print country
2090Sstevel@tonic-gate				}
2100Sstevel@tonic-gate			}
2110Sstevel@tonic-gate		' <$TZ_ZONE_TABLE | $SORT -f)
2120Sstevel@tonic-gate
2130Sstevel@tonic-gate		# i18n country names
2140Sstevel@tonic-gate		c=0
2150Sstevel@tonic-gate		set -A icountry
2160Sstevel@tonic-gate		for country in $countries
2170Sstevel@tonic-gate		do
2180Sstevel@tonic-gate			if [ $is_C -eq 1 ]; then
2190Sstevel@tonic-gate				icountry[c]=$country
2200Sstevel@tonic-gate			else
2210Sstevel@tonic-gate				icountry[c]=`${GETTEXT} ${DOMAIN2} $country`
2220Sstevel@tonic-gate			fi
2230Sstevel@tonic-gate			ocountry[c]="$country"
2240Sstevel@tonic-gate			c=$(( $c + 1 ))
2250Sstevel@tonic-gate		done
2260Sstevel@tonic-gate		maxnum=$c
2270Sstevel@tonic-gate
2280Sstevel@tonic-gate		# If there's more than one country, ask the user which one.
2290Sstevel@tonic-gate		case $countries in
2300Sstevel@tonic-gate		*"$newline"*)
2310Sstevel@tonic-gate			$PRINTF >&2 "`$GETTEXT "$INFO_SELECT_CNTRY"`\n"
2320Sstevel@tonic-gate			select xcountry in ${icountry[*]}
2330Sstevel@tonic-gate			do
2340Sstevel@tonic-gate			    case $xcountry in
2350Sstevel@tonic-gate			    '')
2360Sstevel@tonic-gate				$PRINTF >&2 "`$GETTEXT "$WARN_ENTER_NUM"`\n"
2370Sstevel@tonic-gate				;;
2380Sstevel@tonic-gate			    ?*)   c=0
2390Sstevel@tonic-gate				  while true; do
2400Sstevel@tonic-gate                		    if [ "$xcountry" = "${icountry[$c]}" ];
2410Sstevel@tonic-gate				    then
2420Sstevel@tonic-gate					    country="${ocountry[$c]}"
2430Sstevel@tonic-gate                        		    break
2440Sstevel@tonic-gate                		    fi
2450Sstevel@tonic-gate                		    if [ $c -lt $maxnum ]; then
2460Sstevel@tonic-gate					    c=$(( $c + 1 ))
2470Sstevel@tonic-gate                		    else
2480Sstevel@tonic-gate                        		    break
2490Sstevel@tonic-gate                		    fi
2500Sstevel@tonic-gate        		         done
2510Sstevel@tonic-gate				 break
2520Sstevel@tonic-gate			     esac
2530Sstevel@tonic-gate			done
2540Sstevel@tonic-gate
2550Sstevel@tonic-gate			case $xcountry in
2560Sstevel@tonic-gate			'') exit 1
2570Sstevel@tonic-gate			esac;;
2580Sstevel@tonic-gate		*)
2590Sstevel@tonic-gate			country=$countries
2600Sstevel@tonic-gate			xcountry=$countries
2610Sstevel@tonic-gate		esac
2620Sstevel@tonic-gate
2630Sstevel@tonic-gate
2640Sstevel@tonic-gate		# Get list of names of time zone rule regions in the country.
2650Sstevel@tonic-gate		regions=$($AWK -F'\t' \
2660Sstevel@tonic-gate			-v country="$country" \
2670Sstevel@tonic-gate			-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
2680Sstevel@tonic-gate		'
2690Sstevel@tonic-gate			BEGIN {
2700Sstevel@tonic-gate				cc = country
2710Sstevel@tonic-gate				while (getline <TZ_COUNTRY_TABLE) {
2720Sstevel@tonic-gate					if ($0 !~ /^#/  &&  country == $2) {
2730Sstevel@tonic-gate						cc = $1
2740Sstevel@tonic-gate						break
2750Sstevel@tonic-gate					}
2760Sstevel@tonic-gate				}
2770Sstevel@tonic-gate			}
2780Sstevel@tonic-gate			$1 == cc { print $5 }
2790Sstevel@tonic-gate		' <$TZ_ZONE_TABLE)
2800Sstevel@tonic-gate
2810Sstevel@tonic-gate		# I18n region names
2820Sstevel@tonic-gate		c=0
2830Sstevel@tonic-gate		set -A iregion
2840Sstevel@tonic-gate		for region in $regions
2850Sstevel@tonic-gate		do
2860Sstevel@tonic-gate			if [ $is_C -eq 1 ]; then
2870Sstevel@tonic-gate				iregion[c]=$region
2880Sstevel@tonic-gate			else
2890Sstevel@tonic-gate				iregion[c]=`${GETTEXT} ${DOMAIN2} $region`
2900Sstevel@tonic-gate			fi
2910Sstevel@tonic-gate			oregion[c]="$region"
2920Sstevel@tonic-gate			c=$(( $c + 1 ))
2930Sstevel@tonic-gate		done
2940Sstevel@tonic-gate		maxnum=$c
2950Sstevel@tonic-gate
2960Sstevel@tonic-gate		# If there's more than one region, ask the user which one.
2970Sstevel@tonic-gate		case $regions in
2980Sstevel@tonic-gate		*"$newline"*)
2990Sstevel@tonic-gate			$PRINTF >&2 "`$GETTEXT "$INFO_SELECT_TZ"`\n"
3000Sstevel@tonic-gate
3010Sstevel@tonic-gate			select xregion in ${iregion[*]}
3020Sstevel@tonic-gate			do
3030Sstevel@tonic-gate				case $xregion in
3040Sstevel@tonic-gate				'')
3050Sstevel@tonic-gate				$PRINTF >&2 "`$GETTEXT "$WARN_ENTER_NUM"`\n"
3060Sstevel@tonic-gate				;;
3070Sstevel@tonic-gate				?*) c=0
3080Sstevel@tonic-gate                                    while true; do
3090Sstevel@tonic-gate                                       if [ "$xregion" = "${iregion[$c]}" ];
3100Sstevel@tonic-gate				       then
3110Sstevel@tonic-gate                                            region="${oregion[$c]}"
3120Sstevel@tonic-gate                                            break
3130Sstevel@tonic-gate                                       fi
3140Sstevel@tonic-gate                                       if [ $c -lt $maxnum ]; then
3150Sstevel@tonic-gate					    c=$(( $c + 1 ))
3160Sstevel@tonic-gate                                       else
3170Sstevel@tonic-gate                                            break
3180Sstevel@tonic-gate                                       fi
3190Sstevel@tonic-gate                                    done
3200Sstevel@tonic-gate				    break
3210Sstevel@tonic-gate				esac
3220Sstevel@tonic-gate			done
3230Sstevel@tonic-gate
3240Sstevel@tonic-gate			case $region in
3250Sstevel@tonic-gate			'') exit 1
3260Sstevel@tonic-gate			esac;;
3270Sstevel@tonic-gate		*)
3280Sstevel@tonic-gate			region=$regions
3290Sstevel@tonic-gate			xregion=$regions
3300Sstevel@tonic-gate		esac
3310Sstevel@tonic-gate
3320Sstevel@tonic-gate		# Determine TZ from country and region.
3330Sstevel@tonic-gate		TZ=$($AWK -F'\t' \
3340Sstevel@tonic-gate			-v country="$country" \
3350Sstevel@tonic-gate			-v region="$region" \
3360Sstevel@tonic-gate			-v TZ_COUNTRY_TABLE="$TZ_COUNTRY_TABLE" \
3370Sstevel@tonic-gate		'
3380Sstevel@tonic-gate			BEGIN {
3390Sstevel@tonic-gate				cc = country
3400Sstevel@tonic-gate				while (getline <TZ_COUNTRY_TABLE) {
3410Sstevel@tonic-gate					if ($0 !~ /^#/  &&  country == $2) {
3420Sstevel@tonic-gate						cc = $1
3430Sstevel@tonic-gate						break
3440Sstevel@tonic-gate					}
3450Sstevel@tonic-gate				}
3460Sstevel@tonic-gate			}
3470Sstevel@tonic-gate
3480Sstevel@tonic-gate			$1 == cc && $5 == region {
3490Sstevel@tonic-gate				# Check if tzname mapped to
3500Sstevel@tonic-gate				# backward compatible tzname
3510Sstevel@tonic-gate				if ($4 == "-") {
3520Sstevel@tonic-gate					print $3
3530Sstevel@tonic-gate				} else {
3540Sstevel@tonic-gate					print $4
3550Sstevel@tonic-gate				}
3560Sstevel@tonic-gate			}
3570Sstevel@tonic-gate		' <$TZ_ZONE_TABLE)
3580Sstevel@tonic-gate
3590Sstevel@tonic-gate		# Make sure the corresponding zoneinfo file exists.
3600Sstevel@tonic-gate		TZ_for_date=$TZDIR/$TZ
3610Sstevel@tonic-gate		<$TZ_for_date || {
3620Sstevel@tonic-gate			$PRINTF >&2 "`$GETTEXT "$ERR_NO_SETUP"`\n" $0
3630Sstevel@tonic-gate			exit 1
3640Sstevel@tonic-gate		}
3650Sstevel@tonic-gate		# Absolute path TZ's not supported
3660Sstevel@tonic-gate		TZ_for_date=$TZ
3670Sstevel@tonic-gate	esac
3680Sstevel@tonic-gate
3690Sstevel@tonic-gate
3700Sstevel@tonic-gate	# Use the proposed TZ to output the current date relative to UTC.
3710Sstevel@tonic-gate	# Loop until they agree in seconds.
3720Sstevel@tonic-gate	# Give up after 8 unsuccessful tries.
3730Sstevel@tonic-gate
3740Sstevel@tonic-gate	extra_info1=
3750Sstevel@tonic-gate	extra_info2=
3760Sstevel@tonic-gate	for i in 1 2 3 4 5 6 7 8
3770Sstevel@tonic-gate	do
3780Sstevel@tonic-gate		TZdate=$(LANG=C TZ="$TZ_for_date" $DATE)
3790Sstevel@tonic-gate		UTdate=$(LANG=C TZ=UTC0 $DATE)
3800Sstevel@tonic-gate		TZsec=$($EXPR "$TZdate" : '.*:\([0-5][0-9]\)')
3810Sstevel@tonic-gate		UTsec=$($EXPR "$UTdate" : '.*:\([0-5][0-9]\)')
3820Sstevel@tonic-gate		case $TZsec in
3830Sstevel@tonic-gate		$UTsec)
3840Sstevel@tonic-gate			extra_info1=$($PRINTF "`$GETTEXT "$INFO_EXTRA1"`" \
3850Sstevel@tonic-gate			"$TZdate")
3860Sstevel@tonic-gate			extra_info2=$($PRINTF "`$GETTEXT "$INFO_EXTRA2"`" \
3870Sstevel@tonic-gate			"$UTdate")
3880Sstevel@tonic-gate			break
3890Sstevel@tonic-gate		esac
3900Sstevel@tonic-gate	done
3910Sstevel@tonic-gate
3920Sstevel@tonic-gate
3930Sstevel@tonic-gate	# Output TZ info and ask the user to confirm.
3940Sstevel@tonic-gate
3950Sstevel@tonic-gate	$PRINTF >&2 "\n"
3960Sstevel@tonic-gate	$PRINTF >&2 "`$GETTEXT "$INFO_INFO"`\n"
3970Sstevel@tonic-gate	$PRINTF >&2 "\n"
3980Sstevel@tonic-gate
3990Sstevel@tonic-gate	case $country+$region in
4000Sstevel@tonic-gate	?*+?*)	$PRINTF >&2 "	$xcountry$newline	$xregion\n";;
4010Sstevel@tonic-gate	?*+)	$PRINTF >&2 "	$xcountry\n";;
4020Sstevel@tonic-gate	+)	$PRINTF >&2 "	TZ='$TZ'\n"
4030Sstevel@tonic-gate	esac
4040Sstevel@tonic-gate	$PRINTF >&2 "\n"
4050Sstevel@tonic-gate	$PRINTF >&2 "`$GETTEXT "$INFO_TZ"`\n" "$TZ"
4060Sstevel@tonic-gate	$PRINTF >&2 "$extra_info1\n"
4070Sstevel@tonic-gate	$PRINTF >&2 "$extra_info2\n"
4080Sstevel@tonic-gate	$PRINTF >&2 "`$GETTEXT "$INFO_OK"`\n"
4090Sstevel@tonic-gate
4100Sstevel@tonic-gate	ok=
4110Sstevel@tonic-gate	# select ok in Yes No
4120Sstevel@tonic-gate	Yes="`$GETTEXT "$INFO_YES"`"
4130Sstevel@tonic-gate	No="`$GETTEXT "$INFO_NO"`"
4140Sstevel@tonic-gate	select ok in $Yes $No
4150Sstevel@tonic-gate	do
4160Sstevel@tonic-gate	    case $ok in
4170Sstevel@tonic-gate	    '')
4180Sstevel@tonic-gate		$PRINTF >&2 "`$GETTEXT "$WARN_ENTER_YORN"`\n"
4190Sstevel@tonic-gate		;;
4200Sstevel@tonic-gate	    ?*) break
4210Sstevel@tonic-gate	    esac
4220Sstevel@tonic-gate	done
4230Sstevel@tonic-gate	case $ok in
4240Sstevel@tonic-gate	'') exit 1;;
4250Sstevel@tonic-gate	$Yes) break
4260Sstevel@tonic-gate	esac
4270Sstevel@tonic-gatedo :
4280Sstevel@tonic-gatedone
4290Sstevel@tonic-gate
4300Sstevel@tonic-gate$PRINTF >&2 "`$GETTEXT "$INFO_FINE"`\n"
4310Sstevel@tonic-gate
4320Sstevel@tonic-gate$PRINTF "%s\n" "$TZ"
433