Article View: news.software.readers
Article #3995Re: Tin 1.1pl9 + NOV/INN1.4 XOVERVIEW patches
From: Stephen D. Williams
Date: Tue, 27 Apr 1993 17:39
Date: Tue, 27 Apr 1993 17:39
562 lines
18663 bytes
18663 bytes
A nicer version, with proper date formatting.
Doesn't bounce as many xindex commands to a non-responding INN server.
Improved handing of bad index entries (ARMM).
CHANGES tin v1.1 PL9 -> tin 1.1 PL9+sdw_b (xover, unofficial, alpha)
1) Added support in open.c and art.c for NOV XOVER handling.
Tested against an INN1.4 server.
Considered putting references in the Archive name field, but held off.
The code is alpha and was written to minimize code affected by patches.
It needs cleaned up badly, but appears to work (even with ARMM message
headers!).
It should need more work for local overview files: nntp-only was the
dev. environment.
I'm going to be reporting my compressed/archived news archive patches
to both (new versions of) tin (for local/mounted access) and inn
as I get time..
If headers are rediculous (ARMM...), an attempt is made to ignore them.
diff +recursive +context=5 tin-1.19/CHANGES tin119/CHANGES
*** tin-1.19/CHANGES Fri Mar 19 19:54:08 1993
--- tin119/CHANGES Tue Apr 27 13:33:02 1993
***************
*** 1,5 ****
--- 1,22 ----
+ CHANGES tin v1.1 PL9 -> tin 1.1 PL9+sdw_b (xover, unofficial, alpha)
+ 1) Added support in open.c and art.c for NOV XOVER handling.
+ Tested against an INN1.4 server.
+ Considered putting references in the Archive name field, but held off.
+ The code is alpha and was written to minimize code affected by patches.
+ It needs cleaned up badly, but appears to work (even with ARMM message
+ headers!).
+
+ It should need more work for local overview files: nntp-only was the
+ dev. environment.
+
+ I'm going to be reporting my compressed/archived news archive patches
+ to both (new versions of) tin (for local/mounted access) and inn
+ as I get time..
+
+ If headers are rediculous (ARMM...), an attempt is made to ignore them.
+
CHANGES tin v1.1 PL8 -> tin 1.1 PL9
-----------------------------------
1) Tonis Kelder (tkelder@kask.ebc.ee)
BUG. -w command line option causes SIGBUS.
Only in tin119: CHANGES~
diff +recursive +context=5 tin-1.19/Makefile tin119/Makefile
*** tin-1.19/Makefile Fri Mar 19 19:54:07 1993
--- tin119/Makefile Tue Apr 27 00:12:02 1993
***************
*** 118,130 ****
EXE=tin linkit
# For BSD-derived systems
bsd:
@echo "Compiling $(EXE) v$(VER) for BSD/Dec/DG/NeXT/Sun..."
! @$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD -DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" -DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" -DLIBDIR=\"$(LIBDIR)\" -DSPOOLDIR=\"$(SPOOLDIR)\"' \
LIBS="-lcurses -ltermcap" \
EXE=tin linkit
# For Sequent DYNIX
dynix:
@echo "Compiling $(EXE) v$(VER) for Sequent DYNIX..."
@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD -DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" -DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" -DLIBDIR=\"$(LIBDIR)\" -DSPOOLDIR=\"$(SPOOLDIR)\"' \
--- 119,133 ----
EXE=tin linkit
# For BSD-derived systems
bsd:
@echo "Compiling $(EXE) v$(VER) for BSD/Dec/DG/NeXT/Sun..."
! @$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD -DNNTP_ONLY -DHAVE_ISPELL -DNNTP_SERVER_FILE=\"/home/beast/project/itl/lib/nntpserver\" -DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" -DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" -DLIBDIR=\"$(LIBDIR)\" -DSPOOLDIR=\"$(SPOOLDIR)\"' \
LIBS="-lcurses -ltermcap" \
EXE=tin linkit
+
+ # @$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD -DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" -DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" -DLIBDIR=\"$(LIBDIR)\" -DSPOOLDIR=\"$(SPOOLDIR)\"' \
# For Sequent DYNIX
dynix:
@echo "Compiling $(EXE) v$(VER) for Sequent DYNIX..."
@$(MAKE) CC=$(CC) CFLAGS='$(COPTS) -DBSD -DNNTP_INEWS_GATEWAY=\"$(NNTP_INEWS_GATEWAY)\" -DNNTP_INEWS_DOMAIN=\"$(NNTP_INEWS_DOMAIN)\" -DLIBDIR=\"$(LIBDIR)\" -DSPOOLDIR=\"$(SPOOLDIR)\"' \
diff +recursive +context=5 tin-1.19/art.c tin119/art.c
*** tin-1.19/art.c Fri Mar 19 19:54:21 1993
--- tin119/art.c Tue Apr 27 13:30:31 1993
***************
*** 765,775 ****
*/
void read_index_file (group_name)
char *group_name;
{
! char buf[LEN], *p;
int error = 0;
int i, n;
FILE *fp = NULL;
top = 0;
--- 765,778 ----
*/
void read_index_file (group_name)
char *group_name;
{
! char oartn[40], osub[255], oaddr[255], oauth[255], odate[45], obuf[4096*2];
! int overviewflag = 0;
!
! char buf[4096*2], *p;
int error = 0;
int i, n;
FILE *fp = NULL;
top = 0;
***************
*** 785,816 ****
if (fgets(buf, sizeof buf, fp) == NULL ||
fgets(buf, sizeof buf, fp) == NULL) {
error = 0;
goto corrupt_index;
}
i = atoi (buf);
/*
* num. of last_read_article including any that were killed
*/
if (fgets(buf, sizeof buf, fp) == NULL) {
error = 1;
goto corrupt_index;
! }
last_read_article = (long) atol (buf);
!
/*
* load articles
*/
while (top < i) {
if (top >= max_art) {
expand_art ();
}
arts[top].thread = ART_EXPIRED;
set_article (&arts[top]);
/*
* 0. Article no.
*/
if (fgets (buf, sizeof buf, fp) == NULL) {
error = 2;
--- 788,907 ----
if (fgets(buf, sizeof buf, fp) == NULL ||
fgets(buf, sizeof buf, fp) == NULL) {
error = 0;
goto corrupt_index;
}
+ if (strchr(buf, '\t')) {
+ overviewflag++;
+ i = 99999999;
+ } else
i = atoi (buf);
/*
* num. of last_read_article including any that were killed
*/
+ if (!overviewflag) {
if (fgets(buf, sizeof buf, fp) == NULL) {
error = 1;
goto corrupt_index;
! }
last_read_article = (long) atol (buf);
! }
/*
* load articles
*/
while (top < i) {
+ int varidx = 0;
if (top >= max_art) {
expand_art ();
}
arts[top].thread = ART_EXPIRED;
set_article (&arts[top]);
+ /* handle NOV XOVER format. The elses really don't handle
+ failures completely. */
+ if (overviewflag) {
+ char *cp, *cp2, *cp3;
+ /* skip first time, ok when end of file; flag holds num
+ arts read, if needed */
+ if (overviewflag > 1 && fgets(obuf, sizeof obuf, fp) == NULL) break;
+ else {
+ if (overviewflag == 1) strcpy(obuf, buf);
+ overviewflag++;
+ }
+ /* This handles partial record read.... */
+ if (obuf[strlen(obuf) - 1] != '\n') {
+ while (fgets(buf, sizeof(buf), fp) != NULL &&
+ buf[strlen(buf) - 1] != '\n');
+ }
+ last_read_article = (long) atol (obuf);
+
+ sprintf(oartn, "%d", last_read_article);
+ cp = strchr(obuf, '\t');
+ if (!cp || !( /* make sure we have enough fields... */
+ (cp = strchr(cp+1, '\t')) && (cp = strchr(cp+1, '\t')) &&
+ (cp = strchr(cp+1, '\t')) && (cp = strchr(cp+1, '\t'))
+ ) ) {
+ overviewflag--; continue;
+ }
+ cp = strchr(obuf, '\t'); /* ok, start again... */
+ cp2 = strchr(++cp, '\t'); if (cp2) *cp2++ = 0;
+ strcpy(osub, " ");
+ if (cp && cp2 && cp2 > cp)
+ strncat(osub, cp, sizeof(osub) - 3);
+ else osub[1] = 0;
+ /* try to handle address formats:
+ less are valid in news than email, but not sure if
+ covered everything: addr@domain (full name) or
+ Full Name <addr@domain> or <addr-only@domain> or just
+ plain address */
+
+ strcpy(oaddr, " "); strcpy(oauth, " ");
+ cp3 = cp = strchr(cp2, '\t'); if (cp) *cp = 0;
+ if (!strchr(cp2, '(') && !strchr(cp2, '<')) {
+ strcat(oaddr, cp2);
+ } else if (cp = strchr(cp2, '(')) {
+ if (cp[-1] == ' ') cp[-1] = 0;
+ *cp++ = 0;
+ strcat(oaddr, cp2);
+ cp2 = strchr(cp, ')');
+ if (cp2) {
+ *cp2 = 0;
+ strcat(oauth, cp);
+ } else *oauth = 0;
+ } else if ((cp = strchr(cp2, '<'))) {
+ *cp = 0; if (cp[-1] == ' ') cp[-1] = 0;
+ strcat(oauth, cp2);
+ cp2 = strchr(++cp, '>');
+ if (cp2) *cp2 = 0;
+ strcat(oaddr, cp);
+ } else { /* shouldn't be able to get here... */
+ strcat(oaddr, "Unknown");
+ strcat(oauth, "Unknown");
+ }
+ cp2 = cp3 + 1; /* skip to date */
+ /* Handle day-of-week date format: <Thu,>... */
+ if (cp = strchr(cp2, '\t')) {
+ *cp = 0;
+ if (cp = strchr(cp2, ','))
+ cp2 = cp + 1;
+ }
+ sprintf(odate, "%d",
+ parsedate (cp2, (struct _TIMEINFO *) 0));
+ if (!strcmp(oauth, " ") || !strcmp(osub, " ")) {
+ overviewflag--; continue;
+ }
+ }
+
+ /* I know this is strange, but I didn't want to touch the original code... */
+ #define fgets(buf, n, fp) (overviewflag ? \
+ (strcpy(buf, !varidx ? oartn : varidx == 1 ? osub : \
+ varidx == 2 ? oaddr : varidx == 3 ? oauth : varidx \
+ == 4 ? odate : varidx == 5 ? "" : " "), \
+ strcat(buf, "\n"), varidx++, \
+ buf) : fgets(buf, n, fp))
/*
* 0. Article no.
*/
if (fgets (buf, sizeof buf, fp) == NULL) {
error = 2;
***************
*** 964,973 ****
--- 1055,1065 ----
}
debug_print_header (&arts[top]);
top++;
+ #undef fgets
}
fclose(fp);
/*
* If reading in a mail group index check if min & max numbers are
***************
*** 1038,1047 ****
--- 1130,1144 ----
type = active[j].type;
h = hash_groupname (group);
if (read_news_via_nntp && xindex_supported && type == GROUP_TYPE_NEWS) {
sprintf (index_file, "%sxindex.%d", TMPDIR, process_id);
+ return (type);
+ }
+
+ if (read_news_via_nntp && xover_supported && type == GROUP_TYPE_NEWS) {
+ sprintf (index_file, "%sxover.%d", TMPDIR, process_id);
return (type);
}
if (local_index) {
if (type == GROUP_TYPE_NEWS) {
diff +recursive +context=5 tin-1.19/extern.h tin119/extern.h
*** tin-1.19/extern.h Fri Mar 19 19:54:18 1993
--- tin119/extern.h Tue Apr 27 10:22:05 1993
***************
*** 658,667 ****
--- 658,668 ----
extern int verbose;
extern int update_fork;
extern int check_any_unread;
extern int start_any_unread;
extern int xindex_supported;
+ extern int xover_supported;
extern int xuser_supported;
extern int xspooldir_supported;
extern long *base;
diff +recursive +context=5 tin-1.19/init.c tin119/init.c
*** tin-1.19/init.c Fri Mar 19 19:54:26 1993
--- tin119/init.c Tue Apr 27 10:22:46 1993
***************
*** 72,81 ****
--- 72,82 ----
int unread_art_mark;
int hot_art_mark;
int return_art_mark;
int xindex_supported = FALSE;
+ int xover_supported = FALSE;
int xuser_supported = FALSE;
int xspooldir_supported = FALSE;
int NOTESLINES; /* set in set_win_size () */
int RIGHT_POS; /* set in set_win_size () */
int MORE_POS; /* set in set_win_size () */
diff +recursive +context=5 tin-1.19/main.c tin119/main.c
*** tin-1.19/main.c Fri Mar 19 19:54:29 1993
--- tin119/main.c Tue Apr 27 10:23:17 1993
***************
*** 426,436 ****
*/
void update_index_files ()
{
if (update || update_fork) {
! if (!catchup && (read_news_via_nntp && xindex_supported)) {
error_message ("%s: Updating of index files not supported", progname);
tin_done (1);
}
COLS = 132; /* set because curses has not started */
--- 426,437 ----
*/
void update_index_files ()
{
if (update || update_fork) {
! if (!catchup && (read_news_via_nntp && (xindex_supported ||
! xover_supported))) {
error_message ("%s: Updating of index files not supported", progname);
tin_done (1);
}
COLS = 132; /* set because curses has not started */
diff +recursive +context=5 tin-1.19/misc.c tin119/misc.c
*** tin-1.19/misc.c Fri Mar 19 19:54:31 1993
--- tin119/misc.c Tue Apr 27 10:23:33 1993
***************
*** 1430,1440 ****
void cleanup_tmp_files ()
{
extern char index_file[PATH_LEN];
! if (read_news_via_nntp && xindex_supported) {
unlink (index_file);
}
unlink (local_newsgroups_file);
unlink (lock_file);
}
--- 1430,1440 ----
void cleanup_tmp_files ()
{
extern char index_file[PATH_LEN];
! if (read_news_via_nntp && (xindex_supported || xover_supported)) {
unlink (index_file);
}
unlink (local_newsgroups_file);
unlink (lock_file);
}
diff +recursive +context=5 tin-1.19/nntplib.h tin119/nntplib.h
*** tin-1.19/nntplib.h Fri Mar 19 19:54:18 1993
--- tin119/nntplib.h Tue Apr 27 10:28:07 1993
***************
*** 90,99 ****
--- 90,100 ----
#define OK_ARTICLE 220 /* Article (head & body) follows */
#define OK_HEAD 221 /* Head follows */
#define OK_BODY 222 /* Body follows */
#define OK_NOTEXT 223 /* No text sent -- stat, next, last */
+ #define OK_XOVER 224 /* NOV XOVER data follows */
#define OK_NEWNEWS 230 /* New articles by message-id follow */
#define OK_NEWGROUPS 231 /* New newsgroups follow */
#define OK_XFERED 235 /* Article transferred successfully */
#define OK_POSTED 240 /* Article posted successfully */
#define OK_AUTHSYS 280 /* Authorization system ok */
diff +recursive +context=5 tin-1.19/open.c tin119/open.c
*** tin-1.19/open.c Fri Mar 19 19:54:32 1993
--- tin119/open.c Tue Apr 27 13:01:53 1993
***************
*** 85,98 ****
/*
* Check if NNTP supports my XINDEX & XUSER commands
*/
#ifndef DONT_HAVE_NNTP_EXTS
debug_nntp ("nntp_open", "xindex");
! put_server ("xindex");
if (get_respcode () != ERR_COMMAND) {
xindex_supported = TRUE;
}
debug_nntp ("nntp_open", "xuser");
put_server ("xuser");
if (get_respcode () != ERR_COMMAND) {
xuser_supported = TRUE;
}
--- 85,109 ----
/*
* Check if NNTP supports my XINDEX & XUSER commands
*/
#ifndef DONT_HAVE_NNTP_EXTS
debug_nntp ("nntp_open", "xindex");
! /* don't know why !xindex_supported == inn...*/
! /* xover == inn, so... */
! put_server("mode reader");
if (get_respcode () != ERR_COMMAND) {
+ inn_nntp_server = TRUE;
+ }
+
+ put_server ("xindex");
+ if (get_respcode () != ERR_COMMAND) {
xindex_supported = TRUE;
}
+ put_server ("xover");
+ if (get_respcode () != ERR_COMMAND) {
+ xover_supported = TRUE;
+ }
debug_nntp ("nntp_open", "xuser");
put_server ("xuser");
if (get_respcode () != ERR_COMMAND) {
xuser_supported = TRUE;
}
***************
*** 313,332 ****
if (debug == 2) {
error_message ("INDEX file=[%s]", index_file);
}
! if (read_news_via_nntp && xindex_supported &&
group_type == GROUP_TYPE_NEWS) {
#ifdef NNTP_ABLE
sprintf (line, "xindex %s", group_name);
debug_nntp ("open_index_fp", line);
put_server (line);
if (get_respcode () != OK_XINDEX) {
debug_nntp ("open_index_fp", "NOT_OK");
return (FILE *) 0;
}
debug_nntp ("open_index_fp", "OK");
return nntp_to_fp ();
#else
return (FILE *) 0;
#endif
--- 324,361 ----
if (debug == 2) {
error_message ("INDEX file=[%s]", index_file);
}
! if (read_news_via_nntp && (xindex_supported || xover_supported) &&
group_type == GROUP_TYPE_NEWS) {
#ifdef NNTP_ABLE
+ if (xindex_supported) {
sprintf (line, "xindex %s", group_name);
debug_nntp ("open_index_fp", line);
put_server (line);
if (get_respcode () != OK_XINDEX) {
debug_nntp ("open_index_fp", "NOT_OK");
return (FILE *) 0;
}
+ }
+ if (xover_supported) {
+ /* now try xover */
+ debug_nntp ("open_index_fp", line);
+ sprintf (line, "group %s", group_name);
+ put_server (line);
+ if (get_respcode () != OK_GROUP) {
+ debug_nntp ("open_index_fp", "NOT_OK");
+ return (FILE *) 0;
+ }
+ sprintf (line, "xover 1-99999999");
+ put_server (line);
+ if (get_respcode() != OK_XOVER) {
+ debug_nntp ("open_index_fp", "NOT_OK");
+ return (FILE *) 0;
+ }
+ }
debug_nntp ("open_index_fp", "OK");
return nntp_to_fp ();
#else
return (FILE *) 0;
#endif
diff +recursive +context=5 tin-1.19/post.c tin119/post.c
*** tin-1.19/post.c Fri Mar 19 19:54:34 1993
--- tin119/post.c Tue Apr 27 10:27:28 1993
***************
*** 977,991 ****
DEFAULT_ACTIVE_NUM,
DEFAULT_ARTICLE_NUM,
reread_active_file_secs,
is_longfiles,
(tin_uid == real_uid ? 0 : 1));
! fprintf (fp, "CFG2: nntp=%d nntp_only=%d nntp_xuser=%d nntp_xindex=%d nntp_xspooldir=%d\n",
is_nntp,
is_nntp_only,
xuser_supported,
xindex_supported,
xspooldir_supported);
fprintf (fp, "CFG3: debug=%d gateway=[%s] domain=[%s]\n",
is_debug,
(gateway ? gateway : ""),
(domain ? domain : ""));
--- 977,993 ----
DEFAULT_ACTIVE_NUM,
DEFAULT_ARTICLE_NUM,
reread_active_file_secs,
is_longfiles,
(tin_uid == real_uid ? 0 : 1));
! fprintf (fp, "CFG2: nntp=%d nntp_only=%d nntp_xuser=%d
! nntp_xindex=%d nntp_xover=%d nntp_xspooldir=%d\n",
is_nntp,
is_nntp_only,
xuser_supported,
xindex_supported,
+ xover_supported,
xspooldir_supported);
fprintf (fp, "CFG3: debug=%d gateway=[%s] domain=[%s]\n",
is_debug,
(gateway ? gateway : ""),
(domain ? domain : ""));
Thanks
sdw
--
Stephen D. Williams Local Internet Gateway Co.; SDW Systems 513 496-5223APager
LIG dev./sales Internet: sdw@world.std.com CIS 76244.210@compuserve.com
OO R&D Source Dist. By Horse: 2464 Rosina Dr., Miamisburg, OH 45342-6430
GNU Support ICBM: 39 34N 85 15W I love it when a plan comes together
Technical Details
Message-ID:
<1rjr58$ohu@meaddata.meaddata.com>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!usc!cs.utexas.edu!uunet!meaddata!sdwReferences:
<1rimo7$1n2@meaddata.meaddata.com>Show Full Headers
Complete Article Headers
Message-ID: <1rjr58$ohu@meaddata.meaddata.com> Subject: Re: Tin 1.1pl9 + NOV/INN1.4 XOVERVIEW patches Date: Tue, 27 Apr 1993 17:39:52 +0000 From: sdw@lig.net (Stephen D. Williams) References: <1rimo7$1n2@meaddata.meaddata.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!archive!mbox2nntp-news.software.readers.mbox.zip!gmd.de!newsserver.jvnc.net!howland.reston.ans.net!usc!cs.utexas.edu!uunet!meaddata!sdw Newsgroups: news.software.readers Organization: Local Internet Gateway Co. Lines: 562 NNTP-Posting-Host: bugatti.meaddata.com X-Newsreader: TIN [version 1.1 PL9]