INN commit: branches/2.5 (3 files)

INN Commit rra at isc.org
Tue Aug 18 20:19:00 UTC 2009


    Date: Tuesday, August 18, 2009 @ 13:19:00
  Author: iulius
Revision: 8580

* Return the contents of the expires history field when
"grephistory -l" is used.  It was always empty.
Also returns the hash of the requested message-ID.

* Mention in documentation that "grephistory -l" returns nothing
when the storage API token does not exist.

* Fixed "grephistory -v" which does not work as expected
when the storage API token does not exist.

Modified:
  branches/2.5/doc/pod/grephistory.pod
  branches/2.5/doc/pod/news.pod
  branches/2.5/expire/grephistory.c

-------------------------+
 doc/pod/grephistory.pod |   28 +++++++++++++++-------------
 doc/pod/news.pod        |    7 +++++++
 expire/grephistory.c    |   22 +++++++++++++++++-----
 3 files changed, 39 insertions(+), 18 deletions(-)

Modified: doc/pod/grephistory.pod
===================================================================
--- doc/pod/grephistory.pod	2009-08-18 20:16:49 UTC (rev 8579)
+++ doc/pod/grephistory.pod	2009-08-18 20:19:00 UTC (rev 8580)
@@ -9,14 +9,14 @@
 =head1 DESCRIPTION
 
 B<grephistory> queries the INN history database for information about the
-specified message ID.  If no flags are given, the program prints the
+specified message-ID.  If no flags are given, the program prints the
 storage API token of the corresponding article, or C</dev/null> if the
 article is listed in the history database but not stored on the server.
-If the message ID cannot be found in the database, B<grephistory> will
+If the message-ID cannot be found in the database, B<grephistory> will
 print C<grephistory: not found> and exit with a non-zero status.
 
 Be sure to escape any special characters in the message ID from the shell.
-Single quotes are recommended for this purpose since many message IDs
+Single quotes are recommended for this purpose since many message-IDs
 contain dollar signs.
 
 =head1 OPTIONS
@@ -35,20 +35,21 @@
 
 =item B<-i>
 
-Rather than expecting a message ID on the command line, B<grephistory>
-will read a list of message IDs on standard input, one per line.  Leading
+Rather than expecting a message-ID on the command line, B<grephistory>
+will read a list of message-IDs on standard input, one per line.  Leading
 and trailing whitespace is ignored, as are any malformed lines.  It will
-print out standard output those message IDs which are not found in the
+print on standard output those message-IDs which are not found in the
 history database.  This is used when processing C<ihave> control messages.
 
 =item B<-l>
 
 Display the entire line from the history database, rather than just the
-storage API token.
+storage API token.  If the message-ID is present in the history database
+but has no storage API token, B<grephistory> does not print anything.
 
 =item B<-n>
 
-If the message ID is present in the history database but has no storage
+If the message-ID is present in the history database but has no storage
 API token, print C</dev/null> and exit successfully.  This can happen if
 an article has been cancelled or expired, but history information has
 still been retained.  This is the default behavior.
@@ -59,8 +60,8 @@
 
 =item B<-s>
 
-Rather than expecting a message ID on the command line, B<grephistory>
-will read a list of message IDs on standard input, one per line.  Leading
+Rather than expecting a message-ID on the command line, B<grephistory>
+will read a list of message-IDs on standard input, one per line.  Leading
 and trailing whitespace is ignored, as are any malformed lines.  It will
 print on standard output the storage API tokens for any articles that are
 still available, one per line.  This flag is used when processing
@@ -68,8 +69,9 @@
 
 =item B<-v>
 
-Print out the hash of the message ID for diagnostic purposes, as well as
-any other requested information.  This flag is not useful with B<-s>.
+Print out the hash of the message-ID for diagnostic purposes, as well as
+any other requested information.  This flag is not useful with B<-i> or
+B<-s>.
 
 =back
 
@@ -82,6 +84,6 @@
 
 =head1 SEE ALSO
 
-history(5), inn.conf(5)
+history(5), inn.conf(5).
 
 =cut

Modified: doc/pod/news.pod
===================================================================
--- doc/pod/news.pod	2009-08-18 20:16:49 UTC (rev 8579)
+++ doc/pod/news.pod	2009-08-18 20:19:00 UTC (rev 8580)
@@ -38,6 +38,13 @@
 
 =item *
 
+B<grephistory -l> now returns the contents of the expires history field
+as well as the hash of the message-ID.  Besides, when the storage API
+token does not exist, B<grephistory -v> now also returns the hash
+of the requested message-ID.
+
+=item *
+
 The check on cancel messages when I<verifycancels> is set to true
 in F<inn.conf> has been changed to verify that at least one newsgroup
 in the cancel message can be found in the article to be cancelled.

Modified: expire/grephistory.c
===================================================================
--- expire/grephistory.c	2009-08-18 20:16:49 UTC (rev 8579)
+++ expire/grephistory.c	2009-08-18 20:19:00 UTC (rev 8580)
@@ -135,7 +135,7 @@
 	/* NOTREACHED */
     }
 
-    /* All modes other than -i -l want a Message-ID. */
+    /* All modes other than -i and -l want a message-ID. */
     if (ac != 1)
 	Usage();
 
@@ -161,8 +161,16 @@
     else if (What != 'q') {
 	if (HISlookup(history, key, &arrived, &posted, &expires, &token)) {
 	    if (What == 'l') {
-		printf("[]\t%ld~-~%ld\t%s\n", (long)arrived, (long)posted,
-		       TokenToText(token));
+                if (expires <= 0) {
+                    printf("[%s]\t%ld~-~%ld\t%s\n",
+                           HashToText(HashMessageID(key)),
+                           (long)arrived, (long)posted, TokenToText(token));
+                } else {
+                    printf("[%s]\t%ld~%ld~%ld\t%s\n",
+                           HashToText(HashMessageID(key)),
+                           (long)arrived, (long)expires, (long)posted,
+                           TokenToText(token));
+                }
 	    }
 	    else {
 		if (Verbosity > 0)
@@ -172,8 +180,12 @@
 		    printf("%s\n", TokenToText(token));
 	    }
 	}
-	else if (What == 'n')
-	    printf("/dev/null\n");
+        else if (What == 'n') {
+            if (Verbosity > 0)
+                printf("/dev/null (hash is %s)\n", HashToText(HashMessageID(key)));
+            else
+                printf("/dev/null\n");
+        }
     }
     HISclose(history);
     return 0;




More information about the inn-committers mailing list