[net.notes] nfarchive -d not working?

johnl (12/22/82)

#R:sri-unix:1000028:ima:6100001:000:368
ima!johnl    Dec 21 11:39:00 1982

The code for nfarchive -d is just bogus.  The fixes are pretty simple --
in main() in nfarchive.c there is a big if statement for the -d flag, but
but in fact there should be about three, so that the locking, deleting,
and compressing is always done and just the archiving is conditional.

John Levine, decvax!yale-co!jrl, ucbvax!cbosgd!ima!johnl, Levine@YALE (arpa).

mclure (03/09/83)

#N:sri-unix:1000028:000:174
sri-unix!mclure    Dec 17 15:20:00 1982

I think someone mentioned here quite a while ago why nfarchive -d
fails and also a fix for it. Could whoever knows about this please
repost the bug and fix? Thanks.

	Stuart

mclure (03/09/83)

#R:sri-unix:1000028:sri-unix:1000034:000:1122
sri-unix!mclure    Feb 20 13:53:00 1983

Perhaps I misread your reply, but I think the problem was with
archiver.c, not nfarchive.c.  In there, an attempt to open an empty
"line" variable is made (/usr/spool/oldnotes?).  Also there is an
attempt to close this after the archive.  Both of these should be
conditional on (deleteonly == 0).  Also, later on there are a couple of
printf's to net.log telling what archiver did.  In the case of -d, they
attempt to printf ncount with %n which prints nothing and also cause
the printf of the time to be empty.  This should be a %d in both cases.
Here's a diff to fix these:

			Stuart

diff archiver.c.old archiver.c.new
83c83,84
<     x ((farchfile = fopen (line, "w")) == NULL, "archiver: bad create");
---
>     if (deleteonly == 0)
>         x ((farchfile = fopen (line, "w")) == NULL, "archiver: bad create");
110c111,112
<     x (fclose (farchfile) < 0, "archiver: close archive");
---
>     if (deleteonly == 0)
>         x (fclose (farchfile) < 0, "archiver: close archive");
126c128
< 	    fprintf (log, "%s: Archiver deleted %n notes at %s\n",
---
> 	    fprintf (log, "%s: Archiver deleted %d notes at %s\n",