--- ../xlog-1.4/src/logfile/cabrillo.c 2006-11-29 17:13:48.000000000 +0100 +++ src/logfile/cabrillo.c 2007-01-23 10:15:17.000000000 +0100 @@ -1,6 +1,6 @@ /* * xlog - GTK+ logging program for amateur radio operators - * Copyright (C) 2001 - 2006 Joop Stakenborg + * Copyright (C) 2001 - 2007 Joop Stakenborg * * 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 @@ -26,10 +26,19 @@ */ #include -#include #include +#include +#include +#ifndef __USE_XOPEN +#define __USE_XOPEN +#endif +#include #include -#include + +#ifndef HAVE_STRPTIME +#include "strptime.h" +#define strptime(s,f,t) mystrptime(s,f,t) +#endif #include "logfile.h" #include "preferences.h" @@ -241,10 +250,11 @@ FILE *fp = (FILE *) handle->priv; gint i, ret; qso_t q[QSO_FIELDS]; - gchar *field, *end, buffer[MAXROWLEN]; + gchar *field, *end, buffer[MAXROWLEN], buf[20], *res = NULL; enum cbr_contest_type contest_type = CBR_OTHER; const gint *widths = cabrillo_widths; gint sent_call_len = 14; + struct tm tm_cab; while (!feof (fp)) { @@ -291,7 +301,23 @@ end = field + widths[i]; *end = '\0'; - q[cabrillo_fields[i]] = g_strdup (g_strstrip (field)); + + /* reformat date 2007-01-23 -> 23 Jan 2007 */ + if (i == 2) + { + res = strptime (field, "%Y-%m-%d", &tm_cab); + if (res != NULL) + { + setlocale (LC_TIME, ""); + strftime (buf, 20, "%d %b %Y", &tm_cab); + setlocale (LC_TIME, "C"); + } + else + strcpy (buf, field); + q[cabrillo_fields[i]] = g_strdup (g_strstrip (buf)); + } + else + q[cabrillo_fields[i]] = g_strdup (g_strstrip (field)); field = end + 1; }