rees@apollo.uucp (Jim Rees) (03/05/87)
Has anyone considered adding a field to the active file which specifies the default expiration time for that news group? Some people advocate running expire multiple times with different expiration times for each run, but that's pretty inefficient. I've hacked up our expire to read expiration times from a file. Here are the relevant routines: struct { char *pat; long incr; } nga[100]; readexpdays() { char buf[BUFLEN], ngbuf[BUFLEN]; FILE *f; int i, n; long incr; sprintf(buf, "%s/%s", LIB, "expdays"); f = xfopen(buf, "r"); i = 0; while (fgets(buf, sizeof buf, f) != NULL) { n = sscanf(buf, "%s %d", ngbuf, &incr); if (n < 1) continue; if (n == 1) nga[i].incr = expincr; else nga[i].incr = incr * DAYS; nga[i].pat = malloc(strlen(ngbuf) + 1); strcpy(nga[i].pat, ngbuf); i++; } nga[i].pat = NULL; fclose(f); } getincr(group) char *group; { int i; for (i = 0; nga[i].pat != NULL; i++) if (ngmatch(group, nga[i].pat)) { if (verbose > 2) printf("pattern %s incr %d days\n", nga[i].pat, nga[i].incr / DAYS); return (nga[i].incr); } return -1; }
henry@utzoo.UUCP (Henry Spencer) (03/08/87)
> Has anyone considered adding a field to the active file which specifies the > default expiration time for that news group? The C News expire (be patient, general release is coming...) lets you set expiry time, whether explicit expiry dates should be honored, whether expired articles should be archived, and where they should be archived, on a per-group basis. For example, here's our /usr/lib/news/explist: ----------- sci.astro,sci.lang,sci.math 14 - sci.med,sci.physics,sci.space 14 - news.groups 14 - talk,rec,soc,misc 14 - control,junk,tor.news.stats 14 - mod.map 45 @ mod 30 @ to 2 - general,hacknews,micros 90 /usr/spool/oldnews net 14! @ all 14 @ ----------- (Suffix '!' on the time means ignore explicit expiry dates; archive location of '-' means "don't" and '@' means "default location".) -- "We must choose: the stars or Henry Spencer @ U of Toronto Zoology the dust. Which shall it be?" {allegra,ihnp4,decvax,pyramid}!utzoo!henry