Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP
Posting-Version: version B 2.10.1 Fluke 1/4/84; site fluke.UUCP
Path: utzoo!watmath!clyde!floyd!vax135!cornell!uw-beaver!ssc-vax!fluke!joe
From: joe@fluke.UUCP (Joe Kelsey)
Newsgroups: net.bugs.uucp
Subject: Re: Bug in 4.2 UUXQT
Message-ID: <1397@vax4.fluke.UUCP>
Date: Tue, 21-Feb-84 17:03:01 EST
Article-I.D.: vax4.1397
Posted: Tue Feb 21 17:03:01 1984
Date-Received: Thu, 23-Feb-84 06:08:25 EST
References: <1714@tektronix.UUCP> <1552@rlgvax.UUCP>
Organization: John Fluke Mfg. Co., Everett, WA
Lines: 124

Well, instead of having to manually check and clean out the X. files
all of the time, I decided to bite the bullet and modify uuxqt.c to do
what Tom Truscott suggested.  Here are the modifications to uucp to fix
the problem of dangling X. files.  The only change not noted in the
suggestion by Tom is that you have to modify anlwrk.c to make Nfiles
and LLEN available to the outside world.  I moved LLEN and MAXRQST into
uucp.h and removed the static from the definition of Nfiles.  Here are
the diff -c listings:

*** /tmp/,RCSt1026807	Tue Feb 21 13:41:28 1984
--- uuxqt.c	Tue Feb 21 13:35:27 1984
***************
*** 25,30
  #define	NCMDS	50
  char *Cmds[NCMDS];
  
  int notiok = 1;
  int nonzero = 0;
  

--- 25,33 -----
  #define	NCMDS	50
  char *Cmds[NCMDS];
  
+ /* Nfiles is set in anlwrk.c. fluke!joe */
+ extern int Nfiles;
+ 
  int notiok = 1;
  int nonzero = 0;
  
***************
*** 304,309
   * Mod to recheck for X-able files. Sept 1982, rti!trt.
   * Suggested by utzoo.2458 (utzoo!henry)
   * Uses iswrk/gtwrkf to keep files in sequence, May 1983.
   */
  
  gtxfile(file)

--- 307,313 -----
   * Mod to recheck for X-able files. Sept 1982, rti!trt.
   * Suggested by utzoo.2458 (utzoo!henry)
   * Uses iswrk/gtwrkf to keep files in sequence, May 1983.
+  * Mod to check for old X. files, Feb. 1984, fluke!joe.
   */
  
  gtxfile(file)
***************
*** 311,316
  {
  	char pre[3];
  	register int rechecked;
  
  	pre[0] = XQTPRE;
  	pre[1] = '.';

--- 315,323 -----
  {
  	char pre[3];
  	register int rechecked;
+ 	time_t ystrdy;		/* yesterday */
+ 	extern time_t time();
+ 	struct stat stbuf;	/* for X file age */
  
  	pre[0] = XQTPRE;
  	pre[1] = '.';
***************
*** 333,338
  #endif
  	if (gotfiles(file))
  		return(1);
  	goto retry;
  }
  

--- 340,361 -----
  #endif
  	if (gotfiles(file))
  		return(1);
+ 	/* check for old X. file with no work files and remove them. */
+ 	/* suggested by Tom Truscott. fluke!joe */
+ 	if (Nfiles > LLEN/2) {
+ 	    time(&ystrdy);
+ 	    ystrdy -= (24 * 3600);		/* yesterday */
+ 	    DEBUG(4, "gtxfile: Nfiles > LLEN/2\n", "");
+ 	    (void) iswrk(file, "get", Spool, pre);
+ 	    while (gtwrkf(Spool, file) && !gotfiles(file)) {
+ 		if (stat(subfile(file), &stbuf) == 0)
+ 		    if (stbuf.st_mtime <= ystrdy) {
+ 			DEBUG(4, "gtxfile: unlink %s \n", file);
+ 			unlink(subfile(file));
+ 		    }
+ 	    }
+ 	    return 0;
+ 	}
  	goto retry;
  }
  

Then for anlwrk.c:

52,54c52,54
< 
< #define LLEN 20
< #define MAXRQST 250
---
> /*
>  * fluke!joe moved LLEN and MAXRQST to uucp.h.
>  */
60,61c62,63
< static	int Nfiles = 0;
< static	char Filent[LLEN][NAMESIZE];
---
> int Nfiles = 0;
> char Filent[LLEN][NAMESIZE];

I tested these changes out and it seemed to work quite well.  My X.
directory was cleaned out within an hour and I received all sorts of
backlogged mail!  I guess the only real cleanup would be to change the
(24*3600) to a defined constant, but I didn't feel like it at the
time...

/Joe Kelsey	John Fluke Mfg. Co., Inc.
{microsoft, uw-beaver, allegra}!fluke