INN commit: trunk (doc/pod/getlist.pod frontends/getlist.c)

INN Commit Russ_Allbery at isc.org
Mon Apr 28 13:14:25 UTC 2008


    Date: Monday, April 28, 2008 @ 06:14:25
  Author: iulius
Revision: 7809

Add a -R flag to getlist in order to issue MODE READER.

Modified:
  trunk/doc/pod/getlist.pod
  trunk/frontends/getlist.c

---------------------+
 doc/pod/getlist.pod |    9 ++++++++-
 frontends/getlist.c |   17 +++++++++++++++--
 2 files changed, 23 insertions(+), 3 deletions(-)

Modified: doc/pod/getlist.pod
===================================================================
--- doc/pod/getlist.pod	2008-04-28 12:44:07 UTC (rev 7808)
+++ doc/pod/getlist.pod	2008-04-28 13:14:25 UTC (rev 7809)
@@ -4,7 +4,7 @@
 
 =head1 SYNOPSIS
 
-B<getlist> [B<-A>] [B<-h> I<host>] [B<-p> I<port>]
+B<getlist> [B<-AR>] [B<-h> I<host>] [B<-p> I<port>]
 [I<list> [I<pattern> [I<types>]]]
 
 =head1 DESCRIPTION
@@ -62,6 +62,13 @@
 
 Connect to the port I<port>, which is by default C<119>.
 
+=item B<-R>
+
+Try to switch to B<nnrpd> with a MODE READER command before issuing the
+LIST request.  It can be useful in case a feeding access exists for
+the news server:  more information can be retrieved from B<nnrpd>,
+compared with B<innd>.
+
 =back
 
 =head1 EXAMPLES

Modified: frontends/getlist.c
===================================================================
--- frontends/getlist.c	2008-04-28 12:44:07 UTC (rev 7808)
+++ frontends/getlist.c	2008-04-28 13:14:25 UTC (rev 7809)
@@ -16,7 +16,7 @@
 #include "inn/paths.h"
 
 static const char usage[] = "\
-Usage: getlist [-A] [-h host] [-p port] [list [pattern [types]]]\n\
+Usage: getlist [-AR] [-h host] [-p port] [list [pattern [types]]]\n\
 \n\
 getlist obtains a list from an NNTP server and prints it out.  By default,\n\
 the active file is retrieved, but any list that the NNTP server supports\n\
@@ -218,6 +218,7 @@
     char *line;
     unsigned short port = NNTP_PORT;
     bool authinfo = false;
+    bool reader = false;
     int option;
 
     message_program_name = "getlist";
@@ -226,7 +227,7 @@
     host = innconf->server;
 
     /* Parse options. */
-    while ((option = getopt(argc, argv, "Ah:p:")) != EOF) {
+    while ((option = getopt(argc, argv, "Ah:p:R")) != EOF) {
         switch (option) {
         case 'A':
             authinfo = true;
@@ -239,6 +240,9 @@
             if (port <= 0)
                 die("%s is not a valid port number", optarg);
             break;
+        case 'R':
+            reader = true;
+            break;
         default:
             die("%s", usage);
         }
@@ -270,6 +274,15 @@
     if (response < 200 || response > 201)
         die_nntp_code(response, line);
 
+    /* Switch to nnrpd if desired. */
+    if (reader) {
+        if (!nntp_send_line(nntp, "MODE READER"))
+            sysdie("cannot send MODE READER command to server %s", host);
+        status = nntp_read_response(nntp, &response, &line);
+        if (status != NNTP_READ_OK)
+            die_nntp_status(status);
+    }
+
     /* Authenticate if desired. */
     if (authinfo) {
         char *username, *password;



More information about the inn-committers mailing list