//-----------------------------------------------------------------------------
// Copyright © 2004 - Philip Howard - All rights reserved
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
//-----------------------------------------------------------------------------
// package	libh/callsign
// homepage	http://libh.slashusr.org/
//-----------------------------------------------------------------------------
// author	Philip Howard
// email	libh at ipal dot org
// homepage	http://phil.ipal.org/
//-----------------------------------------------------------------------------
// This file is best viewed using a fixed spaced font such as Courier
// and in a display at least 120 columns wide.
//-----------------------------------------------------------------------------

#include "callsign_lib.h"

#include <string.h>

//-----------------------------------------------------------------------------
// table	country_name_array
//-----------------------------------------------------------------------------
static struct country_name country_name_array[] = {
    {
	"ad",
	"Andorra",
	"Andorra",
	"Principality of Andorra"
    },

    {
	"ae",
	"United Arab Emirates",
	"United Arab Emirates",
	"United Arab Emirates"
    },

    {
	"af",
	"Afghanistan",
	"Afghanistan",
	"Islamic State of Afghanistan"
    },

    {
	"ag",
	"Antigua and Barbuda",
	"Antigua and Barbuda",
	"Antigua and Barbuda"
    },

    {
	"ai",
	"Anguilla",
	"Anguilla",
	"Anguilla"
    },

    {
	"al",
	"Albania",
	"Albania",
	"Republic of Albania"
    },

    {
	"am",
	"Armenia",
	"Armenia",
	"Republic of Armenia"
    },

    {
	"an",
	"Netherlands Antilles",
	"Netherlands Antilles",
	"Kingdom of the Netherlands - Netherlands Antilles"
    },

    {
	"ao",
	"Angola",
	"Angola",
	"Republic of Angola"
    },

    {
	"aq",
	"Antarctica",
	"Antarctica",
	"Antarctica"
    },

    {
	"ar",
	"Argentina",
	"Argentina",
	"Argentine Republic"
    },

    {
	"as",
	"American Samoa",
	"American Samoa",
	"American Samoa"
    },

    {
	"at",
	"Austria",
	"Austria",
	"Austria"
    },

    {
	"au",
	"Australia",
	"Australia",
	"Australia"
    },

    {
	"aw",
	"Aruba",
	"Aruba",
	"Aruba"
    },

    {
	"az",
	"Azerbaijani",
	"Azerbaijani",
	"Azerbaijani Republic"
    },

    {
	"ba",
	"Bosnia and Herzegovina",
	"Bosnia and Herzegovina",
	"Republic of Bosnia and Herzegovina"
    },

    {
	"bb",
	"Barbados",
	"Barbados",
	"Barbados"
    },

    {
	"bd",
	"Bangladesh",
	"Bangladesh",
	"People's Republic of Bangladesh"
    },

    {
	"be",
	"Belgium",
	"Belgium",
	"Belgium"
    },

    {
	"bf",
	"Burkina Faso",
	"Burkina Faso",
	"Burkina Faso"
    },

    {
	"bg",
	"Republic of Bulgaria",
	"Republic of Bulgaria",
	"Republic of Bulgaria"
    },

    {
	"bh",
	"Bahrain",
	"Bahrain",
	"State of Bahrain"
    },

    {
	"bi",
	"Burundi",
	"Burundi",
	"Republic of Burundi"
    },

    {
	"bj",
	"Benin",
	"Benin",
	"Republic of Benin"
    },

    {
	"bm",
	"Bermuda",
	"Bermuda",
	"Bermuda"
    },

    {
	"bn",
	"Brunei Darussalam",
	"Brunei Darussalam",
	"Brunei Darussalam"
    },

    {
	"bo",
	"Bolivia",
	"Bolivia",
	"Bolivia"
    },

    {
	"br",
	"Brazil",
	"Brazil",
	"Federative Republic of Brazil"
    },

    {
	"bs",
	"Bahamas",
	"Bahamas",
	"Commonwealth of the Bahamas"
    },

    {
	"bt",
	"Bhutan",
	"Bhutan",
	"Kingdom of Bhutan"
    },

    {
	"bv",
	"Bouvet Island",
	"Bouvet Island",
	"Bouvet Island"
    },

