menus.subr (0bfd163f522701b486e066fa2e56624c02f5081a) | menus.subr (bc3f5ec90bde2f3a5e4021d133c89793d68b8c73) |
---|---|
1if [ ! "$_TIMEZONE_MENUS_SUBR" ]; then _TIMEZONE_MENUS_SUBR=1 2# 3# Copyright (c) 2011-2012 Devin Teske 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 90 unchanged lines hidden (view full) --- 99# 100# This function is a two-parter. Below is the awk(1) portion of the function, 101# afterward is the sh(1) function which utilizes the below awk script. 102# 103f_make_menus_awk=' 104function add_zone_n_to_country_menu(tlc, n) 105{ 106 zone_title = ENVIRON["country_" tlc "_descr_" n] | 1if [ ! "$_TIMEZONE_MENUS_SUBR" ]; then _TIMEZONE_MENUS_SUBR=1 2# 3# Copyright (c) 2011-2012 Devin Teske 4# All rights reserved. 5# 6# Redistribution and use in source and binary forms, with or without 7# modification, are permitted provided that the following conditions 8# are met: --- 90 unchanged lines hidden (view full) --- 99# 100# This function is a two-parter. Below is the awk(1) portion of the function, 101# afterward is the sh(1) function which utilizes the below awk script. 102# 103f_make_menus_awk=' 104function add_zone_n_to_country_menu(tlc, n) 105{ 106 zone_title = ENVIRON["country_" tlc "_descr_" n] |
107 gsub(/'\''/, "'\''\\'\'''\''", zone_title) | 107 gsub(/'\''/, "'\''\\'\'\''", zone_title) |
108 country_menu_list[tlc] = country_menu_list[tlc] \ 109 ( length(country_menu_list[tlc]) > 0 ? "\n" : "" ) \ 110 n " '\''" zone_title "'\''" 111} 112BEGIN { 113 # 114 # First, count up all the countries in each continent/ocean. 115 # Be careful to count those countries which have multiple zones 116 # only once for each. NB: some countries are in multiple 117 # continents/oceans. 118 # 119 i = split(ENVIRON["COUNTRIES"], countries, /[[:space:]]+/) 120 for (cp = 1; cp <= i; cp++) 121 { 122 tlc = countries[cp] 123 title = ENVIRON["country_" tlc "_name"] | 108 country_menu_list[tlc] = country_menu_list[tlc] \ 109 ( length(country_menu_list[tlc]) > 0 ? "\n" : "" ) \ 110 n " '\''" zone_title "'\''" 111} 112BEGIN { 113 # 114 # First, count up all the countries in each continent/ocean. 115 # Be careful to count those countries which have multiple zones 116 # only once for each. NB: some countries are in multiple 117 # continents/oceans. 118 # 119 i = split(ENVIRON["COUNTRIES"], countries, /[[:space:]]+/) 120 for (cp = 1; cp <= i; cp++) 121 { 122 tlc = countries[cp] 123 title = ENVIRON["country_" tlc "_name"] |
124 gsub(/'\''/, "'\''\\'\'''\''", title) | 124 gsub(/'\''/, "'\''\\'\'\''", title) |
125 nzones = ENVIRON["country_" tlc "_nzones"] 126 if (!nzones) 127 { 128 # Country has no zones 129 continue 130 } 131 else if (nzones < 0) 132 { --- 93 unchanged lines hidden --- | 125 nzones = ENVIRON["country_" tlc "_nzones"] 126 if (!nzones) 127 { 128 # Country has no zones 129 continue 130 } 131 else if (nzones < 0) 132 { --- 93 unchanged lines hidden --- |