we don't have iso3166.tab, but we have iso3166 file with little diff
we have 4 field per line like this:
two three number name
{
char* line = NULL;
size_t linelen = 0;
+ int nameonfourthfield = 0;
CStdString s;
vector<CStdString> tokens;
// Load countries
fp = fopen("/usr/share/zoneinfo/iso3166.tab", "r");
+ if (!fp)
+ {
+ fp = fopen("/usr/share/misc/iso3166", "r");
+ nameonfourthfield = 1;
+ }
if (fp)
{
CStdString countryCode;
int i = 2;
while (s[i] == ' ' || s[i] == '\t') i++;
+ if (nameonfourthfield)
+ {
+ // skip three letter
+ while (s[i] != ' ' && s[i] != '\t') i++;
+ while (s[i] == ' ' || s[i] == '\t') i++;
+ // skip number
+ while (s[i] != ' ' && s[i] != '\t') i++;
+ while (s[i] == ' ' || s[i] == '\t') i++;
+ }
+
countryCode = s.Left(2);
countryName = s.Mid(i);