    {
	"bw",
	"Botswana",
	"Botswana",
	"Republic of Botswana"
    },

    {
	"by",
	"Belarus",
	"Belarus",
	"Republic of Belarus"
    },

    {
	"bz",
	"Belize",
	"Belize",
	"Belize"
    },

    {
	"ca",
	"Canada",
	"Canada",
	"Canada"
    },

    {
	"cc",
	"Cocos Islands",
	"Cocos Islands",
	"Cocos (Keeling) Islands"
    },

    {
	"cd",
	"Democratic Republic of the Congo",
	"Democratic Republic of the Congo",
	"Democratic Republic of the Congo"
    },

    {
	"cf",
	"Central African Republic",
	"Central African Republic",
	"Central African Republic"
    },

    {
	"cg",
	"Republic of the Congo",
	"Republic of the Congo",
	"Republic of the Congo"
    },

    {
	"ch",
	"Switzerland",
	"Switzerland",
	"Confederation of Switzerland"
    },

    {
	"ci",
	"Côte D'Ivoire",
	"Côte D'Ivoire",
	"Republic of Côte D'Ivoire (Ivory Coast)"
    },

    {
	"ck",
	"Cook Islands",
	"Cook Islands",
	"Cook Islands"
    },

    {
	"cl",
	"Chile",
	"Chile",
	"Chile"
    },

    {
	"cm",
	"Cameroon",
	"Cameroon",
	"Republic of Cameroon"
    },

    {
	"cn",
	"China",
	"China",
	"People's Republic of China"
    },

    {
	"co",
	"Colombia",
	"Colombia",
	"Republic of Colombia"
    },

    {
	"cr",
	"Costa Rica",
	"Costa Rica",
	"Costa Rica"
    },

    {
	"cs",
	"Czechoslovakia (former)",
	"Czechoslovakia (former)",
	"Czechoslovakia (former)"
    },

    {
	"cu",
	"Cuba",
	"Cuba",
	"Cuba"
    },

    {
	"cv",
	"Cape Verde",
	"Cape Verde",
	"Republic of Cape Verde"
    },

    {
	"cx",
	"Christmas Island",
	"Christmas Island",
	"Christmas Island"
    },

    {
	"cy",
	"Cyprus",
	"Cyprus",
	"Republic of Cyprus"
    },

    {
	"cz",
	"Czech Republic",
	"Czech Republic",
	"Czech Republic"
    },

    {
	"de",
	"Germany",
	"Germany",
	"Federal Republic of Germany"
    },

    {
	"dj",
	"Djibouti",
	"Djibouti",
	"Republic of Djibouti"
    },

    {
	"dk",
	"Denmark",
	"Denmark",
	"Denmark"
    },

    {
	"dm",
	"Dominica",
	"Dominica",
	"Commonwealth of Dominica"
    },

    {
	"do",
	"Dominican Republic",
	"Dominican Republic",
	"Dominican Republic"
    },

    {
	"dz",
	"Algeria",
	"Algeria",
	"People's Democratic Republic of Algeria"
    },

    {
	"ec",
	"Ecuador",
	"Ecuador",
	"Ecuador"
    },

    {
	"ee",
	"Estonia",
	"Estonia",
	"Republic of Estonia"
    },

    {
	"eg",
	"Egypt",
	"Egypt",
	"Arab Republic of Egypt"
    },

    {
	"eh",
	"Western Sahara",
	"Western Sahara",
	"Western Sahara"
    },

    {
	"er",
	"Eritrea",
	"Eritrea",
	"Eritrea"
    },

    {
	"es",
	"Spain",
	"Spain",
	"Spain"
    },

    {
	"et",
	"Ethiopia",
	"Ethiopia",
	"Federal Democratic Republic of Ethiopia"
    },

    {
	"fi",
	"Finland",
	"Finland",
	"Finland"
    },

    {
	"fj",
	"Fiji",
	"Fiji",
	"Republic of Fiji"
    },

    {
	"fk",
	"Falkland Islands",
	"Falkland Islands",
	"Falkland Islands (Malvinas)"
    },

    {
	"fm",
	"Micronesia",
	"Micronesia",
	"Federated States of Micronesia"
    },

