File: finddef.c

package info (click to toggle)
icmake 6.22-7
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,148 kB
  • ctags: 1,042
  • sloc: ansic: 9,241; makefile: 1,134; sh: 235; asm: 126
file content (38 lines) | stat: -rw-r--r-- 920 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
/*
\funcref{finddef}{int finddef (\params)}
    {
        {char} {*s} {identifier to search for}
    }
    {index in {\em defined} array if identifier found, or {\em -1} if not
     found}
    {}
    {}
    {finddef.c}
    {

        Function {\em finndef()} attempts to find an identifier {\em s} in the
        array of defined identifiers. The {\em defined} array consists of
        structs, holding the redefined identifier (field {\em ident}) and the
        redefinition string (field {\em redef}).

        An index into {\em defined} is returned; at {\em defined[ret].redef}
        the redefinition string can be found. If the identifier is not found in
        {\em redef}, {\em --1} is returned.

    }
*/

#include "icm-pp.h"

int finddef (s)
char *s;
{
    register int
        i;

    for (i = 0; i < ndefined; i++)
        if (! strcmp (defined [i].ident, s))
            return (i);

    return (-1);
}