Batch NNTP Operations
|
NewsRog can be used in a batch mode where commands are sent to the NNTP
server and the results are printed on the standard output. In this
manner, it is possible to use NewsRog as part of a shell script or ARexx
script.
If any of these batch options are present on the command line, then
NewsRog exits after performing the indicated option. No project is loaded
and the NewsRog user interface does not appear. Batch options may be used
even if an interactive NewsRog is currently running. Batch operations may
only be performed if a networking stack is present and online. Currently,
the batch mode is not useable with servers that require NNTP
authentication.
All of the batch NNTP operations require a server name. The following
strategy is used to find the name of the NNTP server with which to
communicate.
- A server name specified with the SERVER option is used if present.
- The value of the NNTPSERVER environment variable is used, if
defined.
- Lastly, the value news is used as a server name. This can
work if you have an alias set up in your IP software.
For example, this command line fetches a particular article by Message-ID
from the news server named news.mydomain.com and prints the result on
the standard output:
NewsRog SRV news.mydomain.com MSGID "<some.message.id@foo.bar.com>"
while the following performs the same command using the server defined in
NNTPSERVER, or "news" otherwise:
NewsRog MSGID "<some.message.id@foo.bar.com>"
In the rest of the examples on this page, the SRV option has been omitted
for brevity, but may be used together with any other batch command.
Many commands refer to Message-ID's. Message-ID's are unique strings
enclosed in angle brackets which refer to a particular usenet article. A
particular article's Message-ID is the same no matter which server it
resides on, and every article has its own Message-ID.
Operation | Description |
Fetching Articles |
The basic command to return a news article given it's
Message-ID is:
NewsRog MSGID <messageid>
If the given message-id does not contain angle brackets, NewsRog
will supply them itself before sending the command to the server.
This reduces the need to quote message-id's to avoid shell I/O
redirection. If the angle brackets are given, surround the message
id in double quotes.
There are optional switches for returning just the article's
headers, just the body, or the whole article (which is the
default):
NewsRog MSGID <message-id> HEAD
NewsRog MSGID <message-id> BODY
NewsRog MSGID <message-id> ART
|
Testing Articles |
It is possible to check for the existance of a particular article
by using the CHECK switch. In this case, NewsRog produces no
output but exits with a return code of zero (0) if the article
was found, or one (1) otherwise:
NewsRog MSGID <message-id> CHECK
Finding a Header Value |
To return just the value of a particular header from a particular
article, use the HDR option:
NewsRog MSGID <message-id> HDR From
Any valid usenet header name may be given. NewsRog will output
the value of the given header in the given article, if found,
without the field name itself. The header name is not
case sensitive.
Listing Groups |
The groups on the server which match a particular pattern may
be listed via:
NewsRog LISTGROUPS wildmat
Where wildmat is a simplified wildcard format supporting
"*" and a few other wildcard characters. For example, to return
a listing of the Amiga related newsgroups:
NewsRog LISTGROUPS *amiga*
|
Listing Message ID's in a group |
A listing of Message-ID's in a particular newsgroup may be
generated via:
NewsRog GROUP groupname LISTMSGIDS
Where groupname is the name of a valid usenet group.
|
Testing Groups |
The existance of a particular newsgroup may be checked via:
NewsRog GROUP groupname CHECK
Where groupname is the name of a valid usenet group.
NewsRog produces no output but exits with a return code of zero
(0) if the group was found on the server, or one (1) otherwise.
|
Counting Group Articles |
The approximate count of articles in a newsgroup may
be obtained via:
NewsRog GROUP groupname ARTCOUNT
Where groupname is the name of a valid usenet group.
The approximate count of articles in the group is printed on the
standard output. This count is only approximate due to the
manner in which NNTP is defined The number of articles in
the group will not exceed this value, although it may be less.
|
Searching through Articles |
To search through the bodies of all articles in a group for a
specific AmigaOS pattern:
NewsRog GROUP groupname SEARCH pattern
Where groupname is the name of a valid usenet group, and
pattern is an AmigaOS pattern. The Message-IDs of
articles containing that pattern will be printed to stdout.
To instead print the Subject (or some other) header of matching
articles, use the SEARCHRES option, like this:
NewsRog GROUP comp.sys.amiga.misc SEARCH NewsRog SEARCHRES Subject
A special value MATCH to the SEARCHRES option will print all
lines that match the pattern. To make the search case sensitive,
use the MATCHCASE switch. To print articles that do not
contain a match for the pattern, use the INVERT switch:
NewsRog GROUP groupname SEARCH pattern MATCHCASE
NewsRog GROUP groupname SEARCH pattern INVERT
To search through all header field, use:
NewsRog GROUP groupname SEARCH pattern HEAD
To search through a particular header field for each article:
NewsRog GROUP groupname SEARCH pattern HEADER header
|
Back to Top
|