    {
	"fo",
	"Faroe Islands",
	"Faroe Islands",
	"Faroe Islands"
    },

    {
	"fr",
	"France",
	"France",
	"France"
    },

    {
	"fx",
	"Metropolitan France",
	"Metropolitan France",
	"Metropolitan France"
    },

    {
	"ga",
	"Gabon",
	"Gabon",
	"Gabonese Republic"
    },

    {
	"gb",
	"Great Britain",
	"Great Britain",
	"Great Britain (UK)"
    },

    {
	"gd",
	"Grenada",
	"Grenada",
	"Grenada"
    },

    {
	"ge",
	"Georgia",
	"Georgia",
	"Republic of Georgia"
    },

    {
	"gf",
	"French Guiana",
	"French Guiana",
	"French Guiana"
    },

    {
	"gh",
	"Ghana",
	"Ghana",
	"Ghana"
    },

    {
	"gi",
	"Gibraltar",
	"Gibraltar",
	"Gibraltar"
    },

    {
	"gl",
	"Greenland",
	"Greenland",
	"Greenland"
    },

    {
	"gm",
	"Gambia",
	"Gambia",
	"Republic of the Gambia"
    },

    {
	"gn",
	"Guinea",
	"Guinea",
	"Republic of Guinea"
    },

    {
	"gp",
	"Guadeloupe",
	"Guadeloupe",
	"Guadeloupe"
    },

    {
	"gq",
	"Equatorial Guinea",
	"Equatorial Guinea",
	"Republic of Equatorial Guinea"
    },

    {
	"gr",
	"Greece",
	"Greece",
	"Greece"
    },

    {
	"gs",
	"S. Georgia and S. Sandwich Isls.",
	"S. Georgia and S. Sandwich Isls.",
	"S. Georgia and S. Sandwich Isls."
    },

    {
	"gt",
	"Guatemala",
	"Guatemala",
	"Republic of Guatemala"
    },

    {
	"gu",
	"Guam",
	"Guam",
	"Guam"
    },

    {
	"gw",
	"Guinea-Bissau",
	"Guinea-Bissau",
	"Republic of Guinea-Bissau"
    },

    {
	"gy",
	"Guyana",
	"Guyana",
	"Guyana"
    },

    {
	"hk",
	"Hong Kong",
	"Hong Kong",
	"Hong Kong"
    },

    {
	"hm",
	"Heard and McDonald Islands",
	"Heard and McDonald Islands",
	"Heard and McDonald Islands"
    },

    {
	"hn",
	"Honduras",
	"Honduras",
	"Republic of Honduras"
    },

    {
	"hr",
	"Croatia",
	"Croatia",
	"Republic of Croatia (Hrvatska)"
    },

    {
	"ht",
	"Haiti",
	"Haiti",
	"Republic of Haiti"
    },

    {
	"hu",
	"Hungary",
	"Hungary",
	"Republic of Hungary"
    },

    {
	"icao",
	"International Civil Aviation Organization",
	"International Civil Aviation Organization",
	"International Civil Aviation Organization"
    },

    {
	"id",
	"Indonesia",
	"Indonesia",
	"Republic of Indonesia"
    },

    {
	"ie",
	"Ireland",
	"Ireland",
	"Ireland"
    },

    {
	"il",
	"Israel",
	"Israel",
	"State of Israel"
    },

    {
	"in",
	"India",
	"India",
	"Republic of India"
    },

    {
	"io",
	"British Indian Ocean Territory",
	"British Indian Ocean Territory",
	"British Indian Ocean Territory"
    },

    {
	"iq",
	"Iraq",
	"Iraq",
	"Iraq"
    },

    {
	"ir",
	"Iran",
	"Iran",
	"Iran"
    },

    {
	"is",
	"Iceland",
	"Iceland",
	"Iceland"
    },

    {
	"it",
	"Italy",
	"Italy",
	"Italy"
    },

    {
	"jm",
	"Jamaica",
	"Jamaica",
	"Jamaica"
    },

    {
	"jo",
	"Jordan",
	"Jordan",
	"Hashemite Kingdom of Jordan"
    },

