/[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.7 by pa4tu, Sat Nov 23 14:29:54 2002 UTC revision 1.8 by pa4tu, Sat Nov 23 14:45:52 2002 UTC
# Line 141  static gchar * Line 141  static gchar *
141  getpx (gchar *checkcall)  getpx (gchar *checkcall)
142  {  {
143    
144    gchar *pxstr, **split;    gchar *pxstr = NULL, **split;
145    
146    /* characters after '/' might contain a country */    /* characters after '/' might contain a country */
147    if (strchr(checkcall, '/'))    if (strchr(checkcall, '/'))
# Line 168  getpx (gchar *checkcall) Line 168  getpx (gchar *checkcall)
168  static gint  static gint
169  lookup_dxcc (gchar * callsign)  lookup_dxcc (gchar * callsign)
170  {  {
171    gint ipx, country = -1;    gint ipx, country = 0;
172    gchar *px, *searchpx = NULL;    gchar *px, *searchpx = NULL;
173    
174    px = getpx(callsign);    px = getpx(callsign);
   
175    for (ipx = strlen(px); ipx > 0; ipx--)    for (ipx = strlen(px); ipx > 0; ipx--)
176    {    {
177      searchpx = g_strndup (px, ipx);      searchpx = g_strndup (px, ipx);
178      country = GPOINTER_TO_INT (g_hash_table_lookup (prefixes, searchpx));      country = GPOINTER_TO_INT (g_hash_table_lookup (prefixes, searchpx));
179      if (country >= 0) break;      if (country > 0) break;
180    }    }
181    
182    g_free (px);    if (strlen(px) > 0) g_free (px);
183    if (strlen(searchpx) > 0) g_free(searchpx);    if (strlen(searchpx) > 0) g_free(searchpx);
184    
185    return (country);    return (country);

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

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