~ubuntu-branches/ubuntu/saucy/tlf/saucy

« back to all changes in this revision

Viewing changes to src/searchcallarray.c

  • Committer: Package Import Robot
  • Author(s): John T. Nogatch
  • Date: 2013-02-09 14:56:34 UTC
  • mfrom: (1.2.5) (3.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20130209145634-de47b40lyf5ntgsu
Tags: 1.1.5-1
* Update from upstream git
* LP: #854080, #514303

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
/*
2
2
 * Tlf - contest logging program for amateur radio operators
3
3
 * Copyright (C) 2001-2002-2003 Rein Couperus <pa0rct@amsat.org>
 
4
 *               2011 Thomas Beierlein <tb@forth-ev.de>
4
5
 *
5
6
 * This program is free software; you can redistribute it and/or modify
6
7
 * it under the terms of the GNU General Public License as published by
17
18
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
18
19
 */
19
20
        /* ------------------------------------------------------------
20
 
        *      search  call array
21
 
        *
22
 
        *--------------------------------------------------------------*/
23
 
 
24
 
        #include "searchcallarray.h"
25
 
        
26
 
        int searchcallarray  (char  *hiscall)
27
 
        {
28
 
//      extern char hiscall[];
29
 
        extern int callarray_nr;
30
 
        extern char callarray[MAX_CALLS][20];
31
 
        
32
 
        int found = 0;
33
 
        int i;
34
 
        static char cbuffer[40] = "";
35
 
        
36
 
                
37
 
                cbuffer[0] = '\0';
38
 
                strcat(cbuffer,  hiscall);
39
 
                strcat(cbuffer, "           ");
40
 
                cbuffer[10] = '\0';
41
 
                        
42
 
                for (i = 0 ; i  <= callarray_nr ; i++){
43
 
                        
44
 
                        if (strcmp(callarray[i], cbuffer) == 0){
45
 
                                found = i;
46
 
                                break;
47
 
                        }
48
 
                        
49
 
                 }
50
 
        
51
 
             return (found);
52
 
        }
53
 
 
 
21
         *      search  call array
 
22
         *
 
23
         *--------------------------------------------------------------*/
 
24
 
 
25
#include "searchcallarray.h"
 
26
 
 
27
/**     \brief lookup 'hiscall' in callarray
 
28
 *
 
29
 *      See if 'hiscall' was already worked by looking it up in callarray
 
30
 *      \param hiscall  callsign to lookup
 
31
 *      \return index in callarray where hiscall was found (-1 if not found)
 
32
 */
 
33
int searchcallarray(char *hiscall)
 
34
{
 
35
    extern int callarray_nr;
 
36
    extern char callarray[MAX_CALLS][20];
 
37
 
 
38
    int found = -1;
 
39
    int i;
 
40
 
 
41
    for (i = 0; i < callarray_nr; i++) {
 
42
 
 
43
        if (strcmp(callarray[i], hiscall) == 0) {
 
44
            found = i;
 
45
            break;
 
46
        }
 
47
 
 
48
    }
 
49
 
 
50
    return (found);
 
51
}