    {
	"jp",
	"Japan",
	"Japan",
	"Japan"
    },

    {
	"ke",
	"Kenya",
	"Kenya",
	"Republic of Kenya"
    },

    {
	"kg",
	"Kyrgyzstan",
	"Kyrgyzstan",
	"Kyrgyz Republic (Kyrgyzstan)"
    },

    {
	"kh",
	"Cambodia",
	"Cambodia",
	"Kingdom of Cambodia"
    },

    {
	"ki",
	"Kiribati",
	"Kiribati",
	"Republic of Kiribati"
    },

    {
	"km",
	"Comoros",
	"Comoros",
	"Islamic Federal Republic of the Comoros"
    },

    {
	"kn",
	"Saint Kitts and Nevis",
	"Saint Kitts and Nevis",
	"Saint Kitts and Nevis"
    },

    {
	"kp",
	"North Korea",
	"North Korea",
	"Democratic People's Republic of Korea (North)"
    },

    {
	"kr",
	"South Korea",
	"South Korea",
	"Republic of Korea (South)"
    },

    {
	"kw",
	"Kuwait",
	"Kuwait",
	"State of Kuwait"
    },

    {
	"ky",
	"Cayman Islands",
	"Cayman Islands",
	"Cayman Islands"
    },

    {
	"kz",
	"Kazakhstan",
	"Kazakhstan",
	"Republic of Kazakhstan"
    },

    {
	"la",
	"Laos",
	"Laos",
	"Lao People's Democratic Republic (Laos)"
    },

    {
	"lb",
	"Lebanon",
	"Lebanon",
	"Lebanon"
    },

    {
	"lc",
	"Saint Lucia",
	"Saint Lucia",
	"Saint Lucia"
    },

    {
	"li",
	"Liechtenstein",
	"Liechtenstein",
	"Liechtenstein"
    },

    {
	"lk",
	"Sri Lanka",
	"Sri Lanka",
	"Democratic Socialist Republic of Sri Lanka"
    },

    {
	"lr",
	"Liberia",
	"Liberia",
	"Republic of Liberia"
    },

    {
	"ls",
	"Lesotho",
	"Lesotho",
	"Kingdom of Lesotho"
    },

    {
	"lt",
	"Lithuania",
	"Lithuania",
	"Republic of Lithuania"
    },

    {
	"lu",
	"Luxembourg",
	"Luxembourg",
	"Luxembourg"
    },

    {
	"lv",
	"Latvia",
	"Latvia",
	"Latvia"
    },

    {
	"ly",
	"Libya",
	"Libya",
	"Socialist People's Libyan Arab Jamahiriya"
    },

    {
	"ma",
	"Morocco",
	"Morocco",
	"Kingdom of Morocco"
    },

    {
	"mc",
	"Monaco",
	"Monaco",
	"Principality of Monaco"
    },

    {
	"md",
	"Moldova",
	"Moldova",
	"Republic of Moldova"
    },

    {
	"mg",
	"Madagascar",
	"Madagascar",
	"Republic of Madagascar"
    },

    {
	"mh",
	"Marshall Islands",
	"Marshall Islands",
	"Republic of the Marshall Islands"
    },

    {
	"mk",
	"Macedonia",
	"Macedonia",
	"The Former Yugoslav Republic of Macedonia"
    },

    {
	"ml",
	"Mali",
	"Mali",
	"Republic of Mali"
    },

    {
	"mm",
	"Myanmar",
	"Myanmar",
	"Union of Myanmar"
    },

    {
	"mn",
	"Mongolia",
	"Mongolia",
	"Mongolia"
    },

    {
	"mo",
	"Macau",
	"Macau",
	"Macau"
    },

    {
	"mp",
	"Northern Mariana Islands",
	"Northern Mariana Islands",
	"Northern Mariana Islands"
    },

    {
	"mq",
	"Martinique",
	"Martinique",
	"Martinique"
    },

    {
	"mr",
	"Mauritania",
	"Mauritania",
	"Islamic Republic of Mauritania"
    },

    {
	"ms",
	"Montserrat",
	"Montserrat",
	"Montserrat"
    },

    {
	"mt",
	"Malta",
	"Malta",
	"Malta"
    },

