|
|
1.1 ! root 1: #ifndef lint ! 2: static char sccsid[] = "@(#)uupoll.c 5.6 (Berkeley) 4/5/88"; ! 3: #endif ! 4: ! 5: /* ! 6: * Poll named system(s). ! 7: * ! 8: * The poll occurs even if recent attempts have failed, ! 9: * but not if L.sys prohibits the call (e.g. wrong time of day). ! 10: * ! 11: * Original Author: Tom Truscott (rti!trt) ! 12: */ ! 13: ! 14: #include "uucp.h" ! 15: ! 16: int TransferSucceeded = 1; ! 17: struct timeb Now; ! 18: ! 19: main(argc, argv) ! 20: int argc; ! 21: char **argv; ! 22: { ! 23: char wrkpre[MAXFULLNAME]; ! 24: char file[MAXFULLNAME]; ! 25: char grade = 'A'; ! 26: int nocall = 0; ! 27: int c; ! 28: char *sysname; ! 29: extern char *optarg; ! 30: extern int optind; ! 31: ! 32: if (argc < 2) { ! 33: fprintf(stderr, "usage: uupoll [-gX] [-n] system ...\n"); ! 34: cleanup(1); ! 35: } ! 36: ! 37: if (chdir(Spool) < 0) { ! 38: syslog(LOG_WARNING, "chdir(%s) failed: %m", Spool); ! 39: cleanup(1); ! 40: } ! 41: strcpy(Progname, "uupoll"); ! 42: uucpname(Myname); ! 43: ! 44: while ((c = getopt(argc, argv, "g:n")) != EOF) ! 45: switch(c) { ! 46: case 'g': ! 47: grade = *optarg; ! 48: break; ! 49: case 'n': ! 50: nocall++; ! 51: break; ! 52: case '?': ! 53: default: ! 54: fprintf(stderr, "unknown option %s\n", ! 55: argv[optind-1]); ! 56: } ! 57: ! 58: while(optind < argc) { ! 59: sysname = argv[optind++]; ! 60: if (strcmp(sysname, Myname) == SAME) { ! 61: fprintf(stderr, "This *is* %s!\n", Myname); ! 62: continue; ! 63: } ! 64: ! 65: if (versys(&sysname)) { ! 66: fprintf(stderr, "%s: unknown system.\n", sysname); ! 67: continue; ! 68: } ! 69: /* Remove any STST file that might stop the poll */ ! 70: sprintf(wrkpre, "%s/LCK..%.*s", LOCKDIR, MAXBASENAME, sysname); ! 71: if (access(wrkpre, 0) < 0) ! 72: rmstat(sysname); ! 73: sprintf(wrkpre, "%c.%.*s", CMDPRE, SYSNSIZE, sysname); ! 74: if (!iswrk(file, "chk", Spool, wrkpre)) { ! 75: sprintf(file, "%s/%c.%.*s%cPOLL", subdir(Spool, CMDPRE), ! 76: CMDPRE, SYSNSIZE, sysname, grade); ! 77: close(creat(file, 0666)); ! 78: } ! 79: /* Attempt the call */ ! 80: if (!nocall) ! 81: xuucico(sysname); ! 82: } ! 83: cleanup(0); ! 84: } ! 85: ! 86: cleanup(code) ! 87: int code; ! 88: { ! 89: exit(code); ! 90: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.