1252995Sdteskeif [ ! "$_TIMEZONE_CONTINENTS_SUBR" ]; then _TIMEZONE_CONTINENTS_SUBR=1 2252995Sdteske# 3252995Sdteske# Copyright (c) 2011-2012 Devin Teske 4252995Sdteske# All rights reserved. 5252995Sdteske# 6252995Sdteske# Redistribution and use in source and binary forms, with or without 7252995Sdteske# modification, are permitted provided that the following conditions 8252995Sdteske# are met: 9252995Sdteske# 1. Redistributions of source code must retain the above copyright 10252995Sdteske# notice, this list of conditions and the following disclaimer. 11252995Sdteske# 2. Redistributions in binary form must reproduce the above copyright 12252995Sdteske# notice, this list of conditions and the following disclaimer in the 13252995Sdteske# documentation and/or other materials provided with the distribution. 14252995Sdteske# 15252995Sdteske# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 16252995Sdteske# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 17252995Sdteske# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18252995Sdteske# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 19252995Sdteske# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20252995Sdteske# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21252995Sdteske# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22252995Sdteske# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23252995Sdteske# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24252995Sdteske# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25252995Sdteske# SUCH DAMAGE. 26252995Sdteske# 27252995Sdteske# $FreeBSD$ 28252995Sdteske# 29252995Sdteske############################################################ INCLUDES 30252995Sdteske 31252995SdteskeBSDCFG_SHARE="/usr/share/bsdconfig" 32252995Sdteske. $BSDCFG_SHARE/common.subr || exit 1 33252995Sdteskef_dprintf "%s: loading includes..." timezone/continents.subr 34252995Sdteske 35252995SdteskeBSDCFG_LIBE="/usr/libexec/bsdconfig" APP_DIR="090.timezone" 36252995Sdteskef_include_lang $BSDCFG_LIBE/$APP_DIR/include/messages.subr 37252995Sdteske 38252995Sdteske############################################################ CONFIGURATION 39252995Sdteske 40252995Sdteske# 41252995Sdteske# List of worldly continents/oceans (export'ed for awk(1) ENVIRON visibility) 42252995Sdteske# 43252995Sdteskeexport CONTINENTS=" 44252995Sdteske africa 45252995Sdteske america 46252995Sdteske antarctica 47252995Sdteske arctic 48252995Sdteske asia 49252995Sdteske atlantic 50252995Sdteske australia 51252995Sdteske europe 52252995Sdteske indian 53252995Sdteske pacific 54252995Sdteske utc 55252995Sdteske" 56252995Sdteske 57252995Sdteske# 58252995Sdteske# Directory name of each continent/ocean (in _PATH_ZONEINFO) 59252995Sdteske# 60252995Sdteskeexport continent_africa_name="Africa" 61252995Sdteskeexport continent_america_name="America" 62252995Sdteskeexport continent_antarctica_name="Antarctica" 63252995Sdteskeexport continent_arctic_name="Arctic" 64252995Sdteskeexport continent_asia_name="Asia" 65252995Sdteskeexport continent_atlantic_name="Atlantic" 66252995Sdteskeexport continent_australia_name="Australia" 67252995Sdteskeexport continent_europe_name="Europe" 68252995Sdteskeexport continent_indian_name="Indian" 69252995Sdteskeexport continent_pacific_name="Pacific" 70252995Sdteskeexport continent_utc_name="UTC" 71252995Sdteske 72252995Sdteske# 73252995Sdteske# Export i18n menu texts of continents/oceans for awk(1) ENVIRON visibility 74252995Sdteske# NOTE: These are defined in messages.subr included above. 75252995Sdteske# 76252995Sdteskeexport continent_africa_title 77252995Sdteskeexport continent_america_title 78252995Sdteskeexport continent_antarctica_title 79252995Sdteskeexport continent_arctic_title 80252995Sdteskeexport continent_asia_title 81252995Sdteskeexport continent_atlantic_title 82252995Sdteskeexport continent_australia_title 83252995Sdteskeexport continent_europe_title 84252995Sdteskeexport continent_indian_title 85252995Sdteskeexport continent_pacific_title 86252995Sdteskeexport continent_utc_title 87252995Sdteske 88252995Sdteske############################################################ FUNCTIONS 89252995Sdteske 90252995Sdteske# f_continent $cont $property 91252995Sdteske# 92252995Sdteske# Returns a single property of a given continent. Available properties are: 93252995Sdteske# 94252995Sdteske# name Directory name of continent/ocean as it appears in 95252995Sdteske# _PATH_ZONEINFO. 96252995Sdteske# title Menu text of this continent/ocean to be displayed in the 97252995Sdteske# continent-selection menu. 98252995Sdteske# nitems Number of submenu items associated with this 99252995Sdteske# continent/ocean. 100252995Sdteske# tlc_N 2-character country code of the Nth submenu item associated 101252995Sdteske# with this continent displayed in the country-selection menu 102252995Sdteske# (which appears after continent selection). 103252995Sdteske# menu_list Menu-list of regions for this continent. 104252995Sdteske# 105252995Sdteskef_continent() 106252995Sdteske{ 107252995Sdteske local cont="$1" property="$2" 108252995Sdteske eval echo \"\${continent_${cont}_$property}\" 109252995Sdteske} 110252995Sdteske 111252995Sdteske# f_find_continent $title 112252995Sdteske# 113252995Sdteske# Returns continent identifier given continent title. 114252995Sdteske# 115252995Sdteskef_find_continent() 116252995Sdteske{ 117252995Sdteske local cont 118252995Sdteske for cont in $CONTINENTS; do 119252995Sdteske if [ "$1" = "$( f_continent $cont title )" ]; then 120252995Sdteske echo "$cont" 121252995Sdteske return $SUCCESS 122252995Sdteske fi 123252995Sdteske done 124252995Sdteske return $FAILURE 125252995Sdteske} 126252995Sdteske 127252995Sdteske# f_OCEANP $cont 128252995Sdteske# 129252995Sdteske# Returns "1" if the first argument is an ocean, otherwise NULL. 130252995Sdteske# 131252995Sdteskef_OCEANP() 132252995Sdteske{ 133252995Sdteske case "$1" in 134252995Sdteske arctic|atlantic|indian|pacific) 135252995Sdteske echo 1 136252995Sdteske esac 137252995Sdteske} 138252995Sdteske 139252995Sdteske############################################################ MAIN 140252995Sdteske 141252995Sdteskef_dprintf "%s: Successfully loaded." timezone/continents.subr 142252995Sdteske 143252995Sdteskefi # ! $_TIMEZONE_CONTINENTS_SUBR 144