    {
	"mu",
	"Mauritius",
	"Republic of Mauritius",
	"Republic of Mauritius"
    },

    {
	"mv",
	"Maldives",
	"Republic of Maldives",
	"Republic of Maldives"
    },

    {
	"mw",
	"Malawi",
	"Malawi",
	"Malawi"
    },

    {
	"mx",
	"Mexico",
	"Mexico",
	"Mexico"
    },

    {
	"my",
	"Malaysia",
	"Malaysia",
	"Malaysia"
    },

    {
	"mz",
	"Mozambique",
	"Mozambique",
	"Republic of Mozambique"
    },

    {
	"na",
	"Namibia",
	"Namibia",
	"Republic of Namibia"
    },

    {
	"nc",
	"New Caledonia",
	"New Caledonia",
	"New Caledonia"
    },

    {
	"ne",
	"Niger",
	"Niger",
	"Republic of the Niger"
    },

    {
	"nf",
	"Norfolk Island",
	"Norfolk Island",
	"Norfolk Island"
    },

    {
	"ng",
	"Nigeria",
	"Nigeria",
	"Federal Republic of Nigeria"
    },

    {
	"ni",
	"Nicaragua",
	"Nicaragua",
	"Nicaragua"
    },

    {
	"nl",
	"Netherlands",
	"Netherlands",
	"Kingdom of the Netherlands"
    },

    {
	"no",
	"Norway",
	"Norway",
	"Norway"
    },

    {
	"np",
	"Nepal",
	"Nepal",
	"Nepal"
    },

    {
	"nr",
	"Nauru",
	"Nauru",
	"Republic of Nauru"
    },

    {
	"nt",
	"Neutral Zone",
	"Neutral Zone",
	"Neutral Zone"
    },

    {
	"nu",
	"Niue",
	"Niue",
	"Niue"
    },

    {
	"nz",
	"New Zealand",
	"New Zealand",
	"New Zealand (Aotearoa)"
    },

    {
	"om",
	"Oman",
	"Oman",
	"Sultanate of Oman"
    },

    {
	"pa",
	"Panama",
	"Panama",
	"Republic of Panama"
    },

    {
	"pe",
	"Peru",
	"Peru",
	"Peru"
    },

    {
	"pf",
	"French Polynesia",
	"French Polynesia",
	"French Polynesia"
    },

    {
	"pg",
	"Papua New Guinea",
	"Papua New Guinea",
	"Papua New Guinea"
    },

    {
	"ph",
	"Philippines",
	"Philippines",
	"Republic of the Philippines"
    },

    {
	"pk",
	"Pakistan",
	"Pakistan",
	"Islamic Republic of Pakistan"
    },

    {
	"pl",
	"Poland",
	"Poland",
	"Republic of Poland"
    },

    {
	"pm",
	"St. Pierre and Miquelon",
	"St. Pierre and Miquelon",
	"St. Pierre and Miquelon"
    },

    {
	"pn",
	"Pitcairn",
	"Pitcairn",
	"Pitcairn"
    },

    {
	"pr",
	"Puerto Rico",
	"Puerto Rico",
	"Puerto Rico"
    },

    {
	"ps",
	"Palestine",
	"Palestine",
	"Palestine Authority"
    },

    {
	"pt",
	"Portugal",
	"Portugal",
	"Portugal"
    },

    {
	"pw",
	"Palau",
	"Palau",
	"Republic of Palau"
    },

    {
	"py",
	"Paraguay",
	"Paraguay",
	"Republic of Paraguay"
    },

    {
	"qa",
	"Qatar",
	"Qatar",
	"State of Qatar"
    },

    {
	"re",
	"Reunion",
	"Reunion",
	"Reunion"
    },

    {
	"ro",
	"Romania",
	"Romania",
	"Romania"
    },

    {
	"ru",
	"Russia",
	"Russia",
	"Russian Federation"
    },

    {
	"rw",
	"Rwanda",
	"Rwanda",
	"Rwandese Republic"
    },

    {
	"sa",
	"Saudi Arabia",
	"Saudi Arabia",
	"Kingdom of Saudi Arabia"
    },

