jr@forcm5.UUCP (John Rogers) (03/29/84)
Hi. Since I got hard hit by the "logjam" of February articles (my disk filled up), I decided to do something about it. So, I added a command line option to expire, which allows you to expire articles based on the date POSTED as well as the date RECEIVED. I ran "expire -e 7" (my normal expire), did a "df", then "expire -e 7 -p" (my new "-p" option to expire based on date posted); that saved me an additional 2.25MB! Anyways, here are the diff's... I got my version of expire.c from Mark Stein (fortune!stein); I'm not sure what version it corresponds to in the outside world. I'd be happy to post or mail the entire expire.c if anyone thinks it's worthwhile. Happy hacking! JR (John Rogers) send mail to: {ihnp4,cbosgd,harpo!fortune!jr P.S. I plan to add a compile-time option to rnews, which will reject incoming articles based on the date posted. That way (1) I don't have to put up with logjam articles for even one day (until expire gets run that night), and (2) they won't get propagated to any of the sites I send articles to. I guess it would write an "Old article rejected" line to /usr/lib/news/log. Give me a few days to get around to it, though. *** expire.c- Mon Mar 26 18:06:38 1984 --- expire.c Mon Mar 26 21:06:51 1984 *************** *** 11,16 * Steven M. Kramer MITRE Corp. (smk@linus.UUCP) 5/22/83 * (who added back the -r and -h options for 2.10 B news) * */ static char *SccsId = "@(#)expire.c 2.16 (hand edited) 6/24/83"; --- 11,19 ----- * Steven M. Kramer MITRE Corp. (smk@linus.UUCP) 5/22/83 * (who added back the -r and -h options for 2.10 B news) * + * John Rogers Fortune Systems (jr@fortune.UUCP) 3/26/84 + * (I added the -p option, to expire based on the date the article + * was posted, in an attempt to gracefully handle "logjams"). */ static char *SccsId = "@(#)expire.c 2.17 (hand edited) 3/26/84"; *************** *** 13,19 * */ ! static char *SccsId = "@(#)expire.c 2.16 (hand edited) 6/24/83"; #include "params.h" #include <ndir.h> --- 16,22 ----- * was posted, in an attempt to gracefully handle "logjams"). */ ! static char *SccsId = "@(#)expire.c 2.17 (hand edited) 3/26/84"; #include "params.h" #include <ndir.h> *************** *** 32,37 int ignorexp = 0; int doarchive = 0; int nohistory = 0; int rebuild = 0; /* --- 35,43 ----- int ignorexp = 0; int doarchive = 0; int nohistory = 0; + int postexp = 0; /* Flag - whether to expire based on the date + ** the article was posted, as well as the + ** expiration date and date received. */ int rebuild = 0; /* *************** *** 114,119 argc++; } break; case 'a': /* archive expired articles */ doarchive++; break; --- 120,128 ----- argc++; } break; + case 'p': /* Expire based on date posted, too. */ + postexp = 1; /* Set flag to "true". */ + break; /* Continue with next option. */ case 'a': /* archive expired articles */ doarchive++; break; *************** *** 125,131 nohistory++; break; default: ! printf("Usage: expire [ -v [level] ] [-e days ] [-i] [-a] [-r] [-h] [-n newsgroups]\n"); exit(1); } argc--; --- 134,140 ----- nohistory++; break; default: ! printf("Usage: expire [ -v [level] ] [-e days ] [-i] [-a] [-r] [-h] [-p] [-n newsgroups]\n"); exit(1); } argc--; *************** *** 341,346 if (!h.expdate[0] || ignorexp == 2 || (ignorexp == 1 && newtime < h.exptime)) h.exptime = newtime; if (now >= h.exptime) { #ifdef DEBUG printf("cancel %s\n", filename); --- 350,361 ----- if (!h.expdate[0] || ignorexp == 2 || (ignorexp == 1 && newtime < h.exptime)) h.exptime = newtime; + if (postexp) { /* Want to expire based on date posted? */ + h.subtime = cgtdate(h.subdate); /* Get time posted. */ + newtime = h.subtime + expincr; + if (newtime < h.exptime) + h.exptime = newtime; /* Pretend exp. date.*/ + } /*if*/ if (now >= h.exptime) { #ifdef DEBUG printf("cancel %s\n", filename); *** /usr/man/man8/expire.8 Wed Mar 28 15:15:39 1984 --- expire.8 Wed Mar 28 15:20:13 1984 *************** *** 13,18 .B \-r ] [ .B \-h ] .SH DESCRIPTION .I Expire --- 13,20 ----- .B \-r ] [ .B \-h + ] [ + .B \-p ] .SH DESCRIPTION .I Expire *************** *** 41,46 .B \-e flag gives the number of days to use for a default expiration date. If not given, an installation dependent default (often 2 weeks) is used. .PP The .B \-i --- 43,60 ----- .B \-e flag gives the number of days to use for a default expiration date. If not given, an installation dependent default (often 2 weeks) is used. + .PP + The + .B \-p + flag indicates that articles should be expired based on the date they + were posted as well the the date they were received. + This is helpful for when "logjams" develop elsewhere in the network, + and your system is inundated by articles which aren't in your current + history file, because they've already expired once. + The number of days to wait past the date posted is the same as that + used for date received (see the + .B \-e + option above). .PP The .B \-i -- JR (John Rogers) UUCP: forcm5!jr, fortune!jr, proper!jr