[net.sources] Extending the range of the "L"ocal flag in /usr/lib/news/sys

bytebug@pertec.UUCP (roger long) (01/14/85)

Consider the situation where you are being fed by two (or more) news
feeds, and you are feeding another site.  How do you send this other
sites articles to either of your main feeds without sending all of
the rest of the news you receive?

Ever notice how some of the messages you read have paths that take the
better part of two lines...  or more?  

The patch I've put together might help out in both situations.  I have
in effect extended my definition of "local", by allowing a "how local"
specification to exist in my sys file.  Take the following example:

	#
	#  pesnta - Perkin-Elmer Corp., Santa Clara
	#
	pesnta:net,usa,na:L3:
	pesnta:ca,to.pesnta::

By adding a digit after the "L" flag, I've specified "local" to be
less than three machines away.  Leaving the digit out makes "local" 
mean what it always has: articles originated on this machine.

Hopefully, some of you will find this of use.

*** ifuncs.c.bak	Thu Dec 27 20:27:54 1984
--- ifuncs.c	Thu Dec 27 21:02:46 1984
***************
*** 3,9
   */
  
  #ifndef lint
! static char	*SccsId = "@(#)ifuncs.c	2.35	9/12/84";
  #endif !lint
  
  #include "iparams.h"

--- 3,9 -----
   */
  
  #ifndef lint
! static char	*SccsId = "@(#)ifuncs.c	2.35.1	12/27/84";
  #endif !lint
  
  #include "iparams.h"
***************
*** 84,89
  
  /*
   * Transmit file to system.
   */
  #define PROC 0004
  transmit(sp, ifp, maynotify)

--- 84,91 -----
  
  /*
   * Transmit file to system.
+  * 27 Dec 84:	pertec!bytebug changed "local" to mean article originated
+  *		within 'n' hops of host.
   */
  #define PROC 0004
  transmit(sp, ifp, maynotify)
***************
*** 105,111
  /* F:	append name to file */
  	int appfile = (index(sp->s_flags, 'F') != NULL);
  /* L:	local: don't send the article unless it was generated locally */
! 	int local = (index(sp->s_flags, 'L') != NULL);
  /* N:	notify: don't send the article, just tell him we have it */
  	int notify = maynotify && (index(sp->s_flags, 'N') != NULL);
  /* S:	noshell: don't fork a shell to execute the xmit command */

--- 107,113 -----
  /* F:	append name to file */
  	int appfile = (index(sp->s_flags, 'F') != NULL);
  /* L:	local: don't send the article unless it was generated locally */
! 	int local = ((ptr = index(sp->s_flags, 'L')) != NULL);
  /* N:	notify: don't send the article, just tell him we have it */
  	int notify = maynotify && (index(sp->s_flags, 'N') != NULL);
  /* S:	noshell: don't fork a shell to execute the xmit command */
***************
*** 113,121
  /* U:	useexist: use the -c option to uux to use the existing copy */
  	int useexist = (index(sp->s_flags, 'U') != NULL);
  
! 	if (local && mode == PROC) {
! 		fclose(ifp);
! 		return FALSE;
  	}
  #ifdef DEBUG
  	printf("Transmitting to '%s'\n", sp->s_name);

--- 115,131 -----
  /* U:	useexist: use the -c option to uux to use the existing copy */
  	int useexist = (index(sp->s_flags, 'U') != NULL);
  
! 	if (local) {		/* allow local to mean within 'n' hops */
! 		++ptr;
! 		if (isdigit(*ptr))
! 			local = *ptr - '0';
! 		for (ptr = h.path; *ptr != '\0'; local--)
! 			while (*ptr++ != '\0')
! 				;
! 		if (local < 0) {
! 			fclose(ifp);
! 			return FALSE;
! 		}
  	}
  #ifdef DEBUG
  	printf("Transmitting to '%s'\n", sp->s_name);

-- 
	roger long
	pertec computer corp
	{ucbvax!unisoft | scgvaxd | trwrb | felix}!pertec!bytebug