/* UUPOLL -- call a UUCP connect site Usage: UUPOLL Copyright 1988 by William Loftus. All rights reserved. ARPA: wpl@prc.unisys.com UUCP: wpl@burdvax.UUCP USMAIL: Unisys/Paoli Research Center;PO BOX 517;Paoli, PA 19301-0517 */ #include #define LOCK_FILE "t:UUCP.LCK" #define TRUE 1 #define FALSE 0 int is_in_L_sys_file(system_name) char *system_name; { char buf[256]; char system[128]; FILE *fd; if (!(fd = fopen("UUCP:lib/L.sys","r"))) { printf("Couldn't open UUCP:lib/L.sys file\n"); exit(1); } sprintf(system,"%s ", system_name); while (NULL != fgets(buf, sizeof buf, fd)) { if (buf[0] == '#') continue; if (strncmp(buf, system, strlen(system)) == 0) { fclose(fd); return TRUE; } } fclose(fd); return FALSE; } void main (argc, argv) int argc; char ** argv; { char buf[256]; if (argc != 2) { printf("Usage: UUPOLL \n"); exit(1); } if (access(LOCK_FILE,0) != -1) { printf("UUCP is locked.\n"); exit(0); } if (is_in_L_sys_file(argv[1])) { sprintf(buf,"UUCP:C/brun UUCP:C/UUCICO -s%s\n", argv[1]); if (system(buf) == -1) { printf("Error spawning task to call system \"%s\"\n", argv[1]); } } else { printf("System \"%s\" not in UUCP:Lib/L.sys file.\n", argv[1]); } }