    {
	"sb",
	"Solomon Islands",
	"Solomon Islands",
	"Solomon Islands"
    },

    {
	"sc",
	"Seychelles",
	"Seychelles",
	"Republic of Seychelles"
    },

    {
	"sd",
	"Sudan",
	"Sudan",
	"Republic of the Sudan"
    },

    {
	"se",
	"Sweden",
	"Sweden",
	"Sweden"
    },

    {
	"sg",
	"Singapore",
	"Singapore",
	"Republic of Singapore"
    },

    {
	"sh",
	"St. Helena",
	"St. Helena",
	"St. Helena"
    },

    {
	"si",
	"Slovenia",
	"Slovenia",
	"Republic of Slovenia"
    },

    {
	"sj",
	"Svalbard and Jan Mayen",
	"Svalbard and Jan Mayen",
	"Svalbard and Jan Mayen Islands"
    },

    {
	"sk",
	"Slovak Republic",
	"Slovak Republic",
	"Slovak Republic"
    },

    {
	"sl",
	"Sierra Leone",
	"Sierra Leone",
	"Sierra Leone"
    },

    {
	"sm",
	"San Marino",
	"San Marino",
	"Republic of San Marino"
    },

    {
	"sn",
	"Senegal",
	"Senegal",
	"Republic of Senegal"
    },

    {
	"so",
	"Somalia",
	"Somalia",
	"Somali Democratic Republic"
    },

    {
	"sr",
	"Suriname",
	"Suriname",
	"Republic of Suriname"
    },

    {
	"st",
	"Sao Tome and Principe",
	"Sao Tome and Principe",
	"Democratic Republic of Sao Tome and Principe"
    },

    {
	"su",
	"Soviet Union",
	"Soviet Union (former)",
	"Union of Soviet Socialist Republics (former)"
    },

    {
	"sv",
	"El Salvador",
	"El Salvador",
	"Republic of El Salvador"
    },

    {
	"sy",
	"Syria",
	"Syria",
	"Syrian Arab Republic"
    },

    {
	"sz",
	"Swaziland",
	"Swaziland",
	"Kingdom of Swaziland"
    },

    {
	"tc",
	"Turks and Caicos",
	"Turks and Caicos",
	"Turks and Caicos Islands"
    },

    {
	"td",
	"Chad",
	"Chad",
	"Republic of Chad"
    },

    {
	"tf",
	"French Southern Territories",
	"French Southern Territories",
	"French Southern Territories"
    },

    {
	"tg",
	"Togo",
	"Togo",
	"Togolese Republic"
    },

    {
	"th",
	"Thailand",
	"Thailand",
	"Thailand"
    },

    {
	"tj",
	"Tajikistan",
	"Tajikistan",
	"Republic of Tajikistan"
    },

    {
	"tk",
	"Tokelau",
	"Tokelau",
	"Tokelau"
    },

    {
	"tm",
	"Turkmenistan",
	"Turkmenistan",
	"Turkmenistan"
    },

    {
	"tn",
	"Tunisia",
	"Tunisia",
	"Tunisia"
    },

    {
	"to",
	"Tonga",
	"Tonga",
	"Kingdom of Tonga"
    },

    {
	"tp",
	"East Timor",
	"East Timor",
	"East Timor"
    },

    {
	"tr",
	"Turkey",
	"Turkey",
	"Turkey"
    },

    {
	"tt",
	"Trinidad and Tobago",
	"Trinidad and Tobago",
	"Trinidad and Tobago"
    },

    {
	"tv",
	"Tuvalu",
	"Tuvalu",
	"Tuvalu"
    },

    {
	"tw",
	"Taiwan",
	"Taiwan",
	"Taiwan"
    },

    {
	"tz",
	"Tanzania",
	"Tanzania",
	"United Republic of Tanzania"
    },

    {
	"ua",
	"Ukraine",
	"Ukraine",
	"Ukraine"
    },

    {
	"ug",
	"Uganda",
	"Uganda",
	"Republic of Uganda"
    },

    {
	"uk",
	"United Kingdom",
	"United Kingdom",
	"United Kingdom (GB)"
    },

