summaryrefslogtreecommitdiffstats
path: root/lib/libmytinfo/tmatch.c
blob: afccda7c9766b42b97e36c3a45b6252dbefc6a74 (plain)
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
/*
 * tmatch.c
 *
 * By Ross Ridge
 * Public Domain
 * 92/02/01 07:30:35
 *
 * See if a terminal name matches a list of terminal names from a
 * terminal description
 *
 */

#include "defs.h"

#ifdef USE_SCCS_IDS
static const char SCCSid[] = "@(#) mytinfo tmatch.c 3.2 92/02/01 public domain, By Ross Ridge";
#endif

int
_tmatch(line, name)
char *line, *name; {
	char term[MAX_LINE];
	char *sp, *dp;

	sp = line;
	while (*sp != '\0') {
		dp = term;
		while (*sp != '\0' && *sp != '|')
			*dp++ = *sp++;
		*dp = '\0';
		if (strcmp(term, name) == 0)
			return 1;
		if (*sp == '|')
			sp++;
	}
	return 0;
}
OpenPOWER on IntegriCloud