|
|
1.1 ! root 1: #ifndef lint ! 2: static char sccsid[] = "@(#)uuname.c 5.4 (Berkeley) 4/5/88"; ! 3: #endif ! 4: ! 5: #include "uucp.h" ! 6: ! 7: /* ! 8: * return list of all remote systems recognized by uucp, or (with -l) the ! 9: * local uucp name. ! 10: * ! 11: * return codes: 0 | 1 (can't read) ! 12: */ ! 13: ! 14: struct timeb Now; ! 15: ! 16: main(argc, argv) ! 17: char *argv[]; ! 18: int argc; ! 19: { ! 20: register FILE *np; ! 21: register char *buf; ! 22: char s[BUFSIZ]; ! 23: char prev[BUFSIZ]; ! 24: ! 25: strcpy(Progname, "uuname"); ! 26: ! 27: if (argc > 1 && argv[1][0] == '-' && argv[1][1] == 'l') { ! 28: uucpname(s); ! 29: puts(s); ! 30: exit(0); ! 31: } ! 32: if (argc != 1) { ! 33: fprintf(stderr, "Usage: uuname [-l]\n"); ! 34: exit(1); ! 35: } ! 36: if ((np = fopen(SYSFILE, "r")) == NULL) { ! 37: syslog(LOG_WARNING, "fopen(%s) failed: %m", SYSFILE); ! 38: exit(1); ! 39: } ! 40: buf = s; ! 41: while (cfgets(buf, sizeof(s), np) != NULL) { ! 42: register char *cp; ! 43: cp = strpbrk(buf, " \t"); ! 44: if (cp) ! 45: *cp = '\0'; ! 46: if (strcmp(s, prev) == SAME) ! 47: continue; ! 48: if (*buf == 'x' && buf[1] == 'x' && buf[2] == 'x') ! 49: continue; ! 50: puts(buf); ! 51: if (buf == s) ! 52: buf = prev; ! 53: else ! 54: buf = s; ! 55: } ! 56: exit(0); ! 57: } ! 58: ! 59: cleanup(code) ! 60: int code; ! 61: { ! 62: exit(code); ! 63: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.