Tdxutils patch

F. Senault fred.letter at lacave.net
Mon Jan 3 15:34:55 UTC 2005


Monday, January 3, 2005, 4:27:50 PM, I wrote:

-- Binary/unsupported file stripped by Ecartis --
-- Type: application/octet-stream
-- File: tdx-util-range.patch

Uh.  Great.

Here's the thing inline :

diff -u inn/storage/tradindexed/tdx-util.c local/storage/tradindexed/tdx-util.c
--- inn/storage/tradindexed/tdx-util.c  Wed Dec 22 05:21:19 2004
+++ local/storage/tradindexed/tdx-util.c        Mon Jan  3 15:50:46 2005
@@ -91,7 +91,7 @@
 **  and expires time (if any) in the overview data as additional fields.
 */
 static void
-dump_overview(const char *group, ARTNUM number)
+dump_overview(const char *group, ARTNUM numlow, ARTNUM numhigh)
 {
     struct group_index *index;
     struct group_data *data;
@@ -115,12 +115,14 @@
     }
     data->refcount++;
 
-    if (number != 0)
-        search = tdx_search_open(data, number, number, entry->high);
-    else
-        search = tdx_search_open(data, entry->low, entry->high, entry->high);
+    if (numlow == 0)
+        numlow = entry->low;
+    if (numhigh ==0)
+        numhigh = entry->high;
+    search = tdx_search_open(data, numlow, numhigh, entry->high);
+
     if (search == NULL) {
-        if (number != 0)
+        if (numlow == numhigh)
             puts("Article not found");
         else
             warn("cannot open search in %s: %lu - %lu", group, entry->low,
@@ -377,6 +379,8 @@
     const char *newsgroup = NULL;
     const char *path = NULL;
     ARTNUM article = 0;
+    ARTNUM artlow = 0;
+    ARTNUM arthigh = 0;
 
     message_program_name = "tdx-util";
 
@@ -385,13 +389,23 @@
 
     /* Parse options. */
     opterr = 0;
-    while ((option = getopt(argc, argv, "a:n:p:AFR:gio")) != EOF) {
+    while ((option = getopt(argc, argv, "a:l:h:n:p:AFR:gio")) != EOF) {
         switch (option) {
         case 'a':
             article = strtoul(optarg, NULL, 10);
             if (article == 0)
                 die("invalid article number %s", optarg);
             break;
+        case 'l':
+            artlow = strtoul(optarg, NULL, 10);
+            if (artlow == 0)
+                die("invalid article number %s", optarg);
+            break;
+        case 'h':
+            arthigh = strtoul(optarg, NULL, 10);
+            if (arthigh == 0)
+                die("invalid article number %s", optarg);
+            break;
         case 'n':
             newsgroup = optarg;
             break;
@@ -439,6 +453,10 @@
     if ((mode == 'g' || mode == 'o' || mode == 'R') && newsgroup == NULL)
         die("group must be specified for -%c", mode);
 
+    /* No sense in supplying lower and/or upper and artnum */
+    if (article != 0 && (artlow !=0 || arthigh != 0))
+        die("specify either an article range (-l and -h) or a single article (-a) for -%c", mode);
+
     /* Run the specified function. */
     switch (mode) {
     case 'A':
@@ -459,7 +477,10 @@
         dump_group_index(newsgroup);
         break;
     case 'o':
-        dump_overview(newsgroup, article);
+        if (artlow !=0 || arthigh !=0)
+           dump_overview(newsgroup, artlow, arthigh);
+        else
+           dump_overview(newsgroup, article, article);
         break;
     default:
         die("a mode option must be specified");

diff -u inn/doc/pod/tdx-util.pod local/doc/pod/tdx-util.pod
--- inn/doc/pod/tdx-util.pod    Mon Jan  3 16:12:15 2005
+++ local/doc/pod/tdx-util.pod  Mon Jan  3 16:13:58 2005
@@ -4,8 +4,8 @@
 
 =head1 SYNOPSIS
 
-B<tdx-util> [B<-AFgio>] [B<-a> I<article>] [B<-n> I<newsgroup>]
-[B<-p> I<path>] [B<-R> I<path>]
+B<tdx-util> [B<-AFgio>] [B<-a> I<article> | [B<-l> I<article>] [B<-h> I<article>]]
+[B<-n> I<newsgroup>] [B<-p> I<path>] [B<-R> I<path>]
 
 =head1 DESCRIPTION
 
@@ -92,6 +92,13 @@
 time (in seconds since epoch) when that newsgroup was deleted or 0 if it
 hasn't been, and the inode of the index file for that group.
 
+=item B<-h> I<article>
+
+The highest article number from a range to act on.  Use B<-h> alone to dump
+any article up to a number (included), and in conjunction witn B<-l> to obtain
+articles within a range.  Only useful in combination with the B<-o> option to
+dump overview information.
+
 =item B<-i>
 
 Dump the index of a particular group.  The fields are, in order, the
@@ -104,6 +111,13 @@
 
 If this option is given, the B<-n> option must also be given to specify
 the newsgroup on which to act.
+
+=item B<-l> I<article>
+
+The lowest article number from a range to act on.  Use B<-l> alone to dump
+any article from a number (included), and in conjunction witn B<-h> to obtain
+articles within a range.  Only useful in combination with the B<-o> option to
+dump overview information.
 
 =item B<-n> I<newsgroup>
 






More information about the inn-workers mailing list