BSD 4_3 release
[unix-history] / usr / src / usr.bin / uucp / uupoll.c
index b6bd908..d2132b4 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef lint
 #ifndef lint
-static char sccsid[] = "@(#)uupoll.c   5.1 (Berkeley) 7/2/83";
+static char sccsid[] = "@(#)uupoll.c   5.5 (Berkeley) 10/9/85";
 #endif
 
 /*
 #endif
 
 /*
@@ -14,16 +14,26 @@ static char sccsid[] = "@(#)uupoll.c        5.1 (Berkeley) 7/2/83";
 
 #include "uucp.h"
 
 
 #include "uucp.h"
 
+int TransferSucceeded = 1;
+struct timeb Now;
+
 main(argc, argv)
 register int argc;
 register char **argv;
 {
 main(argc, argv)
 register int argc;
 register char **argv;
 {
+       int ret;
+       char wrkpre[MAXFULLNAME];
+       char file[MAXFULLNAME];
+       char grade = 'A';
+       int nocall = 0;
+
        if (argc < 2) {
        if (argc < 2) {
-               fprintf(stderr, "usage: uupoll system ...\n");
+               fprintf(stderr, "usage: uupoll [-gX] [-n] system ...\n");
                cleanup(1);
        }
 
                cleanup(1);
        }
 
-       chdir(Spool);
+       ret = chdir(Spool);
+       ASSERT(ret >= 0, "CHDIR FAILED", Spool, ret);
        strcpy(Progname, "uupoll");
        uucpname(Myname);
 
        strcpy(Progname, "uupoll");
        uucpname(Myname);
 
@@ -32,15 +42,32 @@ register char **argv;
                        fprintf(stderr, "This *is* %s!\n", Myname);
                        continue;
                }
                        fprintf(stderr, "This *is* %s!\n", Myname);
                        continue;
                }
+               if (strncmp(argv[0],"-g",2) == SAME) {
+                       grade = argv[0][2];
+                       continue;
+               }
+               if (strcmp(argv[0],"-n") == SAME) {
+                       nocall++;
+                       continue;
+               }
 
 
-               if (versys(argv[0])) {
+               if (versys(&argv[0])) {
                        fprintf(stderr, "%s: unknown system.\n", argv[0]);
                        continue;
                }
                /* Remove any STST file that might stop the poll */
                        fprintf(stderr, "%s: unknown system.\n", argv[0]);
                        continue;
                }
                /* Remove any STST file that might stop the poll */
-               rmstat(argv[0]);
+               sprintf(wrkpre, "%s/LCK..%.*s", LOCKDIR, MAXBASENAME, argv[0]);
+               if (access(wrkpre, 0) < 0)
+                       rmstat(argv[0]);
+               sprintf(wrkpre, "%c.%.*s", CMDPRE, SYSNSIZE, argv[0]);
+               if (!iswrk(file, "chk", Spool, wrkpre)) {
+                       sprintf(file, "%s/%c.%.*s%cPOLL", subdir(Spool, CMDPRE),
+                               CMDPRE, SYSNSIZE, argv[0], grade);
+                       close(creat(file, 0666));
+               }
                /* Attempt the call */
                /* Attempt the call */
-               xuucico(argv[0]);
+               if (!nocall)
+                       xuucico(argv[0]);
        }
        cleanup(0);
 }
        }
        cleanup(0);
 }