71 |
static gint adif_qso_foreach |
static gint adif_qso_foreach |
72 |
(LOGDB *handle, gint (*fn)(LOGDB*, qso_t*, gpointer arg), gpointer arg) |
(LOGDB *handle, gint (*fn)(LOGDB*, qso_t*, gpointer arg), gpointer arg) |
73 |
{ |
{ |
74 |
gchar line [1024], sdate[16], *buffer, *p; |
gchar line [1024], sdate[16], *buffer, *p, *tmp; |
75 |
gchar **adifline, **adifitem, **adifid; |
gchar **adifline, **adifitem, **adifid; |
76 |
gint ret, items, i=0; |
gint ret, items, i=0; |
77 |
struct tm timestruct; |
struct tm timestruct; |
146 |
adif_field = BAND; |
adif_field = BAND; |
147 |
if (g_strrstr(adifitem[1], "m") || |
if (g_strrstr(adifitem[1], "m") || |
148 |
g_strrstr(adifitem[1], "M")) |
g_strrstr(adifitem[1], "M")) |
149 |
{ |
{ /* convert band to freq */ |
150 |
if (g_ascii_strncasecmp (adifitem[1], "160", 3) == 0) |
if (g_ascii_strncasecmp (adifitem[1], "160", 3) == 0) |
151 |
q[adif_field] = g_strdup ("1.8"); |
q[adif_field] = g_strdup ("1.8"); |
152 |
else if (g_ascii_strncasecmp (adifitem[1], "80", 2) == 0) |
else if (g_ascii_strncasecmp (adifitem[1], "80", 2) == 0) |
246 |
else if (!strcasecmp (adifid[0], "COMMENT")) |
else if (!strcasecmp (adifid[0], "COMMENT")) |
247 |
{ |
{ |
248 |
adif_field = REMARKS; |
adif_field = REMARKS; |
249 |
q[adif_field] = |
/* append comment to remarks */ |
250 |
g_strndup (adifitem[1], atoi(adifid[1])); |
if (q[REMARKS]) |
251 |
|
{ |
252 |
|
tmp = g_strndup (adifitem[1], atoi(adifid[1])); |
253 |
|
q[adif_field] = |
254 |
|
g_strconcat (q[adif_field], ", ", tmp, NULL); |
255 |
|
g_free (tmp); |
256 |
|
} |
257 |
|
else |
258 |
|
q[adif_field] = |
259 |
|
g_strndup (adifitem[1], atoi(adifid[1])); |
260 |
} |
} |
261 |
|
else if (!strcasecmp (adifid[0], "NOTES")) |
262 |
|
{ |
263 |
|
adif_field = REMARKS; |
264 |
|
/* append notes to remarks */ |
265 |
|
if (q[REMARKS]) |
266 |
|
{ |
267 |
|
tmp = g_strndup (adifitem[1], atoi(adifid[1])); |
268 |
|
q[adif_field] = |
269 |
|
g_strconcat (q[adif_field], ", ", tmp, NULL); |
270 |
|
g_free (tmp); |
271 |
|
} |
272 |
|
else |
273 |
|
q[adif_field] = |
274 |
|
g_strndup (adifitem[1], atoi(adifid[1])); |
275 |
|
|
276 |
|
} |
277 |
g_strfreev (adifid); |
g_strfreev (adifid); |
278 |
g_strfreev (adifitem); |
g_strfreev (adifitem); |
279 |
} |
} |