    {
	"um",
	"US Minor Outlying Islands",
	"US Minor Outlying Islands",
	"US Minor Outlying Islands"
    },

    {
	"un",
	"United Nations",
	"United Nations",
	"United Nations"
    },

    {
	"us",
	"USA",
	"USA",
	"United States of America"
    },

    {
	"uy",
	"Uruguay",
	"Uruguay",
	"Eastern Republic of Uruguay"
    },

    {
	"uz",
	"Uzbekistan",
	"Uzbekistan",
	"Republic of Uzbekistan"
    },

    {
	"va",
	"Vatican",
	"Vatican",
	"Vatican City State (Holy See)"
    },

    {
	"vc",
	"Saint Vincent and the Grenadines",
	"Saint Vincent and the Grenadines",
	"Saint Vincent and the Grenadines"
    },

    {
	"ve",
	"Venezuela",
	"Venezuela",
	"Republic of Venezuela"
    },

    {
	"vg",
	"Virgin Islands (British)",
	"Virgin Islands (British)",
	"Virgin Islands (British)"
    },

    {
	"vi",
	"Virgin Islands (US)",
	"Virgin Islands (US)",
	"Virgin Islands (US)"
    },

    {
	"vn",
	"Vietnam",
	"Vietnam",
	"Socialist Republic of Viet Nam"
    },

    {
	"vu",
	"Republic of Vanuatu",
	"Republic of Vanuatu",
	"Republic of Vanuatu"
    },

    {
	"wf",
	"Wallis and Futuna Islands",
	"Wallis and Futuna Islands",
	"Wallis and Futuna Islands"
    },

    {
	"wmo",
	"World Meteorological Organization",
	"World Meteorological Organization",
	"World Meteorological Organization"
    },

    {
	"ws",
	"Western Samoa",
	"Western Samoa",
	"Independent State of Western Samoa"
    },

    {
	"ye",
	"Yemen",
	"Yemen",
	"Republic of Yemen"
    },

    {
	"yt",
	"Mayotte",
	"Mayotte",
	"Mayotte"
    },

    {
	"yu",
	"Yugoslavia",
	"Yugoslavia",
	"Federal Republic of Yugoslavia"
    },

    {
	"za",
	"South Africa",
	"South Africa",
	"Republic of South Africa"
    },

    {
	"zm",
	"Zambia",
	"Zambia",
	"Republic of Zambia"
    },

    {
	"zr",
	"Zaire",
	"Zaire",
	"Zaire"
    },

    {
	"zw",
	"Zimbabwe",
	"Zimbabwe",
	"Republic of Zimbabwe"
    },

    {
	NULL,
	NULL,
	NULL,
	NULL
    }
};

__PROTO_BEGIN__
//-----------------------------------------------------------------------------
// function	country_name_table
//
// purpose	Return a pointer to the country code to name table.
//
// arguments	-none-
//
// returns	(struct country_name *) pointer to country code to name table
//
// note		A future version of this function will read the country name
//		mapping table in from a shared resource file instead of having
//		it hard coded here.
//-----------------------------------------------------------------------------
struct country_name *
country_name_table ()
__PROTO_END__
{
    return country_name_array;
}

__PROTO_BEGIN__
//-----------------------------------------------------------------------------
// function	country_to_name_entry
//
// purpose	Given a country code (or a special code for international
//		administrative units), store a pointer to the entry of type
//		struct country_name which contains the short name, long name,
//		and sorting name for that country.
//
// argument	1 (const char *) country code string
//
// returns	(struct country_name *) NULL : country code not found
//		(struct country_name *) pointer to country entry
//
// note		Do not modify the strings pointed to.
//-----------------------------------------------------------------------------
struct country_name *
country_to_name_entry (
    const char *	arg_country_p
    )
__PROTO_END__
{
    struct country_name *	cc_p	;

    //------------------------------------------------
    // Some day I'll come back and do a binary search.
    // But for the mean time, a linear search will do.
    // It's not like list is going to scale up huge.
    //------------------------------------------------
    cc_p = country_name_table();
    while ( cc_p->code ) {
	if ( strcasecmp( cc_p->code, arg_country_p ) == 0 ) return cc_p;
	++ cc_p;
    }
    return NULL;
}

