[tz] [PROPOSED] Improve tzselect explanation

Paul Eggert eggert at cs.ucla.edu
Mon Mar 6 07:55:46 UTC 2023


* tzselect.ksh: Improve quality of "Based on the following
information:" note when the user selected a time first.
---
 tzselect.ksh | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/tzselect.ksh b/tzselect.ksh
index 41180ae9..b8f64077 100644
--- a/tzselect.ksh
+++ b/tzselect.ksh
@@ -551,6 +551,7 @@ while
 			echo >&2 'Please select a country' \
 				'whose clocks agree with yours.'
 			doselect $countries
+			country_result=$select_result
 			country=$select_result;;
 		*)
 			country=$countries
@@ -653,12 +654,13 @@ Universal Time is now:	$UTdate."
 	echo >&2 ""
 	echo >&2 "Based on the following information:"
 	echo >&2 ""
-	case $time%$country%$region%$coord in
+	case $time%$country_result%$region%$coord in
 	?*%?*%?*%)
-	  say >&2 "	$time$newline	$country$newline	$region";;
-	?*%?*%%) say >&2 "	$time$newline	$country";;
-	%?*%?*%) say >&2 "	$country$newline	$region";;
-	%?*%%)	say >&2 "	$country";;
+	  say >&2 "	$time$newline	$country_result$newline	$region";;
+	?*%?*%%|?*%%?*%) say >&2 "	$time$newline	$country_result$region";;
+	?*%%%) say >&2 "	$time";;
+	%?*%?*%) say >&2 "	$country_result$newline	$region";;
+	%?*%%)	say >&2 "	$country_result";;
 	%%?*%?*) say >&2 "	coord $coord$newline	$region";;
 	%%%?*)	say >&2 "	coord $coord";;
 	*)	say >&2 "	TZ='$TZ'"
-- 
2.37.2



More information about the tz mailing list