Thread View: news.software.readers
1 messages
1 total messages
Started by Larry Jones
Sat, 04 Jul 1992 19:29
Fixes for NNTP vnews, checknews, etc. (CORRECTED)
Author: Larry Jones
Date: Sat, 04 Jul 1992 19:29
Date: Sat, 04 Jul 1992 19:29
1122 lines
28296 bytes
28296 bytes
A number of people (including me) have reported strange behavior from
the B-news clients when using NNTP. For example, checknews leaves
stray files on /tmp, vnews gets out of sync with the server (which
causes all kinds of interesting effects), and heaven help you if you
lose your connection to the server since all remaining news articles
will be marked as having been read. These patches should take care of
all the problems. (The version I posted yesterday [and then cancelled]
contained an embarrassing typo which I never noticed. If you happened
to see it, please ignore it and use this instead.)
diff -c /mnt/newshome/src/Makefile.dst ./Makefile.dst
*** /mnt/newshome/src/Makefile.dst Fri Nov 23 15:44:39 1990
--- ./Makefile.dst Thu Jun 4 00:00:00 1992
***************
*** 191,197 ****
-test -d $(DESTDIR)$(BINDIR) || mkdir $(DESTDIR)$(BINDIR)
-test -d $(DESTDIR)$(LIBDIR) || mkdir $(DESTDIR)$(LIBDIR)
for i in $(COMMANDS); do \
! ./installit -m 755 -o $(NEWSUSR) -g $(NEWSGRP) -s $$i \
$(DESTDIR)$(BINDIR); \
done
cp help vnews.help $(DESTDIR)$(LIBDIR)
--- 191,197 ----
-test -d $(DESTDIR)$(BINDIR) || mkdir $(DESTDIR)$(BINDIR)
-test -d $(DESTDIR)$(LIBDIR) || mkdir $(DESTDIR)$(LIBDIR)
for i in $(COMMANDS); do \
! ./installit -c -m 755 -o $(NEWSUSR) -g $(NEWSGRP) -s $$i \
$(DESTDIR)$(BINDIR); \
done
cp help vnews.help $(DESTDIR)$(LIBDIR)
***************
*** 241,247 ****
for i in $(OSRCS); do lint $(LINTFLAGS) $$i; done
inews: $(P) $(IOBJECTS)
! $(CC) $(LFLAGS) $(IOBJECTS) -o inews $(LIBS) #NOTVMS
#VMS vms link/notrace inews.o,ifuncs.o,iextern.o,control.o, \
#VMS fullname.o,ipathinit.o,funcs.o,funcs2.o,getdate.o,header.o, \
#VMS ndir.o,uname.o,lib:libdbm/lib,lib:libc/lib/exe=inews.
--- 241,247 ----
for i in $(OSRCS); do lint $(LINTFLAGS) $$i; done
inews: $(P) $(IOBJECTS)
! $(CC) $(LFLAGS) $(IOBJECTS) -o inews $(NETLIB) $(LIBS) #NOTVMS
#VMS vms link/notrace inews.o,ifuncs.o,iextern.o,control.o, \
#VMS fullname.o,ipathinit.o,funcs.o,funcs2.o,getdate.o,header.o, \
#VMS ndir.o,uname.o,lib:libdbm/lib,lib:libc/lib/exe=inews.
***************
*** 391,397 ****
$(CC) $(CFLAGS) -c fullname.c
expire: $(P) $(EXPOBJS)
! $(CC) $(LFLAGS) -o expire $(EXPOBJS) $(LIBS)
#VMS mv expire.exe expire
header.o: header.c header.h defs.h patchlevel.h params.h Makefile
--- 391,397 ----
$(CC) $(CFLAGS) -c fullname.c
expire: $(P) $(EXPOBJS)
! $(CC) $(LFLAGS) -o expire $(EXPOBJS) $(NETLIB) $(LIBS)
#VMS mv expire.exe expire
header.o: header.c header.h defs.h patchlevel.h params.h Makefile
diff -c /mnt/newshome/src/checknews.c ./checknews.c
*** /mnt/newshome/src/checknews.c Fri Nov 23 15:44:40 1990
--- ./checknews.c Mon Jun 8 11:08:38 1992
***************
*** 225,231 ****
fprintf(stderr, "header.nbuf = %s\n", header.nbuf);
#endif
nchk(argv);
! exit(0);
}
nchk(argv)
--- 229,235 ----
fprintf(stderr, "header.nbuf = %s\n", header.nbuf);
#endif
nchk(argv);
! xxit(0);
}
nchk(argv)
***************
*** 317,322 ****
--- 321,331 ----
printf(".\n");
}
if (e) {
+ #ifdef SERVER
+ if (active_name() != NULL)
+ (void) unlink(active_name());
+ close_server();
+ #endif
#ifdef V6
execv("/usr/bin/readnews", argv);
#else
***************
*** 325,333 ****
perror("Cannot exec readnews.");
}
if (q)
! exit(1);
else
! exit(0);
}
xerror(message, arg1, arg2)
--- 334,342 ----
perror("Cannot exec readnews.");
}
if (q)
! xxit(1);
else
! xxit(0);
}
xerror(message, arg1, arg2)
***************
*** 338,344 ****
sprintf(buffer, message, arg1, arg2);
fprintf(stderr, "checknews: %s.\n", buffer);
! exit(1);
}
/*
--- 347,353 ----
sprintf(buffer, message, arg1, arg2);
fprintf(stderr, "checknews: %s.\n", buffer);
! xxit(1);
}
/*
***************
*** 549,554 ****
--- 558,565 ----
xxit(i)
{
#ifdef SERVER
+ if (active_name() != NULL)
+ (void) unlink(active_name());
close_server();
#endif /* SERVER */
exit(i);
diff -c /mnt/newshome/src/funcs2.c ./funcs2.c
*** /mnt/newshome/src/funcs2.c Fri Nov 23 15:44:41 1990
--- ./funcs2.c Fri Jul 3 10:54:59 1992
***************
*** 21,26 ****
--- 21,29 ----
#endif /* SCCSID */
#include "params.h"
+ #ifdef SERVER
+ #include "nntp.h"
+ #endif
extern char filename[];
***************
*** 492,506 ****
#ifdef SERVER
(void) sprintf(lbuf,"STAT %s",oidbuf);
put_server(lbuf);
! (void) get_server(workspace,sizeof(workspace));
if (*workspace != '2')
return NULL;
(void) sprintf(lbuf,"XHDR xref %s",oidbuf);
put_server(lbuf);
! (void) get_server(workspace,sizeof(workspace)); /* get response */
if (*workspace != '2')
return NULL; /* old style nntp */
! (void) get_server(workspace,sizeof(workspace)); /* get header line */
sync_server(); /* get rid of the rest of it */
p = index(workspace,' ');
p++;
--- 498,517 ----
#ifdef SERVER
(void) sprintf(lbuf,"STAT %s",oidbuf);
put_server(lbuf);
! if (get_server(workspace,sizeof(workspace)) < 0 ||
! strncmp(workspace, ERR_GOODBYE, 3) == 0)
! lost_server();
if (*workspace != '2')
return NULL;
(void) sprintf(lbuf,"XHDR xref %s",oidbuf);
put_server(lbuf);
! if (get_server(workspace,sizeof(workspace)) < 0 ||
! strncmp(workspace, ERR_GOODBYE, 3) == 0)
! lost_server();
if (*workspace != '2')
return NULL; /* old style nntp */
! if (get_server(workspace,sizeof(workspace)) < 0)
! lost_server();
sync_server(); /* get rid of the rest of it */
p = index(workspace,' ');
p++;
***************
*** 511,526 ****
char n[100], buf[100], *name;
(void) sprintf(lbuf,"XHDR newsgroups %s",oidbuf);
put_server(lbuf);
! (void) get_server(workspace,sizeof(workspace));
if (*workspace != '2')
return NULL;
! (void) get_server(workspace,sizeof(workspace));
sync_server();
if ((name = index(workspace,' ')) == NULL)
return NULL;
name++;
/* now we fetch the line from the active file */
af = xfopen(ACTIVE, "r");
while (fgets(buf, sizeof(buf), af) != NULL) {
if (sscanf(buf, "%s %ld %ld", n, &s, &sm) == 3 &&
STRCMP(n, name) == 0) {
--- 522,540 ----
char n[100], buf[100], *name;
(void) sprintf(lbuf,"XHDR newsgroups %s",oidbuf);
put_server(lbuf);
! if (get_server(workspace,sizeof(workspace)) < 0 ||
! strncmp(workspace, ERR_GOODBYE, 3) == 0)
! lost_server();
if (*workspace != '2')
return NULL;
! if (get_server(workspace,sizeof(workspace)) < 0)
! lost_server();
sync_server();
if ((name = index(workspace,' ')) == NULL)
return NULL;
name++;
/* now we fetch the line from the active file */
af = xfopen(ACTIVE, "r");
while (fgets(buf, sizeof(buf), af) != NULL) {
if (sscanf(buf, "%s %ld %ld", n, &s, &sm) == 3 &&
STRCMP(n, name) == 0) {
***************
*** 533,542 ****
return NULL;
(void) sprintf(lbuf, "XHDR message-id %d-%d", sm, s);
put_server(lbuf);
! (void) get_server(workspace,sizeof(workspace));
if (*workspace != '2')
return NULL;
! while ( get_server(workspace,sizeof(workspace)) >= 0) {
if (*workspace == '.' && strlen(workspace) == 1)
return NULL;
if (strindex(workspace,oidbuf) > -1)
--- 551,564 ----
return NULL;
(void) sprintf(lbuf, "XHDR message-id %d-%d", sm, s);
put_server(lbuf);
! if (get_server(workspace,sizeof(workspace)) < 0 ||
! strncmp(workspace, ERR_GOODBYE, 3) == 0)
! lost_server();
if (*workspace != '2')
return NULL;
! for (;;) {
! if (get_server(workspace,sizeof(workspace)) < 0)
! lost_server();
if (*workspace == '.' && strlen(workspace) == 1)
return NULL;
if (strindex(workspace,oidbuf) > -1)
***************
*** 549,559 ****
strcpy(workspace, lbuf);
} else {
bzero(lbuf, sizeof(lbuf));
! strcpy(lbuf, p);
! while (*p != '\0' && (p = index(lbuf,':')) != NULL) {
! *p = '/';
! p++;
! }
strcpy(workspace, lbuf);
}
p = &workspace[0];
--- 571,578 ----
strcpy(workspace, lbuf);
} else {
bzero(lbuf, sizeof(lbuf));
! strcpy(lbuf, index(p+1, ' ') + 1);
! for (p = lbuf; (p = index(p, ':')) != NULL; *p++ = '/') ;
strcpy(workspace, lbuf);
}
p = &workspace[0];
diff -c /mnt/newshome/src/inews.c ./inews.c
*** /mnt/newshome/src/inews.c Fri Nov 23 15:44:40 1990
--- ./inews.c Fri Jan 11 18:02:21 1991
***************
*** 1225,1232 ****
(void) sprintf(command, NFSCMDFORMAT, NFSCMDARGS);
status = system(command);
! (void) unlink(ARTICLE);
! exit(status);
}
#endif /* NFSCLIENT */
}
--- 1242,1248 ----
(void) sprintf(command, NFSCMDFORMAT, NFSCMDARGS);
status = system(command);
! xxit(status);
}
#endif /* NFSCLIENT */
}
diff -c /mnt/newshome/src/nntp.c ./nntp.c
*** /mnt/newshome/src/nntp.c Fri Nov 23 15:44:46 1990
--- ./nntp.c Fri Jul 3 12:44:37 1992
***************
*** 69,74 ****
--- 69,88 ----
}
/*
+ * lost_server prints an error message and exits cleanly when the connection
+ * to the server is lost
+ */
+
+ void
+ lost_server()
+ {
+
+ fprintf(stderr, "\r\nlost connection to news server %s: exiting\r\n",
+ nntpserver);
+ cleanup(0);
+ }
+
+ /*
* open_active gets the active file and returns an open file descriptor to
* the calling program
*/
***************
*** 79,86 ****
FILE *openfp;
bzero(active_file_name, sizeof(active_file_name));
put_server("LIST"); /* tell server we want the active file */
! (void) get_server(ser_line, sizeof(ser_line));
! if (*ser_line != CHAR_OK) { /* and then see if that's ok */
xerror("Can't get active file from server: \n%s\n", ser_line);
}
strcpy(active_file_name, "/tmp/nsact.XXXXXX");
--- 93,100 ----
FILE *openfp;
bzero(active_file_name, sizeof(active_file_name));
put_server("LIST"); /* tell server we want the active file */
! if (get_server(ser_line, sizeof(ser_line)) < 0 ||
! *ser_line != CHAR_OK) { /* and then see if that's ok */
xerror("Can't get active file from server: \n%s\n", ser_line);
}
strcpy(active_file_name, "/tmp/nsact.XXXXXX");
***************
*** 89,98 ****
if (openfp == NULL)
return NULL;
! while (get_server(ser_line, sizeof(ser_line)) >= 0) { /* while */
if (ser_line[0] == '.' && strlen(ser_line) == 1)
! /* there's another line */
! break; /* get it and write it to */
fputs(ser_line, openfp);
putc('\n', openfp);
}
--- 103,113 ----
if (openfp == NULL)
return NULL;
! for(;;) {
! if (get_server(ser_line, sizeof(ser_line)) < 0)
! lost_server();
if (ser_line[0] == '.' && strlen(ser_line) == 1)
! break; /* no more lines */
fputs(ser_line, openfp);
putc('\n', openfp);
}
***************
*** 129,135 ****
return NULL;
(void) sprintf(nntpbfr, "GROUP %s", newsgroup);
put_server(nntpbfr);
! (void) get_server(ser_line, sizeof(ser_line));
if (*ser_line != CHAR_OK)
return NULL;
strcpy(last_group, newsgroup);
--- 144,152 ----
return NULL;
(void) sprintf(nntpbfr, "GROUP %s", newsgroup);
put_server(nntpbfr);
! if (get_server(ser_line, sizeof(ser_line)) < 0 ||
! strncmp(ser_line, ERR_GOODBYE, 3) == 0)
! lost_server();
if (*ser_line != CHAR_OK)
return NULL;
strcpy(last_group, newsgroup);
***************
*** 157,163 ****
return NULL;
(void) sprintf(nntpbfr, "%s %ld", command, number);
put_server(nntpbfr);
! (void) get_server(ser_line, sizeof(ser_line));
if (*ser_line != CHAR_OK)
return NULL;
if ((fp = fopen(article_file_name, "w+")) == NULL) {
--- 174,182 ----
return NULL;
(void) sprintf(nntpbfr, "%s %ld", command, number);
put_server(nntpbfr);
! if (get_server(ser_line, sizeof(ser_line)) < 0 ||
! strncmp(ser_line, ERR_GOODBYE, 3) == 0)
! lost_server();
if (*ser_line != CHAR_OK)
return NULL;
if ((fp = fopen(article_file_name, "w+")) == NULL) {
***************
*** 165,175 ****
sync_server();
return NULL;
}
! while (get_server(ser_line, sizeof(ser_line)) >= 0) { /* while */
if (ser_line[0] == '.' && strlen(ser_line) == 1)
! /* there's another line */
! break; /* get it and write it to */
! fputs(ser_line, fp); /* the temp file */
putc('\n', fp);
}
fseek(fp, 0L, 0); /* just get to the beginning */
--- 184,195 ----
sync_server();
return NULL;
}
! for(;;) {
! if (get_server(ser_line, sizeof(ser_line)) < 0)
! lost_server();
if (ser_line[0] == '.' && strlen(ser_line) == 1)
! break; /* no more lines */
! fputs(ser_line, fp);
putc('\n', fp);
}
fseek(fp, 0L, 0); /* just get to the beginning */
***************
*** 213,219 ****
char nntpbfr[256];
(void) sprintf(nntpbfr, "ARTICLE %s", id);
put_server(nntpbfr);
! (void) get_server(ser_line, sizeof(ser_line));
if (*ser_line != CHAR_OK) {
fprintf(stderr, "Cannot fetch article %s\n", id);
return NULL;
--- 233,241 ----
char nntpbfr[256];
(void) sprintf(nntpbfr, "ARTICLE %s", id);
put_server(nntpbfr);
! if (get_server(ser_line, sizeof(ser_line)) < 0 ||
! strncmp(ser_line, ERR_GOODBYE, 3) == 0)
! lost_server();
if (*ser_line != CHAR_OK) {
fprintf(stderr, "Cannot fetch article %s\n", id);
return NULL;
***************
*** 226,236 ****
sync_server();
return NULL;
}
! while (get_server(ser_line, sizeof(ser_line)) >= 0) { /* while */
if (ser_line[0] == '.' && strlen(ser_line) == 1)
! /* there's another line */
! break; /* get it and write it to */
! fputs(ser_line, fp); /* the temp file */
putc('\n', fp);
}
fseek(fp, 0L, 0); /* just get to the beginning */
--- 248,259 ----
sync_server();
return NULL;
}
! for (;;) {
! if (get_server(ser_line, sizeof(ser_line)) < 0)
! lost_server();
if (ser_line[0] == '.' && strlen(ser_line) == 1)
! break; /* no more lines */
! fputs(ser_line, fp);
putc('\n', fp);
}
fseek(fp, 0L, 0); /* just get to the beginning */
***************
*** 244,255 ****
void
sync_server()
{
! while (get_server(ser_line, sizeof(ser_line)) >= 0) { /* while */
if (ser_line[0] == '.' && strlen(ser_line) == 1)
! /* there's another line */
! break; /* get it and throw it away */
}
-
}
/*
--- 267,278 ----
void
sync_server()
{
! for (;;) {
! if (get_server(ser_line, sizeof(ser_line)) < 0)
! lost_server();
if (ser_line[0] == '.' && strlen(ser_line) == 1)
! break; /* no more lines */
}
}
/*
diff -c /mnt/newshome/src/params.h ./params.h
*** /mnt/newshome/src/params.h Fri Nov 23 15:44:44 1990
--- ./params.h Fri Jul 3 10:29:04 1992
***************
*** 88,94 ****
extern struct group *getgrnam(), *getgrent();
extern void setgrent();
extern time_t time(), getdate(), cgtdate();
! extern int broadcast(), save(), newssave(), ushell(), onsig();
extern long atol();
extern struct tm *localtime();
--- 92,98 ----
extern struct group *getgrnam(), *getgrent();
extern void setgrent();
extern time_t time(), getdate(), cgtdate();
! extern int broadcast(), save(), newssave(), ushell();
extern long atol();
extern struct tm *localtime();
***************
*** 104,113 ****
#endif /* lint */
#ifdef VOID_SIGNALS
! typedef void (*SIGNAL_TYPE)();
#else /* int signals */
! typedef int (*SIGNAL_TYPE)();
#endif /* int signals */
#ifdef VMS
#define LINK(a,b) vmslink(a,b)
--- 108,119 ----
#endif /* lint */
#ifdef VOID_SIGNALS
! typedef void HANDLER_TYPE;
#else /* int signals */
! typedef int HANDLER_TYPE;
#endif /* int signals */
+ typedef HANDLER_TYPE (*SIGNAL_TYPE)();
+ extern HANDLER_TYPE onsig();
#ifdef VMS
#define LINK(a,b) vmslink(a,b)
***************
*** 205,210 ****
--- 211,217 ----
/* from nntp.c */
extern FILE *open_active();
extern int open_server();
+ extern void lost_server();
extern char *set_group();
extern char *active_name();
extern char *group_name();
diff -c /mnt/newshome/src/readnews.c ./readnews.c
*** /mnt/newshome/src/readnews.c Fri Nov 23 15:44:46 1990
--- ./readnews.c Tue Jun 2 18:11:20 1992
***************
*** 21,27 ****
struct timeb Now;
! int onsig(), cleanup();
/*
* Authors:
--- 21,27 ----
struct timeb Now;
! HANDLER_TYPE onsig(), cleanup();
/*
* Authors:
***************
*** 291,297 ****
/*NOTREACHED*/
}
! cleanup(signo)
{
extern short ospeed;
--- 295,301 ----
/*NOTREACHED*/
}
! HANDLER_TYPE cleanup(signo)
{
extern short ospeed;
diff -c /mnt/newshome/src/readr.c ./readr.c
*** /mnt/newshome/src/readr.c Fri Nov 23 15:44:40 1990
--- ./readr.c Fri Jul 3 10:47:21 1992
***************
*** 22,27 ****
--- 22,30 ----
#include "rparams.h"
#include <setjmp.h>
#include <errno.h>
+ #ifdef SERVER
+ #include "nntp.h"
+ #endif
extern int errno;
***************
*** 77,83 ****
static int clrtmp = 0;
#endif
! int catchcont();
readr()
{
register char *m = getenv("MORE");
--- 80,86 ----
static int clrtmp = 0;
#endif
! HANDLER_TYPE catchcont();
readr()
{
register char *m = getenv("MORE");
***************
*** 1126,1132 ****
for(;;){
(void) sprintf(bfr,"STAT %ld",tnum);
put_server(bfr);
! (void) get_server(workspace,sizeof(workspace));
if (*workspace != '2') {
if (rflag)
tnum++;
--- 1129,1137 ----
for(;;){
(void) sprintf(bfr,"STAT %ld",tnum);
put_server(bfr);
! if (get_server(workspace,sizeof(workspace)) < 0 ||
! strncmp(workspace, ERR_GOODBYE, 3) == 0)
! lost_server();
if (*workspace != '2') {
if (rflag)
tnum++;
***************
*** 1253,1259 ****
/*
* Routine to catch a continue signal.
*/
! catchcont(sig)
int sig;
{
(void) signal(sig, catchcont);
--- 1258,1264 ----
/*
* Routine to catch a continue signal.
*/
! HANDLER_TYPE catchcont(sig)
int sig;
{
(void) signal(sig, catchcont);
diff -c /mnt/newshome/src/rfuncs.c ./rfuncs.c
*** /mnt/newshome/src/rfuncs.c Fri Nov 23 15:44:47 1990
--- ./rfuncs.c Tue Jun 2 18:11:21 1992
***************
*** 226,232 ****
}
#ifdef TMAIL
! catchterm()
{
(void) unlink(infile);
(void) unlink(outfile);
--- 230,236 ----
}
#ifdef TMAIL
! HANDLER_TYPE catchterm()
{
(void) unlink(infile);
(void) unlink(outfile);
***************
*** 544,550 ****
/*
* Trap interrupts.
*/
! onsig(n)
int n;
{
(void) signal(n, onsig);
--- 548,554 ----
/*
* Trap interrupts.
*/
! HANDLER_TYPE onsig(n)
int n;
{
(void) signal(n, onsig);
***************
*** 777,783 ****
int entries;
unsigned int alloc_size;
SIGNAL_TYPE old_sig;
! extern lg_trap();
char *gets();
#ifdef SERVER
int lowgp,highgp;
--- 784,790 ----
int entries;
unsigned int alloc_size;
SIGNAL_TYPE old_sig;
! extern HANDLER_TYPE lg_trap();
char *gets();
#ifdef SERVER
int lowgp,highgp;
***************
*** 900,906 ****
}
! lg_trap(code)
int code;
{
--- 907,913 ----
}
! HANDLER_TYPE lg_trap(code)
int code;
{
diff -c /mnt/newshome/src/virtterm.c ./virtterm.c
*** /mnt/newshome/src/virtterm.c Fri Nov 23 15:44:47 1990
--- ./virtterm.c Sat Jun 20 16:18:31 1992
***************
*** 10,22 ****
/*LINTLIBRARY*/
! #include <stdio.h>
! #include <ctype.h>
#include <sys/types.h>
#include <sys/ioctl.h>
- #include <signal.h>
#ifdef USG
#include <termio.h>
#else /* !USG */
#include <sgtty.h>
#endif /* !USG */
--- 10,23 ----
/*LINTLIBRARY*/
! #include "params.h"
#include <sys/types.h>
#include <sys/ioctl.h>
#ifdef USG
#include <termio.h>
+ #ifdef TIOCGWINSZ
+ #include <sys/sioctl.h>
+ #endif /* TIOCGWINSZ */
#else /* !USG */
#include <sgtty.h>
#endif /* !USG */
***************
*** 836,842 ****
#ifdef TIOCGWINSZ
{
struct winsize ws;
! int winch();
COLS = ROWS = -1;
if(ioctl(1, TIOCGWINSZ, &ws) == 0) {
--- 837,843 ----
#ifdef TIOCGWINSZ
{
struct winsize ws;
! HANDLER_TYPE winch();
COLS = ROWS = -1;
if(ioctl(1, TIOCGWINSZ, &ws) == 0) {
***************
*** 975,981 ****
* window changed size -- update ROWS and COLS
* and then redraw screen
*/
! winch()
{
struct winsize ws;
int cols, rows;
--- 976,982 ----
* window changed size -- update ROWS and COLS
* and then redraw screen
*/
! HANDLER_TYPE winch()
{
struct winsize ws;
int cols, rows;
diff -c /mnt/newshome/src/visual.c ./visual.c
*** /mnt/newshome/src/visual.c Fri Nov 23 15:44:48 1990
--- ./visual.c Fri Jul 3 11:15:40 1992
***************
*** 8,13 ****
--- 8,16 ----
#endif /* SCCSID */
#include "rparams.h"
+ #ifdef SERVER
+ #include "nntp.h"
+ #endif
#ifdef USG
#include <sys/ioctl.h>
#include <termio.h>
***************
*** 82,90 ****
#ifdef MYDB
char *findparent();
#endif /* MYDB */
! int onint();
! int onstop();
! int xxit();
char *Progname = "vnews"; /* for xerror */
--- 85,93 ----
#ifdef MYDB
char *findparent();
#endif /* MYDB */
! HANDLER_TYPE onint();
! HANDLER_TYPE onstop();
! HANDLER_TYPE xxit();
char *Progname = "vnews"; /* for xerror */
***************
*** 172,177 ****
--- 175,187 ----
readr()
{
+ #ifdef SERVER
+ #ifdef BSD4_2
+ int mask;
+ #else /* !BSD4_2 */
+ unsigned oalarm;
+ #endif /* !BSD4_2 */
+ #endif /* SERVER */
#ifdef MYDEBUG
debugf = fopen("DEBUG", "w");
***************
*** 214,229 ****
nextng();
quitflg = 0;
while (quitflg == 0) {
if (getnextart(FALSE))
break;
! #ifndef SERVER
(void) strcpy(goodone, filename);
#endif /* !SERVER */
if (SigTrap)
! return;
vcmd();
}
if (!news) {
ttycooked();
ospeed = 0; /* to convince xxit() not to clear screen */
--- 224,256 ----
nextng();
quitflg = 0;
while (quitflg == 0) {
+ #ifdef SERVER
+ /* must keep alarm from interrupting server reads */
+ #ifdef BSD4_2
+ mask = sigblock(1 << (SIGALRM-1));
+ #else /* !BSD4_2 */
+ oalarm = alarm(0);
+ #endif /* !BSD4_2 */
+ #endif /* SERVER */
if (getnextart(FALSE))
break;
! #ifdef SERVER
! #ifdef BSD4_2
! sigsetmask(mask);
! #else /* !BSD4_2 */
! (void) alarm(oalarm);
! #endif /* !BSD4_2 */
! #else /* !SERVER */
(void) strcpy(goodone, filename);
#endif /* !SERVER */
if (SigTrap)
! break;
vcmd();
}
+ #ifdef SERVER
+ if (article_name() != NULL) (void) unlink(article_name());
+ #endif
if (!news) {
ttycooked();
ospeed = 0; /* to convince xxit() not to clear screen */
***************
*** 239,244 ****
--- 266,278 ----
char *p;
long count;
int countset;
+ #ifdef SERVER
+ #ifdef BSD4_2
+ int mask;
+ #else /* !BSD4_2 */
+ unsigned oalarm;
+ #endif /* !BSD4_2 */
+ #endif /* SERVER */
if (prflags & HDRONLY)
appfile(fp, lastlin + 1);
***************
*** 333,339 ****
--- 367,388 ----
secpr[0] = '\0';
if (countset == 0)
count = 1;
+ #ifdef SERVER
+ /* must keep alarm from interrupting server reads */
+ #ifdef BSD4_2
+ mask = sigblock(1 << (SIGALRM-1));
+ #else /* !BSD4_2 */
+ oalarm = alarm(0);
+ #endif /* !BSD4_2 */
+ #endif /* SERVER */
docmd(c, count, countset);
+ #ifdef SERVER
+ #ifdef BSD4_2
+ sigsetmask(mask);
+ #else /* !BSD4_2 */
+ (void) alarm(oalarm);
+ #endif /* !BSD4_2 */
+ #endif /* SERVER */
if (c != '?' && c != 'H') /* UGGH */
prflags &=~ HELPMSG;
if (dlinno > hdrstart)
***************
*** 1029,1037 ****
if (include) {
FILE *of;
char buf[BUFSIZ];
!
! #ifndef SERVER
of = xart_open(goodone, "r");
while (fgets(buf, sizeof buf, of) != NULL)
if (buf[0] == '\n')
break;
--- 1081,1091 ----
if (include) {
FILE *of;
char buf[BUFSIZ];
! #ifdef SERVER
! of = xart_open(article_name(), "r");
! #else
of = xart_open(goodone, "r");
+ #endif
while (fgets(buf, sizeof buf, of) != NULL)
if (buf[0] == '\n')
break;
***************
*** 1039,1045 ****
fprintf(rfp, "> %s", buf);
fclose(of);
putc('\n', rfp);
- #endif /* !SERVER */
}
fflush(rfp);
--- 1093,1098 ----
***************
*** 1236,1242 ****
for(;;){
(void) sprintf(bfr,"STAT %ld",tnum);
put_server(bfr);
! (void) get_server(workspace,sizeof(workspace));
if (*workspace != '2') {
if (rflag)
tnum++;
--- 1289,1297 ----
for(;;){
(void) sprintf(bfr,"STAT %ld",tnum);
put_server(bfr);
! if (get_server(workspace,sizeof(workspace)) < 0 ||
! strncmp(workspace, ERR_GOODBYE, 3) == 0)
! lost_server();
if (*workspace != '2') {
if (rflag)
tnum++;
***************
*** 1299,1307 ****
erased = 0;
obit = bit;
- #ifdef SERVER
- (void) unlink(filename);
- #endif /* SERVER */
return 0;
}
--- 1354,1359 ----
***************
*** 1521,1527 ****
else if (STRCMP(hp->nbuf, groupdir) != 0) {
(void) sprintf(linebuf, "Newsgroups: %s", hp->nbuf);
tfappend(linebuf);
- timer();
}
}
--- 1579,1584 ----
***************
*** 2043,2049 ****
* Simply sets flag, signal processed later.
*/
! onalarm()
{
#ifdef SIGTSTP
int dojump = reading;
--- 2100,2106 ----
* Simply sets flag, signal processed later.
*/
! HANDLER_TYPE onalarm()
{
#ifdef SIGTSTP
int dojump = reading;
***************
*** 2088,2093 ****
--- 2145,2151 ----
}
if (statb.st_size > oldmsize) {
ismail = 2;
+ lastismail = tod;
beep();
} else {
if (statb.st_size == 0)
***************
*** 2097,2103 ****
ismail = 1;
}
oldmsize = statb.st_size;
- lastismail = tod;
if (uflag && !xflag && --rccount < 0) {
writeoutrc();
if (secpr[0] == '\0')
--- 2155,2160 ----
***************
*** 2531,2537 ****
/*** signal handlers ***/
! onint() {
#ifdef SIGTSTP
int dojump = reading;
--- 2588,2594 ----
/*** signal handlers ***/
! HANDLER_TYPE onint() {
#ifdef SIGTSTP
int dojump = reading;
***************
*** 2551,2557 ****
}
#ifdef SIGTSTP
! onstop(signo)
int signo;
{
/* restore old terminal state */
--- 2608,2614 ----
}
#ifdef SIGTSTP
! HANDLER_TYPE onstop(signo)
int signo;
{
/* restore old terminal state */
***************
*** 2689,2695 ****
(void) fseek(fp, saveoff, 0);
}
! xxit(status)
int status;
{
(void) unlink(infile);
--- 2746,2752 ----
(void) fseek(fp, saveoff, 0);
}
! HANDLER_TYPE xxit(status)
int status;
{
(void) unlink(infile);
----
Larry Jones, SDRC, 2000 Eastman Dr., Milford, OH 45150-2789 513-576-2070
Domain: scjones@sdrc.com Path: uunet!sdrc!scjones IBM: USSDR7DR at IBMMAIL
What a stupid world. -- Calvin
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