inn/lib cleanups
Igor Timkin
ivt at gamma.ru
Tue Oct 31 16:21:55 UTC 2000
Make compile inn/lib with WARNINGS options (with -Werror),
exclude parsedate.y.
diff -urN inn-CURRENT-20001031/expire/expire.c inn/expire/expire.c
--- inn-CURRENT-20001031/expire/expire.c Tue Oct 31 13:00:52 2000
+++ inn/expire/expire.c Tue Oct 31 18:49:32 2000
@@ -935,7 +935,7 @@
#endif
dbzsetoptions(opt);
if (IgnoreOld) {
- if (!dbzfresh(NHistory, dbzsize(0L), 0)) {
+ if (!dbzfresh(NHistory, dbzsize(0L))) {
(void)fprintf(stderr, "Can't create database, %s\n",
strerror(errno));
CleanupAndExit(Server, FALSE, 1);
diff -urN inn-CURRENT-20001031/expire/makedbz.c inn/expire/makedbz.c
--- inn-CURRENT-20001031/expire/makedbz.c Tue Oct 31 13:00:52 2000
+++ inn/expire/makedbz.c Tue Oct 31 18:50:46 2000
@@ -102,7 +102,7 @@
#endif
dbzsetoptions(opt);
if (IgnoreOld) {
- if (!dbzfresh(p, dbzsize(size), 0)) {
+ if (!dbzfresh(p, dbzsize(size))) {
(void)fprintf(stderr, "Can't do dbzfresh, %s\n",
strerror(errno));
if (temp[0])
diff -urN inn-CURRENT-20001031/include/dbz.h inn/include/dbz.h
--- inn-CURRENT-20001031/include/dbz.h Tue Oct 31 13:01:05 2000
+++ inn/include/dbz.h Tue Oct 31 17:16:29 2000
@@ -63,7 +63,7 @@
extern bool dbzclose(void);
/* new stuff for dbz */
-extern bool dbzfresh(const char *name, off_t size, int fillpercent);
+extern bool dbzfresh(const char *name, off_t size);
extern bool dbzagain(const char *name, const char *oldname);
extern bool dbzexists(const HASH key);
extern bool dbzfetch(const HASH key, off_t *value);
diff -urN inn-CURRENT-20001031/include/innconf.h inn/include/innconf.h
--- inn-CURRENT-20001031/include/innconf.h Tue Oct 31 13:01:06 2000
+++ inn/include/innconf.h Tue Oct 31 17:41:35 2000
@@ -14,10 +14,10 @@
3: long
*/
struct conf_rec {
- char *name;
- char *value;
- int valtype;
- int mustset;
+ const char *name;
+ const char *value;
+ int valtype;
+ int mustset;
};
struct conf_rec conf_defaults[] = {
diff -urN inn-CURRENT-20001031/include/inndcomm.h inn/include/inndcomm.h
--- inn-CURRENT-20001031/include/inndcomm.h Tue Oct 31 13:01:06 2000
+++ inn/include/inndcomm.h Tue Oct 31 17:58:11 2000
@@ -57,7 +57,7 @@
#define SC_STATUS 'S'
#define SC_SIGNAL 'B'
#define SC_THROTTLE 'r'
-#define SC_TIMER 'Z'
+#define SC_TIMER 'Z'
#define SC_TRACE 'w'
#define SC_XABORT 'x'
#define SC_XEXEC 'y'
@@ -65,19 +65,19 @@
/* Yes, we don't want anyone to use this. */
#define SC_FIRSTFREE G
-#define MAX_REASON_LEN 80
+#define MAX_REASON_LEN 80
-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 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;
+extern const char *ICCfailure;
#ifdef __cplusplus
}
diff -urN inn-CURRENT-20001031/include/libinn.h inn/include/libinn.h
--- inn-CURRENT-20001031/include/libinn.h Tue Oct 31 13:01:06 2000
+++ inn/include/libinn.h Tue Oct 31 17:46:39 2000
@@ -175,9 +175,10 @@
/* Opening the active file on a client. */
extern FILE * CAopen(FILE *FromServer, FILE *ToServer);
-extern FILE * CAlistopen(FILE *FromServer, FILE *ToServer, char *request);
-extern FILE * CA_listopen(char *pathname, FILE *FromServer,
- FILE *ToServer, char *request);
+extern FILE * CAlistopen(FILE *FromServer, FILE *ToServer,
+ const char *request);
+extern FILE * CA_listopen(char *pathname, FILE *FromServer, FILE *ToServer,
+ const char *request);
extern void CAclose(void);
@@ -314,8 +315,8 @@
char *pathtmp; /* Temporary files for the news system */
};
-extern struct conf_vars *innconf;
-extern char * innconffile;
+extern struct conf_vars *innconf;
+extern const char *innconffile;
extern char * GetFQDN(char *domain);
extern char * GetConfigValue(char *value);
extern char * GetFileConfigValue(char *value);
@@ -324,7 +325,7 @@
char *group, char *moderatormailer);
extern void ClearInnConf(void);
extern int ReadInnConf(void);
-extern char *cpcatpath(const char *p, const char *f);
+extern const char *cpcatpath(const char *p, const char *f);
#define TEMPORARYOPEN 0
#define INND_HISTORY 1
diff -urN inn-CURRENT-20001031/innd/art.c inn/innd/art.c
--- inn-CURRENT-20001031/innd/art.c Tue Oct 31 13:01:11 2000
+++ inn/innd/art.c Tue Oct 31 15:54:06 2000
@@ -1690,10 +1690,10 @@
static void
ARTmakekeys(
- register ARTHEADER *hp, /* header data */
- register char *body, /* article body */
- register char *v; /* old kw value */
- register int l) /* old kw length */
+ 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;
diff -urN inn-CURRENT-20001031/lib/clientactive.c inn/lib/clientactive.c
--- inn-CURRENT-20001031/lib/clientactive.c Tue Oct 31 13:01:21 2000
+++ inn/lib/clientactive.c Tue Oct 31 17:30:01 2000
@@ -20,7 +20,8 @@
** Get a copy of the active file for a client host to use, locally or
** remotely.
*/
-FILE *CAopen(FILE *FromServer, FILE *ToServer)
+FILE *
+CAopen(FILE *FromServer, FILE *ToServer)
{
/* Use a local (or NFS-mounted) copy if available. Make sure we don't
* try to delete it when we close it. */
@@ -37,7 +38,9 @@
/*
** Internal library routine.
*/
-FILE *CA_listopen(char *pathname, FILE *FromServer, FILE *ToServer, char *request)
+FILE *
+CA_listopen(char *pathname, FILE *FromServer, FILE *ToServer,
+ const char *request)
{
char buff[BUFSIZ];
char *p;
@@ -92,7 +95,8 @@
** Use the NNTP list command to get a file from a server. Default is
** the active file, otherwise ask for whatever is in the request param.
*/
-FILE *CAlistopen(FILE *FromServer, FILE *ToServer, char *request)
+FILE *
+CAlistopen(FILE *FromServer, FILE *ToServer, const char *request)
{
/* Gotta talk to the server -- see if we can. */
if (FromServer == NULL || ToServer == NULL)
@@ -108,7 +112,8 @@
/*
** Close the file opened by CAopen or CAlistopen.
*/
-void CAclose(void)
+void
+CAclose(void)
{
if (CAfp) {
(void)fclose(CAfp);
diff -urN inn-CURRENT-20001031/lib/clientlib.c inn/lib/clientlib.c
--- inn-CURRENT-20001031/lib/clientlib.c Tue Oct 31 13:01:21 2000
+++ inn/lib/clientlib.c Tue Oct 31 17:07:11 2000
@@ -12,20 +12,21 @@
FILE *ser_rd_fp = NULL;
FILE *ser_wr_fp = NULL;
char ser_line[NNTP_STRLEN + 2];
-void put_server(char *buff);
-int get_server(char *buff, int buffsize);
+void put_server(const char *buff);
+int get_server(char *buff, int buffsize);
/*
** Get the name of the NNTP server. Ignore the filename; we use
** our own configuration stuff. Return pointer to static data.
*/
-/* ARGSUSED0 */
-char *getserverbyfile(char *file)
+char *
+getserverbyfile(char *file)
{
static char buff[256];
- strncpy(buff, innconf->server, sizeof(buff));
+ file = file; /* ARGSUSED0 */
+ strncpy(buff, innconf->server, sizeof(buff)-1);
buff[255] = '\0';
return buff;
}
@@ -35,7 +36,8 @@
** Get a connection to the remote news server. Return server's reply
** code or -1 on error.
*/
-int server_init(char *host, int port)
+int
+server_init(char *host, int port)
{
char line2[NNTP_STRLEN];
@@ -73,7 +75,8 @@
** Print a message based on the the server's initial response.
** Return -1 if server wants us to go away.
*/
-int handle_server_response(int response, char *host)
+int
+handle_server_response(int response, char *host)
{
char *p;
@@ -110,7 +113,8 @@
/*
** Send a line of text to the server.
*/
-void put_server(char *buff)
+void
+put_server(const char *buff)
{
(void)fprintf(ser_wr_fp, "%s\r\n", buff);
(void)fflush(ser_wr_fp);
@@ -121,9 +125,10 @@
** Get a line of text from the server, strip trailing \r\n.
** Return -1 on error.
*/
-int get_server(char *buff, int buffsize)
+int
+get_server(char *buff, int buffsize)
{
- char *p;
+ char *p;
if (fgets(buff, buffsize, ser_rd_fp) == NULL)
return -1;
@@ -138,7 +143,7 @@
** Send QUIT and close the server.
*/
void
-close_server()
+close_server(void)
{
char buff[NNTP_STRLEN];
diff -urN inn-CURRENT-20001031/lib/dbz.c inn/lib/dbz.c
--- inn-CURRENT-20001031/lib/dbz.c Tue Oct 31 13:01:22 2000
+++ inn/lib/dbz.c Tue Oct 31 17:26:59 2000
@@ -327,9 +327,11 @@
/*
- dbzconfbase - reconfigure dbzconf from base file size.
*/
-static void config_by_text_size(dbzconfig *c, of_t basesize) {
- int i;
- unsigned long m;
+static void
+config_by_text_size(dbzconfig *c, of_t basesize)
+{
+ int i;
+ unsigned long m;
/* if no tag requested, just return. */
if ((c->tagmask | c->tagenb) == 0)
@@ -339,7 +341,7 @@
basesize += basesize / 10;
/* calculate tagging from old file */
- for (m = 1, i = 0; m < basesize; i++, m <<= 1)
+ for (m = 1, i = 0; m < (unsigned long)basesize; i++, m <<= 1)
continue;
/* if we had more tags than the default, use the new data */
@@ -373,16 +375,18 @@
- create and truncate .pag, .idx, or .hash files
- return FALSE on error
*/
-static bool create_truncate(const char *name, const char *pag) {
+static bool
+create_truncate(const char *name, const char *pag1)
+{
char *fn;
FILE *f;
- if ((fn = enstring(name, pag)) == NULL)
+ if ((fn = enstring(name, pag1)) == NULL)
return FALSE;
f = Fopen(fn, "w", TEMPORARYOPEN);
DISPOSE(fn);
if (f == NULL) {
- DEBUG(("dbz.c create_truncate: unable to create/truncate %s\n", pag));
+ DEBUG(("dbz.c create_truncate: unable to create/truncate %s\n", pag1));
return FALSE;
} else
Fclose(f);
@@ -393,10 +397,9 @@
* Return TRUE for success, FALSE for failure
* name - base name; .dir and .pag must exist
* size - table size (0 means default)
- * fillpercent - target percentage full ***** inactive
*/
bool
-dbzfresh(const char *name, off_t size, const int fillpercent)
+dbzfresh(const char *name, off_t size)
{
char *fn;
dbzconfig c;
@@ -486,12 +489,12 @@
{
static int quick[] = {2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 0 };
int *ip;
- long div, stop;
+ long div1, stop;
/* hit the first few primes quickly to eliminate easy ones */
/* this incidentally prevents ridiculously small tables */
- for (ip = quick; (div = *ip) != 0; ip++)
- if (x % div == 0) {
+ for (ip = quick; (div1 = *ip) != 0; ip++)
+ if (x % div1 == 0) {
DEBUG(("isprime: quick result on %ld\n", (long)x));
return FALSE;
}
@@ -502,8 +505,8 @@
stop <<= 1;
/* try odd numbers up to stop */
- for (div = *--ip; div < stop; div += 2)
- if (x%div == 0)
+ for (div1 = *--ip; div1 < stop; div1 += 2)
+ if (x%div1 == 0)
return FALSE;
return TRUE;
@@ -550,7 +553,8 @@
* name - base name; .dir and .pag must exist
* oldname - basename, all must exist
*/
-bool dbzagain(const char *name, const char *oldname)
+bool
+dbzagain(const char *name, const char *oldname)
{
char *fn;
dbzconfig c;
@@ -661,8 +665,10 @@
return dbzinit(name);
}
-static bool openhashtable(const char *base, const char *ext, hash_table *tab,
- const size_t reclen, const dbz_incore_val incore) {
+static bool
+openhashtable(const char *base, const char *ext, hash_table *tab,
+ const size_t reclen, const dbz_incore_val incore)
+{
char *name;
if ((name = enstring(base, ext)) == NULL)
@@ -716,7 +722,9 @@
}
#ifdef DO_TAGGED_HASH
-static bool openbasefile(const char *name) {
+static bool
+openbasefile(const char *name)
+{
basef = Fopen(name, "r", DBZ_BASE);
if (basef == NULL) {
DEBUG(("dbzinit: basefile open failed\n"));
@@ -742,7 +750,9 @@
* functions permit this, since many people consult it if dbzinit() fails.
* return TRUE for success, FALSE for failure
*/
-int dbzinit(const char *name) {
+int
+dbzinit(const char *name)
+{
char *fname;
if (opendb) {
@@ -817,7 +827,8 @@
/* enstring - concatenate two strings into newly allocated memory
* Returns NULL on failure
*/
-static char *enstring(const char *s1, const char *s2)
+static char *
+enstring(const char *s1, const char *s2)
{
char *p;
@@ -829,7 +840,8 @@
/* dbzclose - close a database
*/
-bool dbzclose(void)
+bool
+dbzclose(void)
{
bool ret = TRUE;
@@ -868,7 +880,8 @@
/* dbzsync - push all in-core data out to disk
*/
-bool dbzsync(void)
+bool
+dbzsync(void)
{
bool ret = TRUE;
@@ -902,7 +915,9 @@
/*
- okayvalue - check that a value can be stored
*/
-static int okayvalue(of_t value) {
+static int
+okayvalue(of_t value)
+{
if (HASTAG(value))
return(0);
#ifdef OVERFLOW
@@ -915,7 +930,8 @@
/* dbzexists - check if the given message-id is in the database */
bool
-dbzexists(const HASH key) {
+dbzexists(const HASH key)
+{
#ifdef DO_TAGGED_HASH
off_t value;
@@ -1060,7 +1076,9 @@
* dbzstore - add an entry to the database
* returns TRUE for success and FALSE for failure
*/
-DBZSTORE_RESULT dbzstore(const HASH key, off_t data) {
+DBZSTORE_RESULT
+dbzstore(const HASH key, off_t data)
+{
#ifdef DO_TAGGED_HASH
of_t value;
#else
@@ -1135,8 +1153,10 @@
* pf - NULL means don't care about .pag
* returns TRUE for success, FALSE for failure
*/
-static bool getconf(FILE *df, dbzconfig *cp) {
- int i;
+static bool
+getconf(FILE *df, dbzconfig *cp)
+{
+ int i;
/* empty file, no configuration known */
#ifdef DO_TAGGED_HASH
@@ -1219,7 +1239,9 @@
/* putconf - write configuration to .dir file
* Returns: 0 for success, -1 for failure
*/
-static int putconf(FILE *f, dbzconfig *cp) {
+static int
+putconf(FILE *f, dbzconfig *cp)
+{
int i;
int ret = 0;
@@ -1257,7 +1279,9 @@
*
* Returns: pointer to copy of .pag or NULL on errror
*/
-static bool getcore(hash_table *tab) {
+static bool
+getcore(hash_table *tab)
+{
char *it;
int nread;
int i;
@@ -1313,7 +1337,9 @@
*
* Returns TRUE on success, FALSE on failure
*/
-static bool putcore(hash_table *tab) {
+static bool
+putcore(hash_table *tab)
+{
int size;
if (tab->incore == INCORE_MEM) {
@@ -1332,7 +1358,9 @@
/*
- makehash31 : make 31-bit hash from HASH
*/
-static unsigned int makehash31(const HASH *hash) {
+static unsigned int
+makehash31(const HASH *hash)
+{
unsigned int h;
memcpy(&h, hash, sizeof(h));
return (h >> 1);
@@ -1342,9 +1370,11 @@
/* start - set up to start or restart a search
* osp == NULL is acceptable
*/
-static void start(searcher *sp, const HASH hash, searcher *osp) {
+static void
+start(searcher *sp, const HASH hash, searcher *osp)
+{
#ifdef DO_TAGGED_HASH
- long h;
+ unsigned int h;
h = makehash31(&hash);
if (osp != FRESH && osp->shorthash == h) {
@@ -1459,7 +1489,9 @@
*
* return FALSE if we hit vacant rec's or error
*/
-static bool search(searcher *sp) {
+static bool
+search(searcher *sp)
+{
erec value;
unsigned long taboffset = 0;
@@ -1522,7 +1554,9 @@
*
* Returns: TRUE success, FALSE failure
*/
-static bool set(searcher *sp, hash_table *tab, void *value) {
+static bool
+set(searcher *sp, hash_table *tab, void *value)
+{
off_t offset;
if (sp->aborted)
@@ -1571,7 +1605,9 @@
- on the pag table.
- Returns: TRUE success, FALSE failure
*/
-static bool set_pag(searcher *sp, of_t value) {
+static bool
+set_pag(searcher *sp, of_t value)
+{
of_t v = value;
if (CANTAG(v)) {
@@ -1595,7 +1631,9 @@
/* dbzsetoptions - set runtime options for the database.
*/
-void dbzsetoptions(const dbzoptions o) {
+void
+dbzsetoptions(const dbzoptions o)
+{
options = o;
#ifndef HAVE_MMAP
/* Without a working mmap on files, we should avoid it. */
@@ -1606,7 +1644,9 @@
/* dbzgetoptions - get runtime options for the database.
*/
-void dbzgetoptions(dbzoptions *o) {
+void
+dbzgetoptions(dbzoptions *o)
+{
*o = options;
}
@@ -1625,12 +1665,16 @@
#ifdef DBZTEST
-int timediffms(struct timeval start, struct timeval end) {
+int
+timediffms(struct timeval start, struct timeval end)
+{
return (((end.tv_sec - start.tv_sec) * 1000) +
- ((end.tv_usec - start.tv_usec)) / 1000);
+ ((end.tv_usec - start.tv_usec)) / 1000);
}
-void RemoveDBZ(char *filename) {
+void
+RemoveDBZ(char *filename)
+{
char fn[1024];
#ifdef DO_TAGGED_HASH
@@ -1646,7 +1690,8 @@
unlink(fn);
}
-static void usage()
+static void
+usage(void)
{
fprintf(stderr, "usage: dbztest [-i] [-n|m] [-s size] <history>\n");
fprintf(stderr, " -i initialize history. deletes .pag files\n");
@@ -1656,9 +1701,8 @@
exit(1);
}
-int main(argc, argv)
-int argc;
-char *argv[];
+int
+main(int argc, char *argv[])
{
int i, line;
FILE *fpi;
@@ -1704,7 +1748,7 @@
if (initialize) {
RemoveDBZ(history);
gettimeofday(&start, NULL);
- if (dbzfresh(history, dbzsize(size), 0) < 0) {
+ if (dbzfresh(history, dbzsize(size)) < 0) {
fprintf(stderr, "cant dbzfresh %s\n", history);
exit(1);
}
diff -urN inn-CURRENT-20001031/lib/defdist.c inn/lib/defdist.c
--- inn-CURRENT-20001031/lib/defdist.c Tue Oct 31 13:01:22 2000
+++ inn/lib/defdist.c Tue Oct 31 17:32:58 2000
@@ -25,7 +25,8 @@
};
typedef struct _DDHANDLE DDHANDLE;
-struct _DDHANDLE *DDstart(FILE *FromServer, FILE *ToServer)
+struct _DDHANDLE *
+DDstart(FILE *FromServer, FILE *ToServer)
{
DDHANDLE *h;
DDENTRY *ep;
@@ -105,7 +106,8 @@
}
-void DDcheck(DDHANDLE *h, char *group)
+void
+DDcheck(DDHANDLE *h, char *group)
{
DDENTRY *ep;
int i;
@@ -123,7 +125,8 @@
}
-char *DDend(DDHANDLE *h)
+char *
+DDend(DDHANDLE *h)
{
static char NIL[] = "";
char *p;
@@ -150,9 +153,7 @@
#if defined(TEST)
int
-main(ac, av)
- int ac;
- char *av[];
+main(int ac, char *av[])
{
struct _DDHANDLE *h;
char *p;
diff -urN inn-CURRENT-20001031/lib/error.c inn/lib/error.c
--- inn-CURRENT-20001031/lib/error.c Tue Oct 31 13:01:22 2000
+++ inn/lib/error.c Tue Oct 31 17:38:59 2000
@@ -100,6 +100,7 @@
void
error_log_stderr(int len, const char *fmt, va_list args, int err)
{
+ len = len; /* ARGSUSED */
fflush(stdout);
if (error_program_name != NULL)
fprintf(stderr, "%s: ", error_program_name);
@@ -117,7 +118,7 @@
buffer = malloc(len + 1);
if (buffer == NULL) {
- fprintf(stderr, "failed to malloc %lu bytes at %s line %d: %s",
+ fprintf(stderr, "failed to malloc %u bytes at %s line %d: %s",
len + 1, __FILE__, __LINE__, strerror(errno));
exit(1);
}
diff -urN inn-CURRENT-20001031/lib/fdlimit.c inn/lib/fdlimit.c
--- inn-CURRENT-20001031/lib/fdlimit.c Tue Oct 31 13:01:22 2000
+++ inn/lib/fdlimit.c Tue Oct 31 17:40:05 2000
@@ -69,6 +69,7 @@
setfdlimit(int limit)
{
/* Unimplemented system call is close enough. */
+ limit = limit; /* ARGSUSED */
errno = ENOSYS;
return -1;
}
diff -urN inn-CURRENT-20001031/lib/getconfig.c inn/lib/getconfig.c
--- inn-CURRENT-20001031/lib/getconfig.c Tue Oct 31 13:01:23 2000
+++ inn/lib/getconfig.c Tue Oct 31 17:45:14 2000
@@ -41,23 +41,24 @@
*/
struct conf_vars *innconf = NULL;
-char *innconffile = _PATH_CONFIG;
+const char *innconffile = _PATH_CONFIG;
char pathbuff[SMBUF];
-char *
+const char *
cpcatpath(const char *p, const char *f)
{
if (strchr(f, '/') != NULL) {
- return(f);
+ return f;
} else {
strcpy(pathbuff, p);
strcat(pathbuff, "/");
strcat(pathbuff, f);
}
- return(pathbuff);
+ return pathbuff;
}
-char *GetFileConfigValue(char *value)
+char *
+GetFileConfigValue(char *value)
{
FILE *F;
int i;
@@ -94,7 +95,8 @@
/*
** Get a configuration parameter, usually from reading the file.
*/
-char *GetConfigValue(char *value)
+char *
+GetConfigValue(char *value)
{
char *p;
@@ -121,7 +123,9 @@
/*
** Get a boolean config value and return it by value
*/
-bool GetBooleanConfigValue(char *key, bool defaultvalue) {
+bool
+GetBooleanConfigValue(char *key, bool defaultvalue)
+{
char *value;
if ((value = GetConfigValue(key)) == NULL)
@@ -134,7 +138,8 @@
return defaultvalue;
}
-void SetDefaults()
+void
+SetDefaults(void)
{
char *p; /* Temporary working variable */
if (ConfigBit == NULL) {
@@ -269,7 +274,8 @@
innconf->dontrejectfiltered = FALSE;
}
-void ClearInnConf()
+void
+ClearInnConf(void)
{
if (innconf->fromhost != NULL) DISPOSE(innconf->fromhost);
if (innconf->server != NULL) DISPOSE(innconf->server);
@@ -311,7 +317,8 @@
Make sure some compulsory inn.conf values are set and set them
to defaults if possible
*/
-int CheckInnConf()
+int
+CheckInnConf(void)
{
static char *tmpdir = NULL;
static unsigned int dirlen = 0;
@@ -406,7 +413,8 @@
return(0);
}
-int ReadInnConf()
+int
+ReadInnConf(void)
{
FILE *F;
char *p, *q;
diff -urN inn-CURRENT-20001031/lib/getmodaddr.c inn/lib/getmodaddr.c
--- inn-CURRENT-20001031/lib/getmodaddr.c Tue Oct 31 13:01:23 2000
+++ inn/lib/getmodaddr.c Tue Oct 31 17:49:58 2000
@@ -19,7 +19,8 @@
/*
** Close the file opened by GMAlistopen.
*/
-void GMAclose(void)
+void
+GMAclose(void)
{
if (GMAfp) {
(void)fclose(GMAfp);
@@ -33,7 +34,9 @@
/*
** Internal library routine.
*/
-FILE *GMA_listopen(char *pathname, FILE *FromServer, FILE *ToServer, char *request)
+static FILE *
+GMA_listopen(const char *pathname, FILE *FromServer, FILE *ToServer,
+ const char *request)
{
char buff[BUFSIZ];
char *p;
@@ -85,7 +88,9 @@
/*
** Read the moderators file, looking for a moderator.
*/
-char *GetModeratorAddress(FILE *FromServer, FILE *ToServer, char *group, char *moderatormailer)
+char *
+GetModeratorAddress(FILE *FromServer, FILE *ToServer, char *group,
+ char *moderatormailer)
{
static char address[SMBUF];
char *p;
diff -urN inn-CURRENT-20001031/lib/hash.c inn/lib/hash.c
--- inn-CURRENT-20001031/lib/hash.c Tue Oct 31 13:01:24 2000
+++ inn/lib/hash.c Tue Oct 31 17:56:19 2000
@@ -26,13 +26,15 @@
*
* Returns: pointer into s, or NULL for "nowhere"
*/
-static char *cipoint(char *s, size_t size) {
+static char *
+cipoint(char *s, size_t size)
+{
char *p;
static char post[] = "postmaster";
static int plen = sizeof(post) - 1;
- if ((p = memchr(s, '@', size))== NULL) /* no local/domain split */
- return NULL; /* assume all local */
+ if ((p = memchr(s, '@', size))== NULL) /* no local/domain split */
+ return NULL; /* assume all local */
if ((p - (s + 1) == plen) && !strncasecmp(post, s+1, plen)) {
/* crazy -- "postmaster" is case-insensitive */
return s;
@@ -40,7 +42,9 @@
return p;
}
-HASH Hash(const void *value, const size_t len) {
+HASH
+Hash(const void *value, const size_t len)
+{
struct md5_context context;
HASH hash;
@@ -53,7 +57,9 @@
return hash;
}
-HASH HashMessageID(const char *MessageID) {
+HASH
+HashMessageID(const char *MessageID)
+{
char *new;
char *cip;
char *p;
@@ -76,7 +82,9 @@
** Check if the hash is all zeros, and subseqently empty, see HashClear
** for more info on this.
*/
-bool HashEmpty(const HASH h) {
+bool
+HashEmpty(const HASH h)
+{
return (memcmp(&empty, &h, sizeof(HASH)) == 0);
}
@@ -85,7 +93,9 @@
** introduces the possibility of colliding w/a value that actually hashes
** to all zeros, but that's fairly unlikely.
*/
-void HashClear(HASH *hash) {
+void
+HashClear(HASH *hash)
+{
memset(hash, '\0', sizeof(HASH));
}
@@ -93,13 +103,15 @@
** Convert the binary form of the hash to a form that we can use in error
** messages and logs.
*/
-char *HashToText(const HASH hash) {
- static char hex[] = "0123456789ABCDEF";
- char *p;
- unsigned int i;
- static char hashstr[(sizeof(HASH)*2) + 1];
+char *
+HashToText(const HASH hash)
+{
+ static const char hex[] = "0123456789ABCDEF";
+ const char *p;
+ unsigned int i;
+ static char hashstr[(sizeof(HASH)*2) + 1];
- for (p = (char *)&hash, i = 0; i < sizeof(HASH); i++, p++) {
+ for (p = hash.hash, i = 0; i < sizeof(HASH); i++, p++) {
hashstr[i * 2] = hex[(*p & 0xF0) >> 4];
hashstr[(i * 2) + 1] = hex[*p & 0x0F];
}
@@ -110,14 +122,18 @@
/*
** Converts a hex digit and converts it to a int
*/
-static int hextodec(const int c) {
+static
+int hextodec(const int c)
+{
return isdigit(c) ? (c - '0') : ((c - 'A') + 10);
}
/*
** Convert the ASCII representation of the hash back to the canonical form
*/
-HASH TextToHash(const char *text) {
+HASH
+TextToHash(const char *text)
+{
char *q;
int i;
HASH hash;
diff -urN inn-CURRENT-20001031/lib/inndcomm.c inn/lib/inndcomm.c
--- inn-CURRENT-20001031/lib/inndcomm.c Tue Oct 31 13:01:24 2000
+++ inn/lib/inndcomm.c Tue Oct 31 18:01:02 2000
@@ -37,15 +37,14 @@
#endif /* defined(HAVE_UNIX_DOMAIN_SOCKETS) */
static int ICCfd;
static int ICCtimeout;
-char *ICCfailure;
+const char *ICCfailure;
/*
** Set the timeout.
*/
void
-ICCsettimeout(i)
- int i;
+ICCsettimeout(int i)
{
ICCtimeout = i;
}
@@ -55,7 +54,7 @@
** Get ready to talk to the server.
*/
int
-ICCopen()
+ICCopen(void)
{
int mask;
int oerrno;
@@ -127,7 +126,7 @@
** Close down.
*/
int
-ICCclose()
+ICCclose(void)
{
int i;
@@ -149,7 +148,7 @@
** Get the server's pid.
*/
static pid_t
-ICCserverpid()
+ICCserverpid(void)
{
pid_t pid;
FILE *F;
@@ -171,8 +170,7 @@
** message.
*/
static bool
-ICCserveralive(pid)
- pid_t pid;
+ICCserveralive(pid_t pid)
{
if (kill(pid, 0) > 0 || errno != ESRCH)
return TRUE;
@@ -190,10 +188,7 @@
*/
int
-ICCcommand(cmd, argv, replyp)
- char cmd;
- char *argv[];
- char **replyp;
+ICCcommand(char cmd, char *argv[], char **replyp)
{
char *buff;
char *p;
@@ -333,7 +328,7 @@
/* Read the reply. */
i = RECVorREAD(ICCfd, buff, bufsiz) ;
- if (i < HEADER_SIZE) {
+ if ((unsigned int)i < HEADER_SIZE) {
DISPOSE(buff) ;
ICCfailure = "read" ;
return -1 ;
@@ -410,8 +405,7 @@
** Send a "cancel" command.
*/
int
-ICCcancel(msgid)
- char *msgid;
+ICCcancel(char *msgid)
{
char *args[2];
@@ -425,8 +419,7 @@
** Send a "go" command.
*/
int
-ICCgo(why)
- char *why;
+ICCgo(char *why)
{
char *args[2];
@@ -440,8 +433,7 @@
** Send a "pause" command.
*/
int
-ICCpause(why)
- char *why;
+ICCpause(char *why)
{
char *args[2];
@@ -455,8 +447,7 @@
** Send a "reserve" command.
*/
int
-ICCreserve(why)
- char *why;
+ICCreserve(char *why)
{
char *args[2];
diff -urN inn-CURRENT-20001031/lib/md5.c inn/lib/md5.c
--- inn-CURRENT-20001031/lib/md5.c Tue Oct 31 13:01:25 2000
+++ inn/lib/md5.c Tue Oct 31 18:06:20 2000
@@ -76,7 +76,7 @@
Let the compiler zero the remainder of the array for us, guaranteed by
ISO C99 6.7.8 paragraph 21. */
-static const char padding[MD5_CHUNKSIZE] = { 0x80, 0 /* 0, 0, ... */ };
+static const unsigned char padding[MD5_CHUNKSIZE] = { 0x80, 0 /* 0, ... */ };
/* Internal prototypes. */
static void md5_transform(uint32_t *, const uint32_t *);
diff -urN inn-CURRENT-20001031/lib/parsedate.y inn/lib/parsedate.y
--- inn-CURRENT-20001031/lib/parsedate.y Tue Oct 31 13:01:25 2000
+++ inn/lib/parsedate.y Tue Oct 31 18:22:54 2000
@@ -112,9 +112,9 @@
static time_t yyRelSeconds;
-extern struct tm *localtime();
+/* extern struct tm *localtime(); */
-static void date_error();
+static void date_error(const char *s);
%}
%union {
@@ -483,21 +483,16 @@
-/* ARGSUSED */
static void
-date_error(s)
- char *s;
+date_error(const char *s)
{
+ s = s; /* ARGSUSED */
/* NOTREACHED */
}
static time_t
-ToSeconds(Hours, Minutes, Seconds, Meridian)
- time_t Hours;
- time_t Minutes;
- time_t Seconds;
- MERIDIAN Meridian;
+ToSeconds(time_t Hours, time_t Minutes, time_t Seconds, MERIDIAN Meridian)
{
if (Minutes < 0 || Minutes > 59 || Seconds < 0 || Seconds > 61)
return -1;
@@ -518,15 +513,8 @@
static time_t
-Convert(Month, Day, Year, Hours, Minutes, Seconds, Meridian, dst)
- time_t Month;
- time_t Day;
- time_t Year;
- time_t Hours;
- time_t Minutes;
- time_t Seconds;
- MERIDIAN Meridian;
- DSTMODE dst;
+Convert(time_t Month, time_t Day, time_t Year, time_t Hours, time_t Minutes,
+ time_t Seconds, MERIDIAN Meridian, DSTMODE dst)
{
static int DaysNormal[13] = {
0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
@@ -583,9 +571,7 @@
static time_t
-DSTcorrect(Start, Future)
- time_t Start;
- time_t Future;
+DSTcorrect(time_t Start, time_t Future)
{
time_t StartDay;
time_t FutureDay;
@@ -597,9 +583,7 @@
static time_t
-RelativeMonth(Start, RelMonth)
- time_t Start;
- time_t RelMonth;
+RelativeMonth(time_t Start, time_t RelMonth)
{
struct tm *tm;
time_t Month;
@@ -617,7 +601,8 @@
}
-static int LookupWord(char *buff, int length)
+static int
+LookupWord(char *buff, int length)
{
char *p;
const char *q;
@@ -706,7 +691,8 @@
}
-static int date_lex(void)
+static int
+date_lex(void)
{
char c;
char *p;
@@ -768,9 +754,10 @@
}
-time_t parsedate(char *p, TIMEINFO *now)
+time_t
+parsedate(char *p, TIMEINFO *now)
{
- extern int date_parse();
+ extern int date_parse(void);
struct tm *tm;
TIMEINFO ti;
time_t Start;
@@ -830,9 +817,7 @@
/* ARGSUSED */
int
-main(ac, av)
- int ac;
- char *av[];
+main(int ac, char *av[])
{
char buff[128];
time_t d;
diff -urN inn-CURRENT-20001031/lib/reservedfd.c inn/lib/reservedfd.c
--- inn-CURRENT-20001031/lib/reservedfd.c Tue Oct 31 13:01:26 2000
+++ inn/lib/reservedfd.c Tue Oct 31 18:34:13 2000
@@ -60,18 +60,18 @@
}
FILE *
-Fopen(const char *p, const char *type, int index)
+Fopen(const char *p, const char *type, int xindex)
{
FILE *nfp;
if (p == NULL || *p == '\0')
return NULL;
- if (index < 0 || index > Maxfd || Reserved_fd[index] == NULL)
+ if (xindex < 0 || xindex > Maxfd || Reserved_fd[xindex] == NULL)
return fopen(p, type);
- if ((nfp = freopen(p, type, Reserved_fd[index])) == NULL) {
- Reserved_fd[index] = freopen("/dev/null", "r", Reserved_fd[index]);
+ if ((nfp = freopen(p, type, Reserved_fd[xindex])) == NULL) {
+ Reserved_fd[xindex] = freopen("/dev/null", "r", Reserved_fd[xindex]);
return NULL;
}
- return (Reserved_fd[index] = nfp);
+ return (Reserved_fd[xindex] = nfp);
}
int
diff -urN inn-CURRENT-20001031/lib/xwrite.c inn/lib/xwrite.c
--- inn-CURRENT-20001031/lib/xwrite.c Tue Oct 31 13:01:28 2000
+++ inn/lib/xwrite.c Tue Oct 31 18:43:52 2000
@@ -56,7 +56,7 @@
ssize_t
xwritev(int fd, const struct iovec iov[], int iovcnt)
{
- ssize_t total, status;
+ ssize_t total, status = 0;
size_t left;
int iovleft, i, count;
struct iovec *tmpiov;
@@ -82,7 +82,7 @@
the rest of it so that we can modify it to reflect how much we manage
to write on successive tries. */
left = total - status;
- for (i = 0; status >= iov[i].iov_len; i++)
+ for (i = 0; (size_t)status >= iov[i].iov_len; i++)
status -= iov[i].iov_len;
iovleft = iovcnt - i;
tmpiov = xmalloc(iovleft * sizeof(struct iovec));
@@ -98,7 +98,8 @@
/* Skip any leading data that has been written out. */
if (status < 0) status = 0;
- for (; status >= tmpiov[i].iov_len && iovleft > 0; i++, iovleft--)
+ for (; (size_t)status >= tmpiov[i].iov_len && iovleft > 0;
+ i++, iovleft--)
status -= tmpiov[i].iov_len;
tmpiov[i].iov_base = (char *) tmpiov[i].iov_base + status;
tmpiov[i].iov_len -= status;
More information about the inn-patches
mailing list