rendered paste bodydiff -cr xlog-1.4/src/logfile/cabrillo.c xlog-1.4.jla2/src/logfile/cabrillo.c
*** xlog-1.4/src/logfile/cabrillo.c Wed Nov 29 09:13:48 2006
--- xlog-1.4.jla2/src/logfile/cabrillo.c Mon Jun 11 08:18:19 2007
***************
*** 147,153 ****
* there's no exchange fields in xlog. However, the exchange information
* may be piggybacked by the rst field. eg. "599ON".
*/
! if (!strcmp (q_mode, "SSB") || !strcmp (q_mode, "LSB")
|| !strcmp (q_mode, "LSB") || !strcmp (q_mode, "FM"))
rst_len = 2;
else
--- 147,153 ----
* there's no exchange fields in xlog. However, the exchange information
* may be piggybacked by the rst field. eg. "599ON".
*/
! if (!strcmp (q_mode, "SSB") || !strcmp (q_mode, "USB")
|| !strcmp (q_mode, "LSB") || !strcmp (q_mode, "FM"))
rst_len = 2;
else
diff --git a/src/logfile/cabrillo.c b/src/logfile/cabrillo.c
index 2c8d627..2fa1a52 100644
--- a/src/logfile/cabrillo.c
+++ b/src/logfile/cabrillo.c
@@ -157,7 +157,7 @@ cabrillo_qso_append (LOGDB * handle, const qso_t * q)
* there's no exchange fields in xlog. However, the exchange information
* may be piggybacked by the rst field. eg. "599ON".
*/
- if (!strcmp (q_mode, "SSB") || !strcmp (q_mode, "LSB")
+ if (!strcmp (q_mode, "SSB") || !strcmp (q_mode, "USB")
|| !strcmp (q_mode, "LSB") || !strcmp (q_mode, "FM"))
rst_len = 2;
else
*** xlog-1.4/src/logfile/cabrillo.c Wed Nov 29 09:13:48 2006
--- xlog.git/src/logfile/cabrillo.c Mon Jun 11 07:01:48 2007
***************
*** 1,6 ****
/*
* xlog - GTK+ logging program for amateur radio operators
! * Copyright (C) 2001 - 2006 Joop Stakenborg <pg4i@amsat.org>
*
* 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
--- 1,6 ----
/*
* xlog - GTK+ logging program for amateur radio operators
! * Copyright (C) 2001 - 2007 Joop Stakenborg <pg4i@amsat.org>
*
* 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,38 ****
*/
#include <stdlib.h>
- #include <string.h>
#include <stdio.h>
#include <glib.h>
! #include <ctype.h>
#include "logfile.h"
#include "preferences.h"
extern preferencestype preferences;
--- 26,48 ----
*/
#include <stdlib.h>
#include <stdio.h>
+ #include <string.h>
+ #include <locale.h>
+ #ifndef __USE_XOPEN
+ #define __USE_XOPEN
+ #endif
+ #include <time.h>
#include <glib.h>
!
! #ifndef HAVE_STRPTIME
! #include "strptime.h"
! #define strptime(s,f,t) mystrptime(s,f,t)
! #endif
#include "logfile.h"
#include "preferences.h"
+ #include "utils.h"
extern preferencestype preferences;
***************
*** 147,156 ****
* there's no exchange fields in xlog. However, the exchange information
* may be piggybacked by the rst field. eg. "599ON".
*/
! if (!strcmp (q_mode, "SSB") || !strcmp (q_mode, "LSB")
|| !strcmp (q_mode, "LSB") || !strcmp (q_mode, "FM"))
rst_len = 2;
! else
rst_len = 3;
strncpy (rst, q[RST], rst_len);
--- 157,166 ----
* there's no exchange fields in xlog. However, the exchange information
* may be piggybacked by the rst field. eg. "599ON".
*/
! if (!strcmp (q_mode, "SSB") || !strcmp (q_mode, "USB")
|| !strcmp (q_mode, "LSB") || !strcmp (q_mode, "FM"))
rst_len = 2;
! else
rst_len = 3;
strncpy (rst, q[RST], rst_len);
***************
*** 241,256 ****
FILE *fp = (FILE *) handle->priv;
gint i, ret;
qso_t q[QSO_FIELDS];
! gchar *field, *end, buffer[MAXROWLEN];
enum cbr_contest_type contest_type = CBR_OTHER;
const gint *widths = cabrillo_widths;
gint sent_call_len = 14;
while (!feof (fp))
{
if (!fgets (buffer, MAXROWLEN - 1, fp))
break;
/* valid record starts with "QSO: " */
if (strncmp (buffer, "QSO: ", 5))
{
--- 251,269 ----
FILE *fp = (FILE *) handle->priv;
gint i, ret;
qso_t q[QSO_FIELDS];
! 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;
+ gboolean phone;
while (!feof (fp))
{
if (!fgets (buffer, MAXROWLEN - 1, fp))
break;
+ phone = FALSE;
/* valid record starts with "QSO: " */
if (strncmp (buffer, "QSO: ", 5))
{
***************
*** 291,297 ****
end = field + widths[i];
*end = '\0';
! q[cabrillo_fields[i]] = g_strdup (g_strstrip (field));
field = end + 1;
}
--- 304,360 ----
end = field + widths[i];
*end = '\0';
!
! /* check the different mode strings and store mode */
! if (i == 1)
! {
! if (!strcmp (field, "PH"))
! {
! phone = TRUE;
! strcpy (buf, "SSB");
! }
! else if (!strcmp (field, "RY"))
! strcpy (buf, "RTTY");
! else
! strcpy (buf, field);
! q[cabrillo_fields[i]] = g_strdup (buf);
! }
!
! /* reformat date 2007-01-23 -> 23 Jan 2007 */
! else 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 (buf);
! }
!
! else if (i == 4 || i == 6)
! {/* TODO: add prepending zero's if serial */
! if (phone)
! {
! strcpy (buf, field + 2);
! g_strstrip (buf);
! field[2] = '\0';
! }
! else
! {
! strcpy (buf, field + 3);
! g_strstrip (buf);
! field[3] = '\0';
! }
! q[cabrillo_fields[i]] =
! g_strdup_printf ("%s%s", field, buf);
! }
!
! else
! q[cabrillo_fields[i]] = g_strdup (g_strstrip (field));
field = end + 1;
}