🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: news.software.nntp
Article #20419

crosspost.c quick performance hack (?)

#20419
From: Rahul Dhesi
Date: Tue, 12 Aug 1997 00:00
69 lines
2541 bytes
An article cross-posted to many newsgroups causes many system calls: one
link or symlink for each newsgroup.  Below is a quick mod to crosspost.c
from (inn 1.5.1 + patches) to add a -G flag to cause no more than the
specified number of links to be created for an article.  Then the
article will appear to have expired in all other newsgroups.  I don't
know yet just how much of a performance win this will be.

I guess you could run two instances of crosspost, thus:

   crosspost!:*,!alt.sex*:Tc,Ap,WR:/somewhere/bin/crosspost -s
   crosspost!:alt.sex*:Tc,Ap,WR:/somewhere/bin/crosspost -s -G 2

===================================================================
RCS file: RCS/crosspost.c,v
retrieving revision 1.1
diff -u -r1.1 crosspost.c
--- 1.1	1997/07/30 08:24:12
+++ crosspost.c	1997/08/12 11:33:25
@@ -31,6 +31,7 @@
 STATIC int	syncfiles = TRUE;
 
 #define MAXXPOST 256
+STATIC int	maxxpost;
 
 
 /*
@@ -106,7 +107,7 @@
 	    break;
 	}
 
-	for (i = 0; *p && (i < MAXXPOST); i++) { /* parse input into array */
+	for (i = 0; *p && (i < maxxpost); i++) { /* parse input into array */
 	    names[i] = p;
 	    for ( ; *p; p++) {
 		if (*p == '.') *p++ = '/'; /* dot to slash translation */
@@ -232,10 +233,11 @@
 
     /* Set defaults. */
     Dir = _PATH_SPOOL;
+    maxxpost = -1;
     (void)umask(NEWSUMASK);
 
     /* Parse JCL. */
-    while ((i = getopt(ac, av, "D:ds")) != EOF)
+    while ((i = getopt(ac, av, "D:dsG:")) != EOF)
 	switch (i) {
 	default:
 	    Usage();
@@ -249,7 +251,13 @@
 	case 's':
 	    syncfiles = FALSE;	/* do not fsync articles */
 	    break;
+	case 'G':
+	    maxxpost = atoi(optarg);
+	    break;
 	}
+    /* if -G value was 0 or less, default to max possible */
+    if (maxxpost <= 0)
+	maxxpost = MAXXPOST;
     ac -= optind;
     av += optind;
     InSpoolDir = EQ(Dir, _PATH_SPOOL);


-- 
Rahul Dhesi <dhesi@spams.r.us.com>

Technical Details
Message-ID: <5spjtt$ggt$1@samba.rahul.net>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail

Show Full Headers
Complete Article Headers
Message-ID: <5spjtt$ggt$1@samba.rahul.net>
Subject: crosspost.c quick performance hack (?)
Date: Tue, 12 Aug 1997 00:00:00 +0000
From: c.c.eiftj@65.usenet.us.com (Rahul Dhesi)
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail
X-Deja-AN: 263899633
Organization: a2i network
X-Comment: Encoded From: line allows replies that preserve original subject
NNTP-Posting-User: dhesi
Newsgroups: news.software.nntp