|
|
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: #define SYSCLOSE fclose ! 34: fp = fopen(SYSFILE, "r"); ! 35: #else ! 36: #define SYSCLOSE pclose ! 37: fp = sysopen(name); ! 38: #endif ! 39: if (fp == NULL) ! 40: return(FAIL); ! 41: ! 42: while (fgets(line, sizeof(line) ,fp) != NULL) { ! 43: if((line[0] == '#') || (line[0] == ' ') || (line[0] == '\t') || ! 44: (line[0] == '\n')) ! 45: continue; ! 46: ! 47: if ((iptr=strpbrk(line, " \t")) == NULL) ! 48: continue; /* why? */ ! 49: *iptr = '\0'; ! 50: if (EQUALS(name, line)) { ! 51: (void) SYSCLOSE(fp); ! 52: return (0); ! 53: } ! 54: if (abbr && strlen(name) == OLDLEN && strncmp(name, line, OLDLEN) == SAME) { ! 55: (void) fclose(fp); ! 56: return(0); ! 57: } ! 58: } ! 59: SYSCLOSE(fp); ! 60: return(FAIL); ! 61: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.