Path: utzoo!utstat!news-server.csri.toronto.edu!math.lsa.umich.edu!zaphod.mps.ohio-state.edu!wuarchive!uunet!ibmsupt.uucp!!ericm From: ericm@skate.awdpa.ibm.com (Eric Murray) Newsgroups: news.software.b Subject: Re: How do I tell expire to never expire a single group under Cnews?. Message-ID: <2018Apr12.122753.8890@panews> Date: 12 Apr 18 12:27:53 GMT References: <1990Aug13.024146.1575@hades.ausonics.oz.au> Sender: ericm@panews (Eric Murray) Reply-To: ericm@ibmsupt.UUCP (Eric Murray) Distribution: na Organization: IBM AWD, Palo Alto Lines: 169 In article <1990Aug13.024146.1575@hades.ausonics.oz.au> greyham@hades.ausonics.oz.au (Greyham Stoney) writes: >I think I've managed to set up my explist file correctly; but there is one >thing that doesn't seem too clear from the manual page for expire: >How do I tell expire to never expire a single group under Cnews?. You hack it to understand 'never' in the explist file. % diff -c expire.c expire.c.old *** expire.c Thu Jun 7 11:38:56 1990 --- expire.c.old Thu Jun 7 10:16:32 1990 *************** *** 123,132 **** void euclose(); char *whereexpire(); time_t back(); - - /* ericm hack */ - time_t backtime(); - void checkdir(); void fail(); void control(); --- 123,128 ---- *************** *** 259,315 **** char line[200]; /* long enough for any sane line */ register char *p; void ctlline(); - char *buf; - int got_cont = 0; - /* ericm hacks.... modified to accept lines ending in '\\n' (the \n is - * invisible of course) as a line continuation deal. - */ - buf = (char *)0; while (fgets(line, sizeof(line), f) != NULL) { p = &line[strlen(line) - 1]; if (*p != '\n') fail("control line `%.30s...' too long", line); - *p = '\0'; ! if (line[0] == '#' || line[0] == '\0') ! continue; ! ! if (*(p-1) == 0134 ) ! got_cont = 1; ! ! if (got_cont) { ! /* line continuation */ ! char *tmp = buf; ! ! if (*(p-1) != 0134 ) ! got_cont = 0; ! else ! *(p-1) = '\0'; /* erase the '\' */ ! ! if ((buf = (char *)malloc(strlen(tmp) + strlen(line) + 1)) == NULL){ ! fail("out of memory for control line", ""); ! } ! strcpy(buf,tmp); ! strcat(buf,line); ! } ! if (!got_cont) { ! if (!buf) { ! if (line[0] != '#' && line[0] != '\0') { ! /* printf("line = ` %s '\n",line); */ ! ctlline(line); ! } ! } ! else { ! if (buf[0] != '#' && buf[0] != '\0') { ! /* printf("buf = ` %s '\n",buf); */ ! ctlline(buf); ! } ! free(buf); ! buf = (char *)0; ! } ! } ! bzero(line,sizeof(line)); } } --- 255,268 ---- char line[200]; /* long enough for any sane line */ register char *p; void ctlline(); while (fgets(line, sizeof(line), f) != NULL) { p = &line[strlen(line) - 1]; if (*p != '\n') fail("control line `%.30s...' too long", line); *p = '\0'; ! if (line[0] != '#' && line[0] != '\0') ! ctlline(line); } } *************** *** 353,375 **** (void) strcpy(datebuf, field[2]); ndates = split(datebuf, dates, 3, "-"); switch (ndates) { - /* i've replaced ' back(atof(dates[0])) ' with backtime() - * backtime checks for an 'n' in the date field... to - * allow a 'never-never-never' expiry specifyer - */ case 3: ! ct->retain = backtime(dates[0]); ! ct->normal = backtime(dates[1]); ! ct->purge = backtime(dates[2]); break; case 2: ct->retain = (bounds != NULL) ? bounds->retain : back(0.0); ! ct->normal = backtime(dates[0]); ! ct->purge = backtime(dates[1]); break; case 1: ct->retain = (bounds != NULL) ? bounds->retain : back(0.0); ! ct->normal = backtime(dates[0]); ct->purge = (bounds != NULL) ? bounds->purge : EPOCH; break; default: --- 306,324 ---- (void) strcpy(datebuf, field[2]); ndates = split(datebuf, dates, 3, "-"); switch (ndates) { case 3: ! ct->retain = back(atof(dates[0])); ! ct->normal = back(atof(dates[1])); ! ct->purge = back(atof(dates[2])); break; case 2: ct->retain = (bounds != NULL) ? bounds->retain : back(0.0); ! ct->normal = back(atof(dates[0])); ! ct->purge = back(atof(dates[1])); break; case 1: ct->retain = (bounds != NULL) ? bounds->retain : back(0.0); ! ct->normal = back(atof(dates[0])); ct->purge = (bounds != NULL) ? bounds->purge : EPOCH; break; default: *************** *** 1345,1359 **** *rp = '\0'; return(result); - } - - /* ericm hacks */ - time_t backtime(time) - char *time; - { - - if (*time == 'n') - return(EPOCH); /* 'never' */ - - return(back(atof(time))); } --- 1294,1297 ---- I also changed things a bit to allow a '\' as a line continuation so I could use my old Bnews expire script. This diff is from the 25-May-1990 version. eric murray ibmsupt!ericm@uunet.uu.net uunet!ibmsupt!ericm