[net.news.sa] newsgroup exclusion in expire

greg@unlv.UUCP (Greg Wohletz) (02/11/86)

I recently modified expire.c to allow for the -o option which is the same
as the -n option except that it excludes the named groups from those expired
instead of expireing only those groups (ie expire -o mod.sources runs expire
on all groups except mod.sources).  The patch follows, I thought someone
might find it usefull:
						--Greg Wohletz
						greg%unlv@CSNet-Relay
						seismo!unrvax!unlv!greg


---------------------------cut here------------------------------
*** /tmp/,RCSt1001149	Tue Feb 11 02:43:49 1986
--- /tmp/,RCSt2001149	Tue Feb 11 02:43:53 1986
***************
*** 42,47 ****
--- 42,48 ----
  int	usepost = 0;
  int	frflag = 0;
  int	updateactive = 0;
+ int	invert = 0;
  char	baduser[BUFLEN];
  extern 	char filename[], nbuf[];
  
***************
*** 146,157 ****
  			ignorexp = 1;
  			break;
  		case 'n':
  			if (argc > 2) {
  				argv++;
  				argc--;
  				while (argc > 1 && argv[1][0] != '-') {
  					if (ngpatlen + strlen(argv[1]) + 2 > LBUFLEN) {
! 						fprintf(stderr,"Too many groups specified for -n\n");
  						xxit(1);
  					}
  					strcat(ngpat, argv[1]);
--- 147,160 ----
  			ignorexp = 1;
  			break;
  		case 'n':
+ 		case 'o':
+ 			invert = (argv[1][1] == 'o');
  			if (argc > 2) {
  				argv++;
  				argc--;
  				while (argc > 1 && argv[1][0] != '-') {
  					if (ngpatlen + strlen(argv[1]) + 2 > LBUFLEN) {
! 						fprintf(stderr,"Too many groups specified for -%c\n",argv[1][1]);
  						xxit(1);
  					}
  					strcat(ngpat, argv[1]);
***************
*** 373,379 ****
  				grpsleft[0] = '\0';
  				goto checkdate;
  			}
! 			if (!ngmatch(nbuf, ngpat) ||
  			     ((h.rectime+expincr > now) && !dorebuild && !frflag
  				&& !usepost && h.recdate[0] != ' '))
  				goto keephist;
--- 376,383 ----
  				grpsleft[0] = '\0';
  				goto checkdate;
  			}
! 			if ((invert && ngmatch(nbuf, ngpat)) ||
! 			   (!invert && !ngmatch(nbuf, ngpat)) ||
  			     ((h.rectime+expincr > now) && !dorebuild && !frflag
  				&& !usepost && h.recdate[0] != ' '))
  				goto keephist;
***************
*** 381,386 ****
--- 385,392 ----
  			** Look for the file--possibly several times,
  			** if it was posted to several news groups.
  			*/
+ 			if(verbose > 1 && invert)
+ 				printf("Looking at %s\n",nbuf);
  			dc = ' ';
  			p3 = p2;
  			while (dc != '\n') {
***************
*** 745,751 ****
  			/* should be impossible to get here */
  		}
  		fn = dirname(artlist);
! 		if (ngmatch(newname, ngpat)) {
  			if (doarchive){
  				if (ngmatch(newname, arpat)) {
  					q = fn + strlen(SPOOL) + 1;
--- 751,757 ----
  			/* should be impossible to get here */
  		}
  		fn = dirname(artlist);
! 		if ((ngmatch(newname, ngpat) && !invert) || (!ngmatch(newname,ngpat) && invert)) {
  			if (doarchive){
  				if (ngmatch(newname, arpat)) {
  					q = fn + strlen(SPOOL) + 1;

avolio@decuac.UUCP (Frederick M. Avolio) (02/14/86)

In article <131@csee-vax.unlv.UUCP>, greg@unlv.UUCP writes:
> 
> I recently modified expire.c to allow for the -o option which is the same
> as the -n option except that it excludes the named groups from those expired

You can use a ! in front of a news group such as

/usr/lib/news/expire -v -e7 -n all,!uig.meetings,!uig.notes 2>&1
-- 
Fred @ DEC Ultrix Applications Center
{decvax,seismo,cbosgd}!decuac!avolio            avolio@decuac.DEC.COM