Thread View: news.software.nn
2 messages
2 total messages
Started by Nick Sayer
Wed, 07 Sep 1994 04:53
LISTGROUP change
Author: Nick Sayer
Date: Wed, 07 Sep 1994 04:53
Date: Wed, 07 Sep 1994 04:53
192 lines
5503 bytes
5503 bytes
Has anyone actually implemented the LISTGROUP suggestion
in the nn nntp.c file?
I ask this because I have (what I hope to be) a better idea of
how to implement it, at least for nntpd (I don't know about innd's
"mode reader" handler).
If, instead of having LISTGROUP take a group name as an argument,
LISTGROUP takes either no arguments or a range of article IDs, then
it can simply spit out bits of the article-ID array that the GROUP
command builds.
This also has the effect of slightly simplifying the appropriate routine
in nn's nntp.c. The bits of it in the XHDR section that set the group
move outside to the top, and it becomes a simple alternative of sending
LISTGROUP or XHDR.
This implementation reduces expiration time on my spool by no less than
two orders of magnitude.
Here's listgroup.c. It becomes part of nntpd:
----- cut here -----
#ifndef lint
static char *sccsid = "@(#)$Header: listgroup.c,v 1.00 94/09/04 23:59:53 sob Exp $";
#endif
#include "common.h"
#ifdef LISTGROUP
/*
* LISTGROUP [range]
*
* Just generates a list or article numbers present in the indicated
* range, or in the entire group.
*
* This command is an extension, and not included in RFC 977.
*/
listgroup(argc, argv)
int argc;
char *argv[];
{
register int artptr;
register int low, high;
register char *cp;
if (argc>2) {
printf("%d Usage: LISTGROUP [range]\r\n",
ERR_CMDSYN);
(void) fflush(stdout);
return;
}
if (!canread) {
printf("%d You only have permission to transfer, sorry.\r\n",
ERR_ACCESS);
(void) fflush(stdout);
return;
}
if (!ingroup) {
printf("%d You are not currently in a newsgroup.\r\n",
ERR_NCING);
(void) fflush(stdout);
return;
}
if (argc==2) {
cp = index(argv[1], '-');
if (cp == NULL)
low = high = atoi(argv[1]);
else {
*cp = '\0';
low = atoi(argv[1]);
cp++;
high = atoi(cp);
if (high < low)
high = art_array[num_arts-1];
}
} else {
low=1;
high = art_array[num_arts-1];
}
printf("%d article-IDs follow:\r\n", OK_ARTIDS);
for (artptr=0;artptr<num_arts; artptr++)
if (art_array[artptr] >= low && art_array[artptr] <= high)
printf("%d\r\n",art_array[artptr]);
putchar('.');
putchar('\r');
putchar('\n');
(void) fflush(stdout);
}
#else not LISTGROUP
/* Kludge to get around Greenhills C compiler */
listgroup_greenkluydge()
{
}
#endif not LISTGROUP
----- ereh tuc -----
Here's the patch to nntp.c:
*** old/nntp.c Sun Nov 11 16:01:28 1990
--- nntp.c Sun Sep 4 12:56:09 1994
***************
*** 890,895 ****
--- 956,971 ----
if (!is_connected && connect_server() < 0)
return NULL;
+ if (group_is_set == 0)
+ switch (do_set_group()) {
+ case -1:
+ return NULL;
+ case 0:
+ goto again;
+ case 1:
+ break;
+ }
+
/* it is really an extreme waste of time to use XHDR since all we */
/* are interested in is the article numbers (as we do locally). */
/* If somebody hacks up an nntp server that understands LISTGROUP */
***************
*** 898,905 ****
/* -- they don't even have to be sorted (only XHDR needs that) */
if (try_listgroup) {
! switch (n = ask_server("LISTGROUP %s", group_hd->group_name)) {
! case OK_GROUP:
break;
default:
if (try_again) goto again; /* Handle nntp server timeouts */
--- 974,981 ----
/* -- they don't even have to be sorted (only XHDR needs that) */
if (try_listgroup) {
! switch (n = ask_server("LISTGROUP")) {
! case OK_ARTIDS:
break;
default:
if (try_again) goto again; /* Handle nntp server timeouts */
***************
*** 909,926 ****
try_listgroup = 0;
goto again; /* error may have closed down server connection */
}
! }
! if (!try_listgroup) {
! if (group_is_set == 0)
! switch (do_set_group()) {
! case -1:
! return NULL;
! case 0:
! goto again;
! case 1:
! break;
! }
!
switch (n = ask_server("XHDR message-id %ld-%ld",
(long)gh->first_db_article, (long)gh->last_db_article)) {
case OK_HEAD:
--- 985,991 ----
try_listgroup = 0;
goto again; /* error may have closed down server connection */
}
! } else {
switch (n = ask_server("XHDR message-id %ld-%ld",
(long)gh->first_db_article, (long)gh->last_db_article)) {
case OK_HEAD:
--
Nick Sayer <nsayer@quack.kfu.com> | "Garcon! More Java, man!"
N6QQQ @ N0ARY.#NOCAL.CA.USA.NOAM | "It's no use, chick, we're being
+1 408 249 9630, log in as 'guest' | waited on by Godot."
URL: http://www.kfu.com/~nsayer/ | "Just grin and Becket, cats."
Re: LISTGROUP change
Author: Wayne Davison
Date: Wed, 07 Sep 1994 22:47
Date: Wed, 07 Sep 1994 22:47
24 lines
1587 bytes
1587 bytes
According to Nick Sayer <nsayer@quack.kfu.com>:
> Has anyone actually implemented the LISTGROUP suggestion
> in the nn nntp.c file?
NNTP-1.5.11-t5 has an INN-compatible implementation of LISTGROUP.
I believe that the nn version did a GROUP and then reread the
directory instead of just using the article array -- not only
is this much slower, but it results in a non-sorted list, which
is NOT compatible with INN or nntp-t5. Also, both nntp-t5 and INN
allow you to leave off the group name, which also speeds up the
server's list if you've already done a GROUP. The latest NNTP
is available on uunet:
ftp.uu.net:networking/news/nntp/nntp-t5.tar.gz
And it already includes xover, xindex (optional), xthread (optional),
etc.
If you want to make LISTGROUP take an article array, you should
add a new command, such as XARTNUMS. I don't think it's actually
necessary, though.
--
Wayne Davison
davison@borland.com
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads