Thread View: news.software.nn
1 messages
1 total messages
Started by Rudi van Houten
Wed, 20 Feb 1991 16:01
nnsub patch #2
Author: Rudi van Houten
Date: Wed, 20 Feb 1991 16:01
Date: Wed, 20 Feb 1991 16:01
1031 lines
34981 bytes
34981 bytes
This is patch #2 for nnsub, the netnews subscribe program.
The sources last posted in this newsgroup where patched up to
patchlevel 1.
For a description of the changes see the patch history in patchlevel.h
Index: patchlevel.h
Prereq: 1
*** orig/patchlevel.h Mon Feb 11 16:25:25 1991
--- patchlevel.h Wed Feb 20 10:02:02 1991
***************
*** 1 ****
! #define PATCHLEVEL 1
--- 1,21 ----
! #define PATCHLEVEL 2
! /*
! patch history:
!
! 7/2/91 original version with bugs preventing running as
! nntp client on Sun-3/50.
! 13/2/91 patch #1
! -correct an error in uncontrolled use of 'tolower'
! which solved the problem running as nntp client on
! a SUn-3/50.
! -Also truncate long lines in menu to prevent screen
! overflow caused by wrapped lines (controlled by symbol
! TRUNCATE).
! -Add debug value iVleavetmp.
! 20/2/91 patch #2
! -Alan P. Barrett <barrett@dalsy.ee.und.ac.za> reworked
! and contributed the code in Printcharter to fit lines
! on the screen, not rudely truncate them.
! -Present the many found groups after fuzzy match via
! submenu's, don't ask one by one.
! */
*** orig/nnsub.l Tue Feb 19 21:33:08 1991
--- nnsub.l Wed Feb 20 10:06:35 1991
***************
*** 17,23 ****
tries to find all newsgoup names which partially match the supplied
name if an exact match is not found. It then prints the count of
found matches and gives you the option to subscribe to all, to none or
! to ask for the names and confirm or refuse a subscription on each name.
.LP
If a questionmark (\?) is given as groupname
.B nnsub
--- 17,23 ----
tries to find all newsgoup names which partially match the supplied
name if an exact match is not found. It then prints the count of
found matches and gives you the option to subscribe to all, to none or
! to select groups via a menu in the same way as described below.
.LP
If a questionmark (\?) is given as groupname
.B nnsub
***************
*** 27,38 ****
.B nn.
At each menu you are asked to enter a command closed by a NEWLINE.
Newgroups can be selected for subscription by including their preceding
! (lower case) letter in the command. Including the capital Q or R in the
! command will cause
! .B nnsub
! to stop the presenting of newsgroup names in menu's and
! either Quit the collection of names and finish or to Resume asking
! for newsgroup names one by one.
.LP
If running without terminal control or verbosity 0 partial name matching
is only performed if the supplied name starts and\/or ends with a dot (.).
--- 27,37 ----
.B nn.
At each menu you are asked to enter a command closed by a NEWLINE.
Newgroups can be selected for subscription by including their preceding
! (lower case) letter in the command. The presenting of the menu's can
! be quitted by including a capital Q (for Quit) in the commandline. Also
! recognized are B (=Bye), E (=End), R (=Resume) or X (=eXit). An empty
! commandline will result in the prsenting of the next menu (or in quiting
! the presenting of the menu's).
.LP
If running without terminal control or verbosity 0 partial name matching
is only performed if the supplied name starts and\/or ends with a dot (.).
*** orig/nnsub.c Tue Feb 12 16:55:25 1991
--- nnsub.c Wed Feb 20 16:05:36 1991
***************
*** 1,9 ****
! /* #define DEBUG /* to enable extensive debug output */
! #define TRUNCATE /* truncate descriptions to terminal width */
/* filename definitions */
! #define NNTP "accucx.cc.ruu.nl" /* NNTP server (clients only) */
#define PORT 119 /* port for NNTP "/etc/services" */
#define ACTIVE "/usr/lib/news/active" /* file "active" (non NNTP) */
#define NEWSGROUPS "/usr/lib/news/newsgroups" /* idem "newsgroups" */
--- 1,8 ----
! #define DEBUG /* to enable extensive debug output */
/* filename definitions */
! /* #define NNTP "accucx.cc.ruu.nl" /* NNTP server (clients only) */
#define PORT 119 /* port for NNTP "/etc/services" */
#define ACTIVE "/usr/lib/news/active" /* file "active" (non NNTP) */
#define NEWSGROUPS "/usr/lib/news/newsgroups" /* idem "newsgroups" */
***************
*** 22,27 ****
--- 21,28 ----
#ifndef NCOLS
#define NCOLS 80
#endif
+ #define iMenuGrpart 20 /* max. space for newsgroupname in menu */
+
#define TIMEOUT 15
#define ERR_EXIT 9999
***************
*** 112,120 ****
PORT port number for nntp, see file /etc/services
TEMPRC temporary template to write new .newsrc
TIMEOUT timeout value while waiting for server reply
- TRUNCATE truncate groups descriptions to terminalwidth
iShwfac interval for writing a dot if debugging
iSlen length of string buffer
For NNTP-servers where the files "active" and "newsgroups"
are kept local, mostly in "/usr/lib/news" the symbols ACTIVE
--- 113,121 ----
PORT port number for nntp, see file /etc/services
TEMPRC temporary template to write new .newsrc
TIMEOUT timeout value while waiting for server reply
iShwfac interval for writing a dot if debugging
iSlen length of string buffer
+ iMeuGrpart max space to be used to write groupname in menu
For NNTP-servers where the files "active" and "newsgroups"
are kept local, mostly in "/usr/lib/news" the symbols ACTIVE
***************
*** 183,213 ****
s_Group *pGr;
int iOffset;
{
! register char cC;
! #ifdef TRUNCATE
! register int iPos, iCpos;
! #endif
if (pGr->iTitle_pos < 0) { puts(pGr->sName); return; }
if (fseek(fCharters,pGr->iTitle_pos,0) < 0)
{ perror(sCharterlfn); exit(ERR_EXIT); }
! iPos= iCpos= 0;
! while (cC= getc(fCharters), cC != '\n' && cC != '\r' && cC != '\0')
{
! if (cC == '\t')
! {
! iPos= (iCpos/8 + 1) * 8;
! while (iCpos < iPos) { putchar(' '); iCpos++; }
}
else
! {
! putchar(cC); if (cC != '\010') iCpos++;
}
- #ifdef TRUNCATE
- if (iCpos >= NCOLS - iOffset) break;
- #endif
}
! /* while (cC= getc(fCharters), cC != '\n' && cC != '\r' && cC != '\0') */
! putchar('\n');
} /* Printcharter */
int Add_list_element(pGr)
--- 184,236 ----
s_Group *pGr;
int iOffset;
{
! char sLine[iSlen], sNewsgroup[iSlen], sDescription[iSlen];
! int iNglen, iDesclen; /* length of groupname and description */
! int iNgwidth, iDescwidth; /* space to use for printing */
! int iAvailable; /* available space on screnline */
!
! iAvailable= NCOLS - iOffset;
if (pGr->iTitle_pos < 0) { puts(pGr->sName); return; }
if (fseek(fCharters,pGr->iTitle_pos,0) < 0)
{ perror(sCharterlfn); exit(ERR_EXIT); }
! fgets(sLine,iSlen,fCharters);
! sscanf(sLine,"%[^ \t]%*[ \t]%[^\n]",sNewsgroup,sDescription);
! iNglen= strlen(sNewsgroup); iDesclen= strlen(sDescription);
! if (iNglen + 1 + iDesclen > iAvailable)
! { /* have to truncate dscription */
! iNgwidth= iNglen + 1; /* one blank after group name */
! iDescwidth= iAvailable - iNgwidth; /* rest of line */
! }
! else
! if (iNglen < iMenuGrpart)
{
! if (iDesclen + iMenuGrpart <= iAvailable)
! { /* use "iMenuGrpart" columns for groupname */
! iNgwidth= iMenuGrpart;
! iDescwidth= iDesclen;
}
else
! { /* use less space for groupname
! and right-justify description */
! iNgwidth= iAvailable - iDesclen;
! iDescwidth= iDesclen;
}
}
! else /* if (iNglen < iMenuGrpart) */
! {
! if (iNglen + 5 + iDesclen <= iAvailable)
! { /* leave 5 spaces between name and description */
! iNgwidth= iNglen + 5;
! iDescwidth= iDesclen;
! }
! else
! { /* leave less blanks after groupname and right-justify description */
! iNgwidth= iAvailable - iDesclen;
! iDescwidth= iDesclen;
! }
! }
! printf("%-*s%.*s\n",iNgwidth,sNewsgroup,iDescwidth,sDescription);
!
} /* Printcharter */
int Add_list_element(pGr)
***************
*** 221,229 ****
pGr_list= pGr_endlist= pLocal;
else
pGr_endlist= pGr_endlist->pNext= pLocal;
! #ifdef DEBUG
if (iVerbosity > iVdebug) putchar('.');
! #endif
return 0;
} /* Add_list_element */
--- 244,252 ----
pGr_list= pGr_endlist= pLocal;
else
pGr_endlist= pGr_endlist->pNext= pLocal;
! # ifdef DEBUG
if (iVerbosity > iVdebug) putchar('.');
! # endif
return 0;
} /* Add_list_element */
***************
*** 255,262 ****
char cC;
int iCount;
for (iCount=0;iCount<strlen(sName);iCount++)
! if (isupper(sName[iCount]))
! if (isupper(sName[iCount])) sName[iCount]= tolower(sName[iCount]);
bStart_is_free= sName[0] == '.';
bEnd_is_free= (cC= sName[strlen(sName)-1]) == '.';
s_Glocal.sName= sName;
--- 278,284 ----
char cC;
int iCount;
for (iCount=0;iCount<strlen(sName);iCount++)
! if (isupper(sName[iCount])) sName[iCount]= tolower(sName[iCount]);
bStart_is_free= sName[0] == '.';
bEnd_is_free= (cC= sName[strlen(sName)-1]) == '.';
s_Glocal.sName= sName;
***************
*** 266,275 ****
if (pNode= find_avlnode(&s_Glocal,paGr_tree,Grpcmp))
{
insert_avl(pNode->content,&paGr_requests,Grpcmp,&pGr_dum);
! #ifdef DEBUG
if (iVerbosity > iVprogress)
printf("..Added in request tree: %s\n",sName);
! #endif
return(1);
}
else /* if (pNode= find_avlnode(&s_Glocal,paGr_tree,Grpcmp)) */
--- 288,297 ----
if (pNode= find_avlnode(&s_Glocal,paGr_tree,Grpcmp))
{
insert_avl(pNode->content,&paGr_requests,Grpcmp,&pGr_dum);
! # ifdef DEBUG
if (iVerbosity > iVprogress)
printf("..Added in request tree: %s\n",sName);
! # endif
return(1);
}
else /* if (pNode= find_avlnode(&s_Glocal,paGr_tree,Grpcmp)) */
***************
*** 295,349 ****
pGr_endlist= pGr_endlist->pNext) iCount++;
if (iVerbosity)
{
! printf("Partial name \"%s\": %d matching newsgroups found\n"
! ,sName,iCount);
! if (bIntractive && (iCount > 1 || (sName[0] != '.' && cC != '.')))
! {
! fputs("Subscribe to: a)ll, c)onfirmation, n)one? ",stdout);
! cC= getchar(); if (cC != '\n') while (getchar() != '\n');
! switch (cC)
{
! default:
! break; /* default answer is 'a' */
! case 'n':
! case 'N':
! pGr_endlist= pGr_list; pGr_list= NULL;
! while (pGr_endlist)
{
! pLink= pGr_endlist; pGr_endlist= pLink->pNext;
! free(pLink);
! }
! return(0);
! case 'c':
! case 'C':
! /* delete unselected groups from list */
! pLink= pGr_list; pGr_endlist= NULL;
! while (pLink != NULL)
! {
! Printcharter(pLink->pGroup,1);
! fputs(" OK? ",stdout); cC= getchar();
! if (cC != '\n') while (getchar() != '\n');
! if (cC == 'y' || cC == 'Y')
! { /* move on */
! pGr_endlist= pLink; pLink= pLink->pNext;
}
! else /* if (cC == 'y' || cC == 'Y') */
! { /* delete it */
! if (pGr_endlist == NULL)
! {
! pGr_list= pLink->pNext;
! free(pLink); pLink= pGr_list;
! }
! else /* if (pGr_endlist == NULL) */
! {
! pLink= pLink->pNext;
! free(pGr_endlist->pNext);
! pGr_endlist->pNext= pLink;
! } /* if (pGr_endlist == NULL) */
! } /* if (cC == 'y' || cC == 'Y') */
! } /* while (pLink != NULL) */
! } /* switch(cC) */
! } /* if (bIntractive && (iCount>1 || (sName[0]!='.' && cC!='.'))) */
} /* if (iVerbosity) */
if (pGr_list == NULL) return(0);
iCount= 0; pGr_endlist= pGr_list; pGr_list= NULL;
--- 317,360 ----
pGr_endlist= pGr_endlist->pNext) iCount++;
if (iVerbosity)
{
! # ifdef DEBUG
! if (iVerbosity >= iVdebug) putchar('\n');
! # endif
! if (bIntractive)
! if (iCount == 1)
{
! putchar('\n');
! Printcharter(pGr_list->pGroup,1);
! fputs(" OK? (y) ",stdout);
! cC= getchar();
! if (cC != '\n') while (getchar() != '\n'); else cC= 'y';
! if (cC != 'y' && cC != 'Y') { free(pGr_list); pGr_list= NULL; }
! }
! else /* if iCount == 1) */
! {
! printf("Partial name \"%s\": %d matching newsgroups found\n"
! ,sName,iCount);
! fputs("Subscribe to: a)ll, c)onfirmation, n)one? ",stdout);
! cC= getchar(); if (cC != '\n') while (getchar() != '\n');
! switch (cC)
{
! default:
! break; /* default answer is 'a' */
! case 'n':
! case 'N':
! pGr_endlist= pGr_list; pGr_list= NULL;
! while (pGr_endlist)
! {
! pLink= pGr_endlist; pGr_endlist= pLink->pNext;
! free(pLink);
}
! return(0);
! case 'c':
! case 'C':
! return(Menusubscribe());
! } /* switch(cC) */
! } /* if (iCount == 1) */
! /* if (bIntractive) */
} /* if (iVerbosity) */
if (pGr_list == NULL) return(0);
iCount= 0; pGr_endlist= pGr_list; pGr_list= NULL;
***************
*** 352,362 ****
if (find_avlnode(pGr_endlist->pGroup,paGr_requests,Grpcmp) == NULL)
{
insert_avl(pGr_endlist->pGroup,&paGr_requests,Grpcmp,&pGr_dum);
! #ifdef DEBUG
if (iVerbosity > iVprogress)
printf("..Added in request tree: %s\n"
,pGr_endlist->pGroup->sName);
! #endif
iCount++;
}
pLink= pGr_endlist; pGr_endlist= pLink->pNext;
--- 363,373 ----
if (find_avlnode(pGr_endlist->pGroup,paGr_requests,Grpcmp) == NULL)
{
insert_avl(pGr_endlist->pGroup,&paGr_requests,Grpcmp,&pGr_dum);
! # ifdef DEBUG
if (iVerbosity > iVprogress)
printf("..Added in request tree: %s\n"
,pGr_endlist->pGroup->sName);
! # endif
iCount++;
}
pLink= pGr_endlist; pGr_endlist= pLink->pNext;
***************
*** 367,375 ****
int Menusubscribe()
/*
! returnvalue:
! 0: resume processing supplied names
! 1: stop processing, continue with update of newsrc
*/
{
ps_Group sgMline[NLINES], pGr_dum;
--- 378,384 ----
int Menusubscribe()
/*
! returnvalue: number of subscribed groups
*/
{
ps_Group sgMline[NLINES], pGr_dum;
***************
*** 376,443 ****
char sLine[iSlen], cTop;
register s_Grlink * pLink;
register int i;
int iReturnvalue;
! cTop= (char)((int)'a' + NLINES - 1);
! /* first unravel the tree */
! #ifdef DEBUG
! if (iVerbosity >= iVdebug) puts("Unravel tree to one-way linked list");
! #endif
! unravel_avl(&paGr_tree,Add_list_element,0);
! #ifdef DEBUG
! if (iVerbosity >= iVdebug) puts("\n=Done ===========");
! #endif
pGr_endlist= pGr_list; pGr_list= NULL;
! i= 0; iReturnvalue= -1;
! while (pGr_endlist != NULL && iReturnvalue < 0)
{
if (i == 0) puts("\n\n\n");
pLink= pGr_endlist; printf("%c: ",i+'a');
Printcharter(sgMline[i]= pLink->pGroup,4);
pGr_endlist= pLink->pNext; free(pLink);
! if (pGr_endlist == NULL || ++i == NLINES)
{
! printf("\n>> Select with [a..%c], or R or Q:",cTop);
! if (gets(sLine) == NULL) iReturnvalue= 1;
for (i= 0; sLine[i] != '\0'; i++)
! if (sLine[i] == 'R') iReturnvalue= 0;
else
- if (sLine[i] == 'Q') iReturnvalue= 1;
- else
if (sLine[i] >= 'a' && sLine[i] <= cTop)
{
insert_avl(sgMline[(int)sLine[i] - (int)'a']
,&paGr_requests,Grpcmp,&pGr_dum);
! #ifdef DEBUG
! if (iVerbosity >= iVdebug)
! {
! puts("Added to request tree:");
! Printcharter(pGr_dum,1);
! }
! #endif
}
/* ignore garbage */
/* for (i= 0; sLine[i] != '\0'; i++) */
i= 0;
} /* if (pGr_endlist == NULL || ++i > NLINES) */
! } /* while (pGr_endlist != NULL && iReturnvalue < 0) */
! #ifdef DEBUG
if (iVerbosity >= iVdebug && pGr_endlist != NULL)
puts("Clean up the one-way linked list");
! #endif
while (pGr_endlist != NULL)
{
pLink= pGr_endlist; pGr_endlist= pLink->pNext;
free(pLink);
! #ifdef DEBUG
! if (iVerbosity >= iVdebug) putchar('.');
! #endif
} /* while (pGr_endlist != NULL) */
- #ifdef DEBUG
- if (iVerbosity >= iVdebug)
- printf("\nCleaning done\n\n >> %s asking for groups\n"
- ,iReturnvalue ? "Stop" : "Resume");
- #endif
return(iReturnvalue);
} /* int Menusubscribe() */
--- 385,457 ----
char sLine[iSlen], cTop;
register s_Grlink * pLink;
register int i;
+ short bStop;
int iReturnvalue;
! if (pGr_list == NULL) /* first unravel the tree */
! # ifdef DEBUG
! {
! if (iVerbosity >= iVdebug) puts("Unravel tree to one-way linked list");
! # endif
! unravel_avl(&paGr_tree,Add_list_element,0);
! # ifdef DEBUG
! if (iVerbosity >= iVdebug) puts("\n=Done ===========");
! }
! # endif
pGr_endlist= pGr_list; pGr_list= NULL;
! i= iReturnvalue= 0; bStop= 0;
! while (pGr_endlist != NULL && bStop == 0)
{
if (i == 0) puts("\n\n\n");
pLink= pGr_endlist; printf("%c: ",i+'a');
Printcharter(sgMline[i]= pLink->pGroup,4);
pGr_endlist= pLink->pNext; free(pLink);
! if (i++, pGr_endlist == NULL || i == NLINES)
{
! cTop= (char)((int)'a' + i - 1);
! printf("\n>> Select with [a..%c], or Quit:",cTop);
! if (gets(sLine) == NULL) bStop= 1;
! else
for (i= 0; sLine[i] != '\0'; i++)
! if (index("QREBSX",sLine[i])) bStop= 1;
else
if (sLine[i] >= 'a' && sLine[i] <= cTop)
{
insert_avl(sgMline[(int)sLine[i] - (int)'a']
,&paGr_requests,Grpcmp,&pGr_dum);
! if (pGr_dum == sgMline[(int)sLine[i] - (int)'a'])
! {
! iReturnvalue++;
! # ifdef DEBUG
! if (iVerbosity >= iVdebug)
! {
! puts("Added to request tree:");
! Printcharter(pGr_dum,1);
! }
! # endif
! }
}
/* ignore garbage */
/* for (i= 0; sLine[i] != '\0'; i++) */
i= 0;
} /* if (pGr_endlist == NULL || ++i > NLINES) */
! } /* while (pGr_endlist != NULL && bStop == 0) */
! # ifdef DEBUG
if (iVerbosity >= iVdebug && pGr_endlist != NULL)
puts("Clean up the one-way linked list");
! # endif
while (pGr_endlist != NULL)
{
pLink= pGr_endlist; pGr_endlist= pLink->pNext;
free(pLink);
! # ifdef DEBUG
! if (iVerbosity >= iVdebug)
! {
! putchar('.');
! if (pGr_endlist == NULL) puts("\n>> Cleaning done\n");
! }
! # endif
} /* while (pGr_endlist != NULL) */
return(iReturnvalue);
} /* int Menusubscribe() */
***************
*** 464,472 ****
{
char sLine[iSlen];
int iReply;
! #ifdef DEBUG
if (iVerbosity >= iVactions) printf("NNTP: %s\n",sCommand);
! #endif
fprintf(fNntpOut,"%s\r\n",sCommand);
if (fflush(fNntpOut) == EOF)
{ perror(sCommand); exit(ERR_EXIT); }
--- 478,486 ----
{
char sLine[iSlen];
int iReply;
! # ifdef DEBUG
if (iVerbosity >= iVactions) printf("NNTP: %s\n",sCommand);
! # endif
fprintf(fNntpOut,"%s\r\n",sCommand);
if (fflush(fNntpOut) == EOF)
{ perror(sCommand); exit(ERR_EXIT); }
***************
*** 484,492 ****
fprintf(stderr,"Error response on %s\n%s",sCommand,sLine);
exit(ERR_EXIT);
}
! #ifdef DEBUG
if (iVerbosity >= iVactions) fputs(sLine,stdout);
! #endif
} /* Nntpcommand */
#endif
--- 498,506 ----
fprintf(stderr,"Error response on %s\n%s",sCommand,sLine);
exit(ERR_EXIT);
}
! # ifdef DEBUG
if (iVerbosity >= iVactions) fputs(sLine,stdout);
! # endif
} /* Nntpcommand */
#endif
***************
*** 578,586 ****
while (fgets(sLine,iSlen,fGroups) != NULL)
#endif
{
! #ifdef NNTP
alarm(0);
! #endif
k= strlen(sLine);
for (j=0; j<k; j++)
if (index(" \t\r\n",sLine[j])) { sLine[j]= '\0'; break; }
--- 592,600 ----
while (fgets(sLine,iSlen,fGroups) != NULL)
#endif
{
! # ifdef NNTP
alarm(0);
! # endif
k= strlen(sLine);
for (j=0; j<k; j++)
if (index(" \t\r\n",sLine[j])) { sLine[j]= '\0'; break; }
***************
*** 592,601 ****
if (pG1 == pG2)
{
i++;
! #ifdef DEBUG
if (iVerbosity >= iVprogress)
{ if (i % iShwfac == 0) putchar('.'); }
! #endif
pG1= NULL;
}
} /* while (...fgets(sLine,iSlen,fGroups) != NULL) */
--- 606,615 ----
if (pG1 == pG2)
{
i++;
! # ifdef DEBUG
if (iVerbosity >= iVprogress)
{ if (i % iShwfac == 0) putchar('.'); }
! # endif
pG1= NULL;
}
} /* while (...fgets(sLine,iSlen,fGroups) != NULL) */
***************
*** 618,637 ****
#endif
for (j=0;;j++)
{
! #ifdef NNTP
alarm(TIMEOUT);
! #endif
if (fgets(sLine,iSlen,fGroups) == NULL) break;
! #ifdef NNTP
alarm(0);
! #endif
i= strlen(sLine) - 1;
while (index(" \t\r\n",sLine[i])) sLine[i--]= '\0';
if (strcmp(sLine,".") == 0) break;
fputs(sLine,fCharters); putc('\n',fCharters);
! #ifdef DEBUG
if (iVerbosity >= iVprogress) if (j % iShwfac == 0) putchar('.');
! #endif
}
#ifdef DEBUG
if (iVerbosity >= iVprogress) putchar('\n');
--- 632,651 ----
#endif
for (j=0;;j++)
{
! # ifdef NNTP
alarm(TIMEOUT);
! # endif
if (fgets(sLine,iSlen,fGroups) == NULL) break;
! # ifdef NNTP
alarm(0);
! # endif
i= strlen(sLine) - 1;
while (index(" \t\r\n",sLine[i])) sLine[i--]= '\0';
if (strcmp(sLine,".") == 0) break;
fputs(sLine,fCharters); putc('\n',fCharters);
! # ifdef DEBUG
if (iVerbosity >= iVprogress) if (j % iShwfac == 0) putchar('.');
! # endif
}
#ifdef DEBUG
if (iVerbosity >= iVprogress) putchar('\n');
***************
*** 652,661 ****
}
else /* if ((fCharters= fopen(sCharterlfn,"r")) == NULL) */
{
! #ifdef DEBUG
if (iVerbosity >= iVactions)
printf("Reading short descriptions from \"%s\"\n",sCharterlfn);
! #endif
if (pG1 == NULL) pG1= (s_Group*)malloc(sizeof(s_Group));
pG1->iTitle_pos= 0; i= 0;
while (fgets(sLine,iSlen,fCharters) != NULL)
--- 666,675 ----
}
else /* if ((fCharters= fopen(sCharterlfn,"r")) == NULL) */
{
! # ifdef DEBUG
if (iVerbosity >= iVactions)
printf("Reading short descriptions from \"%s\"\n",sCharterlfn);
! # endif
if (pG1 == NULL) pG1= (s_Group*)malloc(sizeof(s_Group));
pG1->iTitle_pos= 0; i= 0;
while (fgets(sLine,iSlen,fCharters) != NULL)
***************
*** 667,694 ****
if (sLine[0] != '\0')
if ((p_AVL= find_avlnode(pG1,paGr_tree,Grpcmp)) != NULL)
((s_Group*)(p_AVL->content))->iTitle_pos= pG1->iTitle_pos;
! #ifdef DEBUG
else
if (iVerbosity > iVprogress)
printf("\nNot \"active\" group: %s\n\t%s",sLine,pcC);
! #endif
pG1->iTitle_pos= ftell(fCharters);
! #ifdef DEBUG
if (iVerbosity >= iVprogress)
if (++i % iShwfac == 0) putchar('.');
! #endif
} /* while (fgets(sLine,iSlen,fCharters) != NULL) */
/* don't close file, read random when titles must be printed */
! #ifdef DEBUG
if (iVerbosity >= iVprogress) putchar('\n');
! #endif
} /* if ((fCharter= fopen(sCharterlfn,"r")) == NULL) */
if (iGr) /* requests are supplied as program arguments */
{
! #ifdef DEBUG
if (iVerbosity >= iVdebug) puts("Process arguments");
! #endif
iGrfault= iGr;
for (i=1;i<argc;i++)
{
--- 681,708 ----
if (sLine[0] != '\0')
if ((p_AVL= find_avlnode(pG1,paGr_tree,Grpcmp)) != NULL)
((s_Group*)(p_AVL->content))->iTitle_pos= pG1->iTitle_pos;
! # ifdef DEBUG
else
if (iVerbosity > iVprogress)
printf("\nNot \"active\" group: %s\n\t%s",sLine,pcC);
! # endif
pG1->iTitle_pos= ftell(fCharters);
! # ifdef DEBUG
if (iVerbosity >= iVprogress)
if (++i % iShwfac == 0) putchar('.');
! # endif
} /* while (fgets(sLine,iSlen,fCharters) != NULL) */
/* don't close file, read random when titles must be printed */
! # ifdef DEBUG
if (iVerbosity >= iVprogress) putchar('\n');
! # endif
} /* if ((fCharter= fopen(sCharterlfn,"r")) == NULL) */
if (iGr) /* requests are supplied as program arguments */
{
! # ifdef DEBUG
if (iVerbosity >= iVdebug) puts("Process arguments");
! # endif
iGrfault= iGr;
for (i=1;i<argc;i++)
{
***************
*** 696,704 ****
if (strcmp(argv[i],"?") == 0)
{
if (bIntractive && iVerbosity)
! {
! if (Menusubscribe(&j)) break; else iGr= 0;
! }
}
else
if (strcmp(argv[i],"."))
--- 710,716 ----
if (strcmp(argv[i],"?") == 0)
{
if (bIntractive && iVerbosity)
! if (Menusubscribe()) iGrfault--;
}
else
if (strcmp(argv[i],"."))
***************
*** 718,724 ****
if (strcmp(sLine,".") == 0) break;
if (strcmp(sLine,"?") == 0)
{
! if (bIntractive && iVerbosity) if (Menusubscribe(&j)) break;
}
else
if (Checkrequest(sLine) == 0) iGr++;
--- 730,736 ----
if (strcmp(sLine,".") == 0) break;
if (strcmp(sLine,"?") == 0)
{
! if (bIntractive && iVerbosity) if (Menusubscribe()) break;
}
else
if (Checkrequest(sLine) == 0) iGr++;
***************
*** 728,743 ****
if (paGr_requests == NULL)
{
if (iVerbosity) puts("No legal subscribe requests");
! #ifdef NNTP
! #ifdef DEBUG
if (iVerbosity == iVdebug) printf("unlink temporary %s\n",sCharterlfn);
if (iVerbosity < iVleavetmp)
! #endif
unlink(sCharterlfn);
! #ifdef DEBUG
else printf("Temporary newsgroup descriptions on %s\n",sCharterlfn);
! #endif
! #endif
exit(0);
}
--- 740,755 ----
if (paGr_requests == NULL)
{
if (iVerbosity) puts("No legal subscribe requests");
! # ifdef NNTP
! # ifdef DEBUG
if (iVerbosity == iVdebug) printf("unlink temporary %s\n",sCharterlfn);
if (iVerbosity < iVleavetmp)
! # endif
unlink(sCharterlfn);
! # ifdef DEBUG
else printf("Temporary newsgroup descriptions on %s\n",sCharterlfn);
! # endif
! # endif
exit(0);
}
***************
*** 773,782 ****
s_Group sGr_local, *pGr_dum;
register char *pCc;
register P_AVL_NODE pNode;
! #ifdef DEBUG
if (iVerbosity >= iVactions)
printf("Read default groups from %s\n",DEFRC);
! #endif
sGr_local.sName= sLine; /* and hold it during the loop */
while (fgets(sLine,iSlen,fDefnewsrc) != NULL)
if (strlen(sLine))
--- 785,794 ----
s_Group sGr_local, *pGr_dum;
register char *pCc;
register P_AVL_NODE pNode;
! # ifdef DEBUG
if (iVerbosity >= iVactions)
printf("Read default groups from %s\n",DEFRC);
! # endif
sGr_local.sName= sLine; /* and hold it during the loop */
while (fgets(sLine,iSlen,fDefnewsrc) != NULL)
if (strlen(sLine))
***************
*** 788,825 ****
{
insert_avl(pNode->content,&paGr_requests
,Grpcmp,&pGr_dum);
! #ifdef DEBUG
if (iVerbosity >= iVdebug)
printf("Default group %s added\n",sLine);
! #endif
}
}
fclose(fDefnewsrc);
}
! #ifdef DEBUG
else
if (iVerbosity >= iVactions)
printf("Default newsrc (%s) non-existant or not readable\n",DEFRC);
! #endif
}
else /* if ((fGroups= fopen(NEWSRC,"r")) == NULL) */
{
s_Group sG_local;
register char cC;
! #ifdef DEBUG
if (iVerbosity >= iVactions) printf("Opened file %s for reading\n",NEWSRC);
! #endif
sG_local.sName= sLine; /* and hold it so during read of .newsrc */
for (;;)
{
if (fgets(sLine,iSlen,fGroups) == NULL)
{
! #ifdef DEBUG
if (iVerbosity >= iVprogress) putchar('\n');
if (iVerbosity >= iVdebug)
printf("End of %s reached\n",NEWSRC);
! #endif
! break;
}
/* search for '!' or ':' or 'white space' */
--- 800,837 ----
{
insert_avl(pNode->content,&paGr_requests
,Grpcmp,&pGr_dum);
! # ifdef DEBUG
if (iVerbosity >= iVdebug)
printf("Default group %s added\n",sLine);
! # endif
}
}
fclose(fDefnewsrc);
}
! # ifdef DEBUG
else
if (iVerbosity >= iVactions)
printf("Default newsrc (%s) non-existant or not readable\n",DEFRC);
! # endif
}
else /* if ((fGroups= fopen(NEWSRC,"r")) == NULL) */
{
s_Group sG_local;
register char cC;
! # ifdef DEBUG
if (iVerbosity >= iVactions) printf("Opened file %s for reading\n",NEWSRC);
! # endif
sG_local.sName= sLine; /* and hold it so during read of .newsrc */
for (;;)
{
if (fgets(sLine,iSlen,fGroups) == NULL)
{
! # ifdef DEBUG
if (iVerbosity >= iVprogress) putchar('\n');
if (iVerbosity >= iVdebug)
printf("End of %s reached\n",NEWSRC);
! # endif
! break;
}
/* search for '!' or ':' or 'white space' */
***************
*** 827,835 ****
cC= *pcC; *pcC= '\0';
if (p_AVL= find_avlnode(&sG_local,paGr_requests,Grpcmp))
{
! #ifdef DEBUG
if (iVerbosity >= iVprogress) putchar('\n');
! #endif
if (iVerbosity)
switch(cC)
{
--- 839,847 ----
cC= *pcC; *pcC= '\0';
if (p_AVL= find_avlnode(&sG_local,paGr_requests,Grpcmp))
{
! # ifdef DEBUG
if (iVerbosity >= iVprogress) putchar('\n');
! # endif
if (iVerbosity)
switch(cC)
{
***************
*** 853,861 ****
else /* if (p_AVL= find_avlnode(&sG_local,paGr_requests,Grpcmp)) */
{
*pcC= cC;
! #ifdef DEBUG
if (iVerbosity >= iVprogress) putchar('.');
! #endif
} /* if (p_AVL= find_avlnode(&sG_local,paGr_requests,Grpcmp)) */
fputs(sLine,fNewgroups);
} /* for (;;) */
--- 865,873 ----
else /* if (p_AVL= find_avlnode(&sG_local,paGr_requests,Grpcmp)) */
{
*pcC= cC;
! # ifdef DEBUG
if (iVerbosity >= iVprogress) putchar('.');
! # endif
} /* if (p_AVL= find_avlnode(&sG_local,paGr_requests,Grpcmp)) */
fputs(sLine,fNewgroups);
} /* for (;;) */
***************
*** 879,890 ****
rename(sNewgrplfn,NEWSRC);
#ifdef NNTP
#ifdef DEBUG
! if (iVerbosity == iVdebug) printf("unlink temporary %s\n",sCharterlfn);
! if (iVerbosity < iVleavetmp)
#endif
unlink(sCharterlfn);
#ifdef DEBUG
! else printf("Temporary newsgroup descriptions on %s\n",sCharterlfn);
#endif
#endif
--- 891,902 ----
rename(sNewgrplfn,NEWSRC);
#ifdef NNTP
#ifdef DEBUG
! if (iVerbosity == iVdebug) printf("unlink temporary %s\n",sCharterlfn);
! if (iVerbosity < iVleavetmp)
#endif
unlink(sCharterlfn);
#ifdef DEBUG
! else printf("Temporary newsgroup descriptions on %s\n",sCharterlfn);
#endif
#endif
--
Rudi van Houten <acbhour@cc.ruu.nl>
Academisch Computer Centrum Utrecht / Besturings Systemen
Budapestlaan 8 - 3584 CD - Utrecht - Netherlands
Tel: +31 30 531731 Fax: +31 30 531633
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