innd's code cleanup
Igor Timkin
ivt at gamma.ru
Mon Oct 30 15:51:44 UTC 2000
innd's code cleanup (remove unused variables, compiler's warning,
add prototypes, etc). Next patch will cleanup rest of inn's code and add
-Wall -W -Wunused -Wshadow -Wpointer-arith -Wbad-function-cast \
-Wcast-qual -Wcast-align -Wwrite-strings -Wstrict-prototypes
to COPT in Makefile.global.in.
diff -ur inn-CURRENT-20001030/include/inndcomm.h inn/include/inndcomm.h
--- inn-CURRENT-20001030/include/inndcomm.h Thu Jun 3 10:20:03 1999
+++ inn/include/inndcomm.h Fri Oct 27 13:06:26 2000
@@ -68,14 +68,14 @@
#define MAX_REASON_LEN 80
-extern void ICCsettimeout();
-extern int ICCopen();
-extern int ICCclose();
-extern int ICCcommand();
-extern int ICCcancel();
-extern int ICCgo();
-extern int ICCpause();
-extern int ICCreserve();
+extern void ICCsettimeout(int i);
+extern int ICCopen(void);
+extern int ICCclose(void);
+extern int ICCcommand(char cmd, char *argv[], char **replyp);
+extern int ICCcancel(char *msgid);
+extern int ICCgo(char *why);
+extern int ICCpause(char *why);
+extern int ICCreserve(char *why);
extern char *ICCfailure;
diff -ur inn-CURRENT-20001030/include/libinn.h inn/include/libinn.h
--- inn-CURRENT-20001030/include/libinn.h Mon Oct 30 13:00:48 2000
+++ inn/include/libinn.h Fri Oct 27 15:00:54 2000
@@ -324,7 +324,7 @@
char *group, char *moderatormailer);
extern void ClearInnConf(void);
extern int ReadInnConf(void);
-extern char *cpcatpath(char *p, char *f);
+extern char *cpcatpath(const char *p, const char *f);
#define TEMPORARYOPEN 0
#define INND_HISTORY 1
@@ -355,7 +355,7 @@
extern void TempName(char *dir, char *buff);
extern FILE * xfopena(const char *p);
extern bool fdreserve(int fdnum);
-extern FILE * Fopen(const char *p, char *type, int fd);
+extern FILE * Fopen(const char *p, const char *type, int fd);
extern int Fclose(FILE *fp);
extern int argify(char *line, char ***argvp);
diff -ur inn-CURRENT-20001030/innd/art.c inn/innd/art.c
--- inn-CURRENT-20001030/innd/art.c Mon Oct 30 13:00:51 2000
+++ inn/innd/art.c Mon Oct 30 15:40:55 2000
@@ -83,66 +83,70 @@
** The header table. Not necessarily sorted, but the first character
** must be uppercase.
*/
+#define ARTHEADERINIT(name, type) \
+ {name, type, sizeof(name) - 1, (char *)0, 0, 0, FALSE}
+
ARTHEADER ARTheaders[] = {
- /* Name Type ... */
- { "Approved", HTstd },
+ /* Name Type */
+ ARTHEADERINIT("Approved", HTstd),
#define _approved 0
- { "Control", HTstd },
+ ARTHEADERINIT("Control", HTstd),
#define _control 1
- { "Date", HTreq },
+ ARTHEADERINIT("Date", HTreq),
#define _date 2
- { "Distribution", HTstd },
+ ARTHEADERINIT("Distribution", HTstd),
#define _distribution 3
- { "Expires", HTstd },
+ ARTHEADERINIT("Expires", HTstd),
#define _expires 4
- { "From", HTreq },
+ ARTHEADERINIT("From", HTreq),
#define _from 5
- { "Lines", HTstd },
+ ARTHEADERINIT("Lines", HTstd),
#define _lines 6
- { "Message-ID", HTreq },
+ ARTHEADERINIT("Message-ID", HTreq),
#define _message_id 7
- { "Newsgroups", HTreq },
+ ARTHEADERINIT("Newsgroups", HTreq),
#define _newsgroups 8
- { "Path", HTreq },
+ ARTHEADERINIT("Path", HTreq),
#define _path 9
- { "Reply-To", HTstd },
+ ARTHEADERINIT("Reply-To", HTstd),
#define _reply_to 10
- { "Sender", HTstd },
+ ARTHEADERINIT("Sender", HTstd),
#define _sender 11
- { "Subject", HTreq },
+ ARTHEADERINIT("Subject", HTreq),
#define _subject 12
- { "Supersedes", HTstd },
+ ARTHEADERINIT("Supersedes", HTstd),
#define _supersedes 13
- { "Bytes", HTstd },
+ ARTHEADERINIT("Bytes", HTstd),
#define _bytes 14
- { "Also-Control", HTstd },
- { "References", HTstd },
+ ARTHEADERINIT("Also-Control", HTstd),
+ ARTHEADERINIT("References", HTstd),
#define _references 16
- { "Xref", HTsav },
+ ARTHEADERINIT("Xref", HTsav),
#define _xref 17
- { "Keywords", HTstd },
+ ARTHEADERINIT("Keywords", HTstd),
#define _keywords 18
- { "X-Trace", HTstd },
+ ARTHEADERINIT("X-Trace", HTstd),
#define _xtrace 19
- { "Date-Received", HTobs },
- { "Posted", HTobs },
- { "Posting-Version", HTobs },
- { "Received", HTobs },
- { "Relay-Version", HTobs },
- { "NNTP-Posting-Host", HTstd },
- { "Followup-To", HTstd },
+ ARTHEADERINIT("Date-Received", HTobs),
+ ARTHEADERINIT("Posted", HTobs),
+ ARTHEADERINIT("Posting-Version", HTobs),
+ ARTHEADERINIT("Received", HTobs),
+ ARTHEADERINIT("Relay-Version", HTobs),
+ ARTHEADERINIT("NNTP-Posting-Host", HTstd),
+ ARTHEADERINIT("Followup-To", HTstd),
#define _followup_to 26
- { "Organization", HTstd },
- { "Content-Type", HTstd },
- { "Content-Base", HTstd },
- { "Content-Disposition", HTstd },
- { "X-Newsreader", HTstd },
- { "X-Mailer", HTstd },
- { "X-Newsposter", HTstd },
- { "X-Cancelled-By", HTstd },
- { "X-Canceled-By", HTstd },
- { "Cancel-Key", HTstd },
+ ARTHEADERINIT("Organization", HTstd),
+ ARTHEADERINIT("Content-Type", HTstd),
+ ARTHEADERINIT("Content-Base", HTstd),
+ ARTHEADERINIT("Content-Disposition", HTstd),
+ ARTHEADERINIT("X-Newsreader", HTstd),
+ ARTHEADERINIT("X-Mailer", HTstd),
+ ARTHEADERINIT("X-Newsposter", HTstd),
+ ARTHEADERINIT("X-Cancelled-By", HTstd),
+ ARTHEADERINIT("X-Canceled-By", HTstd),
+ ARTHEADERINIT("Cancel-Key", HTstd)
};
+#undef ARTHEADERINIT
ARTHEADER *ARTheadersENDOF = ENDOF(ARTheaders);
@@ -155,7 +159,8 @@
/*
** Mark that the site gets this article.
*/
-void SITEmark(SITE *sp, NEWSGROUP *ngp) {
+void
+SITEmark(SITE *sp, NEWSGROUP *ngp) {
SITE *funnel;
sp->Sendit = TRUE;
@@ -171,7 +176,8 @@
/*
**
*/
-bool ARTreadschema(void)
+bool
+ARTreadschema(void)
{
static char *SCHEMA = NULL;
FILE *F;
@@ -248,10 +254,7 @@
** so we don't bother to unroll the recursion.
*/
static TREE *
-ARTbuildtree(Table, lo, hi)
- ARTHEADER **Table;
- int lo;
- int hi;
+ARTbuildtree(ARTHEADER **Table, int lo, int hi)
{
int mid;
TREE *tp;
@@ -278,24 +281,21 @@
static int
ARTcompare(const void *p1, const void *p2)
{
- ARTHEADER **h1;
- ARTHEADER **h2;
-
- h1 = (ARTHEADER **) p1;
- h2 = (ARTHEADER **) p2;
- return strcasecmp(h1[0]->Name, h2[0]->Name);
+ return strcasecmp(((const ARTHEADER **)p1)[0]->Name,
+ ((const ARTHEADER **)p2)[0]->Name);
}
/*
** Setup the article processing.
*/
-void ARTsetup(void)
+void
+ARTsetup(void)
{
- const char * p;
- ARTHEADER * hp;
- ARTHEADER ** table;
- int i;
+ const char * p;
+ ARTHEADER * hp;
+ ARTHEADER ** table;
+ unsigned int i;
/* Set up the character class tables. These are written a
* little strangely to work around a GCC2.0 bug. */
@@ -321,7 +321,6 @@
/* Allocate space in the header table. */
for (hp = ARTheaders; hp < ENDOF(ARTheaders); hp++) {
- hp->Size = strlen(hp->Name);
hp->Allocated = hp->Value == NULL && hp->Type != HTobs
&& hp != &ARTheaders[_bytes];
if (hp->Allocated)
@@ -346,8 +345,7 @@
static void
-ARTfreetree(tp)
- TREE *tp;
+ARTfreetree(TREE *tp)
{
TREE *next;
@@ -360,7 +358,8 @@
}
-void ARTclose(void)
+void
+ARTclose(void)
{
ARTHEADER *hp;
@@ -380,9 +379,10 @@
** Parse a Path line, splitting it up into NULL-terminated array of strings.
** The argument is modified!
*/
-static char **ARTparsepath(char *p, int *countp)
+static const char **
+ARTparsepath(char *p, int *countp)
{
- static char *NULLPATH[1] = { NULL };
+ static const char *NULLPATH[1] = { NULL };
static int oldlength;
static char **hosts;
int i;
@@ -421,13 +421,14 @@
}
*hp = NULL;
*countp = hp - hosts;
- return hosts;
+ return (const char **)hosts;
}
/* Write an article using the storage api. Put it together in memory and
call out to the api. */
-static TOKEN ARTstore(BUFFER *Article, ARTDATA *Data) {
- char *path;
+static TOKEN
+ARTstore(BUFFER *Article, ARTDATA *Data) {
+ const char *ppath;
char *p;
char *end;
unsigned long size;
@@ -440,8 +441,8 @@
result.type = TOKEN_EMPTY;
- if (((path = (char *)HeaderFindMem(Article->Data, Article->Used, "Path", 4)) == NULL)
- || (path == Article->Data)) {
+ if (((ppath = HeaderFindMem(Article->Data, Article->Used, "Path", 4)) == NULL)
+ || (ppath == Article->Data)) {
/* This should not happen */
syslog(L_ERROR, "%s internal %s no Path header",
Data->MessageID, LogName);
@@ -450,29 +451,29 @@
size = Article->Used + 6 + ARTheaders[_xref].Length + 4 + 3 + Path.Used + Pathalias.Used + 64 + 1;
p = artbuff = NEW(char, size);
- if ((Path.Used >= Article->Used - (int)(path - Article->Data)) || strncmp(Path.Data, path, Path.Used) != 0) {
+ if ((Path.Used >= Article->Used - (int)(ppath - Article->Data)) || strncmp(Path.Data, ppath, Path.Used) != 0) {
Hassamepath = FALSE;
- memcpy(p, Article->Data, path - Article->Data);
- p += path - Article->Data;
+ memcpy(p, Article->Data, ppath - Article->Data);
+ p += ppath - Article->Data;
memcpy(p, Path.Data, Path.Used);
p += Path.Used;
if (AddAlias) {
memcpy(p, Pathalias.Data, Pathalias.Used);
p += Pathalias.Used;
}
- memcpy(p, path, Data->Body - path - 1);
- p += Data->Body - path - 1;
+ memcpy(p, ppath, Data->Body - ppath - 1);
+ p += Data->Body - ppath - 1;
} else {
Hassamepath = TRUE;
if (AddAlias) {
- memcpy(p, Article->Data, path - Article->Data);
- p += path - Article->Data;
+ memcpy(p, Article->Data, ppath - Article->Data);
+ p += ppath - Article->Data;
memcpy(p, Path.Data, Path.Used);
p += Path.Used;
memcpy(p, Pathalias.Data, Pathalias.Used);
p += Pathalias.Used;
- memcpy(p, path + Path.Used, Data->Body - path - Path.Used - 1);
- p += Data->Body - path - Path.Used - 1;
+ memcpy(p, ppath + Path.Used, Data->Body - ppath - Path.Used - 1);
+ p += Data->Body - ppath - Path.Used - 1;
} else {
memcpy(p, Article->Data, Data->Body - Article->Data - 1);
p += Data->Body - Article->Data - 1;
@@ -480,11 +481,11 @@
}
if (NeedPath) {
- Data->Path = path;
- for (i = Data->Body - path; --i >= 0; path++)
- if (*path == '\r' || *path == '\n')
+ Data->Path = ppath;
+ for (i = Data->Body - ppath; --i >= 0; ppath++)
+ if (*ppath == '\r' || *ppath == '\n')
break;
- Data->PathLength = path - Data->Path;
+ Data->PathLength = ppath - Data->Path;
}
if (ARTheaders[_lines].Found == 0) {
@@ -688,7 +689,8 @@
** in <#*tyo2'~n at twinsun.com>, with additional email discussion.
** Thanks, Paul.
*/
-bool ARTidok(const char *MessageID)
+bool
+ARTidok(const char *MessageID)
{
int c;
const char *p;
@@ -944,10 +946,7 @@
** Start a log message about an article.
*/
static void
-ARTlog(Data, code, text)
- ARTDATA *Data;
- char code;
- char *text;
+ARTlog(const ARTDATA *Data, char code, const char *text)
{
int i;
bool Done;
@@ -981,10 +980,7 @@
** and the article.
*/
static void
-ARTreject(code, cp, buff, article)
- Reject_type code;
- CHANNEL *cp;
- BUFFER *article;
+ARTreject(Reject_type code, CHANNEL *cp, BUFFER *article)
{
/* Remember why the article was rejected (for the status file) */
@@ -1026,10 +1022,12 @@
** matches the user who posted the article, return the list of filenames
** otherwise return NULL.
*/
-static TOKEN *ARTcancelverify(const ARTDATA *Data, const char *MessageID, const HASH hash)
+static TOKEN *
+ARTcancelverify(const ARTDATA *Data, const char *MessageID, const HASH hash)
{
- char *p, *q;
- char *local;
+ const char *p;
+ char *q, *q1;
+ const char *local;
char buff[SMBUF];
ARTHANDLE *art;
TOKEN *token;
@@ -1038,8 +1036,8 @@
return NULL;
if ((art = SMretrieve(*token, RETR_HEAD)) == NULL)
return NULL;
- if ((local = (char *)HeaderFindMem(art->data, art->len, "Sender", 6)) == NULL
- && (local = (char *)HeaderFindMem(art->data, art->len, "From", 4)) == NULL) {
+ if ((local = HeaderFindMem(art->data, art->len, "Sender", 6)) == NULL
+ && (local = HeaderFindMem(art->data, art->len, "From", 4)) == NULL) {
SMfreearticle(art);
return NULL;
}
@@ -1058,15 +1056,15 @@
HeaderCleanFrom(q);
/* Compare canonical forms. */
- p = COPY(Data->Poster);
- HeaderCleanFrom(p);
- if (!EQ(q, p)) {
+ q1 = COPY(Data->Poster);
+ HeaderCleanFrom(q1);
+ if (!EQ(q, q1)) {
token = NULL;
(void)sprintf(buff, "\"%.50s\" wants to cancel %s by \"%.50s\"",
- p, MaxLength(MessageID, MessageID), q);
+ q1, MaxLength(MessageID, MessageID), q);
ARTlog(Data, ART_REJECT, buff);
}
- DISPOSE(p);
+ DISPOSE(q1);
DISPOSE(q);
return token;
}
@@ -1075,7 +1073,8 @@
/*
** Process a cancel message.
*/
-void ARTcancel(const ARTDATA *Data, const char *MessageID, const bool Trusted)
+void
+ARTcancel(const ARTDATA *Data, const char *MessageID, const bool Trusted)
{
char buff[SMBUF+16];
HASH hash;
@@ -1137,14 +1136,15 @@
** are passed out to an external program in a specific directory that
** has the same name as the first word of the control message.
*/
-static void ARTcontrol(ARTDATA *Data, HASH hash, char *Control, CHANNEL *cp)
+static void
+ARTcontrol(ARTDATA *Data, char *Control, CHANNEL *cp)
{
char *p;
char buff[SMBUF];
char *av[6];
struct stat Sb;
char c;
- char **hops;
+ const char **hops;
int hopcount;
/* See if it's a cancel message. */
@@ -1210,15 +1210,15 @@
av[3] = Data->Name;
if (innconf->logipaddr) {
hops = ARTparsepath(HDR(_path), &hopcount);
- av[4] = hops && hops[0] ? hops[0] : CHANname(cp);
+ (const char *)av[4] = hops && hops[0] ? hops[0] : CHANname(cp);
} else {
- av[4] = (char *)Data->Feedsite;
+ (const char *)av[4] = Data->Feedsite;
}
av[5] = NULL;
HeaderCleanFrom(av[1]);
HeaderCleanFrom(av[2]);
if (Spawn(innconf->nicekids, STDIN_FILENO, fileno(Errlog),
- fileno(Errlog), av) < 0)
+ fileno(Errlog), (char * const *)av) < 0)
/* We know the strrchr below can't fail. */
syslog(L_ERROR, "%s cant spawn %s for %s %m",
LogName, MaxLength(av[0], strrchr(av[0], '/')), Data->Name);
@@ -1232,7 +1232,8 @@
** Split a Distribution header, making a copy and skipping leading and
** trailing whitespace (which the RFC allows).
*/
-static void DISTparse(char **list, ARTDATA *Data)
+static void
+DISTparse(char **list, ARTDATA *Data)
{
static BUFFER Dist;
char *p;
@@ -1276,7 +1277,8 @@
** A somewhat similar routine, except that this handles negated entries
** in the list and is used to check the distribution sub-field.
*/
-static bool DISTwanted(char **list, char *p)
+static bool
+DISTwanted(char **list, char *p)
{
char *q;
char c;
@@ -1300,7 +1302,8 @@
/*
** See if any of the distributions in the article are wanted by the site.
*/
-static bool DISTwantany(char **site, char **article)
+static bool
+DISTwantany(char **site, char **article)
{
for ( ; *article; article++)
if (DISTwanted(site, *article))
@@ -1313,7 +1316,8 @@
** Send the current article to all sites that would get it if the
** group were created.
*/
-static void ARTsendthegroup(char *name)
+static void
+ARTsendthegroup(char *name)
{
SITE *sp;
int i;
@@ -1330,7 +1334,8 @@
** Check if site doesn't want this group even if it's crossposted
** to a wanted group.
*/
-static void ARTpoisongroup(char *name)
+static void
+ARTpoisongroup(char *name)
{
SITE *sp;
int i;
@@ -1347,7 +1352,8 @@
** If we end up not being able to write the article, we'll get "holes"
** in the directory and active file.
*/
-static void ARTassignnumbers(void)
+static void
+ARTassignnumbers(void)
{
char *p;
int i;
@@ -1382,7 +1388,7 @@
** This involves replacing the GroupPointers entries.
*/
static bool
-ARTxrefslave()
+ARTxrefslave(void)
{
char *p;
char *q;
@@ -1460,9 +1466,10 @@
** Return TRUE if a list of strings has a specific one. This is a
** generic routine, but is used for seeing if a host is in the Path line.
*/
-static bool ListHas(char **list, char *p)
+static bool
+ListHas(const char **list, const char *p)
{
- char *q;
+ const char *q;
char c;
for (c = *p; (q = *list) != NULL; list++)
@@ -1475,7 +1482,9 @@
/*
** Propagate an article to the sites have "expressed an interest."
*/
-static void ARTpropagate(ARTDATA *Data, char **hops, int hopcount, char **list, bool ControlStore, bool OverviewCreated)
+static void
+ARTpropagate(ARTDATA *Data, const char **hops, int hopcount, char **list,
+ bool ControlStore, bool OverviewCreated)
{
SITE *sp;
int i;
@@ -1645,11 +1654,8 @@
int
wvec_freq_cmp(const void *p1, const void *p2)
{
- struct word_entry *w1, *w2;
-
- w1 = (struct word_entry *) p1;
- w2 = (struct word_entry *) p2;
- return w2->count - w1->count; /* decreasing sort */
+ return ((const struct word_entry *)p2)->count - /* decreasing sort */
+ ((const struct word_entry *)p1)->count;
}
/*
@@ -1659,11 +1665,8 @@
int
wvec_length_cmp(const void *p1, const void *p2)
{
- struct word_entry *w1, *w2;
-
- w1 = (struct word_entry *) p1;
- w2 = (struct word_entry *) p2;
- return w2->length - w1->length; /* decreasing sort */
+ return ((const struct word_entry *)p2)->length - /* decreasing sort */
+ ((const struct word_entry *)p1)->length;
}
/*
@@ -1674,14 +1677,11 @@
ptr_strcmp(const void *p1, const void *p2)
{
int cdiff;
- char **s1, **s2;
- s1 = (char **) p1;
- s2 = (char **) p2;
- cdiff = (**s1) - (**s2);
+ cdiff = (**(const char **)p1) - (**(const char **)p2);
if (cdiff)
return cdiff;
- return strcmp((*s1)+1, (*s2)+1);
+ return strcmp((*(const char **)p1)+1, (*(const char **)p2)+1);
}
/*
@@ -1689,24 +1689,25 @@
*/
static void
-ARTmakekeys(hp, body, v, l)
- register ARTHEADER *hp; /* header data */
- register char *body, *v; /* article body, old kw value */
- register int l; /* old kw length */
+ARTmakekeys(
+ register ARTHEADER *hp, /* header data */
+ register char *body, /* article body */
+ register char *v, /* old kw value */
+ register int l) /* old kw length */
{
int word_count, word_length, bodylen, word_index, distinct_words;
int last;
char *text, *orig_text, *text_end, *this_word, *chase, *punc;
static struct word_entry *word_vec;
- static char **word;
- static char *whitespace = " \t\r\n";
+ static char **word;
+ static const char *whitespace = " \t\r\n";
/* ---------------------------------------------------------------- */
/* Prototype setup: Regex match preparation. */
static int regex_lib_init = 0;
static regex_t preg;
- static char *elim_regexp = "^\\([-+/0-9][-+/0-9]*\\|.*1st\\|.*2nd\\|.*3rd\\|.*[04-9]th\\|about\\|after\\|ago\\|all\\|already\\|also\\|among\\|and\\|any\\|anybody\\|anyhow\\|anyone\\|anywhere\\|are\\|bad\\|because\\|been\\|before\\|being\\|between\\|but\\|can\\|could\\|did\\|does\\|doing\\|done\\|dont\\|during\\|eight\\|eighth\\|eleven\\|else\\|elsewhere\\|every\\|everywhere\\|few\\|five\\|fifth\\|first\\|for\\|four\\|fourth\\|from\\|get\\|going\\|gone\\|good\\|got\\|had\\|has\\|have\\|having\\|he\\|her\\|here\\|hers\\|herself\\|him\\|himself\\|his\\|how\\|ill\\|into\\|its\\|ive\\|just\\|kn[eo]w\\|least\\|less\\|let\\|like\\|look\\|many\\|may\\|more\\|m[ou]st\\|myself\\|next\\|nine\\|ninth\\|not\\|now\\|off\\|one\\|only\\|onto\\|our\\|out\\|over\\|really\\|said\\|saw\\|says\\|second\\|see\\|set\\|seven\\|seventh\\|several\\|shall\\|she\\|should\\|since\\|six\\|sixth\\|some\\|somehow\\|someone\\|something\\|somewhere\\|such\\|take\\|ten\\|tenth\\|than\\|that\\|the\\|their!
\\!|them\\|then\\|there\\|therell\
\|theres\\|these\\|they\\|thing\\|things\\|third\\|this\\|those\\|three\\|thus\\|together\\|told\\|too\\|twelve\\|two\\|under\\|upon\\|very\\|via\\|want\\|wants\\|was\\|wasnt\\|way\\|were\\|weve\\|what\\|whatever\\|when\\|where\\|wherell\\|wheres\\|whether\\|which\\|while\\|who\\|why\\|will\\|will\\|with\\|would\\|write\\|writes\\|wrote\\|yes\\|yet\\|you\\|your\\|youre\\|yourself\\)$";
+ static const char *elim_regexp = "^\\([-+/0-9][-+/0-9]*\\|.*1st\\|.*2nd\\|.*3rd\\|.*[04-9]th\\|about\\|after\\|ago\\|all\\|already\\|also\\|among\\|and\\|any\\|anybody\\|anyhow\\|anyone\\|anywhere\\|are\\|bad\\|because\\|been\\|before\\|being\\|between\\|but\\|can\\|could\\|did\\|does\\|doing\\|done\\|dont\\|during\\|eight\\|eighth\\|eleven\\|else\\|elsewhere\\|every\\|everywhere\\|few\\|five\\|fifth\\|first\\|for\\|four\\|fourth\\|from\\|get\\|going\\|gone\\|good\\|got\\|had\\|has\\|have\\|having\\|he\\|her\\|here\\|hers\\|herself\\|him\\|himself\\|his\\|how\\|ill\\|into\\|its\\|ive\\|just\\|kn[eo]w\\|least\\|less\\|let\\|like\\|look\\|many\\|may\\|more\\|m[ou]st\\|myself\\|next\\|nine\\|ninth\\|not\\|now\\|off\\|one\\|only\\|onto\\|our\\|out\\|over\\|really\\|said\\|saw\\|says\\|second\\|see\\|set\\|seven\\|seventh\\|several\\|shall\\|she\\|should\\|since\\|six\\|sixth\\|some\\|somehow\\|someone\\|something\\|somewhere\\|such\\|take\\|ten\\|tenth\\|than\\|that\\|the\\!
|their\\!|them\\|then\\|there\\|th
erell\\|theres\\|these\\|they\\|thing\\|things\\|third\\|this\\|those\\|three\\|thus\\|together\\|told\\|too\\|twelve\\|two\\|under\\|upon\\|very\\|via\\|want\\|wants\\|was\\|wasnt\\|way\\|were\\|weve\\|what\\|whatever\\|when\\|where\\|wherell\\|wheres\\|whether\\|which\\|while\\|who\\|why\\|will\\|will\\|with\\|would\\|write\\|writes\\|wrote\\|yes\\|yet\\|you\\|your\\|youre\\|yourself\\)$";
if (word_vec == 0) {
word_vec = NEW(struct word_entry, innconf->keymaxwords);
@@ -1879,7 +1880,8 @@
/*
** Build up the overview data.
*/
-static void ARTmakeoverview(ARTDATA *Data, bool Filename)
+static void
+ARTmakeoverview(ARTDATA *Data)
{
static char SEP[] = "\t";
static char COLONSPACE[] = ": ";
@@ -1990,7 +1992,7 @@
BUFFER *article;
HASH hash;
char **groups;
- char **hops;
+ const char **hops;
int hopcount;
char **distributions;
const char *error;
@@ -2043,7 +2045,7 @@
if (HIShavearticle(hash)) {
sprintf(buff, "%d Duplicate", NNTP_REJECTIT_VAL);
ARTlog(&Data, ART_REJECT, buff);
- ARTreject(REJECT_DUPLICATE, cp, buff, article);
+ ARTreject(REJECT_DUPLICATE, cp, article);
return buff;
}
@@ -2053,7 +2055,7 @@
if (innconf->remembertrash && (Mode == OMrunning) && !HISremember(hash))
syslog(L_ERROR, "%s cant write history %s %m",
LogName, Data.MessageID);
- ARTreject(REJECT_OTHER, cp, buff, article);
+ ARTreject(REJECT_OTHER, cp, article);
return buff;
}
@@ -2067,7 +2069,7 @@
!HISremember(hash))
syslog(L_ERROR, "%s cant write history %s %m",
LogName, Data.MessageID);
- ARTreject(REJECT_SITE, cp, buff, article);
+ ARTreject(REJECT_SITE, cp, article);
return buff;
}
}
@@ -2093,7 +2095,7 @@
!HISremember(hash))
syslog(L_ERROR, "%s cant write history %s %m",
LogName, Data.MessageID);
- ARTreject(REJECT_FILTER, cp, buff, article);
+ ARTreject(REJECT_FILTER, cp, article);
return buff;
}
}
@@ -2116,7 +2118,7 @@
!HISremember(hash))
syslog(L_ERROR, "%s cant write history %s %m",
LogName, Data.MessageID);
- ARTreject(REJECT_FILTER, cp, buff, article);
+ ARTreject(REJECT_FILTER, cp, article);
return buff;
}
}
@@ -2162,7 +2164,7 @@
!HISremember(hash))
syslog(L_ERROR, "%s cant write history %s %m",
LogName, Data.MessageID);
- ARTreject(REJECT_FILTER, cp, buff, article);
+ ARTreject(REJECT_FILTER, cp, article);
return buff;
}
}
@@ -2203,7 +2205,7 @@
syslog(L_ERROR, "%s cant write history %s %m",
LogName, Data.MessageID);
DISPOSE(distributions);
- ARTreject(REJECT_DISTRIB, cp, buff, article);
+ ARTreject(REJECT_DISTRIB, cp, article);
return buff;
} else {
DISTparse(distributions, &Data);
@@ -2218,7 +2220,7 @@
syslog(L_ERROR, "%s cant write history %s %m",
LogName, Data.MessageID);
DISPOSE(distributions);
- ARTreject(REJECT_DISTRIB, cp, buff, article);
+ ARTreject(REJECT_DISTRIB, cp, article);
return buff;
}
}
@@ -2353,7 +2355,7 @@
LogName, Data.MessageID);
if (distributions)
DISPOSE(distributions);
- ARTreject(REJECT_UNAPP, cp, buff, article);
+ ARTreject(REJECT_UNAPP, cp, article);
return buff;
}
@@ -2378,7 +2380,7 @@
ARTlog(&Data, ART_REJECT, buff);
if (distributions)
DISPOSE(distributions);
- ARTreject(REJECT_GROUP, cp, buff, article);
+ ARTreject(REJECT_GROUP, cp, article);
return buff;
}
@@ -2452,7 +2454,7 @@
LogName, Data.MessageID);
if (distributions)
DISPOSE(distributions);
- ARTreject(REJECT_GROUP, cp, buff, article);
+ ARTreject(REJECT_GROUP, cp, article);
return buff;
} else {
/* if !GroupMissing, then all the groups the article was posted
@@ -2467,7 +2469,7 @@
LogName, Data.MessageID);
if (distributions)
DISPOSE(distributions);
- ARTreject(REJECT_GROUP, cp, buff, article);
+ ARTreject(REJECT_GROUP, cp, article);
return buff;
}
}
@@ -2514,7 +2516,7 @@
ARTlog(&Data, ART_REJECT, buff);
if (distributions)
DISPOSE(distributions);
- ARTreject(REJECT_OTHER, cp, buff, article);
+ ARTreject(REJECT_OTHER, cp, article);
return buff;
}
} else {
@@ -2540,12 +2542,12 @@
LogName, Data.MessageID);
if (distributions)
DISPOSE(distributions);
- ARTreject(REJECT_OTHER, cp, buff, article);
+ ARTreject(REJECT_OTHER, cp, article);
TMRstop(TMR_ARTWRITE);
return buff;
}
TMRstop(TMR_ARTWRITE);
- ARTmakeoverview(&Data, FALSE);
+ ARTmakeoverview(&Data);
MadeOverview = TRUE;
if (innconf->enableoverview && !innconf->useoverchan) {
TMRstart(TMR_OVERV);
@@ -2566,7 +2568,7 @@
Data.NameLength = strlen(Data.Name);
/* Update history if we didn't get too many I/O errors above. */
- if ((Mode != OMrunning) || !HISwrite(&Data, hash, Files.Data, &token)) {
+ if ((Mode != OMrunning) || !HISwrite(&Data, hash, Files.Data)) {
i = errno;
syslog(L_ERROR, "%s cant write history %s %m", LogName, Data.MessageID);
(void)sprintf(buff, "%d cant write history, %s",
@@ -2574,7 +2576,7 @@
ARTlog(&Data, ART_REJECT, buff);
if (distributions)
DISPOSE(distributions);
- ARTreject(REJECT_OTHER, cp, buff, article);
+ ARTreject(REJECT_OTHER, cp, article);
return buff;
}
@@ -2643,7 +2645,7 @@
if (Accepted) {
if (IsControl) {
TMRstart(TMR_ARTCTRL);
- ARTcontrol(&Data, hash, HDR(_control), cp);
+ ARTcontrol(&Data, HDR(_control), cp);
TMRstop(TMR_ARTCTRL);
}
p = HDR(_supersedes);
@@ -2654,7 +2656,7 @@
/* If we need the overview data, write it. */
if (NeedOverview && !MadeOverview)
- ARTmakeoverview(&Data, TRUE);
+ ARTmakeoverview(&Data);
/* And finally, send to everyone who should get it */
for (sp = Sites, i = nSites; --i >= 0; sp++)
diff -ur inn-CURRENT-20001030/innd/cc.c inn/innd/cc.c
--- inn-CURRENT-20001030/innd/cc.c Mon Oct 30 13:00:52 2000
+++ inn/innd/cc.c Mon Oct 30 15:44:37 2000
@@ -31,50 +31,50 @@
typedef struct _CCDISPATCH {
char Name;
int argc;
- const char * (*Function)();
+ const char * (*Function)(char *av[]);
} CCDISPATCH;
-static const char * CCallow();
-static const char * CCbegin();
-static const char * CCchgroup();
-static const char * CCdrop();
-static const char * CCfeedinfo();
-static const char * CCflush();
-static const char * CCflushlogs();
-static const char * CCgo();
-static const char * CChangup();
-static const char * CCreserve();
-static const char * CClogmode();
-static const char * CCmode();
-static const char * CCname();
-static const char * CCnewgroup();
-static const char * CCparam();
-static const char * CCpause();
-static const char * CCreaders();
-static const char * CCreject();
-static const char * CCreload();
-static const char * CCrenumber();
-static const char * CCrmgroup();
-static const char * CCsend();
-static const char * CCshutdown();
-static const char * CCsignal();
-static const char * CCstatus();
-static const char * CCthrottle();
-static const char * CCtimer();
-static const char * CCtrace();
-static const char * CCxabort();
-static const char * CCxexec();
+static const char * CCallow(char *av[]);
+static const char * CCbegin(char *av[]);
+static const char * CCchgroup(char *av[]);
+static const char * CCdrop(char *av[]);
+static const char * CCfeedinfo(char *av[]);
+static const char * CCflush(char *av[]);
+static const char * CCflushlogs(char *unused[]);
+static const char * CCgo(char *av[]);
+static const char * CChangup(char *av[]);
+static const char * CCreserve(char *av[]);
+static const char * CClogmode(char *unused[]);
+static const char * CCmode(char *unused[]);
+static const char * CCname(char *av[]);
+static const char * CCnewgroup(char *av[]);
+static const char * CCparam(char *av[]);
+static const char * CCpause(char *av[]);
+static const char * CCreaders(char *av[]);
+static const char * CCreject(char *av[]);
+static const char * CCreload(char *av[]);
+static const char * CCrenumber(char *av[]);
+static const char * CCrmgroup(char *av[]);
+static const char * CCsend(char *av[]);
+static const char * CCshutdown(char *av[]);
+static const char * CCsignal(char *av[]);
+static const char * CCstatus(char *av[]);
+static const char * CCthrottle(char *av[]);
+static const char * CCtimer(char *av[]);
+static const char * CCtrace(char *av[]);
+static const char * CCxabort(char *av[]);
+static const char * CCxexec(char *av[]);
#if defined(DO_TCL)
-static const char * CCfilter();
+static const char * CCfilter(char *av[]);
#endif /* defined(DO_TCL) */
#if defined(DO_PERL)
-static const char * CCperl();
+static const char * CCperl(char *av[]);
#endif /* defined(DO_PERL) */
#if defined(DO_PYTHON)
-static const char * CCpython();
+static const char * CCpython(char *av[]);
#endif /* defined(DO_PYTHON) */
-static const char * CClowmark();
+static const char * CClowmark(char *av[]);
static char *CCpath = NULL;
@@ -135,12 +135,11 @@
{ SC_XEXEC, 1, CCxexec }
};
-static RETSIGTYPE CCresetup();
+static RETSIGTYPE CCresetup(int unused);
void
-CCcopyargv(av)
- char *av[];
+CCcopyargv(char *av[])
{
register char **v;
register int i;
@@ -164,7 +163,7 @@
** Return a string representing our operating mode.
*/
static const char *
-CCcurrmode()
+CCcurrmode(void)
{
static char buff[32];
@@ -187,9 +186,7 @@
** Add <> around Message-ID if needed.
*/
static const char *
-CCgetid(p, store)
- char *p;
- char **store;
+CCgetid(char *p, const char **store)
{
static char NULLMESGID[] = "1 Empty Message-ID";
static BUFFER Save;
@@ -215,7 +212,7 @@
RENEW(Save.Data, char, Save.Size);
}
*store = Save.Data;
- (void)sprintf(*store, "<%s>", p);
+ (void)sprintf((char *)*store, "<%s>", p);
return NULL;
}
@@ -224,8 +221,7 @@
** Abort and dump core.
*/
static const char *
-CCxabort(av)
- char *av[];
+CCxabort(char *av[])
{
syslog(L_FATAL, "%s abort %s", LogName, av[0]);
abort();
@@ -239,16 +235,14 @@
** Do the work needed to add a history entry.
*/
const char *
-CCaddhist(av)
- char *av[];
+CCaddhist(char *av[])
{
static char DIGITS[] = "0123456789";
ARTDATA Data;
- const char * p;
+ const char * p;
bool ok;
HASH hash;
int i;
- TOKEN token;
/* Check to see if we were passed a hash first. */
i = strlen(av[0]);
@@ -258,8 +252,6 @@
if (av[4] != NULL && *av[4] != '\0') {
if (!IsToken(av[4]))
return "1 Bad Token";
- else
- token = TextToToken(av[4]);
}
hash = TextToHash(&av[0][1]);
@@ -303,11 +295,11 @@
Data.Posted = atol(av[3]);
if (Mode == OMrunning)
- ok = HISwrite(&Data, hash, av[4], &token);
+ ok = HISwrite(&Data, hash, av[4]);
else {
/* Possible race condition, but documented in ctlinnd manpage. */
HISsetup();
- ok = HISwrite(&Data, hash, av[4], &token);
+ ok = HISwrite(&Data, hash, av[4]);
HISclose();
}
return ok ? NULL : "1 Write failed";
@@ -318,8 +310,7 @@
** Do the work to allow foreign connectiosn.
*/
static const char *
-CCallow(av)
- char *av[];
+CCallow(char *av[])
{
char *p;
@@ -343,16 +334,17 @@
SITE *sp;
int i;
int length;
- const char * p;
+ char *p;
+ const char *p1;
char **strings;
NEWSGROUP *ngp;
- const char * error;
+ const char *error;
char *subbed;
char *poison;
/* If site already exists, drop it. */
- if (SITEfind(av[0]) != NULL && (p = CCdrop(av)) != NULL)
- return p;
+ if (SITEfind(av[0]) != NULL && (p1 = CCdrop(av)) != NULL)
+ return p1;
/* Find the named site. */
length = strlen(av[0]);
@@ -408,9 +400,7 @@
** Common code to change a group's flags.
*/
static const char *
-CCdochange(ngp, Rest)
- register NEWSGROUP *ngp;
- char *Rest;
+CCdochange(register NEWSGROUP *ngp, char *Rest)
{
int length;
char *p;
@@ -439,8 +429,7 @@
** Change the mode of a newsgroup.
*/
static const char *
-CCchgroup(av)
- char *av[];
+CCchgroup(char *av[])
{
NEWSGROUP *ngp;
char *Rest;
@@ -461,8 +450,7 @@
** Cancel a message.
*/
const char *
-CCcancel(av)
- char *av[];
+CCcancel(char *av[])
{
ARTDATA Data;
const char * p;
@@ -496,10 +484,8 @@
/*
** Syntax-check the newsfeeds file.
*/
-/* ARGSUSED */
const char *
-CCcheckfile(av)
- char *av[];
+CCcheckfile(char *unused[])
{
register char **strings;
register char *p;
@@ -508,6 +494,7 @@
const char * error;
SITE fake;
+ unused = unused; /* ARGSUSED */
/* Parse all site entries. */
strings = SITEreadfile(FALSE);
fake.Buffer.Size = 0;
@@ -542,8 +529,7 @@
** Drop a site.
*/
static const char *
-CCdrop(av)
- char *av[];
+CCdrop(char *av[])
{
SITE *sp;
register NEWSGROUP *ngp;
@@ -574,8 +560,7 @@
** Return info on the feeds for one, or all, sites
*/
static const char *
-CCfeedinfo(av)
- char *av[];
+CCfeedinfo(char *av[])
{
register SITE *sp;
register char *p;
@@ -603,8 +588,7 @@
#if defined(DO_TCL)
static const char *
-CCfilter(av)
- char *av[];
+CCfilter(char *av[])
{
char *p;
@@ -639,8 +623,7 @@
extern int PERLreadfilter(char *filterfile, char *function);
static const char *
-CCperl(av)
- char *av[];
+CCperl(char *av[])
{
extern int PerlFilterActive;
@@ -667,8 +650,7 @@
#if defined(DO_PYTHON)
static const char *
-CCpython(av)
- char *av[];
+CCpython(char *av[])
{
return PYcontrol(av);
}
@@ -679,8 +661,7 @@
** Flush all sites or one site.
*/
static const char *
-CCflush(av)
- char *av[];
+CCflush(char *av[])
{
register SITE *sp;
register int i;
@@ -706,11 +687,11 @@
/*
** Flush the log files.
*/
-/* ARGSUSED0 */
static const char *
-CCflushlogs(av)
- char *av[];
+CCflushlogs(char *unused[])
{
+ unused = unused; /* ARGSUSED */
+
if (Debug)
return "1 In debug mode";
@@ -726,8 +707,7 @@
** Leave paused or throttled mode.
*/
static const char *
-CCgo(av)
- char *av[];
+CCgo(char *av[])
{
static char YES[] = "y";
char *p;
@@ -779,8 +759,7 @@
** Hangup a channel.
*/
static const char *
-CChangup(av)
- char *av[];
+CChangup(char *av[])
{
register CHANNEL *cp;
register int fd;
@@ -819,10 +798,8 @@
/*
** Return our operating mode.
*/
-/* ARGSUSED */
static const char *
-CCmode(av)
- char *av[];
+CCmode(char *unused[])
{
register char *p;
register int i;
@@ -832,6 +809,8 @@
extern int PerlFilterActive;
#endif /* defined(DO_PERL) */
+ unused = unused; /* ARGSUSED */
+
/* nb: We assume here that BUFSIZ is >= 512, and that none of
* ModeReason RejectReason Reservation or NNRPReason is longer than
* MAX_REASON_LEN bytes (or actually, the average of their lengths is
@@ -943,11 +922,10 @@
/*
** Log our operating mode (via syslog).
*/
-/* ARGSUSED */
static const char *
-CClogmode(av)
- char *av[];
+CClogmode(char *unused[])
{
+ unused = unused; /* ARGSUSED */
syslog(L_NOTICE, "%s servermode %s", LogName, CCcurrmode());
return NULL;
}
@@ -1026,8 +1004,7 @@
** Create a newsgroup.
*/
static const char *
-CCnewgroup(av)
- char *av[];
+CCnewgroup(char *av[])
{
static char *TIMES = NULL;
static char WHEN[] = "updating active.times";
@@ -1115,10 +1092,7 @@
** Parse and set a boolean flag.
*/
static bool
-CCparsebool(name, bp, value)
- char name;
- bool *bp;
- char value;
+CCparsebool(char name, bool *bp, char value)
{
switch (value) {
default:
@@ -1139,8 +1113,7 @@
** Change a running parameter.
*/
static const char *
-CCparam(av)
- char *av[];
+CCparam(char *av[])
{
static char BADVAL[] = "1 Bad value";
char *p;
@@ -1206,12 +1179,10 @@
** Common code to implement a pause or throttle.
*/
const char *
-CCblock(NewMode, reason)
- OPERATINGMODE NewMode;
- char *reason;
+CCblock(OPERATINGMODE NewMode, char *reason)
{
static char NO[] = "n";
- const char * av[2];
+ char * av[2];
if (*reason == '\0')
return CCnoreason;
@@ -1256,8 +1227,7 @@
** Enter paused mode.
*/
static const char *
-CCpause(av)
- char *av[];
+CCpause(char *av[])
{
switch (Mode) {
case OMrunning:
@@ -1275,10 +1245,9 @@
** Allow or disallow newsreaders.
*/
static const char *
-CCreaders(av)
- char *av[];
+CCreaders(char *av[])
{
- char *p;
+ const char *p;
switch (av[0][0]) {
default:
@@ -1311,8 +1280,7 @@
** Re-exec ourselves.
*/
static const char *
-CCxexec(av)
- char *av[];
+CCxexec(char *av[])
{
char *inndstart;
char *p;
@@ -1347,8 +1315,7 @@
** Reject remote readers.
*/
static const char *
-CCreject(av)
- char *av[];
+CCreject(char *av[])
{
if (RejectReason)
return "1 Already rejecting";
@@ -1363,8 +1330,7 @@
** Re-read all in-core data.
*/
static const char *
-CCreload(av)
- char *av[];
+CCreload(char *av[])
{
static char BADSCHEMA[] = "1 Can't read schema";
#if defined(DO_PERL)
@@ -1466,8 +1432,7 @@
** Renumber the active file.
*/
static const char *
-CCrenumber(av)
- char *av[];
+CCrenumber(char *av[])
{
static char CANTRENUMBER[] = "1 Failed (see syslog)";
char *p;
@@ -1494,8 +1459,7 @@
** Reserve a lock.
*/
static const char *
-CCreserve(av)
- char *av[];
+CCreserve(char *av[])
{
char *p;
@@ -1525,8 +1489,7 @@
** Remove a newsgroup.
*/
static const char *
-CCrmgroup(av)
- char *av[];
+CCrmgroup(char *av[])
{
NEWSGROUP *ngp;
@@ -1548,8 +1511,7 @@
** Send a command line to an exploder.
*/
static const char *
-CCsend(av)
- char *av[];
+CCsend(char *av[])
{
SITE *sp;
@@ -1566,8 +1528,7 @@
** Shut down the system.
*/
static const char *
-CCshutdown(av)
- char *av[];
+CCshutdown(char *av[])
{
syslog(L_NOTICE, "%s shutdown %s", LogName, av[0]);
CleanupAndExit(0, av[0]);
@@ -1580,8 +1541,7 @@
** Send a signal to a site's feed.
*/
static const char *
-CCsignal(av)
- char *av[];
+CCsignal(char *av[])
{
register SITE *sp;
register char *p;
@@ -1628,8 +1588,7 @@
** Enter throttled mode.
*/
static const char *
-CCthrottle(av)
- char *av[];
+CCthrottle(char *av[])
{
char *p;
@@ -1650,7 +1609,9 @@
/*
** Turn on or off performance monitoring
*/
-static const char * CCtimer(char *av[]) {
+static const char *
+CCtimer(char *av[])
+{
int value;
char *p;
@@ -1670,7 +1631,9 @@
/*
** Turn innd status creation on or off
*/
-static const char * CCstatus(char *av[]) {
+static const char *
+CCstatus(char *av[])
+{
int value;
char *p;
@@ -1691,8 +1654,7 @@
** Add or remove tracing.
*/
static const char *
-CCtrace(av)
- char *av[];
+CCtrace(char *av[])
{
char *p;
bool Flag;
@@ -1737,11 +1699,8 @@
** number of elements or -1 on error.
*/
static int
-CCargsplit(p, end, argv, size)
- register char *p;
- register char *end;
- register char **argv;
- register int size;
+CCargsplit(register char *p, register char *end, register char **argv,
+ register int size)
{
char **save;
@@ -1761,8 +1720,7 @@
** Read function. Read and process the message.
*/
static void
-CCreader(cp)
- CHANNEL *cp;
+CCreader(CHANNEL *cp)
{
static char TOOLONG[] = "0 Reply too long for server to send";
register CCDISPATCH *dp;
@@ -1784,7 +1742,7 @@
char *tbuff ;
if (cp != CCchan) {
- syslog(L_ERROR, "%s internal CCreader wrong channel 0x%x not 0x%x",
+ syslog(L_ERROR, "%s internal CCreader wrong channel 0x%p not 0x%p",
LogName, cp, CCchan);
return;
}
@@ -1798,7 +1756,7 @@
} else if (i == 0) {
syslog(L_ERROR, "%s cant recv CCreader empty", LogName);
return;
- } else if (i < HEADER_SIZE) {
+ } else if (i < (int)HEADER_SIZE) {
syslog(L_ERROR, "%s cant recv CCreader header-length %m", LogName);
return;
}
@@ -1945,8 +1903,9 @@
** Called when a write-in-progress is done on the channel. Shouldn't happen.
*/
static void
-CCwritedone()
+CCwritedone(CHANNEL *unused)
{
+ unused = unused; /* ARGSUSED */
syslog(L_ERROR, "%s internal CCwritedone", LogName);
}
@@ -1955,7 +1914,7 @@
** Create the channel.
*/
void
-CCsetup()
+CCsetup(void)
{
int i;
#if defined(HAVE_UNIX_DOMAIN_SOCKETS)
@@ -2024,7 +1983,7 @@
** Cleanly shut down the channel.
*/
void
-CCclose()
+CCclose(void)
{
CHANclose(CCchan, CHANname(CCchan));
CCchan = NULL;
@@ -2045,10 +2004,12 @@
** Restablish the control channel.
*/
static RETSIGTYPE
-CCresetup(int s)
+CCresetup(int unused)
{
#ifndef HAVE_SIGACTION
xsignal(s, CCresetup);
+#else
+ unused = unused; /* ARGSUSED */
#endif
CCclose();
CCsetup();
@@ -2059,10 +2020,12 @@
* Read a file containing lines of the form "newsgroup lowmark",
* and reset the low article number for the specified groups.
*/
-static const char * CClowmark(char *av[])
+static const char *
+CClowmark(char *av[])
{
long lo;
- char *line, *cp, *ret = NULL;
+ char *line, *cp;
+ const char *ret = NULL;
QIOSTATE *qp;
NEWSGROUP *ngp;
diff -ur inn-CURRENT-20001030/innd/chan.c inn/innd/chan.c
--- inn-CURRENT-20001030/innd/chan.c Mon Oct 30 13:00:52 2000
+++ inn/innd/chan.c Mon Oct 30 15:14:36 2000
@@ -55,7 +55,8 @@
/*
** Append data to a buffer.
*/
-void BUFFappend(BUFFER *bp, const char *p, const int len) {
+void
+BUFFappend(BUFFER *bp, const char *p, const int len) {
int i;
if (len == 0)
@@ -75,7 +76,8 @@
** Set a buffer's contents, ignoring anything that might have
** been there.
*/
-void BUFFset(BUFFER *bp, const char *p, const int length)
+void
+BUFFset(BUFFER *bp, const char *p, const int length)
{
if ((bp->Left = length) != 0) {
/* Need more space? */
@@ -93,7 +95,8 @@
/*
** Swap the contents of two buffers.
*/
-void BUFFswap(BUFFER *b1, BUFFER *b2)
+void
+BUFFswap(BUFFER *b1, BUFFER *b2)
{
BUFFER b;
@@ -105,7 +108,8 @@
/*
** Trim '\r' from buffer.
*/
-void BUFFtrimcr(BUFFER *bp)
+void
+BUFFtrimcr(BUFFER *bp)
{
char *p, *q;
int trimmed = 0;
@@ -124,7 +128,7 @@
** Tear down our world
*/
void
-CHANshutdown()
+CHANshutdown(void)
{
CHANNEL *cp;
int i;
@@ -146,7 +150,8 @@
/*
** Initialize all the I/O channels.
*/
-void CHANsetup(int i)
+void
+CHANsetup(int i)
{
CHANNEL *cp;
@@ -256,7 +261,8 @@
/*
** Start tracing a channel.
*/
-void CHANtracing(CHANNEL *cp, bool Flag)
+void
+CHANtracing(CHANNEL *cp, bool Flag)
{
char *p;
@@ -269,7 +275,7 @@
syslog(L_NOTICE, "%s trace address %s lastactive %ld nextlog %ld",
p, inet_ntoa(cp->Address), cp->LastActive, cp->NextLog);
if (FD_ISSET(cp->fd, &SCHANmask))
- syslog(L_NOTICE, "%s trace sleeping %ld 0x%x",
+ syslog(L_NOTICE, "%s trace sleeping %ld 0x%p",
p, (long)cp->Waketime, cp->Waker);
if (FD_ISSET(cp->fd, &RCHANmask))
syslog(L_NOTICE, "%s trace reading %d %s",
@@ -284,7 +290,8 @@
/*
** Close a channel.
*/
-void CHANclose(CHANNEL *cp, char *name)
+void
+CHANclose(CHANNEL *cp, const char *name)
{
char *label, *tmplabel, buff[SMBUF];
@@ -371,7 +378,8 @@
/*
** Return a printable name for the channel.
*/
-char *CHANname(const CHANNEL *cp)
+char *
+CHANname(const CHANNEL *cp)
{
static char buff[SMBUF];
int i;
@@ -434,7 +442,8 @@
/*
** Return the channel for a specified descriptor.
*/
-CHANNEL *CHANfromdescriptor(int fd)
+CHANNEL *
+CHANfromdescriptor(int fd)
{
if (fd <0 || fd > CHANtablesize)
return NULL;
@@ -445,7 +454,8 @@
/*
** Iterate over all channels of a specified type.
*/
-CHANNEL *CHANiter(int *ip, CHANNELTYPE Type)
+CHANNEL *
+CHANiter(int *ip, CHANNELTYPE Type)
{
CHANNEL *cp;
int i;
@@ -468,7 +478,8 @@
/*
** Mark a channel as an active reader.
*/
-void RCHANadd(CHANNEL *cp)
+void
+RCHANadd(CHANNEL *cp)
{
FD_SET(cp->fd, &RCHANmask);
if (cp->fd > CHANlastfd)
@@ -482,7 +493,8 @@
/*
** Remove a channel from the set of readers.
*/
-void RCHANremove(CHANNEL *cp)
+void
+RCHANremove(CHANNEL *cp)
{
if (FD_ISSET(cp->fd, &RCHANmask)) {
FD_CLR(cp->fd, &RCHANmask);
@@ -524,7 +536,8 @@
/*
** Take a channel off the sleep list.
*/
-void SCHANremove(CHANNEL *cp)
+void
+SCHANremove(CHANNEL *cp)
{
if (FD_ISSET(cp->fd, &SCHANmask)) {
FD_CLR(cp->fd, &SCHANmask);
@@ -543,7 +556,8 @@
/*
** Is a channel on the sleep list?
*/
-bool CHANsleeping(CHANNEL *cp)
+bool
+CHANsleeping(CHANNEL *cp)
{
return FD_ISSET(cp->fd, &SCHANmask);
}
@@ -568,7 +582,8 @@
** Mark a channel as an active writer. Don't reset the Out->Left field
** since we could have buffered I/O already in there.
*/
-void WCHANadd(CHANNEL *cp)
+void
+WCHANadd(CHANNEL *cp)
{
if (cp->Out.Left > 0) {
FD_SET(cp->fd, &WCHANmask);
@@ -581,7 +596,8 @@
/*
** Remove a channel from the set of writers.
*/
-void WCHANremove(CHANNEL *cp)
+void
+WCHANremove(CHANNEL *cp)
{
if (FD_ISSET(cp->fd, &WCHANmask)) {
FD_CLR(cp->fd, &WCHANmask);
@@ -604,7 +620,8 @@
/*
** Set a channel to start off with the contents of an existing channel.
*/
-void WCHANsetfrombuffer(CHANNEL *cp, BUFFER *bp)
+void
+WCHANsetfrombuffer(CHANNEL *cp, BUFFER *bp)
{
WCHANset(cp, &bp->Data[bp->Used], bp->Left);
}
@@ -614,7 +631,8 @@
/*
** Read in text data, return the amount we read.
*/
-int CHANreadtext(CHANNEL *cp)
+int
+CHANreadtext(CHANNEL *cp)
{
int i;
BUFFER *bp;
@@ -715,7 +733,8 @@
/*
** Try to flush out the buffer. Use this only on file channels!
*/
-bool WCHANflush(CHANNEL *cp)
+bool
+WCHANflush(CHANNEL *cp)
{
BUFFER *bp;
int i;
@@ -823,7 +842,8 @@
}
#endif /* defined(INND_FIND_BAD_FDS) */
-void CHANsetActiveCnx(CHANNEL *cp) {
+void
+CHANsetActiveCnx(CHANNEL *cp) {
int found;
CHANNEL *tempchan;
char *label, *tmplabel;
@@ -855,7 +875,8 @@
**
** Yes, the main code has really wandered over to the side a lot.
*/
-void CHANreadloop(void)
+void
+CHANreadloop(void)
{
static char EXITING[] = "INND exiting because of signal\n";
static int fd;
diff -ur inn-CURRENT-20001030/innd/his.c inn/innd/his.c
--- inn-CURRENT-20001030/innd/his.c Mon Oct 30 13:00:52 2000
+++ inn/innd/his.c Mon Oct 30 15:45:38 2000
@@ -21,7 +21,6 @@
static FILE *HISwritefp;
static int HISreadfd;
static int HISdirty;
-static int HISincore = INND_DBZINCORE;
static _HIScache *HIScache;
static int HIScachesize; /* Number of entries in HIScache */
static int HIShitpos; /* In cache, in history */
@@ -33,7 +32,8 @@
/*
** Put an entry into the history cache
*/
-void HIScacheadd(HASH MessageID, bool Found) {
+void
+HIScacheadd(HASH MessageID, bool Found) {
unsigned int i, loc;
if (HIScache == NULL)
@@ -47,7 +47,8 @@
/*
** Lookup an entry in the history cache
*/
-HISresult HIScachelookup(HASH MessageID) {
+HISresult
+HIScachelookup(HASH MessageID) {
unsigned int i, loc;
if (HIScache == NULL)
@@ -70,7 +71,8 @@
/*
** Set up the history files.
*/
-void HISsetup(void)
+void
+HISsetup(void)
{
dbzoptions opt;
@@ -107,7 +109,7 @@
opt.pag_incore = INCORE_MMAP;
#else
opt.pag_incore = INCORE_NO;
- opt.exists_incore = HISincore ? INCORE_MMAP : INCORE_NO;
+ opt.exists_incore = INND_DBZINCORE ? INCORE_MMAP : INCORE_NO;
#endif
dbzsetoptions(opt);
if (!dbzinit(HIShistpath)) {
@@ -133,7 +135,8 @@
/*
** Synchronize the in-core history file (flush it).
*/
-void HISsync(void)
+void
+HISsync(void)
{
TMRstart(TMR_HISSYNC);
if (HISdirty) {
@@ -147,7 +150,8 @@
}
-static void HISlogstats() {
+static void
+HISlogstats(void) {
syslog(L_NOTICE, "ME HISstats %d hitpos %d hitneg %d missed %d dne",
HIShitpos, HIShitneg, HISmisses, HISdne);
HIShitpos = HIShitneg = HISmisses = HISdne = 0;
@@ -157,7 +161,8 @@
/*
** Close the history files.
*/
-void HISclose(void)
+void
+HISclose(void)
{
if (HISwritefp != NULL) {
HISsync();
@@ -184,7 +189,8 @@
/*
** Get the list of files under which a Message-ID is stored.
*/
-TOKEN *HISfilesfor(const HASH MessageID)
+TOKEN *
+HISfilesfor(const HASH MessageID)
{
static BUFFER Files;
off_t offset;
@@ -250,7 +256,8 @@
/*
** Have we already seen an article?
*/
-bool HIShavearticle(const HASH MessageID)
+bool
+HIShavearticle(const HASH MessageID)
{
bool val;
@@ -287,7 +294,8 @@
/*
** Write a history entry.
*/
-bool HISwrite(const ARTDATA *Data, const HASH hash, char *paths, TOKEN *token)
+bool
+HISwrite(const ARTDATA *Data, const HASH hash, char *paths)
{
static char NOPATHS[] = "";
off_t offset;
@@ -328,8 +336,8 @@
/* Set up the database values and write them. */
if (dbzstore(hash, offset) == DBZSTORE_ERROR) {
i = errno;
- syslog(L_ERROR, "%s cant dbzstore [%s]@%lu: %m", LogName,
- HashToText(hash), offset);
+ syslog(L_ERROR, "%s cant dbzstore [%s]@%.0f: %m", LogName,
+ HashToText(hash), (double)offset);
IOError("history database", i);
TMRstop(TMR_HISWRITE);
return FALSE;
@@ -375,8 +383,8 @@
/* Set up the database values and write them. */
if (dbzstore(hash, offset) == DBZSTORE_ERROR) {
i = errno;
- syslog(L_ERROR, "%s cant dbzstore [%s]@%lu: %m", LogName,
- HashToText(hash), offset);
+ syslog(L_ERROR, "%s cant dbzstore [%s]@%.0f: %m", LogName,
+ HashToText(hash), (double)offset);
IOError("history database", i);
TMRstop(TMR_HISWRITE);
return FALSE;
diff -ur inn-CURRENT-20001030/innd/icd.c inn/innd/icd.c
--- inn-CURRENT-20001030/innd/icd.c Mon Oct 30 13:00:52 2000
+++ inn/innd/icd.c Fri Oct 27 15:14:36 2000
@@ -48,7 +48,7 @@
** Close the active file, releasing its resources.
*/
static void
-ICDcloseactive()
+ICDcloseactive(void)
{
if (ICDactpointer) {
#ifdef HAVE_MMAP
@@ -100,7 +100,7 @@
** Write out all in-core data.
*/
void
-ICDwrite()
+ICDwrite(void)
{
HISsync();
SMflushcacheddata(SM_ALL);
@@ -122,7 +122,7 @@
** Close things down.
*/
void
-ICDclose()
+ICDclose(void)
{
ICDwrite();
ICDcloseactive();
@@ -133,7 +133,7 @@
** Scan the active file, and renumber the min/max counts.
*/
bool
-ICDrenumberactive()
+ICDrenumberactive(void)
{
register int i;
register NEWSGROUP *ngp;
@@ -236,7 +236,8 @@
/*
** Change the flag on a newsgroup. Fairly easy.
*/
-bool ICDchangegroup(NEWSGROUP *ngp, char *Rest)
+bool
+ICDchangegroup(NEWSGROUP *ngp, char *Rest)
{
static char NEWLINE[] = "\n";
int i;
@@ -430,7 +431,7 @@
** Write the active file out.
*/
void
-ICDwriteactive()
+ICDwriteactive(void)
{
#ifdef HAVE_MMAP
# ifdef MMAP_NEEDS_MSYNC
diff -ur inn-CURRENT-20001030/innd/innd.c inn/innd/innd.c
--- inn-CURRENT-20001030/innd/innd.c Mon Oct 30 13:00:52 2000
+++ inn/innd/innd.c Mon Oct 30 15:33:47 2000
@@ -92,11 +92,8 @@
** filenames.
*/
void
-FileGlue(p, n1, c, n2)
- register char *p;
- register char *n1;
- char c;
- register char *n2;
+FileGlue(register char *p, register const char *n1, char c,
+ register const char *n2)
{
p += strlen(strcpy(p, n1));
*p++ = c;
@@ -109,8 +106,7 @@
** headers into a single line.
*/
static char *
-Join(text)
- register char *text;
+Join(register char *text)
{
register char *p;
@@ -126,20 +122,20 @@
** q should either be p, or point into p where the "interesting" part is.
*/
char *
-MaxLength(p, q)
- char *p;
- char *q;
+MaxLength(const char *p, const char *q)
{
- static char buff[80];
- register int i;
+ static char buff[80];
+ register unsigned int i;
/* Already short enough? */
i = strlen(p);
- if (i < sizeof buff - 1)
- return Join(p);
+ if (i < sizeof buff - 1) {
+ (void)strcpy(buff, p);
+ return Join(buff);
+ }
/* Simple case of just want the begining? */
- if (q - p < sizeof buff - 4) {
+ if ((unsigned)(q - p) < sizeof buff - 4) {
(void)strncpy(buff, p, sizeof buff - 4);
(void)strcpy(&buff[sizeof buff - 4], "...");
}
@@ -167,8 +163,7 @@
** the text is expected to be either relatively short or "comma-dense."
*/
char **
-CommaSplit(text)
- char *text;
+CommaSplit(char *text)
{
register int i;
register char *p;
@@ -198,10 +193,7 @@
** have NUL's inserted.
*/
bool
-NeedShell(p, av, end)
- register char *p;
- register char **av;
- register char **end;
+NeedShell(register char *p, register const char **av, register const char **end)
{
static char Metachars[] = ";<>|*?[]{}()#$&=`'\"\\~\n";
register char *q;
@@ -243,12 +235,7 @@
** (and a syslog'd message) on error.
*/
pid_t
-Spawn(niceval, fd0, fd1, fd2, av)
- int niceval;
- int fd0;
- int fd1;
- int fd2;
- char *av[];
+Spawn(int niceval, int fd0, int fd1, int fd2, char * const av[])
{
static char NOCLOSE[] = "%s cant close %d in %s %m";
static char NODUP2[] = "%s cant dup2 %d to %d in %s %m";
@@ -316,7 +303,7 @@
** Stat our control directory and see who should own things.
*/
static bool
-GetNewsOwnerships()
+GetNewsOwnerships(void)
{
struct stat Sb;
@@ -335,8 +322,7 @@
** Change the onwership of a file.
*/
void
-xchown(p)
- char *p;
+xchown(char *p)
{
if (chown(p, NewsUID, NewsGID) < 0)
syslog(L_ERROR, "%s cant chown %s %m", LogName, p);
@@ -347,8 +333,7 @@
** Flush one log file, with pessimistic size of working filename buffer.
*/
void
-ReopenLog(F)
- FILE *F;
+ReopenLog(FILE *F)
{
char buff[SMBUF];
char *Name;
@@ -389,7 +374,7 @@
AllocationFailure(const char *what, size_t size, const char *file, int line)
{
syslog(L_FATAL, "%s cant %s %lu bytes at line %d of %s: %m", LogName,
- what, size, line, file);
+ what, (unsigned long)size, line, file);
abort();
}
@@ -398,7 +383,7 @@
** We ran out of space or other I/O error, throttle ourselves.
*/
void
-ThrottleIOError(char *when)
+ThrottleIOError(const char *when)
{
char buff[SMBUF];
const char * p;
@@ -448,7 +433,7 @@
** Close down all parts of the system (e.g., before calling exit or exec).
*/
void
-JustCleanup()
+JustCleanup(void)
{
SITEflushall(FALSE);
/* PROCclose(FALSE); */
@@ -489,9 +474,7 @@
** The name is self-explanatory.
*/
void
-CleanupAndExit(x, why)
- int x;
- char *why;
+CleanupAndExit(int x, const char *why)
{
JustCleanup();
if (why)
@@ -528,14 +511,15 @@
}
-int main(int ac, char *av[])
+int
+main(int ac, char *av[])
{
static char WHEN[] = "PID file";
int i;
int fd;
int logflags;
char buff[SMBUF];
- char *p;
+ const char *p;
FILE *F;
bool ShouldFork;
bool ShouldRenumber;
@@ -698,7 +682,7 @@
NNRPReason = COPY(ModeReason);
if (ShouldSyntaxCheck) {
- if ((p = (char *) CCcheckfile((char **)NULL)) == NULL)
+ if ((p = CCcheckfile((char **)NULL)) == NULL)
exit(0);
(void)fprintf(stderr, "%s\n", p + 2);
exit(1);
@@ -865,7 +849,7 @@
LCsetup();
RCsetup(fd);
WIPsetup();
- NCsetup(i);
+ NCsetup();
ARTsetup();
ICDsetup(TRUE);
diff -ur inn-CURRENT-20001030/innd/innd.h inn/innd/innd.h
--- inn-CURRENT-20001030/innd/innd.h Mon Oct 30 13:00:52 2000
+++ inn/innd/innd.h Mon Oct 30 15:23:57 2000
@@ -1,27 +1,27 @@
/* $Id: innd.h,v 1.74 2000/10/27 07:31:59 kondou Exp $
**
** Many of the data types used here have abbreviations, such as CT
** for CHANNELTYPE. Here are a list of the conventions and meanings:
**
-** ART A news article
-** CHAN An I/O channel
-** CS Channel state
-** CT Channel type
-** FNL Funnel, into which other feeds pour
-** FT Feed type -- how a site gets told about new articles
-** ICD In-core data (primarily the active and sys files)
-** LC Local NNTP connection-receiving channel
-** CC Control channel (used by ctlinnd)
-** NC NNTP client channel
-** NG Newsgroup
-** NGH Newgroup hashtable
-** PROC A process (used to feed a site)
-** PS Process state
-** RC Remote NNTP connection-receiving channel
-** RCHAN A channel in "read" state
-** SITE Something that gets told when we get an article
-** WCHAN A channel in "write" state
-** WIP Work-In-Progress, keeps track of articles before committed.
+** ART A news article
+** CHAN An I/O channel
+** CS Channel state
+** CT Channel type
+** FNL Funnel, into which other feeds pour
+** FT Feed type -- how a site gets told about new articles
+** ICD In-core data (primarily the active and sys files)
+** LC Local NNTP connection-receiving channel
+** CC Control channel (used by ctlinnd)
+** NC NNTP client channel
+** NG Newsgroup
+** NGH Newgroup hashtable
+** PROC A process (used to feed a site)
+** PS Process state
+** RC Remote NNTP connection-receiving channel
+** RCHAN A channel in "read" state
+** SITE Something that gets told when we get an article
+** WCHAN A channel in "write" state
+** WIP Work-In-Progress, keeps track of articles before committed.
*/
#ifndef INND_H
@@ -53,7 +53,7 @@
BEGIN_DECLS
-typedef short SITEIDX;
+typedef short SITEIDX;
#define NOSITE ((SITEIDX) -1)
/*
@@ -71,10 +71,10 @@
** much space is left if reading or how much still needs to be written.
*/
typedef struct _BUFFER {
- long Size;
- long Used;
- long Left;
- char * Data;
+ int Size;
+ int Used;
+ int Left;
+ char * Data;
} BUFFER;
@@ -134,72 +134,72 @@
typedef void (*innd_callback_t)(struct _CHANNEL *);
typedef struct _CHANNEL {
- CHANNELTYPE Type;
- CHANNELSTATE State;
- int fd;
- bool Skip;
- bool Streaming;
- bool NoResendId;
- bool privileged;
- unsigned long Duplicate;
- unsigned long Unwanted_s;
- unsigned long Unwanted_f;
- unsigned long Unwanted_d;
- unsigned long Unwanted_g;
- unsigned long Unwanted_u;
- unsigned long Unwanted_o;
- float Size;
- float DuplicateSize;
- unsigned long Check;
- unsigned long Check_send;
- unsigned long Check_deferred;
- unsigned long Check_got;
- unsigned long Check_cybercan;
- unsigned long Takethis;
- unsigned long Takethis_Ok;
- unsigned long Takethis_Err;
- unsigned long Ihave;
- unsigned long Ihave_Duplicate;
- unsigned long Ihave_Deferred;
- unsigned long Ihave_SendIt;
- unsigned long Ihave_Cybercan;
- int Reported;
- long Received;
- long Refused;
- long Rejected;
- int BadWrites;
- int BadReads;
- int BlockedWrites;
- int BadCommands;
- time_t LastActive;
- time_t NextLog;
- struct in_addr Address;
- innd_callback_t Reader;
- innd_callback_t WriteDone;
- time_t Waketime;
- time_t Started;
- innd_callback_t Waker;
- void * Argument;
- void * Event;
- BUFFER In;
- BUFFER Out;
- bool Tracing;
- BUFFER Sendid;
- HASH CurrentMessageIDHash;
+ CHANNELTYPE Type;
+ CHANNELSTATE State;
+ int fd;
+ bool Skip;
+ bool Streaming;
+ bool NoResendId;
+ bool privileged;
+ unsigned long Duplicate;
+ unsigned long Unwanted_s;
+ unsigned long Unwanted_f;
+ unsigned long Unwanted_d;
+ unsigned long Unwanted_g;
+ unsigned long Unwanted_u;
+ unsigned long Unwanted_o;
+ float Size;
+ float DuplicateSize;
+ unsigned long Check;
+ unsigned long Check_send;
+ unsigned long Check_deferred;
+ unsigned long Check_got;
+ unsigned long Check_cybercan;
+ unsigned long Takethis;
+ unsigned long Takethis_Ok;
+ unsigned long Takethis_Err;
+ unsigned long Ihave;
+ unsigned long Ihave_Duplicate;
+ unsigned long Ihave_Deferred;
+ unsigned long Ihave_SendIt;
+ unsigned long Ihave_Cybercan;
+ int Reported;
+ long Received;
+ long Refused;
+ long Rejected;
+ int BadWrites;
+ int BadReads;
+ int BlockedWrites;
+ int BadCommands;
+ time_t LastActive;
+ time_t NextLog;
+ struct in_addr Address;
+ innd_callback_t Reader;
+ innd_callback_t WriteDone;
+ time_t Waketime;
+ time_t Started;
+ innd_callback_t Waker;
+ void * Argument;
+ void * Event;
+ BUFFER In;
+ BUFFER Out;
+ bool Tracing;
+ BUFFER Sendid;
+ HASH CurrentMessageIDHash;
#define PRECOMMITCACHESIZE 128
- struct _WIP * PrecommitWIP[PRECOMMITCACHESIZE];
- int PrecommitiCachenext;
- int XBatchSize;
- int LargeArtSize;
- int LargeCmdSize;
- int Lastch;
- int Rest;
- int SaveUsed;
- int ActiveCnx;
- int MaxCnx;
- int HoldTime;
- time_t ArtBeg;
- int ArtMax;
+ struct _WIP * PrecommitWIP[PRECOMMITCACHESIZE];
+ int PrecommitiCachenext;
+ int XBatchSize;
+ int LargeArtSize;
+ int LargeCmdSize;
+ int Lastch;
+ int Rest;
+ int SaveUsed;
+ int ActiveCnx;
+ int MaxCnx;
+ int HoldTime;
+ time_t ArtBeg;
+ int ArtMax;
} CHANNEL;
@@ -209,20 +209,20 @@
** get this group.
*/
typedef struct _NEWSGROUP {
- long Start; /* Offset into the active file */
- char * Name;
- char * Dir; /* The name, as a directory */
- int NameLength;
- ARTNUM Last;
- ARTNUM Filenum; /* File name to use */
- int Lastwidth;
- int PostCount; /* Have we already put it here? */
- char * LastString;
- char * Rest; /* Flags, NOT NULL TERMINATED */
- SITEIDX nSites;
- int * Sites;
- SITEIDX nPoison;
- int * Poison;
+ long Start; /* Offset into the active file */
+ char * Name;
+ char * Dir; /* The name, as a directory */
+ int NameLength;
+ ARTNUM Last;
+ ARTNUM Filenum; /* File name to use */
+ int Lastwidth;
+ int PostCount; /* Have we already put it here? */
+ char * LastString;
+ char * Rest; /* Flags, NOT NULL TERMINATED */
+ SITEIDX nSites;
+ int * Sites;
+ SITEIDX nPoison;
+ int * Poison;
struct _NEWSGROUP * Alias;
} NEWSGROUP;
@@ -246,55 +246,55 @@
** too many hops, or a bad distribution.
*/
typedef struct _SITE {
- char * Name;
- char * Entry;
- int NameLength;
- char ** Exclusions;
- char ** Distributions;
- char ** Patterns;
- bool Poison;
- bool PoisonEntry;
- bool Sendit;
- bool Seenit;
- bool IgnoreControl;
- bool DistRequired;
- bool IgnorePath;
- bool ControlOnly;
- bool DontWantNonExist;
- bool NeedOverviewCreation;
- bool FeedwithoutOriginator;
- bool DropFiltered;
- int Hops;
- int Groupcount;
- int Followcount;
- int Crosscount;
- FEEDTYPE Type;
- NEWSGROUP * ng;
- bool Spooling;
- char * SpoolName;
- bool Working;
- long StartWriting;
- long StopWriting;
- long StartSpooling;
- char * Param;
- char FileFlags[FEED_MAXFLAGS + 1];
- long MaxSize;
- long MinSize;
- int Nice;
- CHANNEL * Channel;
- bool IsMaster;
- int Master;
- int Funnel;
- bool FNLwantsnames;
- BUFFER FNLnames;
- int Process;
- pid_t pid;
- long Flushpoint;
- BUFFER Buffer;
- bool Buffered;
- char ** Originator;
- int Next;
- int Prev;
+ const char * Name;
+ char * Entry;
+ int NameLength;
+ char ** Exclusions;
+ char ** Distributions;
+ char ** Patterns;
+ bool Poison;
+ bool PoisonEntry;
+ bool Sendit;
+ bool Seenit;
+ bool IgnoreControl;
+ bool DistRequired;
+ bool IgnorePath;
+ bool ControlOnly;
+ bool DontWantNonExist;
+ bool NeedOverviewCreation;
+ bool FeedwithoutOriginator;
+ bool DropFiltered;
+ int Hops;
+ int Groupcount;
+ int Followcount;
+ int Crosscount;
+ FEEDTYPE Type;
+ NEWSGROUP * ng;
+ bool Spooling;
+ char * SpoolName;
+ bool Working;
+ long StartWriting;
+ long StopWriting;
+ long StartSpooling;
+ char * Param;
+ char FileFlags[FEED_MAXFLAGS + 1];
+ long MaxSize;
+ long MinSize;
+ int Nice;
+ CHANNEL * Channel;
+ bool IsMaster;
+ int Master;
+ int Funnel;
+ bool FNLwantsnames;
+ BUFFER FNLnames;
+ int Process;
+ pid_t pid;
+ long Flushpoint;
+ BUFFER Buffer;
+ bool Buffered;
+ char ** Originator;
+ int Next;
+ int Prev;
} SITE;
@@ -343,15 +343,15 @@
int NameLength;
char TimeReceived[33];
int TimeReceivedLength;
- char * MessageID;
- int MessageIDLength;
+ const char *MessageID;
+ int MessageIDLength;
char * Newsgroups;
int NewsgroupsLength;
- char * Distribution;
+ const char *Distribution;
int DistributionLength;
- char * Feedsite;
+ const char *Feedsite;
int FeedsiteLength;
- char * Path;
+ const char *Path;
int PathLength;
char * Replic;
int ReplicLength;
@@ -393,12 +393,8 @@
TMR_ARTCNCL, /* Processing a cancel message. */
TMR_SITESEND, /* Sending an article to feeds. */
TMR_OVERV, /* Generating overview information. */
-#if defined(DO_PERL)
TMR_PERL, /* Perl filter. */
-#endif
-#if defined(DO_PYTHON)
TMR_PYTHON, /* Python filter. */
-#endif
TMR_MAX
};
@@ -431,275 +427,274 @@
** with "EXTERN" are not explicitly initialized in innd.c.
*/
#if defined(DEFINE_DATA)
-# define EXTERN /* NULL */
+# define EXTERN /* NULL */
#else
-# define EXTERN extern
+# define EXTERN extern
#endif
-extern bool AmRoot;
-extern bool BufferedLogs;
-EXTERN bool AnyIncoming;
-extern bool Debug;
-EXTERN bool ICDneedsetup;
-EXTERN bool NeedHeaders;
-EXTERN bool NeedOverview;
-EXTERN bool NeedPath;
-extern bool NNRPTracing;
-extern bool StreamingOff;
-extern bool Tracing;
-EXTERN int Overfdcount;
-EXTERN int SeqNum;
-EXTERN char * path;
-EXTERN BUFFER Path;
-EXTERN BUFFER Pathalias;
-EXTERN char * ModeReason; /* NNTP reject message */
-EXTERN char * NNRPReason; /* NNRP reject message */
-EXTERN char * Reservation; /* Reserved lock message */
-EXTERN char * RejectReason; /* NNTP reject message */
-EXTERN FILE * Errlog;
-EXTERN FILE * Log;
-extern char LogName[];
-EXTERN struct in_addr MyAddress;
-extern int ErrorCount;
-EXTERN int ICDactivedirty;
-EXTERN int KillerSignal;
-EXTERN int MaxOutgoing;
-EXTERN int nGroups;
-EXTERN SITEIDX nSites;
-EXTERN int PROCneedscan;
-extern int SPOOLlen;
-EXTERN int Xrefbase;
-extern long LargestArticle;
-EXTERN NEWSGROUP ** GroupPointers;
-EXTERN NEWSGROUP * Groups;
-extern OPERATINGMODE Mode;
-EXTERN sig_atomic_t GotTerminate;
-EXTERN SITE * Sites;
-EXTERN SITE ME;
-EXTERN struct timeval TimeOut;
-EXTERN TIMEINFO Now; /* Reasonably accurate time */
-EXTERN bool ThrottledbyIOError;
-EXTERN bool AddAlias;
-EXTERN bool Hassamepath;
-EXTERN char * NCgreeting;
+extern bool AmRoot;
+extern bool BufferedLogs;
+EXTERN bool AnyIncoming;
+extern bool Debug;
+EXTERN bool ICDneedsetup;
+EXTERN bool NeedHeaders;
+EXTERN bool NeedOverview;
+EXTERN bool NeedPath;
+extern bool NNRPTracing;
+extern bool StreamingOff;
+extern bool Tracing;
+EXTERN int Overfdcount;
+EXTERN int SeqNum;
+EXTERN const char * path;
+EXTERN BUFFER Path;
+EXTERN BUFFER Pathalias;
+EXTERN char * ModeReason; /* NNTP reject message */
+EXTERN char * NNRPReason; /* NNRP reject message */
+EXTERN char * Reservation; /* Reserved lock message */
+EXTERN char * RejectReason; /* NNTP reject message */
+EXTERN FILE * Errlog;
+EXTERN FILE * Log;
+extern char LogName[];
+EXTERN struct in_addr MyAddress;
+extern int ErrorCount;
+EXTERN int ICDactivedirty;
+EXTERN int KillerSignal;
+EXTERN int MaxOutgoing;
+EXTERN int nGroups;
+EXTERN SITEIDX nSites;
+EXTERN int PROCneedscan;
+extern int SPOOLlen;
+EXTERN int Xrefbase;
+extern long LargestArticle;
+EXTERN NEWSGROUP ** GroupPointers;
+EXTERN NEWSGROUP * Groups;
+extern OPERATINGMODE Mode;
+EXTERN sig_atomic_t GotTerminate;
+EXTERN SITE * Sites;
+EXTERN SITE ME;
+EXTERN struct timeval TimeOut;
+EXTERN TIMEINFO Now; /* Reasonably accurate time */
+EXTERN bool ThrottledbyIOError;
+EXTERN bool AddAlias;
+EXTERN bool Hassamepath;
+EXTERN char * NCgreeting;
/*
** Table size for limiting incoming connects. Do not change the table
** size unless you look at the code manipulating it in rc.c.
*/
-#define REMOTETABLESIZE 128
+#define REMOTETABLESIZE 128
/*
** Setup the default values. The REMOTETIMER being zero turns off the
** code to limit incoming connects.
*/
-#define REMOTELIMIT 2
-#define REMOTETIMER 0
-#define REMOTETOTAL 60
-#define REJECT_TIMEOUT 10
-extern int RemoteLimit; /* Per host limit. */
-extern time_t RemoteTimer; /* How long to remember connects. */
-extern int RemoteTotal; /* Total limit. */
+#define REMOTELIMIT 2
+#define REMOTETIMER 0
+#define REMOTETOTAL 60
+#define REJECT_TIMEOUT 10
+extern int RemoteLimit; /* Per host limit. */
+extern time_t RemoteTimer; /* How long to remember connects. */
+extern int RemoteTotal; /* Total limit. */
/*
** Function declarations.
*/
-extern bool FormatLong();
-extern bool MakeSpoolDirectory();
-extern bool NeedShell();
-extern char ** CommaSplit();
-extern char * MaxLength();
-extern pid_t Spawn();
-extern void CleanupAndExit();
-extern void FileGlue();
-extern void JustCleanup();
-extern void ThrottleIOError();
-extern void ThrottleNoMatchError();
-extern void ReopenLog();
-extern void xchown();
-
-extern bool ARTidok(const char *MessageID);
-extern bool ARTreadschema(void);
-extern const char * ARTreadarticle(char *files);
-extern char * ARTreadheader(char *files);
-extern const char * ARTpost(CHANNEL *cp);
-extern void ARTcancel(const ARTDATA *Data,
- const char *MessageID, bool Trusted);
-extern void ARTclose(void);
-extern void ARTsetup(void);
-
-extern void BUFFset(BUFFER *bp, const char *p, const int length);
-extern void BUFFswap(BUFFER *b1, BUFFER *b2);
-extern void BUFFappend(BUFFER *bp, const char *p, const int len);
-extern void BUFFtrimcr(BUFFER *bp);
-
-extern bool CHANsleeping(CHANNEL *cp);
-extern CHANNEL * CHANcreate(int fd, CHANNELTYPE Type,
- CHANNELSTATE State,
- innd_callback_t Reader,
- innd_callback_t WriteDone);
-extern CHANNEL * CHANiter(int *cp, CHANNELTYPE Type);
-extern CHANNEL * CHANfromdescriptor(int fd);
-extern char * CHANname(const CHANNEL *cp);
-extern int CHANreadtext(CHANNEL *cp);
-extern void CHANclose(CHANNEL *cp, char *name);
-extern void CHANreadloop(void);
-extern void CHANsetup(int i);
-extern void CHANshutdown();
-extern void CHANtracing(CHANNEL *cp, bool Flag);
-extern void CHANsetActiveCnx(CHANNEL *cp);
-
-extern void RCHANadd(CHANNEL *cp);
-extern void RCHANremove(CHANNEL *cp);
-
-extern void SCHANadd(CHANNEL *cp, time_t Waketime,
- void *Event, innd_callback_t Waker,
- void *Argument);
-extern void SCHANremove(CHANNEL *cp);
-extern void SCHANwakeup(void *Event);
-
-extern bool WCHANflush(CHANNEL *cp);
-extern void WCHANadd(CHANNEL *cp);
-extern void WCHANremove(CHANNEL *cp);
-extern void WCHANsetfrombuffer(CHANNEL *cp, BUFFER *bp);
-
-extern void CCcopyargv();
-extern const char * CCaddhist(char *av[]);
-extern const char * CCblock();
-extern const char * CCcancel();
-extern const char * CCcheckfile();
-
-extern bool HIShavearticle(const HASH MessageID);
-extern bool HISwrite(const ARTDATA *Data, const HASH hash,
- char *paths, TOKEN *token);
-extern bool HISremember(const HASH MessageID);
-extern TOKEN * HISfilesfor(const HASH MessageID);
-extern void HISclose(void);
-extern void HISsetup(void);
-extern void HISsync(void);
-
-extern bool ICDnewgroup();
-extern char * ICDreadactive();
-extern bool ICDchangegroup();
-extern void ICDclose();
-extern bool ICDrenumberactive();
-extern bool ICDrmgroup();
-extern void ICDsetup();
-extern void ICDwrite();
-extern void ICDwriteactive();
-
-extern void CCclose();
-extern void CCsetup();
-
-extern void LCclose();
-extern void LCsetup();
-
-extern char ** NGsplit();
-extern NEWSGROUP * NGfind();
-extern void NGclose();
-extern CHANNEL * NCcreate(int fd, bool MustAuthorize, bool IsLocal);
-extern void NGparsefile();
-extern bool NGrenumber();
-extern bool NGlowmark(NEWSGROUP *ngp, long lomark);
-
-extern void NCclearwip(CHANNEL *cp);
-extern void NCclose();
-extern void NCsetup();
-extern void NCwritereply(CHANNEL *cp, char *text);
-extern void NCwriteshutdown(CHANNEL *cp, char *text);
+extern bool FormatLong(char *p, unsigned long value, int width);
+extern bool NeedShell(char *p, const char **av, const char **end);
+extern char ** CommaSplit(char *text);
+extern char * MaxLength(const char *p, const char *q);
+extern pid_t Spawn(int niceval, int fd0, int fd1, int fd2,
+ char * const av[]);
+extern void CleanupAndExit(int x, const char *why);
+extern void FileGlue(char *p, const char *n1, char c, const char *n2);
+extern void JustCleanup(void);
+extern void ThrottleIOError(const char *when);
+extern void ThrottleNoMatchError(void);
+extern void ReopenLog(FILE *F);
+extern void xchown(char *p);
+
+extern bool ARTidok(const char *MessageID);
+extern bool ARTreadschema(void);
+extern const char * ARTreadarticle(char *files);
+extern char * ARTreadheader(char *files);
+extern const char * ARTpost(CHANNEL *cp);
+extern void ARTcancel(const ARTDATA *Data,
+ const char *MessageID, bool Trusted);
+extern void ARTclose(void);
+extern void ARTsetup(void);
+
+extern void BUFFset(BUFFER *bp, const char *p, const int length);
+extern void BUFFswap(BUFFER *b1, BUFFER *b2);
+extern void BUFFappend(BUFFER *bp, const char *p, const int len);
+extern void BUFFtrimcr(BUFFER *bp);
+
+extern bool CHANsleeping(CHANNEL *cp);
+extern CHANNEL * CHANcreate(int fd, CHANNELTYPE Type,
+ CHANNELSTATE State,
+ innd_callback_t Reader,
+ innd_callback_t WriteDone);
+extern CHANNEL * CHANiter(int *cp, CHANNELTYPE Type);
+extern CHANNEL * CHANfromdescriptor(int fd);
+extern char * CHANname(const CHANNEL *cp);
+extern int CHANreadtext(CHANNEL *cp);
+extern void CHANclose(CHANNEL *cp, const char *name);
+extern void CHANreadloop(void);
+extern void CHANsetup(int i);
+extern void CHANshutdown(void);
+extern void CHANtracing(CHANNEL *cp, bool Flag);
+extern void CHANsetActiveCnx(CHANNEL *cp);
+
+extern void RCHANadd(CHANNEL *cp);
+extern void RCHANremove(CHANNEL *cp);
+
+extern void SCHANadd(CHANNEL *cp, time_t Waketime, void *Event,
+ innd_callback_t Waker, void *Argument);
+extern void SCHANremove(CHANNEL *cp);
+extern void SCHANwakeup(void *Event);
+
+extern bool WCHANflush(CHANNEL *cp);
+extern void WCHANadd(CHANNEL *cp);
+extern void WCHANremove(CHANNEL *cp);
+extern void WCHANsetfrombuffer(CHANNEL *cp, BUFFER *bp);
+
+extern void CCcopyargv(char *av[]);
+extern const char * CCaddhist(char *av[]);
+extern const char * CCblock(OPERATINGMODE NewMode, char *reason);
+extern const char * CCcancel(char *av[]);
+extern const char * CCcheckfile(char *av[]);
+
+extern bool HIShavearticle(const HASH MessageID);
+extern bool HISwrite(const ARTDATA *Data, const HASH hash,
+ char *paths);
+extern bool HISremember(const HASH MessageID);
+extern TOKEN * HISfilesfor(const HASH MessageID);
+extern void HISclose(void);
+extern void HISsetup(void);
+extern void HISsync(void);
+
+extern bool ICDnewgroup(char *Name, char *Rest);
+extern char * ICDreadactive(char **endp);
+extern bool ICDchangegroup(NEWSGROUP *ngp, char *Rest);
+extern void ICDclose(void);
+extern bool ICDrenumberactive(void);
+extern bool ICDrmgroup(NEWSGROUP *ngp);
+extern void ICDsetup(bool StartSites);
+extern void ICDwrite(void);
+extern void ICDwriteactive(void);
+
+extern void CCclose(void);
+extern void CCsetup(void);
+
+extern void LCclose(void);
+extern void LCsetup(void);
+
+extern char ** NGsplit(char *p);
+extern NEWSGROUP * NGfind(const char *Name);
+extern void NGclose(void);
+extern CHANNEL * NCcreate(int fd, bool MustAuthorize, bool IsLocal);
+extern void NGparsefile(void);
+extern bool NGrenumber(NEWSGROUP *ngp);
+extern bool NGlowmark(NEWSGROUP *ngp, long lomark);
+
+extern void NCclearwip(CHANNEL *cp);
+extern void NCclose(void);
+extern void NCsetup(void);
+extern void NCwritereply(CHANNEL *cp, const char *text);
+extern void NCwriteshutdown(CHANNEL *cp, const char *text);
/* perl.c */
-extern char * PLartfilter(char *artBody, int lines);
-extern char * PLmidfilter(char *messageID);
-extern void PLmode(OPERATINGMODE Mode, OPERATINGMODE NewMode,
- char *reason);
-extern void PLxsinit();
-
-extern int PROCwatch();
-extern void PROCunwatch();
-/* extern void PROCclose(); */
-extern void PROCscan();
-extern void PROCsetup();
-
-extern int RClimit();
-extern bool RCnolimit();
-extern bool RCauthorized();
-extern int RCcanpost();
-extern char * RChostname();
-extern char * RClabelname(CHANNEL *cp);
-extern void RCclose();
-extern void RChandoff();
-extern void RCreadlist();
-extern void RCsetup();
-
-extern bool SITEfunnelpatch();
-extern bool SITEsetup();
-extern bool SITEwantsgroup();
-extern bool SITEpoisongroup();
-extern char ** SITEreadfile();
-extern SITE * SITEfind();
-extern SITE * SITEfindnext();
-extern const char * SITEparseone();
-extern void SITEchanclose();
-extern void SITEdrop();
-extern void SITEflush();
-extern void SITEflushall();
-extern void SITEforward();
-extern void SITEfree();
-extern void SITEinfo();
-extern void SITElinkall();
-extern void SITEparsefile();
-extern void SITEprocdied();
-extern void SITEsend();
-extern void SITEwrite();
+extern char * PLartfilter(char *artBody, int lines);
+extern char * PLmidfilter(char *messageID);
+extern void PLmode(OPERATINGMODE mode, OPERATINGMODE NewMode,
+ char *reason);
+extern void PLxsinit(void);
+
+extern int PROCwatch(pid_t pid, int site);
+extern void PROCunwatch(int process);
+/* extern void PROCclose(bool Quickly); */
+extern void PROCscan(void);
+extern void PROCsetup(int i);
+
+extern int RClimit(CHANNEL *cp);
+extern bool RCnolimit(CHANNEL *cp);
+extern bool RCauthorized(CHANNEL *cp, char *pass);
+extern int RCcanpost(CHANNEL *cp, char *group);
+extern char * RChostname(const CHANNEL *cp);
+extern char * RClabelname(CHANNEL *cp);
+extern void RCclose(void);
+extern void RChandoff(int fd, HANDOFF h);
+extern void RCreadlist(void);
+extern void RCsetup(int i);
+
+extern bool SITEfunnelpatch(void);
+extern bool SITEsetup(SITE *sp);
+extern bool SITEwantsgroup(SITE *sp, char *name);
+extern bool SITEpoisongroup(SITE *sp, char *name);
+extern char ** SITEreadfile(const bool ReadOnly);
+extern SITE * SITEfind(const char *p);
+extern SITE * SITEfindnext(const char *p, SITE *sp);
+extern const char * SITEparseone(char *Entry, SITE *sp,
+ char *subbed, char *poison);
+extern void SITEchanclose(CHANNEL *cp);
+extern void SITEdrop(SITE *sp);
+extern void SITEflush(SITE *sp, const bool Restart);
+extern void SITEflushall(const bool Restart);
+extern void SITEforward(SITE *sp, const char *text);
+extern void SITEfree(SITE *sp);
+extern void SITEinfo(BUFFER *bp, SITE *sp, const bool Verbose);
+extern void SITEparsefile(bool StartSite);
+extern void SITEprocdied(SITE *sp, int process, PROCESS *pp);
+extern void SITEsend(SITE *sp, ARTDATA *Data);
+extern void SITEwrite(SITE *sp, const char *text);
-extern void STATUSinit(void);
-extern void STATUSmainloophook(void);
+extern void STATUSinit(void);
+extern void STATUSmainloophook(void);
/* timer.c */
-extern void TMRinit(void);
-extern int TMRmainloophook(void);
-extern void TMRstart(enum timer timer);
-extern void TMRstop(enum timer timer);
-
-extern void WIPsetup(void);
-extern WIP * WIPnew(const char *messageid, CHANNEL *cp);
-extern void WIPprecomfree(CHANNEL *cp);
-extern void WIPfree(WIP *wp);
-extern bool WIPinprogress(const char *msgid, CHANNEL *cp,
- bool Add);
-extern WIP * WIPbyid(const char *mesageid);
-extern WIP * WIPbyhash(const HASH hash);
+extern void TMRinit(void);
+extern int TMRmainloophook(void);
+extern void TMRstart(enum timer timer);
+extern void TMRstop(enum timer timer);
+
+extern void WIPsetup(void);
+extern WIP * WIPnew(const char *messageid, CHANNEL *cp);
+extern void WIPprecomfree(CHANNEL *cp);
+extern void WIPfree(WIP *wp);
+extern bool WIPinprogress(const char *msgid, CHANNEL *cp,
+ bool Add);
+extern WIP * WIPbyid(const char *mesageid);
+extern WIP * WIPbyhash(const HASH hash);
/*
** TCL globals and functions
*/
#if DO_TCL
-extern Tcl_Interp * TCLInterpreter;
-extern bool TCLFilterActive;
-extern BUFFER * TCLCurrArticle;
-extern ARTDATA * TCLCurrData;
-
-extern void TCLfilter();
-extern void TCLreadfilter();
-extern void TCLsetup();
-extern void TCLclose();
+extern Tcl_Interp * TCLInterpreter;
+extern bool TCLFilterActive;
+extern BUFFER * TCLCurrArticle;
+extern ARTDATA * TCLCurrData;
+
+extern void TCLfilter(bool value);
+extern void TCLreadfilter(void);
+extern void TCLsetup(void);
+extern void TCLclose(void);
#endif /* DO_TCL */
/*
** Python globals and functions
*/
#if DO_PYTHON
-extern bool PythonFilterActive;
+extern bool PythonFilterActive;
-extern const char * PYcontrol(char **av);
-extern int PYreadfilter(void);
-extern char * PYartfilter(char *artBody, long artLen, int lines);
-extern char * PYmidfilter(char *messageID, int msglen);
-extern void PYmode(OPERATINGMODE Mode, OPERATINGMODE newmode,
- char *reason);
-extern void PYsetup(void);
-extern void PYclose(void);
+extern const char * PYcontrol(char **av);
+extern int PYreadfilter(void);
+extern char * PYartfilter(char *artBody, long artLen, int lines);
+extern char * PYmidfilter(char *messageID, int msglen);
+extern void PYmode(OPERATINGMODE Mode, OPERATINGMODE newmode,
+ char *reason);
+extern void PYsetup(void);
+extern void PYclose(void);
#endif /* DO_PYTHON */
END_DECLS
diff -ur inn-CURRENT-20001030/innd/lc.c inn/innd/lc.c
--- inn-CURRENT-20001030/innd/lc.c Mon Oct 30 13:00:52 2000
+++ inn/innd/lc.c Fri Oct 27 15:48:16 2000
@@ -24,14 +24,13 @@
** Read function. Accept the connection and create an NNTP channel.
*/
static void
-LCreader(cp)
- CHANNEL *cp;
+LCreader(CHANNEL *cp)
{
int fd;
CHANNEL *new;
if (cp != LCchan) {
- syslog(L_ERROR, "%s internal LCreader wrong channel 0x%x not 0x%x",
+ syslog(L_ERROR, "%s internal LCreader wrong channel 0x%p not 0x%p",
LogName, cp, LCchan);
return;
}
@@ -52,8 +51,9 @@
** Write-done function. Shouldn't happen.
*/
static void
-LCwritedone()
+LCwritedone(CHANNEL *unused)
{
+ unused = unused; /* ARGSUSED */
syslog(L_ERROR, "%s internal LCwritedone", LogName);
}
@@ -64,7 +64,7 @@
** Create the channel.
*/
void
-LCsetup()
+LCsetup(void)
{
#if defined(HAVE_UNIX_DOMAIN_SOCKETS)
int i;
@@ -107,7 +107,7 @@
** Cleanly shut down the channel.
*/
void
-LCclose()
+LCclose(void)
{
#if defined(HAVE_UNIX_DOMAIN_SOCKETS)
CHANclose(LCchan, CHANname(LCchan));
diff -ur inn-CURRENT-20001030/innd/nc.c inn/innd/nc.c
--- inn-CURRENT-20001030/innd/nc.c Mon Oct 30 13:00:53 2000
+++ inn/innd/nc.c Mon Oct 30 15:37:18 2000
@@ -28,52 +28,55 @@
int Size;
} NCDISPATCH;
-static void NCauthinfo();
-static void NChead();
-static void NChelp();
-static void NCihave();
-static void NClist();
-static void NCmode();
-static void NCquit();
-static void NCstat();
-static void NCxpath();
-static void NC_unimp();
+static void NCauthinfo(CHANNEL *cp);
+static void NChead(CHANNEL *cp);
+static void NChelp(CHANNEL *cp);
+static void NCihave(CHANNEL *cp);
+static void NClist(CHANNEL *cp);
+static void NCmode(CHANNEL *cp);
+static void NCquit(CHANNEL *cp);
+static void NCstat(CHANNEL *cp);
+static void NCxpath(CHANNEL *cp);
+static void NC_unimp(CHANNEL *cp);
/* new modules for streaming */
-static void NCxbatch();
-static void NCcheck();
-static void NCtakethis();
-static void NCwritedone();
-static void NCcancel();
+static void NCxbatch(CHANNEL *cp);
+static void NCcheck(CHANNEL *cp);
+static void NCtakethis(CHANNEL *cp);
+static void NCwritedone(CHANNEL *cp);
+static void NCcancel(CHANNEL *cp);
static int NCcount; /* Number of open connections */
+#define NCDISPATCHINIT(name, func) \
+ {name, func, sizeof(name) - 1}
static NCDISPATCH NCcommands[] = {
#if 0
- { "article", NCarticle },
+ NCDISPATCHINIT("article", NCarticle),
#else
- { "article", NC_unimp },
+ NCDISPATCHINIT("article", NC_unimp),
#endif /* 0 */
- { "authinfo", NCauthinfo },
- { "help", NChelp },
- { "ihave", NCihave },
- { "check", NCcheck },
- { "takethis", NCtakethis },
- { "list", NClist },
- { "mode", NCmode },
- { "quit", NCquit },
- { "head", NChead },
- { "stat", NCstat },
- { "body", NC_unimp },
- { "group", NC_unimp },
- { "last", NC_unimp },
- { "newgroups", NC_unimp },
- { "newnews", NC_unimp },
- { "next", NC_unimp },
- { "post", NC_unimp },
- { "slave", NC_unimp },
- { "xbatch", NCxbatch },
- { "xhdr", NC_unimp },
- { "xpath", NCxpath },
+ NCDISPATCHINIT("authinfo", NCauthinfo),
+ NCDISPATCHINIT("help", NChelp),
+ NCDISPATCHINIT("ihave", NCihave),
+ NCDISPATCHINIT("check", NCcheck),
+ NCDISPATCHINIT("takethis", NCtakethis),
+ NCDISPATCHINIT("list", NClist),
+ NCDISPATCHINIT("mode", NCmode),
+ NCDISPATCHINIT("quit", NCquit),
+ NCDISPATCHINIT("head", NChead),
+ NCDISPATCHINIT("stat", NCstat),
+ NCDISPATCHINIT("body", NC_unimp),
+ NCDISPATCHINIT("group", NC_unimp),
+ NCDISPATCHINIT("last", NC_unimp),
+ NCDISPATCHINIT("newgroups", NC_unimp),
+ NCDISPATCHINIT("newnews", NC_unimp),
+ NCDISPATCHINIT("next", NC_unimp),
+ NCDISPATCHINIT("post", NC_unimp),
+ NCDISPATCHINIT("slave", NC_unimp),
+ NCDISPATCHINIT("xbatch", NCxbatch),
+ NCDISPATCHINIT("xhdr", NC_unimp),
+ NCDISPATCHINIT("xpath", NCxpath)
};
+#undef NCDISPATCHINIT
static char *NCquietlist[] = {
INND_QUIET_BADLIST
};
@@ -84,7 +87,9 @@
/*
** Clear the WIP entry for the given channel
*/
-void NCclearwip(CHANNEL *cp) {
+void
+NCclearwip(CHANNEL *cp)
+{
WIPfree(WIPbyhash(cp->CurrentMessageIDHash));
HashClear(&cp->CurrentMessageIDHash);
cp->ArtBeg = 0;
@@ -104,7 +109,7 @@
** *before* NCwritereply is called.
*/
void
-NCwritereply(CHANNEL *cp, char *text)
+NCwritereply(CHANNEL *cp, const char *text)
{
BUFFER *bp;
int i;
@@ -142,7 +147,7 @@
** Tell the NNTP channel to go away.
*/
void
-NCwriteshutdown(CHANNEL *cp, char *text)
+NCwriteshutdown(CHANNEL *cp, const char *text)
{
cp->State = CSwritegoodbye;
RCHANremove(cp); /* we're not going to read anything more */
@@ -199,7 +204,6 @@
if (atoi(response) == NNTP_TOOKIT_VAL) {
cp->Received++;
if (cp->Sendid.Size > 3) { /* We be streaming */
- char buff[4];
cp->Takethis_Ok++;
(void)sprintf(buff, "%d", NNTP_OK_RECID_VAL);
cp->Sendid.Data[0] = buff[0];
@@ -226,7 +230,7 @@
break;
}
cp->State = CSgetcmd;
- NCwritereply(cp, (char *)response);
+ NCwritereply(cp, response);
break;
case OMthrottled:
@@ -274,7 +278,8 @@
/*
** The "head" command.
*/
-static void NChead(CHANNEL *cp)
+static void
+NChead(CHANNEL *cp)
{
char *p;
TOKEN *token;
@@ -310,7 +315,8 @@
/*
** The "stat" command.
*/
-static void NCstat(CHANNEL *cp)
+static void
+NCstat(CHANNEL *cp)
{
char *p;
TOKEN *token;
@@ -537,17 +543,17 @@
continue;
if (cp->XBatchSize) {
- syslog(L_FATAL, "NCxbatch(): oops, cp->XBatchSize already set to %ld",
+ syslog(L_FATAL, "NCxbatch(): oops, cp->XBatchSize already set to %d",
cp->XBatchSize);
}
cp->XBatchSize = atoi(p);
if (Tracing || cp->Tracing)
- syslog(L_TRACE, "%s will read batch of size %ld",
+ syslog(L_TRACE, "%s will read batch of size %d",
CHANname(cp), cp->XBatchSize);
if (cp->XBatchSize <= 0 || ((innconf->maxartsize != 0) && (innconf->maxartsize < cp->XBatchSize))) {
- syslog(L_NOTICE, "%s got bad xbatch size %ld",
+ syslog(L_NOTICE, "%s got bad xbatch size %d",
CHANname(cp), cp->XBatchSize);
NCwritereply(cp, NNTP_XBATCH_BADSIZE);
return;
@@ -672,7 +678,8 @@
/*
** The "quit" command. Acknowledge, and set the state to closing down.
*/
-static void NCquit(CHANNEL *cp)
+static void
+NCquit(CHANNEL *cp)
{
cp->State = CSwritegoodbye;
NCwritereply(cp, NNTP_GOODBYE_ACK);
@@ -714,7 +721,8 @@
** Check whatever data is available on the channel. If we got the
** full amount (i.e., the command or the whole article) process it.
*/
-static void NCproc(CHANNEL *cp)
+static void
+NCproc(CHANNEL *cp)
{
char *p;
NCDISPATCH *dp;
@@ -861,7 +869,6 @@
cp->Rejected++;
cp->State = CSgetcmd;
if (cp->Sendid.Size > 3) { /* We be streaming */
- char buff[4];
cp->Takethis_Err++;
(void)sprintf(buff, "%d", NNTP_ERR_FAILID_VAL);
cp->Sendid.Data[0] = buff[0];
@@ -951,16 +958,17 @@
cp->Argument = NULL;
}
i = cp->LargeArtSize + bp->Used;
- syslog(L_NOTICE, "%s internal rejecting huge article (%d > %d)",
+ syslog(L_NOTICE, "%s internal rejecting huge article (%d > %ld)",
CHANname(cp), i, innconf->maxartsize);
cp->LargeArtSize = 0;
- (void)sprintf(buff, "%d Article exceeds local limit of %ld bytes",
- NNTP_REJECTIT_VAL, innconf->maxartsize);
cp->State = CSgetcmd;
if (cp->Sendid.Size)
NCwritereply(cp, cp->Sendid.Data);
- else
+ else {
+ (void)sprintf(buff, "%d Article exceeds local limit of %ld bytes",
+ NNTP_REJECTIT_VAL, innconf->maxartsize);
NCwritereply(cp, buff);
+ }
cp->Rejected++;
/* Write a local cancel entry so nobody else gives it to us. */
@@ -1059,7 +1067,7 @@
* directory with an unique timestamp, and start rnews on it.
*/
if (Tracing || cp->Tracing)
- syslog(L_TRACE, "%s CSgetxbatch: now %ld of %ld bytes",
+ syslog(L_TRACE, "%s CSgetxbatch: now %d of %d bytes",
CHANname(cp), bp->Used, cp->XBatchSize);
if (bp->Used < cp->XBatchSize) {
@@ -1070,7 +1078,7 @@
/* now do something with the batch */
{
- char buff[SMBUF], buff2[SMBUF];
+ char buff2[SMBUF];
int fd, oerrno, failed;
long now;
@@ -1126,7 +1134,7 @@
} else
cp->Rejected++;
}
- syslog(L_NOTICE, "%s accepted batch size %ld",
+ syslog(L_NOTICE, "%s accepted batch size %d",
CHANname(cp), cp->XBatchSize);
cp->State = CSgetcmd;
@@ -1213,9 +1221,8 @@
** Set up the NNTP channel state.
*/
void
-NCsetup(int i)
+NCsetup(void)
{
- NCDISPATCH *dp;
char *p;
char buff[SMBUF];
@@ -1227,10 +1234,6 @@
(void)sprintf(buff, "%d %s InterNetNews server %s ready",
NNTP_POSTOK_VAL, p, inn_version_string);
NCgreeting = COPY(buff);
-
- /* Get the length of every command. */
- for (dp = NCcommands; dp < ENDOF(NCcommands); dp++)
- dp->Size = strlen(dp->Name);
}
@@ -1409,7 +1412,8 @@
** The "takethis" command. Article follows.
** Remember <id> for later ack.
*/
-static void NCtakethis(CHANNEL *cp)
+static void
+NCtakethis(CHANNEL *cp)
{
char *p;
int msglen;
diff -ur inn-CURRENT-20001030/innd/newsfeeds.c inn/innd/newsfeeds.c
--- inn-CURRENT-20001030/innd/newsfeeds.c Mon Oct 30 13:00:53 2000
+++ inn/innd/newsfeeds.c Mon Oct 30 15:10:36 2000
@@ -18,8 +18,7 @@
** Return a copy of an array of strings.
*/
static char **
-SITEcopystrings(av)
- char **av;
+SITEcopystrings(char **av)
{
register char **new;
register char **pp;
@@ -38,8 +37,7 @@
** Read the newsfeeds file, return a string array of entries.
*/
char **
-SITEreadfile(ReadOnly)
- bool ReadOnly;
+SITEreadfile(const bool ReadOnly)
{
static char **old_strings;
static time_t old_mtime;
@@ -113,11 +111,7 @@
** Modify "subbed" according to the patterns in "patlist."
*/
static void
-SITEsetlist(patlist, subbed, poison, poisonEntry)
- char **patlist;
- char *subbed;
- char *poison;
- bool *poisonEntry;
+SITEsetlist(char **patlist, char *subbed, char *poison, bool *poisonEntry)
{
register char *pat;
register char *p;
@@ -167,8 +161,7 @@
** the text is expected to be either relatively short or "slash-dense."
*/
char **
-SlashSplit(text)
- char *text;
+SlashSplit(char *text)
{
register int i;
register char *p;
@@ -545,7 +538,7 @@
** Patch up the funnel references.
*/
bool
-SITEfunnelpatch()
+SITEfunnelpatch(void)
{
register int i;
register int length;
@@ -601,8 +594,7 @@
** Read the entries in the newsfeeds file, and parse them one at a time.
*/
void
-SITEparsefile(StartSite)
- bool StartSite;
+SITEparsefile(bool StartSite)
{
int i;
char * p;
diff -ur inn-CURRENT-20001030/innd/ng.c inn/innd/ng.c
--- inn-CURRENT-20001030/innd/ng.c Mon Oct 30 13:00:53 2000
+++ inn/innd/ng.c Mon Oct 30 15:15:22 2000
@@ -56,12 +56,8 @@
static int
NGcompare(const void *p1, const void *p2)
{
- NEWSGROUP **ng1;
- NEWSGROUP **ng2;
-
- ng1 = (NEWSGROUP **) p1;
- ng2 = (NEWSGROUP **) p2;
- return ng1[0]->Last - ng2[0]->Last;
+ return ((const NEWSGROUP **)p1)[0]->Last -
+ ((const NEWSGROUP **)p2)[0]->Last;
}
@@ -69,8 +65,7 @@
** Convert a newsgroup name into a directory name.
*/
static void
-NGdirname(p)
- register char *p;
+NGdirname(register char *p)
{
for ( ; *p; p++)
if (*p == '.')
@@ -83,7 +78,8 @@
** not to write NUL's into the in-core copy, since we're either mmap(2)'d,
** or we want to just blat it out to disk later.
*/
-static bool NGparseentry(NEWSGROUP *ngp, char *p, char *end)
+static bool
+NGparseentry(NEWSGROUP *ngp, const char *p, char *end)
{
register char *q;
register unsigned int j;
@@ -152,7 +148,7 @@
** Parse the active file, building the initial Groups global.
*/
void
-NGparsefile()
+NGparsefile(void)
{
register char *p;
register char *q;
@@ -249,7 +245,7 @@
** Free allocated memory
*/
void
-NGclose()
+NGclose(void)
{
register int i;
register NEWSGROUP *ngp;
@@ -281,10 +277,9 @@
** Hash a newsgroup and see if we get it.
*/
NEWSGROUP *
-NGfind(Name)
- char *Name;
+NGfind(const char *Name)
{
- register char *p;
+ register const char *p;
register int i;
register unsigned int j;
register NEWSGROUP **ngp;
@@ -350,7 +345,8 @@
static char NORENUMBER[] = "%s cant renumber %s %s too wide";
static char RENUMBER[] = "%s renumber %s %s from %ld to %ld";
-bool NGrenumber(NEWSGROUP *ngp)
+bool
+NGrenumber(NEWSGROUP *ngp)
{
int low, high, count,flag;
char *f2;
@@ -417,7 +413,8 @@
* Like NGrenumber(), but we don't scan the spool,
* and the himark is ignored.
*/
-bool NGlowmark(NEWSGROUP *ngp, long lomark)
+bool
+NGlowmark(NEWSGROUP *ngp, long lomark)
{
long l;
char *f2, *f3, *f4;
diff -ur inn-CURRENT-20001030/innd/perl.c inn/innd/perl.c
--- inn-CURRENT-20001030/innd/perl.c Mon Oct 30 13:00:53 2000
+++ inn/innd/perl.c Mon Oct 30 15:19:52 2000
@@ -472,7 +472,7 @@
** Initialize the XS callbacks defined in this file.
*/
void
-PLxsinit()
+PLxsinit(void)
{
newXS("INN::addhist", XS_INN_addhist, "perl.c");
newXS("INN::article", XS_INN_article, "perl.c");
diff -ur inn-CURRENT-20001030/innd/proc.c inn/innd/proc.c
--- inn-CURRENT-20001030/innd/proc.c Mon Oct 30 13:00:53 2000
+++ inn/innd/proc.c Fri Oct 27 15:50:27 2000
@@ -13,14 +13,14 @@
static PROCESS *PROCtable;
static int PROCtablesize;
-static PROCESS PROCnull = { PSfree };
+static PROCESS PROCnull = { PSfree, 0, 0, 0, 0, 0 };
/*
** Collect dead processes.
*/
static void
-PROCreap()
+PROCreap(void)
{
int status;
PROCESS *pp;
@@ -58,6 +58,8 @@
#ifndef HAVE_SIGACTION
xsignal(s, PROCcatchsignal);
+#else
+ s = s; /* ARGSUSED */
#endif
}
@@ -66,7 +68,7 @@
** Synchronous version that notifies a site when its process went away.
*/
void
-PROCscan()
+PROCscan(void)
{
register PROCESS *pp;
register int i;
@@ -163,8 +165,7 @@
** Setup.
*/
void
-PROCsetup(i)
- register int i;
+PROCsetup(register int i)
{
register PROCESS *pp;
diff -ur inn-CURRENT-20001030/innd/rc.c inn/innd/rc.c
--- inn-CURRENT-20001030/innd/rc.c Mon Oct 30 13:00:53 2000
+++ inn/innd/rc.c Mon Oct 30 15:45:54 2000
@@ -187,7 +187,8 @@
* and removed here)
*/
-char **RCCommaSplit(char *text)
+char **
+RCCommaSplit(char *text)
{
register int i;
register char *p;
@@ -398,7 +399,7 @@
/* Call NNRP; don't send back a QUIT message if Spawn fails since
* that's a major error we want to find out about quickly. */
- (void)Spawn(innconf->nicekids, fd, fd, fd, argv);
+ (void)Spawn(innconf->nicekids, fd, fd, fd, (char * const *)argv);
}
@@ -417,7 +418,7 @@
CHANNEL *new;
char *name;
long reject_val = 0;
- char *reject_message;
+ const char *reject_message;
int count;
int found;
time_t now;
@@ -425,7 +426,7 @@
char buff[SMBUF];
if (cp != RCchan) {
- syslog(L_ERROR, "%s internal RCreader wrong channel 0x%x not 0x%x",
+ syslog(L_ERROR, "%s internal RCreader wrong channel 0x%p not 0x%p",
LogName, cp, RCchan);
return;
}
@@ -615,8 +616,9 @@
** Write-done function. Shouldn't happen.
*/
static void
-RCwritedone()
+RCwritedone(CHANNEL *unused)
{
+ unused = unused; /* ARGSUSED */
syslog(L_ERROR, "%s internal RCwritedone", LogName);
}
@@ -632,7 +634,8 @@
/*
* Read something (a word or a double quoted string) from a file.
*/
-char *RCreaddata (int *num, FILE *F, bool *toolong)
+char *
+RCreaddata(int *num, FILE *F, bool *toolong)
{
register char *p;
register char *s;
@@ -712,7 +715,8 @@
/*
* Add all data into RCpeerlistfile.
*/
-void RCadddata(REMOTEHOST_DATA **d, int *count, int Key, int Type, char* Value)
+void
+RCadddata(REMOTEHOST_DATA **d, int *count, int Key, int Type, char* Value)
{
(*d)[*count].key = Key;
(*d)[*count].type = Type;
@@ -815,6 +819,7 @@
linecount = 0;
infocount = 0;
groupcount = 0; /* no group defined yet */
+ groups = 0;
peer_params.Label = NULL;
default_params.Streaming = TRUE;
default_params.Skip = FALSE;
@@ -999,11 +1004,11 @@
continue;
}
if (i == 1) {
- char **r;
+ char **rr;
int t = 0;
/* Strange DNS ? try this.. */
- for (r = hp->h_aliases; *r != 0; r++) {
- if (!inet_aton(*r, &addr))
+ for (rr = hp->h_aliases; *rr != 0; rr++) {
+ if (!inet_aton(*rr, &addr))
continue;
(*count)++;
/* Grow the array */
@@ -1592,7 +1597,7 @@
}
void
-RCreadlist()
+RCreadlist(void)
{
static char *INNDHOSTS = NULL;
@@ -1607,8 +1612,7 @@
** Find the name of a remote host we've connected to.
*/
char *
-RChostname(cp)
- register CHANNEL *cp;
+RChostname(register const CHANNEL *cp)
{
static char buff[SMBUF];
register REMOTEHOST *rp;
@@ -1639,7 +1643,8 @@
/*
** Is the remote site allowed to post to this group?
*/
-int RCcanpost(CHANNEL *cp, char *group)
+int
+RCcanpost(CHANNEL *cp, char *group)
{
REMOTEHOST *rp;
char match;
@@ -1674,8 +1679,7 @@
** Create the channel.
*/
void
-RCsetup(i)
- register int i;
+RCsetup(register int i)
{
struct sockaddr_in server;
#if defined(SO_REUSEADDR)
@@ -1730,7 +1734,7 @@
** Cleanly shut down the channel.
*/
void
-RCclose()
+RCclose(void)
{
register REMOTEHOST *rp;
register int i;
diff -ur inn-CURRENT-20001030/innd/site.c inn/innd/site.c
--- inn-CURRENT-20001030/innd/site.c Mon Oct 30 13:00:54 2000
+++ inn/innd/site.c Mon Oct 30 15:38:21 2000
@@ -20,9 +20,10 @@
/*
** Called when input is ready to read. Shouldn't happen.
*/
-/* ARGSUSED0 */
-static void SITEreader(CHANNEL *cp)
+static void
+SITEreader(CHANNEL *unused)
{
+ unused = unused; /* ARGSUSED */
syslog(L_ERROR, "%s internal SITEreader", LogName);
}
@@ -30,16 +31,18 @@
/*
** Called when write is done. No-op.
*/
-/* ARGSUSED0 */
-static void SITEwritedone(CHANNEL *cp)
+static void
+SITEwritedone(CHANNEL *unused)
{
+ unused = unused; /* ARGSUSED */
}
/*
** Make a site start spooling.
*/
-bool SITEspool(SITE *sp, CHANNEL *cp)
+bool
+SITEspool(SITE *sp, CHANNEL *cp)
{
int i;
char buff[SPOOLNAMEBUFF];
@@ -88,7 +91,8 @@
** Delete a site from the file writing list. Can be called even if
** site is not on the list.
*/
-static void SITEunlink(SITE *sp)
+static void
+SITEunlink(SITE *sp)
{
if (sp->Next != NOSITE || sp->Prev != NOSITE
|| (SITEhead != NOSITE && sp == &Sites[SITEhead]))
@@ -111,7 +115,8 @@
/*
** Find the oldest "file feed" site and buffer it.
*/
-static void SITEbufferoldest(void)
+static void
+SITEbufferoldest(void)
{
SITE *sp;
BUFFER *bp;
@@ -171,7 +176,8 @@
/*
* * Bilge Site's Channel out buffer.
*/
-static bool SITECHANbilge(SITE *sp)
+static bool
+SITECHANbilge(SITE *sp)
{
int fd;
int i;
@@ -217,7 +223,8 @@
** Check if we need to write out the site's buffer. If we're buffered
** or the feed is backed up, this gets a bit complicated.
*/
-static void SITEflushcheck(SITE *sp, BUFFER *bp)
+static void
+SITEflushcheck(SITE *sp, BUFFER *bp)
{
int i;
CHANNEL *cp;
@@ -291,7 +298,8 @@
/*
** Send a control line to an exploder.
*/
-void SITEwrite(SITE *sp, const char *text)
+void
+SITEwrite(SITE *sp, const char *text)
{
static char PREFIX[] = { EXP_CONTROL, '\0' };
BUFFER *bp;
@@ -315,7 +323,8 @@
/*
** Send the desired data about an article down a channel.
*/
-static void SITEwritefromflags(SITE *sp, ARTDATA *Data)
+static void
+SITEwritefromflags(SITE *sp, ARTDATA *Data)
{
static char ITEMSEP[] = " ";
static char NL[] = "\n";
@@ -468,13 +477,14 @@
/*
** Send one article to a site.
*/
-void SITEsend(SITE *sp, ARTDATA *Data)
+void
+SITEsend(SITE *sp, ARTDATA *Data)
{
int i;
char *p;
char *temp;
char buff[BUFSIZ];
- const char * argv[MAX_BUILTIN_ARGV];
+ char * argv[MAX_BUILTIN_ARGV];
int fd;
switch (sp->Type) {
@@ -513,7 +523,7 @@
else
(void)sprintf(buff, sp->Param, Data->Name);
- if (NeedShell(buff, argv, ENDOF(argv))) {
+ if (NeedShell(buff, (const char **)argv, (const char **)ENDOF(argv))) {
argv[0] = SITEshell;
argv[1] = "-c";
argv[2] = buff;
@@ -547,7 +557,8 @@
** The channel was sleeping because we had to spool our output to
** a file. Flush and restart.
*/
-static void SITEspoolwake(CHANNEL *cp)
+static void
+SITEspoolwake(CHANNEL *cp)
{
SITE *sp;
int *ip;
@@ -574,7 +585,7 @@
SITEstartprocess(SITE *sp)
{
pid_t i;
- const char *argv[MAX_BUILTIN_ARGV];
+ char *argv[MAX_BUILTIN_ARGV];
char *process;
int *ip;
int pan[2];
@@ -596,7 +607,7 @@
/* Set up the argument vector. */
process = COPY(sp->Param);
- if (NeedShell(process, argv, ENDOF(argv))) {
+ if (NeedShell(process, (const char **)argv, (const char **)ENDOF(argv))) {
argv[0] = SITEshell;
argv[1] = "-c";
argv[2] = process;
@@ -604,7 +615,8 @@
}
/* Fork a child. */
- i = Spawn(sp->Nice, pan[PIPE_READ], (int)fileno(Errlog), (int)fileno(Errlog), argv);
+ i = Spawn(sp->Nice, pan[PIPE_READ], (int)fileno(Errlog),
+ (int)fileno(Errlog), argv);
if (i > 0) {
sp->pid = i;
sp->Spooling = FALSE;
@@ -638,7 +650,8 @@
/*
** Set up a site for internal buffering.
*/
-static void SITEbuffer(SITE *sp)
+static void
+SITEbuffer(SITE *sp)
{
BUFFER *bp;
@@ -663,7 +676,8 @@
/*
** Link a site at the head of the "currently writing to a file" list
*/
-static void SITEmovetohead(SITE *sp)
+static void
+SITEmovetohead(SITE *sp)
{
if ((SITEhead == NOSITE) && ((sp->Next != NOSITE) || (sp->Prev != NOSITE)))
SITEunlink(sp);
@@ -683,7 +697,8 @@
/*
** Set up a site's feed. This means opening a file or channel if needed.
*/
-bool SITEsetup(SITE *sp)
+bool
+SITEsetup(SITE *sp)
{
int fd;
int oerrno;
@@ -740,7 +755,8 @@
/*
** A site's channel process died; restart it.
*/
-void SITEprocdied(SITE *sp, int process, PROCESS *pp)
+void
+SITEprocdied(SITE *sp, int process, PROCESS *pp)
{
syslog(pp->Status ? L_ERROR : L_NOTICE, "%s exit %d elapsed %ld pid %ld",
sp->Name ? sp->Name : "?", pp->Status,
@@ -762,7 +778,8 @@
/*
** A channel is about to be closed; see if any site cares.
*/
-void SITEchanclose(CHANNEL *cp)
+void
+SITEchanclose(CHANNEL *cp)
{
int i;
SITE *sp;
@@ -791,7 +808,8 @@
/*
** Flush any pending data waiting to be sent.
*/
-void SITEflush(SITE *sp, bool Restart)
+void
+SITEflush(SITE *sp, const bool Restart)
{
CHANNEL *cp;
BUFFER *out;
@@ -887,7 +905,8 @@
/*
** Flush all sites.
*/
-void SITEflushall(bool Restart)
+void
+SITEflushall(const bool Restart)
{
int i;
SITE *sp;
@@ -902,7 +921,8 @@
** Run down the site's pattern list and see if it wants the specified
** newsgroup.
*/
-bool SITEwantsgroup(SITE *sp, char *name)
+bool
+SITEwantsgroup(SITE *sp, char *name)
{
bool match;
bool subvalue;
@@ -934,7 +954,8 @@
** Run down the site's pattern list and see if specified newsgroup is
** considered poison.
*/
-bool SITEpoisongroup(SITE *sp, char *name)
+bool
+SITEpoisongroup(SITE *sp, char *name)
{
bool match;
bool poisonvalue;
@@ -965,7 +986,8 @@
/*
** Find a site.
*/
-SITE *SITEfind(char *p)
+SITE *
+SITEfind(const char *p)
{
int i;
SITE *sp;
@@ -980,7 +1002,8 @@
/*
** Find the next site that matches this site.
*/
-SITE *SITEfindnext(char *p, SITE *sp)
+SITE *
+SITEfindnext(const char *p, SITE *sp)
{
SITE *end;
@@ -994,7 +1017,8 @@
/*
** Close a site down.
*/
-void SITEfree(SITE *sp)
+void
+SITEfree(SITE *sp)
{
SITE *s;
int new;
@@ -1073,7 +1097,8 @@
** If a site is an exploder or funnels into one, forward a command
** to it.
*/
-void SITEforward(SITE *sp, char *text)
+void
+SITEforward(SITE *sp, const char *text)
{
SITE *fsp;
char *p;
@@ -1099,7 +1124,8 @@
/*
** Drop a site.
*/
-void SITEdrop(SITE *sp)
+void
+SITEdrop(SITE *sp)
{
SITEforward(sp, "drop");
SITEflush(sp, FALSE);
@@ -1110,12 +1136,13 @@
/*
** Append info about the current state of the site to the buffer
*/
-void SITEinfo(BUFFER *bp, SITE *sp, bool Verbose)
+void
+SITEinfo(BUFFER *bp, SITE *sp, const bool Verbose)
{
static char FREESITE[] = "<<No name>>\n\n";
char *p;
CHANNEL *cp;
- char *sep;
+ const char *sep;
char buff[BUFSIZ];
if (sp->Name == NULL) {
@@ -1142,13 +1169,13 @@
case FTfile:
p += strlen(strcpy(p, "file"));
if (sp->Buffered) {
- (void)sprintf(p, " buffered(%ld)", sp->Buffer.Left);
+ (void)sprintf(p, " buffered(%d)", sp->Buffer.Left);
p += strlen(p);
}
else if ((cp = sp->Channel) == NULL)
p += strlen(strcpy(p, " no channel?"));
else {
- (void)sprintf(p, " open fd=%d, in mem %ld", cp->fd, cp->Out.Left);
+ (void)sprintf(p, " open fd=%d, in mem %d", cp->fd, cp->Out.Left);
p += strlen(p);
}
break;
@@ -1167,7 +1194,7 @@
if ((cp = sp->Channel) == NULL)
p += strlen(strcpy(p, " no channel?"));
else {
- (void)sprintf(p, " fd=%d, in mem %ld", cp->fd, cp->Out.Left);
+ (void)sprintf(p, " fd=%d, in mem %d", cp->fd, cp->Out.Left);
p += strlen(p);
}
break;
diff -ur inn-CURRENT-20001030/innd/status.c inn/innd/status.c
--- inn-CURRENT-20001030/innd/status.c Mon Oct 30 13:00:54 2000
+++ inn/innd/status.c Mon Oct 30 15:45:11 2000
@@ -15,43 +15,44 @@
#endif
typedef struct _STATUS {
- char name[SMBUF];
- char ip_addr[15];
- bool can_stream;
- unsigned short activeCxn;
- unsigned short sleepingCxns;
- unsigned long seconds;
- unsigned long accepted;
- unsigned long refused;
- unsigned long rejected;
- unsigned long Duplicate;
- unsigned long Unwanted_u;
- unsigned long Unwanted_d;
- unsigned long Unwanted_g;
- unsigned long Unwanted_s;
- unsigned long Unwanted_f;
- float Size;
- float DuplicateSize;
- unsigned long Check;
- unsigned long Check_send;
- unsigned long Check_deferred;
- unsigned long Check_got;
- unsigned long Check_cybercan;
- unsigned long Takethis;
- unsigned long Takethis_Ok;
- unsigned long Takethis_Err;
- unsigned long Ihave;
- unsigned long Ihave_Duplicate;
- unsigned long Ihave_Deferred;
- unsigned long Ihave_SendIt;
- unsigned long Ihave_Cybercan;
+ char name[SMBUF];
+ char ip_addr[15];
+ bool can_stream;
+ unsigned short activeCxn;
+ unsigned short sleepingCxns;
+ time_t seconds;
+ unsigned long accepted;
+ unsigned long refused;
+ unsigned long rejected;
+ unsigned long Duplicate;
+ unsigned long Unwanted_u;
+ unsigned long Unwanted_d;
+ unsigned long Unwanted_g;
+ unsigned long Unwanted_s;
+ unsigned long Unwanted_f;
+ float Size;
+ float DuplicateSize;
+ unsigned long Check;
+ unsigned long Check_send;
+ unsigned long Check_deferred;
+ unsigned long Check_got;
+ unsigned long Check_cybercan;
+ unsigned long Takethis;
+ unsigned long Takethis_Ok;
+ unsigned long Takethis_Err;
+ unsigned long Ihave;
+ unsigned long Ihave_Duplicate;
+ unsigned long Ihave_Deferred;
+ unsigned long Ihave_SendIt;
+ unsigned long Ihave_Cybercan;
struct _STATUS *next;
} STATUS;
static unsigned STATUSlast_time;
char start_time[50];
-static unsigned STATUSgettime(void)
+static unsigned
+STATUSgettime(void)
{
static int init = 0;
static struct timeval start_tv;
@@ -66,7 +67,8 @@
(tv.tv_usec - start_tv.tv_usec) / 1000);
}
-void STATUSinit(void)
+void
+STATUSinit(void)
{
time_t now;
@@ -75,7 +77,8 @@
strcpy (start_time, ctime (&now)) ;
}
-char *PrettySize (float size, char *str)
+char *
+PrettySize(float size, char *str)
{
if (size > 1073741824) /* 1024*1024*1024 */
sprintf (str, "%.1fGb", size / 1073741824.);
@@ -87,28 +90,29 @@
return (str);
}
-static void STATUSsummary(void)
+static void
+STATUSsummary(void)
{
- FILE *F;
- int i, j;
- register CHANNEL *cp;
- int activeCxn = 0;
- int sleepingCxns = 0;
- unsigned long seconds = 0;
- unsigned long duplicate = 0;
- unsigned long offered;
- unsigned long accepted = 0;
- unsigned long refused = 0;
- unsigned long rejected = 0;
- float size = 0;
- float DuplicateSize = 0;
- int peers = 0;
- char TempString [SMBUF];
- STATUS *head, *status, *tmp;
- char str[9];
- time_t now;
+ FILE *F;
+ int i, j;
+ register CHANNEL *cp;
+ int activeCxn = 0;
+ int sleepingCxns = 0;
+ time_t seconds = 0;
+ unsigned long duplicate = 0;
+ unsigned long offered;
+ unsigned long accepted = 0;
+ unsigned long refused = 0;
+ unsigned long rejected = 0;
+ float size = 0;
+ float DuplicateSize = 0;
+ int peers = 0;
+ char TempString [SMBUF];
+ STATUS *head, *status, *tmp;
+ char str[9];
+ time_t now;
#if defined(DO_PERL)
- extern int PerlFilterActive;
+ extern int PerlFilterActive;
#endif /* defined(DO_PERL) */
#if defined(HTML_STATUS)
@@ -331,7 +335,8 @@
(void)Fclose(F);
}
-void STATUSmainloophook(void)
+void
+STATUSmainloophook(void)
{
unsigned now;
@@ -339,9 +344,8 @@
return;
now = STATUSgettime();
- if (now - STATUSlast_time > (innconf->status * 1000)) {
+ if (now - STATUSlast_time > (unsigned)(innconf->status * 1000)) {
STATUSsummary();
STATUSlast_time = now;
}
}
-
diff -ur inn-CURRENT-20001030/innd/tcl.c inn/innd/tcl.c
--- inn-CURRENT-20001030/innd/tcl.c Mon Oct 30 13:00:54 2000
+++ inn/innd/tcl.c Mon Oct 30 15:17:05 2000
@@ -34,7 +34,7 @@
void
-TCLreadfilter()
+TCLreadfilter(void)
{
int code;
@@ -82,9 +82,7 @@
*/
static uint32_t
-makechecksum(sumbuf, buflen)
- u_char *sumbuf;
- int buflen;
+makechecksum(u_char *sumbuf, int buflen)
{
register u_char *buf = (u_char *)sumbuf;
register int32_t len = buflen;
@@ -154,11 +152,7 @@
int
-TCLCksumArt(clientData, interp, argc, argv)
- ClientData clientData;
- Tcl_Interp *interp;
- int argc;
- char *argv[];
+TCLCksumArt(ClientData clientData, Tcl_Interp *interp, int argc, char *argv[])
{
char buf[100];
@@ -172,7 +166,7 @@
void
-TCLsetup()
+TCLsetup(void)
{
int code;
@@ -195,7 +189,7 @@
void
-TCLclose()
+TCLclose(void)
{
}
diff -ur inn-CURRENT-20001030/innd/timer.c inn/innd/timer.c
--- inn-CURRENT-20001030/innd/timer.c Mon Oct 30 13:00:54 2000
+++ inn/innd/timer.c Fri Oct 27 17:18:28 2000
@@ -1,4 +1,4 @@
/* $Id: timer.c,v 1.17 2000/10/27 07:31:59 kondou Exp $
**
** Timer functions, to gather profiling data.
**
@@ -43,13 +43,7 @@
static const char * const timer_name[TMR_MAX] = {
"idle", "hishave", "hisgrep", "hiswrite", "hissync",
"artclean", "artwrite", "artctrl", "artcncl",
- "sitesend", "overv"
-#if defined(DO_PERL)
- , "perl"
-#endif
-#if defined(DO_PYTHON)
- , "python"
-#endif
+ "sitesend", "overv", "perl", "python"
};
/* Timer values. start stores the time (relative to the last summary) at
@@ -159,7 +153,7 @@
return 0;
now = get_time(false);
- if (now >= innconf->timer * 1000) {
+ if (now >= (unsigned int)innconf->timer * 1000) {
summarize();
return innconf->timer;
} else {
diff -ur inn-CURRENT-20001030/innd/wip.c inn/innd/wip.c
--- inn-CURRENT-20001030/innd/wip.c Mon Oct 30 13:00:54 2000
+++ inn/innd/wip.c Mon Oct 30 15:35:41 2000
@@ -18,13 +18,17 @@
static WIP *WIPtable[WIPTABLESIZE]; /* Top level of the WIP hash table */
-void WIPsetup(void) {
+void
+WIPsetup(void)
+{
memset(WIPtable, '\0', sizeof(WIPtable));
}
/* Add a new entry into the table. It is the appilications responsiblity to
to call WIPinprogress or WIPbyid first. */
-WIP *WIPnew(const char *messageid, CHANNEL *cp) {
+WIP *
+WIPnew(const char *messageid, CHANNEL *cp)
+{
HASH hash;
unsigned long bucket;
WIP *new;
@@ -44,7 +48,9 @@
return new;
}
-void WIPprecomfree(CHANNEL *cp) {
+void
+WIPprecomfree(CHANNEL *cp)
+{
WIP *cur;
int i;
if (cp == NULL)
@@ -58,7 +64,9 @@
}
}
-void WIPfree(WIP *wp) {
+void
+WIPfree(WIP *wp)
+{
unsigned long bucket;
WIP *cur;
WIP *prev = NULL;
@@ -95,7 +103,9 @@
/* Check if the given messageid is being transfered on another channel. If
Add is true then add the given message-id to the current channel */
-bool WIPinprogress(const char *msgid, CHANNEL *cp, bool Precommit) {
+bool
+WIPinprogress(const char *msgid, CHANNEL *cp, bool Precommit)
+{
WIP *wp;
int i;
@@ -139,7 +149,9 @@
return FALSE;
}
-WIP *WIPbyid(const char *messageid) {
+WIP *
+WIPbyid(const char *messageid)
+{
HASH hash;
unsigned long bucket;
WIP *wp;
@@ -157,7 +169,9 @@
return NULL;
}
-WIP *WIPbyhash(const HASH hash) {
+WIP *
+WIPbyhash(const HASH hash)
+{
unsigned long bucket;
WIP *wp;
@@ -172,4 +186,3 @@
return NULL;
}
-
diff -ur inn-CURRENT-20001030/lib/getconfig.c inn/lib/getconfig.c
--- inn-CURRENT-20001030/lib/getconfig.c Mon Oct 30 13:01:08 2000
+++ inn/lib/getconfig.c Fri Oct 27 13:28:14 2000
@@ -44,9 +44,8 @@
char *innconffile = _PATH_CONFIG;
char pathbuff[SMBUF];
-char *cpcatpath(p, f)
- char *p;
- char *f;
+char *
+cpcatpath(const char *p, const char *f)
{
if (strchr(f, '/') != NULL) {
return(f);
diff -ur inn-CURRENT-20001030/lib/reservedfd.c inn/lib/reservedfd.c
--- inn-CURRENT-20001030/lib/reservedfd.c Mon Oct 30 13:01:13 2000
+++ inn/lib/reservedfd.c Mon Oct 30 15:25:45 2000
@@ -13,7 +13,9 @@
static FILE **Reserved_fd = NULL;
static int Maxfd = -1;
-bool fdreserve(int fdnum) {
+bool
+fdreserve(int fdnum)
+{
static int allocated = 0;
int i, start = allocated;
@@ -57,7 +59,9 @@
return TRUE;
}
-FILE *Fopen(const char *p, char *type, int index) {
+FILE *
+Fopen(const char *p, const char *type, int index)
+{
FILE *nfp;
if (p == NULL || *p == '\0')
return NULL;
@@ -70,7 +74,9 @@
return (Reserved_fd[index] = nfp);
}
-int Fclose(FILE *fp) {
+int
+Fclose(FILE *fp)
+{
int i;
if (fp == NULL)
More information about the inn-patches
mailing list