patch to inews

Matus "fantomas" Uhlar uhlar at fantomas.sk
Fri Apr 7 16:24:18 UTC 2000


Hello,

this little patch to inews adds -p paramater to define port inews have to
connect to. If it's not specified, inews connect to port definedin inn.conf,
if that's not specified, it connects NNTP_PORT.

--- inews.c.orig        Wed Nov 24 22:02:15 1999
+++ inews.c     Fri Apr  7 18:21:01 2000
@@ -1203,6 +1203,7 @@
     register char      *p;
     register HEADER    *hp;
     int                        j;
+    int                        port;
     int                        Mode;
     int                        SigLines;
     FILE               *F;
@@ -1229,13 +1230,14 @@
     Dump = FALSE;
     DoSignature = TRUE;
     AddOrg = TRUE;
+    port = 0;
 
     if (ReadInnConf() < 0) exit(1);
 
     (void)umask(NEWSUMASK);
 
     /* Parse JCL. */
-    while ((i = getopt(ac, av, "DNAVWORShx:a:c:d:e:f:n:r:t:F:o:w:")) != EOF)
+    while ((i = getopt(ac, av, "DNAVWORShx:a:c:d:e:f:n:p:r:t:F:o:w:")) != EOF)
 	switch (i) {
 	default:
 	    Usage();
@@ -1265,6 +1267,9 @@
 	    Exclusions = NEW(char, strlen(optarg) + 1 + 1);
 	    (void)sprintf(Exclusions, "%s!", optarg);
 	    break;
+	 case 'p':
+	    port = atoi(optarg);
+	    break;
 	/* Header lines that can be specified on the command line. */
 	case 'a':       HDR(_approved) = optarg;                break;
 	case 'c':       HDR(_control) = optarg;                 break;
@@ -1298,8 +1303,10 @@
 	break;
     }
 
+    if (port == 0) port = (innconf->port != 0) ? innconf->port : NNTP_PORT;
+
     /* Try to open a connection to the server. */
-    if (NNTPremoteopen(NNTP_PORT, &FromServer, &ToServer, buff) < 0) {
+    if (NNTPremoteopen(port, &FromServer, &ToServer, buff) < 0) {
 	Spooling = TRUE;
 	if ((p = strchr(buff, '\n')) != NULL)
 	    *p = '\0';

-- 
 Matus "fantomas" Uhlar, sysadmin at NEXTRA, Slovakia; IRCNET admin of *.sk
 uhlar at fantomas.sk ; http://www.fantomas.sk/ ; http://www.nextra.sk/
 Linux is like a wigwam: no Windows, no Gates and an apache inside...



More information about the inn-patches mailing list