Thread View: news.software.nn
2 messages
2 total messages
Started by J.P.M. van der Jagt
Tue, 21 Apr 1992 13:28
SUMMARY: LISTGROUP patch for NNmaster/nntpd
Author: J.P.M. van der Jagt
Date: Tue, 21 Apr 1992 13:28
Date: Tue, 21 Apr 1992 13:28
415 lines
13924 bytes
13924 bytes
Hi All,
A month ago I posted a request for the the source of the LISTGROUP patch
for the NNTP daemon (nntpd) that speeds up the expire time of the NNmaster
program that is part of the NN newsreader package.
I received no replies from the net that could direct me to the whereabouts
of this patch. However, in the end I managed to find a file which contained
the source, but it wasn't in patch format and it wasn't tested on the most
recent NNTP release (1.5.11). I added the LISTGROUP source to the NNTP.1.5.11
source and removed two bugs from it. I recompiled and the the nntpd now runs
fine. The time in which nnmaster expires its database has speeded up
dramatically: a factor 10-15 can be seen.
The patch follows. It is in shar format with a README included.
Happy News Reading.
John-Paul
--
[] J.P.M. van der Jagt [] Systems manager [] Delft University of Technology []
[] Email: jeanpaul@duteca.et.tudelft.nl [] Phone: 31-15-781366 [] unix unix []
[] - He sells C-shells by the seashore - Lauren Bacall - Key Largo - 1948 - []
_______________________________ CUT HERE _____________________________________
#! /bin/sh
# This is a shell archive. Remove anything before this line, then unpack
# it by saving it into a file and typing "sh file". To overwrite existing
# files, type "sh file -c". You can also feed this as standard input via
# unshar, or by typing "sh <file", e.g.. If this archive is complete, you
# will see the following message at the end:
# "End of shell archive."
# Contents: README help.c.patch nntp_awk.patch serve.c.patch
# xhdr.c.patch conf.h.added
# Wrapped by jeanpaul@duteca on Tue Apr 21 15:02:28 1992
PATH=/bin:/usr/bin:/usr/ucb ; export PATH
if test -f 'README' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'README'\"
else
echo shar: Extracting \"'README'\" \(1074 characters\)
sed "s/^X//" >'README' <<'END_OF_FILE'
X
XHi All,
X
XThis is the LISTGROUP patch for NNTP.1.5.11. It makes the nnmaster program
X(that is part of the famous NN newsreader) expire its database much quicker
Xwhile generating much less load on the NNTP server host. An average speed-up
Xfactor of 10-15 is possible.
XThis patch consists of five files:
X README
X help.c.patch
X serve.c.patch
X xhdr.c.patch
X conf.h.added
X nntp_awk.patch
XThe files help.c.patch, serve.c.patch and xhdr.c.patch are in patch format
Xand have to be applied to files in the "server" directory.
XThe file conf.h.added has to be edited somewhere in the conf.h file in the
X"common" directory. It wouldn't be much use to supply a patch, since everyone
Xhas his own copy of conf.h...
XThe file nntp_awk.patch is in patch format and has to be applied to a file in
Xthe "support" directory.
X
XHappy News Reading.
XJohn-Paul
X--
X[] J.P.M. van der Jagt [] Systems manager [] Delft University of Technology []
X[] Email: jeanpaul@duteca.et.tudelft.nl [] Phone: 31-15-781366 [] unix unix []
X[] - He sells C-shells by the seashore - Lauren Bacall - Key Largo - 1948 - []
END_OF_FILE
if test 1074 -ne `wc -c <'README'`; then
echo shar: \"'README'\" unpacked with wrong size!
fi
# end of 'README'
fi
if test -f 'help.c.patch' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'help.c.patch'\"
else
echo shar: Extracting \"'help.c.patch'\" \(2324 characters\)
sed "s/^X//" >'help.c.patch' <<'END_OF_FILE'
X*** help.c.orig
X--- help.c
X**************
X*** 21,27
X printf("NEXT POST QUIT\r\n");
X printf("STAT NEWGROUPS HELP\r\n");
X printf("IHAVE NEWNEWS SLAVE\r\n");
X! printf("\r\nAdditionally, the following extention is supported:\r\n\r\n");
X printf("XHDR Retrieve a single header line from a range of articles.\r\n");
X printf("\r\n");
X printf("Bugs to Stan Barber (Internet: nntp@tmc.edu; UUCP: ...!bcm!nntp)\r\n");
X--- 21,27 -----
X printf("NEXT POST QUIT\r\n");
X printf("STAT NEWGROUPS HELP\r\n");
X printf("IHAVE NEWNEWS SLAVE\r\n");
X! printf("\r\nAdditionally, the following extentions are supported:\r\n\r\n");
X printf("XHDR Retrieve a single header line from a range of articles.\r\n");
X #ifdef LISTGROUP
X printf("LISTGROUP Retrieve a list of article-numbers (for nn's nnmaster).\r\n");
X**************
X*** 23,28
X printf("IHAVE NEWNEWS SLAVE\r\n");
X printf("\r\nAdditionally, the following extention is supported:\r\n\r\n");
X printf("XHDR Retrieve a single header line from a range of articles.\r\n");
X printf("\r\n");
X printf("Bugs to Stan Barber (Internet: nntp@tmc.edu; UUCP: ...!bcm!nntp)\r\n");
X printf(".\r\n");
X--- 23,31 -----
X printf("IHAVE NEWNEWS SLAVE\r\n");
X printf("\r\nAdditionally, the following extentions are supported:\r\n\r\n");
X printf("XHDR Retrieve a single header line from a range of articles.\r\n");
X+ #ifdef LISTGROUP
X+ printf("LISTGROUP Retrieve a list of article-numbers (for nn's nnmaster).\r\n");
X+ #endif LISTGROUP
X printf("\r\n");
X
X printf("Bugs to Stan Barber (Internet: nntp@tmc.edu; UUCP: ...!bcm!nntp)\r\n");
X**************
X*** 24,29
X printf("\r\nAdditionally, the following extention is supported:\r\n\r\n");
X printf("XHDR Retrieve a single header line from a range of articles.\r\n");
X printf("\r\n");
X printf("Bugs to Stan Barber (Internet: nntp@tmc.edu; UUCP: ...!bcm!nntp)\r\n");
X printf(".\r\n");
X (void) fflush(stdout);
X--- 27,33 -----
X printf("LISTGROUP Retrieve a list of article-numbers (for nn's nnmaster).\r\n");
X #endif LISTGROUP
X printf("\r\n");
X+
X printf("Bugs to Stan Barber (Internet: nntp@tmc.edu; UUCP: ...!bcm!nntp)\r\n");
X printf(".\r\n");
X (void) fflush(stdout);
END_OF_FILE
if test 2324 -ne `wc -c <'help.c.patch'`; then
echo shar: \"'help.c.patch'\" unpacked with wrong size!
fi
# end of 'help.c.patch'
fi
if test -f 'nntp_awk.patch' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'nntp_awk.patch'\"
else
echo shar: Extracting \"'nntp_awk.patch'\" \(1309 characters\)
sed "s/^X//" >'nntp_awk.patch' <<'END_OF_FILE'
X*** nntp_awk.orig
X--- nntp_awk
X**************
X*** 30,35
X # Fixed bug in explorers couting - November 7, 1989
X # Stan Barber <sob@bcm.tmc.edu>
X #
X BEGIN{
X readers = 0;
X transmit = 0;
X--- 30,38 -----
X # Fixed bug in explorers couting - November 7, 1989
X # Stan Barber <sob@bcm.tmc.edu>
X #
X+ # Added listgroup count - April 21, 1992
X+ # J.P.M. van der Jagt <jeanpaul@duteca.et.tudelft.nl>
X+ #
X BEGIN{
X readers = 0;
X transmit = 0;
X**************
X*** 159,164
X unknown[host]++;
X curious = 1;
X }
X ### Print anything that we don't recognize in the report
X {
X print;
X--- 162,172 -----
X unknown[host]++;
X curious = 1;
X }
X+ $7 == "listgroup" {
X+ listgroup = 1;
X+ lg[host]++;
X+ next;
X+ }
X ### Print anything that we don't recognize in the report
X {
X print;
X**************
X*** 435,440
X printf("Server timeouts\n");
X for(s in timeout) {
X printf("%-25s %5d\n", s, timeout[s]);
X }
X printf("\n");
X }
X--- 443,456 -----
X printf("Server timeouts\n");
X for(s in timeout) {
X printf("%-25s %5d\n", s, timeout[s]);
X+ }
X+ printf("\n");
X+ }
X+ ###############################################################################
X+ if (listgroup) {
X+ printf("Listgroup requests\n");
X+ for(s in lg) {
X+ printf("%-25s %5d\n", s, lg[s]);
X }
X printf("\n");
X }
END_OF_FILE
if test 1309 -ne `wc -c <'nntp_awk.patch'`; then
echo shar: \"'nntp_awk.patch'\" unpacked with wrong size!
fi
# end of 'nntp_awk.patch'
fi
if test -f 'serve.c.patch' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'serve.c.patch'\"
else
echo shar: Extracting \"'serve.c.patch'\" \(882 characters\)
sed "s/^X//" >'serve.c.patch' <<'END_OF_FILE'
X*** serve.c.orig
X--- serve.c
X**************
X*** 26,32
X
X extern int ahbs(), group(), help(), ihave();
X extern int list(), newgroups(), newnews(), nextlast(), post();
X! extern int slave(), stat(), xhdr();
X
X extern int errno;
X
X--- 26,36 -----
X
X extern int ahbs(), group(), help(), ihave();
X extern int list(), newgroups(), newnews(), nextlast(), post();
X! #ifdef LISTGROUP
X! extern int slave(), stat(), xhdr(), listgroup();
X! #else
X! extern int slave(), stat(), xhdr();
X! #endif LISTGROUP
X
X extern int errno;
X
X**************
X*** 61,66
X #ifdef XHDR
X "xhdr", 0, xhdr,
X #endif XHDR
X };
X #define NUMCMDS (sizeof(cmdtbl) / sizeof(struct cmdent))
X
X--- 65,74 -----
X #ifdef XHDR
X "xhdr", 0, xhdr,
X #endif XHDR
X+ #ifdef LISTGROUP
X+ "listgroup", 0, listgroup,
X+ #endif LISTGROUP
X+
X };
X #define NUMCMDS (sizeof(cmdtbl) / sizeof(struct cmdent))
X
END_OF_FILE
if test 882 -ne `wc -c <'serve.c.patch'`; then
echo shar: \"'serve.c.patch'\" unpacked with wrong size!
fi
# end of 'serve.c.patch'
fi
if test -f 'xhdr.c.patch' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'xhdr.c.patch'\"
else
echo shar: Extracting \"'xhdr.c.patch'\" \(2705 characters\)
sed "s/^X//" >'xhdr.c.patch' <<'END_OF_FILE'
X*** xhdr.c.orig
X--- xhdr.c
X**************
X*** 167,169
X }
X
X #endif not XHDR
X--- 167,282 -----
X }
X
X #endif not XHDR
X+
X+
X+ #ifdef LISTGROUP
X+ /*
X+ * LISTGROUP group
X+ *
X+ * Lists all article numbers (filenames) in the given group. Used by the
X+ * famous newsreader 'nn' for fast expiration of the nn database.
X+ *
X+ * This command is an extention, and not included in RFC 977.
X+ */
X+
X+ listgroup(argc, argv)
X+ int argc;
X+ char *argv[];
X+ {
X+ DIR *dirp;
X+ struct direct *dp;
X+ char temp_dir[256];
X+ int high_msg, low_msg;
X+ char *cp;
X+ char *reqlist[2];
X+
X+ if (argc != 2) {
X+ printf("%d Usage: LISTGROUP newsgroup.\r\n", ERR_CMDSYN);
X+ (void) fflush(stdout);
X+ return;
X+ }
X+
X+ ingroup = 0;
X+
X+ if (!canread) {
X+ printf("%d You only have permission to transfer, sorry.\r\n",
X+ ERR_ACCESS);
X+ (void) fflush(stdout);
X+ return;
X+ }
X+
X+ if (index(argv[1], '/') != (char *) NULL) {
X+ printf("%d Invalid group name (bad format).\r\n", ERR_NOGROUP);
X+ (void) fflush(stdout);
X+ return;
X+ }
X+
X+ if (find_group(argv[1], num_groups, &low_msg, &high_msg) < 0) {
X+ printf("%d Invalid group name (not in active).\r\n",
X+ ERR_NOGROUP);
X+ (void) fflush(stdout);
X+ return;
X+ }
X+
X+ reqlist[0] = argv[1];
X+ reqlist[1] = NULL;
X+
X+ if (ngpermcount) {
X+ if (ngmatch(s1strneql, ALLBUT,
X+ ngpermlist, ngpermcount, reqlist, 1) == 0) {
X+ printf("%d You're not allowed to read %s, sorry.\r\n",
X+ ERR_ACCESS, argv[1]);
X+ (void) fflush(stdout);
X+ return;
X+ }
X+ } else if (ALLBUT == 0) {
X+ printf("%d You're not allowed to read %s, sorry.\r\n",
X+ ERR_ACCESS, argv[1]);
X+ (void) fflush(stdout);
X+ return;
X+ }
X+
X+ close_crnt();
X+ (void) chdir(spooldir);
X+
X+ #ifdef LOG
X+ syslog(LOG_INFO, "%s listgroup %s", hostname, argv[1]);
X+ #endif
X+
X+ while ((cp = index(argv[1], '.')) != (char *) NULL)
X+ *cp = '/';
X+
X+ (void) strcpy(temp_dir, spooldir);
X+ (void) strcat(temp_dir, "/");
X+ (void) strcat(temp_dir, argv[1]);
X+
X+ /*
X+ * (void) because a group can be in the active file
X+ * but not have a spool directory. Just leave us
X+ * chdired to base spool directory if this fails.
X+ */
X+ (void) chdir(temp_dir);
X+
X+ #ifdef LOG
X+ ++grps_acsd;
X+ #endif
X+
X+ printf("%d list of article numbers follow\r\n", OK_GROUP);
X+
X+ if((dirp = opendir(".")) == NULL) {
X+ printf("%d directory open failed.\r\n",
X+ ERR_ACCESS);
X+ } else {
X+ while((dp = readdir(dirp)) != NULL ) {
X+ if( *(dp->d_name) >= '0' && *(dp->d_name) <= '9' ) {
X+ printf( "%s\r\n", dp->d_name );
X+ }
X+ }
X+ closedir(dirp);
X+ }
X+ putchar('.');
X+ putchar('\r');
X+ putchar('\n');
X+ (void) fflush(stdout);
X+ }
X+ #endif LISTGROUP
END_OF_FILE
if test 2705 -ne `wc -c <'xhdr.c.patch'`; then
echo shar: \"'xhdr.c.patch'\" unpacked with wrong size!
fi
# end of 'xhdr.c.patch'
fi
if test -f 'conf.h.added' -a "${1}" != "-c" ; then
echo shar: Will not clobber existing file \"'conf.h.added'\"
else
echo shar: Extracting \"'conf.h.added'\" \(123 characters\)
sed "s/^X//" >'conf.h.added' <<'END_OF_FILE'
X#define LISTGROUP /* Optional LISTGROUP command. Defining this will */
X /* speed up the expire command for nnmaster */
X
END_OF_FILE
if test 123 -ne `wc -c <'conf.h.added'`; then
echo shar: \"'conf.h.added'\" unpacked with wrong size!
fi
# end of 'conf.h.added'
fi
echo shar: End of shell archive.
exit 0
Re: SUMMARY: LISTGROUP patch for NNmaster/nntpd
Author: Wayne Davison
Date: Tue, 21 Apr 1992 19:06
Date: Tue, 21 Apr 1992 19:06
32 lines
2367 bytes
2367 bytes
J.P.M. van der Jagt (jeanpaul@duteca.et.tudelft.nl) wrote: > I managed to find a file which contained the source [to LISTGROUP ...] > The patch follows. This implementation of LISTGROUP suffers from a number of irksome details: o It almost completely duplicates the GROUP command's code, which can only serve to make maintenance harder. o It forces you to specify a group name, which is very inefficient if you want to list the current group (which already has an article array with all the article numbers available). o The command name should have started with an 'X'. I took this code a while back and transformed it into a call that will list the current group (using the existing article number array) or the specified group (by first calling the GROUP command for you). This is only slightly less efficient than the previous code if you plan to just issue a whole bunch of LISTGROUPs (e.g. the article numbers will be sorted). It is much more efficient if you are already in a GROUP or need to use the group after listing the article numbers (in which case the prior code kicks you out of whatever group you were in and forces you to issue a GROUP command). I'm planning to include my changes in my next trn patch (version 2.3 -- available God knows when) which will speed up mthreads' extra-expire pass a little bit. I was wondering if I should change the name to something like "XENUM"? Should it only enumerate the current group? Does anyone else besides nnmaster use the LISTGROUP command? -- \ /| / /|\/ /| /(_) Wayne Davison (_)/ |/ /\|/ / |/ \ davison@borland.com (W A Y N e)
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