summaryrefslogtreecommitdiffstats
path: root/lib/libmytinfo/getother.c
blob: 2542f668b8fd7f51fb77099d087f9ade9d9a769a (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
38
39
40
41
42
43
44
45
46
47
48
49
/*
 * getother.c
 *
 * By Ross Ridge
 * Public Domain
 * 92/02/01 07:29:58
 *
 */

#include "defs.h"
#include <term.h>

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

int
_getother(name, path, ct)
char *name;
struct term_path *path;
TERMINAL *ct; {
	static int depth = 0;
	int r;
	char buf[MAX_BUF];

	if (depth >= MAX_DEPTH)
		return 1;		/* infinite loop */

#ifdef DEBUG
	printf("\ngetother: %s\n", name);
#endif

	switch(_findterm(name, path, buf)) {
	case -3:
		return 1;
	case 1:
		depth++;
		r = _gettcap(buf, ct, path);
		break;
	case 2:
		depth++;
		r = _gettinfo(buf, ct, path);
		break;
	default:
		return 0;
	}
	depth--;
	return r;
}
OpenPOWER on IntegriCloud