INN commit: branches/2.5 (backends/batcher.c doc/pod/batcher.pod)

INN Commit rra at isc.org
Sun Nov 15 09:23:28 UTC 2009


    Date: Sunday, November 15, 2009 @ 01:23:27
  Author: iulius
Revision: 8774

Remove dead code in batcher (it is no longer possible to
use file names).

Modified:
  branches/2.5/backends/batcher.c
  branches/2.5/doc/pod/batcher.pod

---------------------+
 backends/batcher.c  |   34 ++++++++--------------------------
 doc/pod/batcher.pod |   16 +++-------------
 2 files changed, 11 insertions(+), 39 deletions(-)

Modified: backends/batcher.c
===================================================================
--- backends/batcher.c	2009-11-15 09:22:56 UTC (rev 8773)
+++ backends/batcher.c	2009-11-15 09:23:27 UTC (rev 8774)
@@ -157,6 +157,7 @@
 	i = 1;
     }
 
+    free(spool);
     exit(i);
     /* NOTREACHED */
 }
@@ -180,15 +181,12 @@
 {
     bool	Redirect;
     FILE	*F;
-    const char	*AltSpool;
     char	*p;
-    char	*data;
     char	line[BIG_BUFFER];
     char	buff[BIG_BUFFER];
     size_t	BytesInArt;
     size_t	BytesInCB;
     off_t	Cookie;
-    size_t	datasize;
     int		i;
     int		ArtsInCB;
     int		length;
@@ -202,7 +200,6 @@
     message_program_name = "batcher";
     if (!innconf_read(NULL))
         exit(1);
-    AltSpool = NULL;
     Redirect = true;
     umask(NEWSUMASK);
     ERRLOG = concatpath(innconf->pathlog, INN_PATH_ERRLOG);
@@ -211,7 +208,7 @@
     message_handlers_notice(1, message_log_syslog_notice);
 
     /* Parse JCL. */
-    while ((i = getopt(ac, av, "a:A:b:B:i:N:p:rs:S:v")) != EOF)
+    while ((i = getopt(ac, av, "a:A:b:B:i:N:p:rs:v")) != EOF)
 	switch (i) {
 	default:
             die("usage error");
@@ -243,9 +240,6 @@
 	case 's':
 	    Separator = optarg;
 	    break;
-	case 'S':
-	    AltSpool = optarg;
-	    break;
 	case 'v':
             message_handlers_notice(2, message_log_syslog_notice,
                                     message_log_stdout);
@@ -272,13 +266,7 @@
     if (Redirect)
 	freopen(ERRLOG, "a", stderr);
 
-    /* Go to where the articles are. */
-    if (chdir(innconf->patharticles) < 0)
-        sysdie("%s cannot chdir to %s", Host, innconf->patharticles);
-
     /* Set initial counters, etc. */
-    datasize = 8 * 1024;
-    data = xmalloc(datasize);
     BytesInCB = 0;
     ArtsInCB = 0;
     Cookie = -1;
@@ -292,13 +280,13 @@
     SMinit();
     F = NULL;
     while (fgets(line, sizeof line, stdin) != NULL) {
-	/* Record line length in case we do an ftello. Not portable to
+	/* Record line length in case we do an ftello.  Not portable to
 	 * systems with non-Unix file formats. */
 	length = strlen(line);
 	Cookie = ftello(stdin) - length;
 
 	/* Get lines like "name size".  Note that we ignore size but accept
-           it for backwards compatibility. */
+         * it for backwards compatibility. */
 	if ((p = strchr(line, '\n')) == NULL) {
             warn("%s skipping %.40s: too long", Host, line);
 	    continue;
@@ -310,15 +298,9 @@
         if (p != NULL)
             *p = '\0';
 
-	/* Strip of leading spool pathname. */
-	if (line[0] == '/'
-	 && line[strlen(innconf->patharticles)] == '/'
-	 && strncmp(line, innconf->patharticles, strlen(innconf->patharticles)) == 0)
-	    p = line + strlen(innconf->patharticles) + 1;
-	else
-	    p = line;
+        p = line;
 
-	/* Open the file. */
+	/* Open the article. */
 	if (IsToken(p)) {
 	    token = TextToToken(p);
 	    if ((art = SMretrieve(token, RETR_ALL)) == NULL) {
@@ -334,7 +316,7 @@
 	}
 
 	/* Have an open article, do we need to open a batch?  This code
-	 * is here (rather then up before the while loop) so that we
+	 * is here (rather than up before the while loop) so that we
 	 * can avoid sending an empty batch.  The goto makes the code
 	 * a bit more clear. */
 	if (F == NULL) {
@@ -398,7 +380,7 @@
 	}
 
         /* Write the article.  In case of interrupts, retry the read but not
-           the fwrite because we can't check that reliably and portably. */
+         * the fwrite because we can't check that reliably and portably. */
         written = fwrite(artdata, 1, BytesInArt, F);
 	if (written != BytesInArt || ferror(F))
 	    break;

Modified: doc/pod/batcher.pod
===================================================================
--- doc/pod/batcher.pod	2009-11-15 09:22:56 UTC (rev 8773)
+++ doc/pod/batcher.pod	2009-11-15 09:23:27 UTC (rev 8774)
@@ -7,7 +7,7 @@
 B<batcher> [B<-rv>] [B<-a> I<articles>] [B<-A> I<total-articles>]
 [B<-b> I<size>] [B<-B> I<total-size>] [B<-i> I<string>]
 [B<-N> I<batches>] [B<-p> I<process>] [B<-s> I<separator>]
-[B<-S> I<spool>] I<host> [I<input>]
+I<host> [I<input>]
 
 =head1 DESCRIPTION
 
@@ -23,11 +23,8 @@
 I<pathoutgoing> as set in F<inn.conf>.  Blank lines and lines starting
 with a number sign (C<#>) are ignored.  All other lines in the input
 should consist of one or two fields separated by a single space.  The
-first field is either the storage API token of an article or the name of a
-file holding an article.  If it is not an absolute pathname or a storage
-API token, it is taken to be a file name relative to I<patharticles> in
-F<inn.conf>.  The second field, if present, specifies the size of the
-article in bytes.
+first field is the storage API token of an article.  The second field,
+if present, specifies the size of the article in bytes.
 
 By default, batches are written to standard output (which isn't very
 useful if more than one batch is output), but see the B<-p> option.
@@ -110,13 +107,6 @@
 
 and this should rarely be changed.
 
-=item B<-S> I<spool>
-
-Specifies an additional spool directory to search in for articles.  If
-this option is given, the first field of an input line is a relative path
-name, and if the article isn't found in I<patharticles>, it is also looked
-for under I<spool>.
-
 =item B<-v>
 
 Upon exit, B<batcher> reports statistics via syslog.  With this flag, the




More information about the inn-committers mailing list