118 |
} |
} |
119 |
} |
} |
120 |
|
|
|
/* |
|
|
static void convert_to_hashtable(void) |
|
|
{ |
|
|
guint i, ITUindex = 0, otherindex = 0; |
|
|
gchar **dxccsplit = NULL, *otherprefix = NULL, *reverseprimaryprefix = NULL, |
|
|
**ITUsplit = NULL, **othersplit = NULL; |
|
|
|
|
|
for (i = 0; i <= state.countries; i++) |
|
|
{ |
|
|
dxccsplit = g_strsplit(dxcc[i], ":", 0); |
|
|
|
|
|
reverseprimaryprefix = g_strdup(dxccsplit[0]); |
|
|
g_strreverse(reverseprimaryprefix); |
|
|
|
|
|
if (g_strncasecmp(reverseprimaryprefix, "*", 1) != 0) |
|
|
{ |
|
|
if (g_strcasecmp(dxccsplit[0], "") != 0) |
|
|
{ |
|
|
if (!find_underscore(dxccsplit[0], dxccsplit[0], i)) |
|
|
{ |
|
|
g_hash_table_insert(prefixes, g_strdup(dxccsplit[0]), GINT_TO_POINTER(i + 1)); |
|
|
state.prefixes++; |
|
|
} |
|
|
} |
|
|
if (g_strcasecmp(dxccsplit[8], "") != 0) |
|
|
{ |
|
|
ITUsplit = g_strsplit(dxccsplit[8], ",", 0); |
|
|
for (;;) |
|
|
{ |
|
|
if (ITUsplit[ITUindex] == NULL) break; |
|
|
if (!find_dash(ITUsplit[ITUindex], dxccsplit[0], i)) |
|
|
if (g_strcasecmp(ITUsplit[ITUindex], dxccsplit[0]) != 0) |
|
|
{ |
|
|
g_hash_table_insert(prefixes, g_strdup(ITUsplit[ITUindex]), |
|
|
GINT_TO_POINTER(i + 1)); |
|
|
state.prefixes++; |
|
|
} |
|
|
ITUindex++; |
|
|
} |
|
|
ITUindex = 0; |
|
|
} |
|
|
otherprefix = g_strndup(dxccsplit[9], strlen(dxccsplit[9])-1); |
|
|
if (g_strcasecmp(otherprefix, "") != 0) |
|
|
{ |
|
|
othersplit = g_strsplit(otherprefix, ",", 0); |
|
|
for (;;) |
|
|
{ |
|
|
if (othersplit[otherindex] == NULL) break; |
|
|
if (!find_dash(othersplit[otherindex], dxccsplit[0], i)) |
|
|
if (!find_underscore(othersplit[otherindex], dxccsplit[0], i)) |
|
|
if (g_strcasecmp(othersplit[otherindex], dxccsplit[0]) != 0) |
|
|
{ |
|
|
g_hash_table_insert(prefixes, g_strdup(othersplit[otherindex]), |
|
|
GINT_TO_POINTER(i + 1)); |
|
|
state.prefixes++; |
|
|
} |
|
|
otherindex++; |
|
|
} |
|
|
otherindex = 0; |
|
|
} |
|
|
} |
|
|
} |
|
|
g_free(reverseprimaryprefix); |
|
|
g_free(otherprefix); |
|
|
g_strfreev(othersplit); |
|
|
g_strfreev(ITUsplit); |
|
|
g_strfreev(dxccsplit); |
|
|
} |
|
|
*/ |
|
121 |
|
|
122 |
static gchar * |
static gchar * |
123 |
findpfx (gchar * pfx) |
findpfx (gchar * pfx) |
206 |
return (0); |
return (0); |
207 |
} |
} |
208 |
|
|
|
/* |
|
|
void loaddxcc(void) |
|
|
{ |
|
|
gchar *dxccfile, line[200]; |
|
|
FILE *fp; |
|
|
gint i; |
|
|
|
|
|
dxcc = g_new0(gchar *, 400); |
|
|
for (i = 0; i < 400; i++) |
|
|
dxcc[i] = g_new0(gchar, 200); |
|
|
|
|
|
dxccfile = g_strconcat(PACKAGE_DATA_DIR, G_DIR_SEPARATOR_S, "dxcc", |
|
|
G_DIR_SEPARATOR_S, "dxcck2di.txt", NULL); |
|
|
fp = fopen(dxccfile, "r"); |
|
|
if (fp != NULL) |
|
|
{ |
|
|
|
|
|
for(;;) { |
|
|
fgets(line, 200, fp); |
|
|
if (g_strncasecmp(line, "---", 3) == 0) break; |
|
|
} |
|
|
fgets(line, 200, fp); |
|
|
|
|
|
for(;;) { |
|
|
fgets(line, 200, fp); |
|
|
if (g_strncasecmp(line, "---", 3) == 0 || state.countries == 400) { |
|
|
state.countries--; |
|
|
break; |
|
|
} |
|
|
dxcc[state.countries++] = g_strdup(line); |
|
|
} |
|
|
fclose(fp); |
|
|
prefixes = g_hash_table_new(g_str_hash, g_str_equal); |
|
|
convert_to_hashtable(); |
|
|
} |
|
|
g_free(dxccfile); |
|
|
}*/ |
|
209 |
|
|
210 |
static gint |
static gint |
211 |
lookup_dxcc (gchar * callsign) |
lookup_dxcc (gchar * callsign) |