File: inlist.c

package info (click to toggle)
icmake 6.22-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 2,120 kB
  • ctags: 1,045
  • sloc: ansic: 9,241; makefile: 1,138; asm: 126; sh: 124
file content (31 lines) | stat: -rw-r--r-- 622 bytes parent folder | download | duplicates (3)
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
/*
\funcref{inlist}{int inlist (\params)}
    {
        {VAR\_} {v} {variable holding list}
        {char} {*s} {string to search for}
    }
    {0: string not in list, otherwise: string present in list}
    {}
    {copylist(), addtolist()}
    {inlist.c}
    {
        This function checks if a string {\em s} is present in the list
        contained in variable {\em v}.
    }
*/

#include "icm-exec.h"

int inlist (v, s)
VAR_ v;
char *s;
{
    register unsigned
        i;

    for (i = 0; i < v.vu.i->ls.list.size; i++)
        if (! strcmp (v.vu.i->ls.list.element [i], s))
            return (1);

    return (0);
}