2 Copyright © 1995-2007, The AROS Development Team. All rights reserved.
5 Desc: Program that makes country files
17 struct CountryPrefs
*ca_Data
;
20 extern struct CountryPrefs
27 bosna_i_hercegovinaPrefs
,
74 /* Please keep this in alphabetical order, ie the order of Latin 1 */
76 struct CountryEntry CountryArray
[] =
78 { "andorra" , &andorraPrefs
},
79 { "angola" , &angolaPrefs
},
80 { "argentina" , &argentinaPrefs
},
81 { "australia" , &australiaPrefs
},
82 { "belgië" , &belgiePrefs
},
83 { "belgique" , &belgiquePrefs
},
84 { "bosna_i_hercegovina", &bosna_i_hercegovinaPrefs
},
85 { "brasil" , &brasilPrefs
},
86 { "bulgarija" , &bulgarijaPrefs
},
87 { "cabo_verde" , &cabo_verdePrefs
},
88 { "canada" , &canadaPrefs
},
89 { "canada_français" , &canada_francaisPrefs
},
90 { "czech_republic" , &czech_republicPrefs
},
91 { "danmark" , &danmarkPrefs
},
92 { "deutschland" , &deutschPrefs
},
93 { "éire" , &eirePrefs
},
94 { "españa" , &espanaPrefs
},
95 { "france" , &francePrefs
},
96 { "great_britain" , &greatBritainPrefs
},
97 { "hrvatska" , &hrvatskaPrefs
},
98 { "iran" , &iranPrefs
},
99 { "ireland" , &irelandPrefs
},
100 { "ísland" , &islandPrefs
},
101 { "italia" , &italiaPrefs
},
102 { "jugoslavija" , &jugoslavijaPrefs
},
103 { "liechtenstein" , &liechtensteinPrefs
},
104 { "lëtzebuerg" , &letzebuergPrefs
},
105 { "lietuva" , &lietuvaPrefs
},
106 { "magyarország" , &magyarorszagPrefs
},
107 { "monaco" , &monacoPrefs
},
108 { "nihon" , &nihonPrefs
},
109 { "nederland" , &nederlandPrefs
},
110 { "norge" , &norgePrefs
},
111 { "österreich" , &osterreichPrefs
},
112 { "polska" , &polskaPrefs
},
113 { "portugal" , &portugalPrefs
},
114 { "românia" , &romaniaPrefs
},
115 { "rossija" , &rossijaPrefs
},
116 { "san_marino" , &san_marinoPrefs
},
117 { "schweiz" , &schweizPrefs
},
118 { "slovakia" , &slovakiaPrefs
},
119 { "slovenija" , &slovenijaPrefs
},
120 { "suisse" , &suissePrefs
},
121 { "suomi" , &suomiPrefs
},
122 { "sverige" , &sverigePrefs
},
123 { "svizzera" , &svizzeraPrefs
},
124 { "timor-leste" , &timor_lestePrefs
},
125 { "türkiye" , &turkiyePrefs
},
126 { "ukrajina" , &ukrajinaPrefs
},
127 { "united_kingdom" , &united_kingdomPrefs
},
128 { "united_states" , &united_statesPrefs
},
129 { "vaticano" , &vaticanoPrefs
},
133 /* This is equivalent to the start of the catalog file.
134 It is a series of strings, so that the endianness is
139 "FORM" "\x00\x00\x02\x12" "PREF"
141 "PRHD" "\x00\x00\x00\x06"
142 "\x00\x00\x00\x00\x00\x00"
144 "CTRY" "\x00\x00\x01\xF8"
147 void convertEndianness(struct CountryPrefs
*cp
);
148 unsigned long getCountryPrefsSize(void);
150 int doCountry(struct CountryPrefs
*cp
, char *progname
, char *filename
)
154 fp
= fopen(filename
, "w");
157 printf("%s: Could not open file %s\n", progname
, filename
);
161 /* Write the preamble...
167 if(fwrite(preamble
, 34, 1, fp
) < 1)
169 printf("%s: Write error during preable of %s.\n", progname
, filename
);
174 convertEndianness(cp
);
176 if(fwrite(cp
, getCountryPrefsSize(), 1, fp
) < 1)
178 printf("%s: Write error during data for %s.\n", progname
, filename
);
187 int main(int argc
, char **argv
)
193 size_t inbytes
, outbytes
;
198 printf("%s: Wrong number of arguments\n", argv
[0]);
202 cd
= iconv_open("ISO-8859-1", "ISO-8859-1");
203 if(cd
== (iconv_t
)(-1))
205 printf("%s: Error converting character sets\n", argv
[0]);
209 for(i
=2; i
< argc
; i
++)
211 for(j
=0; CountryArray
[j
].ca_Name
!= NULL
; j
++)
213 /* Convert country name to local character set */
214 inpos
= CountryArray
[j
].ca_Name
;
215 inbytes
= strlen(inpos
) + 1;
218 iconv(cd
, &inpos
, &inbytes
, &outpos
, &outbytes
);
220 res
= strcmp(buffer
, argv
[i
]);
223 strcpy(buffer
, argv
[1]);
224 strcat(buffer
, argv
[i
]);
225 strcat(buffer
, ".country");
226 doCountry(CountryArray
[j
].ca_Data
, argv
[0], buffer
);
230 /* stegerg: does not work because of 'ö' in österreich */
231 /* If countryArray < argv[] don't bother searching */
239 printf("Unknown country %s\n", argv
[i
]);