/[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.9 by pa4tu, Sat Nov 23 15:03:32 2002 UTC revision 1.10 by pa4tu, Sat Nov 23 15:42:26 2002 UTC
# Line 138  readctydata (void) Line 138  readctydata (void)
138  }  }
139    
140  static gchar *  static gchar *
141    replace (gchar *callsign, gint area)
142    {
143      gchar *end, *j;
144    
145      end = callsign + strlen (callsign);
146      for (j = callsign; j < end; ++j)
147        {
148          switch (*j)
149            {
150            case '0' ... '9':
151              if ((j - callsign) > 1)
152                *j = area + 48;
153              break;
154            }
155        }
156      
157      return(g_strdup(callsign));
158    }
159    
160    static gchar *
161  getpx (gchar *checkcall)  getpx (gchar *checkcall)
162  {  {
163    
# Line 150  getpx (gchar *checkcall) Line 170  getpx (gchar *checkcall)
170      if (split[1]) /* we might be typing */      if (split[1]) /* we might be typing */
171      {      {
172        if ((strlen(split[1]) > 1) &&        if ((strlen(split[1]) > 1) &&
173                  (strlen(split[1]) < strlen(split[0])))                  (strlen(split[1]) < strlen(split[0])))
174          /* this might be a candidate */
175        {        {
176        if ((g_strcasecmp(split[1], "AM") == 0) ||        if ((g_strcasecmp(split[1], "AM") == 0) ||
177                  (g_strcasecmp(split[1], "MM") == 0))                  (g_strcasecmp(split[1], "MM") == 0))
# Line 159  getpx (gchar *checkcall) Line 180  getpx (gchar *checkcall)
180            pxstr = g_strdup(split[0]);            pxstr = g_strdup(split[0]);
181          else pxstr = g_strdup(split[1]);          else pxstr = g_strdup(split[1]);
182        }        }
183          else if ((strlen(split[1]) == 1) && atoi(split[1]))
184          /* callsign area changed */
185          {
186            pxstr = replace(split[0], atoi(split[1]));
187          }
188      }      }
189      else pxstr = g_strdup(split[0]);      else pxstr = g_strdup(split[0]);
190      g_strfreev(split);      g_strfreev(split);
191    }    }
192    else pxstr = g_strdup(checkcall);    else pxstr = g_strdup(checkcall);
193    
194    return(pxstr);    return(pxstr);
195  }  }
196    

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

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