Add a '-b' option, to print the article number bounds of a newsgroup.
[sgt/utils] / nntpid / nntpid.but
index 7f21512..cffd9b1 100644 (file)
@@ -8,15 +8,17 @@
 
 \U SYNOPSIS
 
-\c nntpid [ -v ] [ -d ] message-id
-\e bbbbbb   bb     bb   iiiiiiiiii
-\c nntpid [ -v ] [ -d ] newsgroup-name article-number
-\e bbbbbb   bb     bb   iiiiiiiiiiiiii iiiiiiiiiiiiii
+\c nntpid [ -v ] [ -d ] article [ article... ]
+\e bbbbbb   bb     bb   iiiiiii   iiiiiii
+\c nntpid [ -v ] [ -d ]
+\e bbbbbb   bb     bb
+\c nntpid [ -v ] -a newsgroup-name
+\e bbbbbb   bb   bb iiiiiiiiiiiiii
 
 \U DESCRIPTION
 
-\cw{nntpid} makes a connection to a news server, retrieves a single
-article, and displays it.
+\cw{nntpid} makes a connection to a news server, retrieves one or
+more articles, and displays them.
 
 You can specify the article you want by either:
 
@@ -38,15 +40,53 @@ that cause unexpected behaviour in your terminal. If \cw{nntpid}
 detects that its standard output is not a terminal, however, it will
 bypass the pager and just write out the article directly.
 
+There are a couple of alternative mode of operation. In one, enabled
+by the \cw{-a} option, \cw{nntpid} retrieves \e{all} available
+articles in the group and writes them to standard output in \cw{mbox}
+format. In the other, enabled with \cw{-b}, \cw{nntpid} simply prints
+the lowest and highest article numbers currently available in that
+group from the news server.
+
+The location of the news server is obtained by reading the
+environment variable \cw{NNTPSERVER}, or failing that the file
+\cw{/etc/nntpserver}.
+
 \U ARGUMENTS
 
-If you specify one argument, \cw{nntpid} assumes it is a Message-ID.
+\cw{nntpid} will attempt to interpret its argument list as specifying
+a series of news articles, as follows:
+
+\b An argument containing an @ sign will be parsed as a Message-ID.
 The angle brackets that usually delimit Message-IDs are optional;
-\cw{nntpid} will strip them off if it sees them, and will not
-complain if it does not.
+\cw{nntpid} will strip them off if it sees them, and will not complain
+if it does not. If the angle brackets are present, anything outside
+them will also be discarded.
+
+\b Otherwise, an argument containing whitespace or a colon will be
+parsed as a group name and an article number.
+
+\b Otherwise, two successive arguments will be treated as a group name
+and an article number.
+
+For example, the following invocations should all behave identically.
+(Single quotes are intended to represent POSIX shell quoting, not part
+of the command line as it reaches \cw{nntpid}.)
 
-If you specify two arguments, \cw{nntpid} will interpret the first
-as a newsgroup name, and the second as an article number.
+\c $ nntpid '<foo.bar@baz.quux>' misc.test 1234
+\e   bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+\c $ nntpid 'foo.bar@baz.quux' misc.test:1234
+\e   bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+\c $ nntpid 'wibble <foo.bar@baz.quux> blah' 'misc.test 1234'
+\e   bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb
+
+If \cw{nntpid} is given no arguments at all, it will read from
+standard input. Every line it reads will be interpreted as described
+above, except that whitespace will also be trimmed from the start and
+end of the line first.
+
+If you provide the \cw{-a} option (see below), none of the above
+applies. Instead, \cw{nntpid} will expect exactly one command-line
+argument, which it will treat as a newsgroup name.
 
 \U OPTIONS
 
@@ -60,6 +100,19 @@ conversation with the news server on standard error.
 \dd Direct output. In this mode, \cw{nntpid} will write the article
 straight to standard output without bothering to try using a pager.
 
+\dt \cw{-a}
+
+\dd Retrieve all articles from the given newsgroup. In this mode,
+\cw{nntpid} will always write straight to standard output (so the
+\cw{-d} option is unnecessary).
+
+\dt \cw{-b}
+
+\dd Print the current bounds on that group's article numbers. The
+output is one line consisting of a minimum and maximum article number.
+(Not every article in that range will necessarily actually exist: a
+cancelled article will still use up a space in the numbering range.)
+
 \U AUTHENTICATION
 
 Currently, the only form of authentication supported by \cw{nntpid}