/[xlog]/xlog/src/dxcc.c
ViewVC logotype

Diff of /xlog/src/dxcc.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.8 by pa4tu, Sat Nov 23 14:45:52 2002 UTC revision 1.9 by pa4tu, Sat Nov 23 15:03:32 2002 UTC
# Line 146  getpx (gchar *checkcall) Line 146  getpx (gchar *checkcall)
146    /* characters after '/' might contain a country */    /* characters after '/' might contain a country */
147    if (strchr(checkcall, '/'))    if (strchr(checkcall, '/'))
148    {    {
149    split = g_strsplit(checkcall, "/", 2);      split = g_strsplit(checkcall, "/", 2);
150    if ((strlen(split[1]) > 1) &&      if (split[1]) /* we might be typing */
     (strlen(split[1]) < strlen(split[0])))  
151      {      {
152          if ((strlen(split[1]) > 1) &&
153                    (strlen(split[1]) < strlen(split[0])))
154          {
155        if ((g_strcasecmp(split[1], "AM") == 0) ||        if ((g_strcasecmp(split[1], "AM") == 0) ||
156          (g_strcasecmp(split[1], "MM") == 0))                  (g_strcasecmp(split[1], "MM") == 0))
157            pxstr = NULL;            pxstr = NULL; /* don't know location */
158          else if (g_strcasecmp(split[1], "QRP") == 0)          else if (g_strcasecmp(split[1], "QRP") == 0)
159            pxstr = g_strdup(split[0]);            pxstr = g_strdup(split[0]);
160          else pxstr = g_strdup(split[1]);          else pxstr = g_strdup(split[1]);
161          }
162      }      }
163      else pxstr = g_strdup(split[0]);      else pxstr = g_strdup(split[0]);
164      g_strfreev(split);      g_strfreev(split);
# Line 172  lookup_dxcc (gchar * callsign) Line 175  lookup_dxcc (gchar * callsign)
175    gchar *px, *searchpx = NULL;    gchar *px, *searchpx = NULL;
176    
177    px = getpx(callsign);    px = getpx(callsign);
178    for (ipx = strlen(px); ipx > 0; ipx--)    if (px)
179    {    {
180      searchpx = g_strndup (px, ipx);      for (ipx = strlen(px); ipx > 0; ipx--)
181      country = GPOINTER_TO_INT (g_hash_table_lookup (prefixes, searchpx));      {
182      if (country > 0) break;        searchpx = g_strndup (px, ipx);
183          country = GPOINTER_TO_INT (g_hash_table_lookup (prefixes, searchpx));
184          g_free(searchpx);
185          if (country > 0) break;
186        }
187        g_free (px);
188    }    }
189      else country = 0;
   if (strlen(px) > 0) g_free (px);  
   if (strlen(searchpx) > 0) g_free(searchpx);  
190    
191    return (country);    return (country);
192  }  }

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.9

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26