|
|
1.1 root 1: /* /sccs/src/cmd/uucp/s.versys.c
2: versys.c 1.1 8/30/84 17:38:20
3: */
4: #include "uucp.h"
5: VERSION(@(#)versys.c 1.1);
6:
7: /*
8: * verify system name
9: * if abbr is nonzero, allow the name to be truncated
10: * for compatibility with old uucps
11: * input:
12: * name -> system name
13: * returns:
14: * 0 -> success
15: * FAIL -> failure
16: */
17:
18: #define OLDLEN 7 /* max length of old uucp names */
19:
20: versys(name, abbr)
21: char *name;
22: int abbr;
23: {
24: register FILE *fp;
25: register char *iptr;
26: char line[300];
27: FILE *sysopen();
28:
29: if (EQUALS(name, Myname))
30: return(0);
31:
32: #ifndef MANYSYS
33: fp = fopen(SYSFILE, "r");
34: if (fp == NULL)
35: return(FAIL);
36: #else
37: sysrewind();
38: while ((fp = sysopen("r")) != NULL) {
39: #endif
40:
41: while (fgets(line, sizeof(line) ,fp) != NULL) {
42: if((line[0] == '#') || (line[0] == ' ') || (line[0] == '\t') ||
43: (line[0] == '\n'))
44: continue;
45:
46: if ((iptr=strpbrk(line, " \t")) == NULL)
47: continue; /* why? */
48: *iptr = '\0';
49: if (EQUALS(name, line)) {
50: (void) fclose(fp);
51: return (0);
52: }
53: if (abbr && strlen(name) == OLDLEN && strncmp(name, line, OLDLEN) == SAME) {
54: (void) fclose(fp);
55: return(0);
56: }
57: }
58: fclose(fp);
59: #ifdef MANYSYS
60: }
61: #endif
62: return(FAIL);
63: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.