--- inject/actflag.c.orig 1993-08-22 00:52:27 UTC +++ inject/actflag.c @@ -5,6 +5,8 @@ #include #include #include +#include +#include #include "news.h" #include "config.h" #include "active.h" @@ -21,18 +23,17 @@ extern int optind; extern char *optarg; /* exports */ -char *progname = ""; +const char *progname = ""; int debug; /* forwards */ -char *actflag(); +char *actflag(register char *ngs); /* * main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c, errflg = 0; @@ -60,8 +61,7 @@ char *argv[]; * actflag - compute dominant active file flag for a list of newsgroups */ char * -actflag(ngs) -register char *ngs; +actflag(register char *ngs) { register char *comma, *flagp, *status = strsave(""), *nlp; char *actent; --- readnews/active.c.orig 1990-11-19 22:20:05 UTC +++ readnews/active.c @@ -7,14 +7,13 @@ */ #include "defs.h" +#include "readnews_error.h" static int lineno; static active *alist; -static -getline(f, g, d, d2) -register FILE *f; -char *g, *d, *d2; +static int +get_line(register FILE *f, char *g, char *d, char *d2) { register int c; register char *s; @@ -43,7 +42,7 @@ char *g, *d, *d2; } if (c != EOF && (c != '\n' || !*d || !*d2)) - error("%s: bad format: line %d", "active", lineno); + readnews_error("%s: bad format: line %d", "active", lineno); return c != EOF; } @@ -52,7 +51,7 @@ char *g, *d, *d2; * build internal active file structure */ active * -readactive() +readactive(void) { register FILE *f; register active *ap, *last; @@ -61,7 +60,7 @@ readactive() alist = last = NULL; f = fopenf(ctlfile("active"), "r"); lineno = 0; - while (getline(f, gbuf, dbuf, dbuf2)) { + while (get_line(f, gbuf, dbuf, dbuf2)) { ap = NEW(active); ap->a_name = newstr(gbuf); ap->a_seq = atol(dbuf); @@ -82,8 +81,7 @@ readactive() * return pointer to named group */ active * -activep(grp) -register char *grp; +activep(register char *grp) { register active *ap; --- relay/active.c.orig 1993-03-13 07:18:44 UTC +++ relay/active.c @@ -15,6 +15,7 @@ #include "news.h" #include "config.h" #include "active.h" +#include "rerror.h" /* ordinal numbers of fields */ #define CURRFIELD 2 /* current article # */ @@ -28,24 +29,21 @@ #define FLAGGOTO '=' /* see another group (following) instead */ /* imports */ -extern char *actfind(); -extern statust actfload(), actfsync(), actfwrnum(); /* exports */ char actrelnm[] = "active"; /* privates */ -static char *actmode = "r+"; +static const char *actmode = "r+"; static FILE *actfp = NULL; static struct lastngcache { char *lnc_ng; /* newsgroup name */ char *lnc_line; /* matching active file line */ } lnc = { NULL, NULL }; +/* return address of field "fieldno" in ngline */ STATIC char * -fieldfind(ngline, fieldno) /* return address of field "fieldno" in ngline */ -register char *ngline; -register int fieldno; +fieldfind(register char *ngline, register int fieldno) { register int field; @@ -57,9 +55,9 @@ register int fieldno; return ngline; } +/* return address of flag field in ngline */ char * -findflag(ngline) /* return address of flag field in ngline */ -register char *ngline; +findflag(register char *ngline) { return fieldfind(ngline, FLAGFIELD); } @@ -71,8 +69,7 @@ register char *ngline; * actlook caches the last newsgroup looked-up and the result. */ char * -actlook(ang) -register char *ang; +actlook(register char *ang) { register char *ngline, *ng, *flag; register int loopbreak = 100; @@ -104,9 +101,7 @@ register char *ang; * Return the resultant number. */ long -incartnum(ng, inc) -char *ng; -int inc; +incartnum(char *ng, int inc) { char testnum[40]; register char *line = actlook(ng); @@ -142,7 +137,8 @@ int inc; return nextart; } -actread() /* set mode: just reading */ +void +actread(void) /* set mode: just reading */ { actmode = "r"; } @@ -151,7 +147,7 @@ actread() /* set mode: just reading */ * Reload the active file cache. */ statust -actload() +actload(void) { register statust status = ST_OKAY; @@ -169,7 +165,7 @@ actload() * last-newsgroup-cache, since it refers to the (now invalid) active file cache. */ statust -actsync() +actsync(void) { register statust status = ST_OKAY; @@ -192,9 +188,7 @@ actsync() * matches thisflag. */ boolean -isflag(ngs, thisflag) -register char *ngs; -int thisflag; +isflag(register char *ngs, int thisflag) { register char *newng, *flag, *ng; register boolean result = NO; @@ -218,8 +212,7 @@ int thisflag; * Are any groups in ngs moderated? */ boolean -moderated(ngs) -register char *ngs; +moderated(register char *ngs) { return isflag(ngs, FLAGMOD); } @@ -228,8 +221,7 @@ register char *ngs; * Are any groups in ngs unwanted? */ boolean -unwanted(ngs) -register char *ngs; +unwanted(register char *ngs) { return isflag(ngs, FLAGNEVER); } @@ -240,8 +232,7 @@ register char *ngs; * This is done by tracing the chain of "=ng" pointers (in actlook()), if any. */ char * -realngname(ong) -char *ong; +realngname(char *ong) { register char *ngline = actlook(ong); --- libbig/active.fast.c.orig 1993-03-13 06:35:43 UTC +++ libbig/active.fast.c @@ -16,10 +16,17 @@ #include "active.h" #include "hdbm.h" +#include "headers.h" +#include "relay.h" +#include "rerror.h" + +/* forwards */ +int linescan(char *s, const char **lnarray, register int nent); + /* private */ static char *active = NULL; /* cache: points at entire active file */ static int actsize; /* bytes in active: type int fixed by fread */ -static char **actlnps; /* point at lines in active file */ +static const char **actlnps; /* point at lines in active file */ static unsigned actlines; /* lines in actlnps actually used */ static HASHTABLE *acttbl; @@ -27,7 +34,7 @@ static HASHTABLE *acttbl; extern char actrelnm[]; STATIC statust -actmkindx() /* build actlnps index for active */ +actmkindx(void) /* build actlnps index for active */ { register statust status = ST_OKAY; unsigned lnpsz; @@ -38,7 +45,7 @@ actmkindx() /* build actlnps index for active */ maxlines = charcount(active, '\n') + 2; lnpsz = sizeof(char *) * (long) maxlines; if (lnpsz != sizeof(char *) * (long)maxlines || - (actlnps = (char **)malloc(lnpsz)) == NULL) { + (actlnps = (const char **)malloc(lnpsz)) == NULL) { persistent(NOART, 'm', "`%s' index won't fit in memory", ctlfile(actrelnm)); status |= ST_DROPPED|ST_NEEDATTN; @@ -56,24 +63,24 @@ actmkindx() /* build actlnps index for active */ } STATIC statust -hashlines() +hashlines(void) { register statust status = ST_OKAY; - register char *pos; + register const char *pos; register unsigned line = 0; - acttbl = hdbmcreate(1000, (unsigned (*)())NULL); + acttbl = hdbmcreate(1000, (unsigned (*)(struct hdbmdatum))NULL); while (pos = actlnps[line], line++ < actlines && pos[0] != '\0') { - register char *sp; + register const char *sp; HDBMDATUM key, data; STRCHR(pos, ' ', sp); if (sp == NULL) continue; /* junk */ key.dat_len = sp - pos; - key.dat_ptr = pos; + key.dat_ptr = (char *)pos; data.dat_len = 0; /* fake */ - data.dat_ptr = pos; + data.dat_ptr = (char *)pos; errno = 0; if (!hdbmstore(acttbl, key, data)) { persistent(NOART, 'f', "can't store active hash item", @@ -86,7 +93,7 @@ hashlines() } STATIC void -freeactive() +freeactive(void) { nnfree(&active); nnafree(&actlnps); @@ -95,8 +102,7 @@ freeactive() } statust -actfload(fp) -FILE *fp; +actfload(FILE *fp) { statust status = ST_OKAY; @@ -146,12 +152,9 @@ FILE *fp; * Thus lnarray should be one bigger than needed to detect overflow. */ int -linescan(s, lnarray, nent) -char *s; -char **lnarray; -register int nent; +linescan(char *s, const char **lnarray, register int nent) { - register char **lnarrp = lnarray; + register const char **lnarrp = lnarray; register int i = 0; register char *nlp = s; @@ -162,9 +165,9 @@ register int nent; return i; /* number of addrs stored */ } +/* write to disk, fp is open */ statust -actfsync(fp) /* write to disk, fp is open */ -FILE *fp; +actfsync(FILE *fp) { statust status = ST_OKAY; @@ -181,10 +184,7 @@ FILE *fp; /* ARGSUSED fp */ char * -actfind(fp, ng, nglen) -FILE *fp; -register char *ng; -register int nglen; +actfind(FILE *fp, register char *ng, register int nglen) { HDBMDATUM key, data; @@ -196,9 +196,7 @@ register int nglen; /* ARGSUSED */ statust -actfwrnum(fp, pos) -FILE *fp; -char *pos; +actfwrnum(FILE *fp, char *pos) { return ST_OKAY; } --- relay/active.h.orig 1991-09-14 08:43:27 UTC +++ relay/active.h @@ -1,8 +1,20 @@ /* imports from active.c */ -extern statust actload(), actsync(); -extern long incartnum(); -extern char *realngname(), *actlook(), *findflag(); -extern boolean isflag(), unwanted(), moderated(); +extern statust actload(void); +extern statust actsync(void); +extern long incartnum(char *ng, int inc); +extern char *realngname(char *ong); +extern char *actlook(register char *ang); +extern char *findflag(register char *ngline); +extern boolean isflag(register char *ngs, int thisflag); +extern boolean unwanted(register char *ngs); +extern boolean moderated(register char *ngs); + +/* imports from active.fast.c, active.slow.c */ +extern statust actfload(FILE *fp); +extern statust actfsync(FILE *fp); +extern statust actfwrnum(FILE *fp, char *pos); +extern char *actfind(FILE *fp, register char *ng, register int nglen); +extern void actread(void); #define nxtartnum(ng) incartnum(ng, 1) #define prevartnum(ng) incartnum(ng, -1) --- include/alloc.h.orig 1992-12-05 04:58:24 UTC +++ include/alloc.h @@ -3,7 +3,18 @@ #ifndef notdef /* stdlib.h declares malloc, realloc */ -extern char *emalloc(), *nemalloc(), *strsave(), *str3save(); + +/* emalloc.c */ +extern char *emalloc(unsigned amount); + +/* nemalloc.c */ +extern char *nemalloc(unsigned size); + +/* strsave.c */ +extern char *strsave(register const char *s); + +/* str3save.c */ +extern char *str3save(const char *s1, const char *s2, const char *s3); #else /* notdef */ /* setup for UT debugging malloc */ #define MALLOC_TRACE --- relay/article.c.orig 1993-03-13 07:19:08 UTC +++ relay/article.c @@ -11,10 +11,11 @@ #include "news.h" #include "headers.h" #include "relay.h" +#include "rerror.h" +#include "io.h" void -artinit(art) -register struct article *art; +artinit(register struct article *art) { static long uniqno = 0; static struct article zart; @@ -26,8 +27,7 @@ register struct article *art; } void -artfree(art) -register struct article *art; +artfree(register struct article *art) { freeheaders(&art->h); /* a_haccum is currently not malloced */ --- libc/ascingmtime.c.orig 1992-07-12 05:38:14 UTC +++ libc/ascingmtime.c @@ -7,18 +7,19 @@ #include #include #include +#include "libc.h" #define HIGH(nn) ((nn) / 10) #define LOW(nn) ((nn) % 10) +/* better be GMT */ char * -ascingmtime(tm) -register struct tm *tm; /* better be GMT */ +ascingmtime(register struct tm *tm) { static char chtime[128]; - static char *days[] = + static const char *days[] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; - static char *months[] = { + static const char *months[] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; --- libc/awksplit.c.orig 1992-10-21 08:59:31 UTC +++ libc/awksplit.c @@ -5,20 +5,21 @@ #include #include #include +#include "libc.h" int /* number of fields, including overflow */ -awksplit(string, fieldsp, nfields, sep) -char *string; -register char ***fieldsp; /* list is not NULL-terminated */ -register int nfields; /* number of entries available in fields[] */ -char *sep; /* "" white, "c" single char, "ab" [ab]+ */ +awksplit( +char *string, +register char ***fieldsp, /* list is not NULL-terminated */ +register int nfields, /* number of entries available in fields[] */ +const char *sep) /* "" white, "c" single char, "ab" [ab]+ */ { register int nf; nf = split(string, *fieldsp, nfields, sep); if (nf > nfields) { /* too many fields to fieldsp? */ register char **array = - (char **)malloc((unsigned)(nf * sizeof(char *))); + (char **)malloc((unsigned)((unsigned)nf * sizeof(char *))); register int i; if (array == NULL) --- batch/batcher.c.orig 1994-11-28 01:14:35 UTC +++ batch/batcher.c @@ -16,23 +16,30 @@ #include #include #include +#include +#include +#include #include "fgetfln.h" +#include "news.h" +/* forwards */ +void procart(register char *article); +void procfile(FILE *list, const char *filename); + #ifndef READSIZE #define READSIZE 8192 /* allows for even 4.2 worst case file systems */ #endif char buffer[READSIZE]; -char *progname; +const char *progname; int debug = 0; /* Debugging? */ char filler[] = "--- Filler to cover I/O error ---\n"; #define NFILL (sizeof(filler)-1) -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c; int errflg = 0; @@ -71,9 +78,8 @@ char *argv[]; /* - procfile - process a file of article names */ -procfile(list, filename) -FILE *list; -char *filename; +void +procfile(FILE *list, const char *filename) { char *article; @@ -89,8 +95,8 @@ char *filename; /* - procart - process an article */ -procart(article) -register char *article; +void +procart(register char *article) { register int artfile; register int count; --- input/bdecode.c.orig 1991-11-04 18:18:39 UTC +++ input/bdecode.c @@ -2,12 +2,17 @@ * bdecode [file] */ #include +#include #include #include "coder.h" -char *myname, *inputfile = "(stdin)"; -main(argc, argv) - char **argv; +/* forwards */ +void fatal(const char *s); + +const char *myname, *inputfile = "(stdin)"; + +int +main(int argc, char **argv) { register long word; register int c, bcount; @@ -110,8 +115,8 @@ main(argc, argv) } } -fatal(s) - char *s; +void +fatal(const char *s) { fprintf(stderr, "%s: %s: %s\n", myname, inputfile, s); exit(2); --- batch/bencode.c.orig 1991-11-04 18:16:50 UTC +++ batch/bencode.c @@ -2,12 +2,13 @@ * bencode [file] */ #include +#include #include "coder.h" #define MAXPERLINE 78 /* max chars/line */ char *myname; -main(argc,argv) - char **argv; +int +main(int argc, char **argv) { register FILE *fin = stdin, *fout = stdout; /* faster in a register */ register int c, bcount, ccount = MAXPERLINE-1; @@ -58,7 +59,7 @@ main(argc,argv) */ if (ccount != MAXPERLINE-1) /* avoid empty lines */ putc('\n', fout); - fprintf(fout, "/%d%x\n", 3-bcount, word); + fprintf(fout, "/%d%lx\n", 3-bcount, word); /* * And finally the byte count and CRC. */ --- libdbz/byteflip.c.orig 1990-05-25 21:03:49 UTC +++ libdbz/byteflip.c @@ -1,10 +1,10 @@ #include +#include #define MAXWORD 32 -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { register int len; int inmap[MAXWORD]; --- input/c7decode.c.orig 1989-02-21 22:57:32 UTC +++ input/c7decode.c @@ -1,4 +1,5 @@ #include +#include /* * This program is the inverse of encode @@ -26,15 +27,20 @@ #define ENDMARK1 ((90*91 + 90) / 91) #define ENDMARK2 ((90*91 + 90) % 91) +/* forwards */ +void pack6bit(register char *p, register int n, int last); +void pack12(register char *p, register int n, int last); + int errcnt = 0; -main() +int +main(int argc, char **argv) { - register c; + register int c; register char *p; - register i; - register first = 1; - register cnt = 0; + register int i; + register int first = 1; + register int cnt = 0; char b12[12]; char c12[12]; @@ -88,18 +94,16 @@ main() static char b4[4]; static int cnt = 0; -pack12(p, n, last) - register char *p; - register n; - int last; +void +pack12(register char *p, register int n, int last) { - register i; + register int i; register char *q; char b13[13]; { - register c; - register c13; + register int c; + register int c13; q = b13; c13 = 0; @@ -155,13 +159,11 @@ pack12(p, n, last) cnt = i; } -pack6bit(p, n, last) - register char *p; - register int n; - int last; +void +pack6bit(register char *p, register int n, int last) { register char *q; - register i = 3; + register int i = 3; char b3[3]; if (last) { --- batch/c7encode.c.orig 1989-02-21 00:04:56 UTC +++ batch/c7encode.c @@ -1,4 +1,5 @@ #include +#include #ifdef SCCSID static char *SccsId = "@(#)encode.c 1.3 5/15/85"; @@ -46,11 +47,17 @@ static char *SccsId = "@(#)encode.c 1.3 5/15/85"; #define ENDMARK1 ((90*91 + 90) / 91 + ' ') #define ENDMARK2 ((90*91 + 90) % 91 + ' ') -main() +/* forwards */ +void encode(register char *c, int n); +void flushout(void); +void dumpcode(register char *p, register int n); + +int +main(int argc, char **argv) { register char *p; register char *e; - register c; + register int c; char b3[3]; p = b3; @@ -70,13 +77,12 @@ main() static char b13[13]; static int cnt = 0; -encode(c, n) - register char *c; - int n; +void +encode(register char *c, int n) { register char *p; - register i = cnt; - register j; + register int i = cnt; + register int j; char b4[4]; p = b4; @@ -101,7 +107,8 @@ encode(c, n) cnt = i; } -flushout() +void +flushout(void) { putchar(ENDMARK1); putchar(ENDMARK2); @@ -109,12 +116,11 @@ flushout() dumpcode(b13, cnt); } -dumpcode(p, n) - register char *p; - register int n; +void +dumpcode(register char *p, register int n) { - register last; - register c; + register int last; + register int c; if (n == 13) n--, last = p[12]; --- relay/caches.h.orig 1989-05-26 07:50:55 UTC +++ relay/caches.h @@ -1,2 +1,2 @@ /* imports from caches.c */ -extern statust loadcaches(), synccaches(); +extern statust synccaches(void); --- util/canonhdr.c.orig 1995-04-28 00:51:38 UTC +++ util/canonhdr.c @@ -11,19 +11,14 @@ #include #include #include +#include #include "news.h" #include "libc.h" /* imports */ -extern int optind; -extern char *optarg; -extern FILE *efopen(); -extern char *strsave(), *str3save(); -extern char *ascingmtime(); -extern time_t getabsdate(); /* exports */ -char *progname; +const char *progname; int debug; /* privates */ @@ -31,14 +26,16 @@ static int convdates = 0; static int convhdrs = 0; /* forwards */ -char *mailtonews(), *canondate(); +char *mailtonews(char *hdr); +char *canondate(const char *hdr, const char *vulgdate); +int nonnull(char *s); +void process(FILE *in, const char *inname); /* * main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c, errflg = 0; @@ -79,9 +76,8 @@ char *argv[]; /* * process - process input file */ -process(in, inname) -FILE *in; -char *inname; +void +process(FILE *in, const char *inname) { register char *hdr, *nhdr; int ishdr = YES; @@ -144,8 +140,7 @@ char *inname; } int -nonnull(s) -char *s; +nonnull(char *s) { register char *nwp = skipsp(s); @@ -153,8 +148,7 @@ char *s; } char * /* malloced */ -mailtonews(hdr) -char *hdr; +mailtonews(char *hdr) { register char *p; @@ -179,8 +173,7 @@ char *hdr; } char * /* ascii Internet format of GMT */ -canondate(hdr, vulgdate) -char *hdr, *vulgdate; +canondate(const char *hdr, const char *vulgdate) { time_t date; char *copydate; --- libcnews/case.c.orig 1989-10-30 21:59:03 UTC +++ libcnews/case.c @@ -24,7 +24,7 @@ static int primed = 0; /* has casemap been set up? */ - prime - set up case-mapping stuff */ static void -prime() +prime(void) { register char *lp; register char *up; @@ -48,10 +48,7 @@ prime() - cistrncmp - case-independent strncmp */ int /* < == > 0 */ -cistrncmp(s1, s2, len) -char *s1; -char *s2; -int len; +cistrncmp(char *s1, char *s2, int len) { register char *p1; register char *p2; @@ -98,11 +95,11 @@ int len; * Forget it; none of them would come near it.) */ char * /* returns the argument */ -rfc822ize(s) -char *s; +rfc822ize(char *s) { register char *p; static char post[] = "postmaster"; + static char empty[] = ""; static int postlen = sizeof(post)-1; if (!primed) @@ -110,7 +107,7 @@ char *s; p = strrchr(s, '@'); if (p == NULL) /* no local/domain split */ - p = ""; /* assume all local */ + p = empty; /* assume all local */ else if (p - (s+1) == postlen && CISTREQN(s+1, post, postlen)) { /* crazy special case -- "postmaster" is case-insensitive */ p = s; --- include/case.h.orig 1992-06-18 04:32:05 UTC +++ include/case.h @@ -1,5 +1,7 @@ -extern int cistrncmp(); -extern char *rfc822ize(); + +/* case.c */ +extern int cistrncmp(char *s1, char *s2, int len); +extern char *rfc822ize(char *s); extern char casemap[]; --- libc/cfgetln.c.orig 1993-09-12 01:52:44 UTC +++ libc/cfgetln.c @@ -6,6 +6,7 @@ */ #include +#include #include #include #include "news.h" @@ -14,10 +15,10 @@ #define CONTCHAR '\\' char * -csfgetln(fp, limit, skipflag) -FILE *fp; -register int limit; -int skipflag; /* skip leading whitespace on continuations? */ +csfgetln( +FILE *fp, +register int limit, +int skipflag) /* skip leading whitespace on continuations? */ { register char *line, *contlin, *oldline; int length = 0, contleng = 0; --- libc/closeall.c.orig 1994-03-24 22:12:28 UTC +++ libc/closeall.c @@ -1,5 +1,8 @@ +#include #include #include +#include +#include "news.h" /* if NOFILE wasn't defined in sys/param.h, try for sysconf()... */ #ifndef NOFILE @@ -8,8 +11,7 @@ #endif void -closeall(leavestd) -int leavestd; +closeall(int leavestd) { register int i; register int openmax = NOFILE; --- libcnews/complain.c.orig 1987-06-26 00:09:22 UTC +++ libcnews/complain.c @@ -1,15 +1,13 @@ #include +#include +#include "news.h" /* - complain - lodge a complaint */ void -complain(s1, s2) -char *s1; -char *s2; +complain(const char *s1, const char *s2) { - extern char *progname; - (void) fprintf(stderr, "%s: ", progname); (void) fprintf(stderr, s1, s2); (void) putc('\n', stderr); --- libcnews/config.c.orig 1994-08-17 04:50:38 UTC +++ libcnews/config.c @@ -4,6 +4,8 @@ #include #include +#include +#include #include "libc.h" #include "news.h" #include "config.h" @@ -34,20 +36,19 @@ #endif #ifndef NEWSCONFIG /* =()<#define NEWSCONFIG "@@">()= */ #define NEWSCONFIG "/etc/news/bin/config" #endif static char *pwd = NULL; /* Current directory, NULL means unknown. */ static int dirsset = NO; /* Have the following been set up? */ -static char *arts = NEWSARTS; -static char *bin = NEWSBIN; -static char *ctl = NEWSCTL; -static char *path = NEWSPATH; +static const char *arts = NEWSARTS; +static const char *bin = NEWSBIN; +static const char *ctl = NEWSCTL; +static const char *path = NEWSPATH; static int numask = NEWSUMASK; -static char *nconfig = NEWSCONFIG; +static const char *nconfig = NEWSCONFIG; #define DIRS() if (!dirsset) setdirs() -extern char *getenv(); /* - setdirs - set up stuff from environment, for use by other functions @@ -55,7 +56,7 @@ extern char *getenv(); * Invokes user-supplied function unprivileged() if non-standard values used. */ static void -setdirs() +setdirs(void) { register char *p; register int mask; @@ -118,9 +119,8 @@ setdirs() /* - artfile - best pathname for a file in NEWSARTS */ -char * -artfile(base) -char *base; +const char * +artfile(const char *base) { static char *artf = NULL; @@ -142,11 +142,10 @@ char *base; /* - fullartfile - full pathname for a file in NEWSARTS */ -char * -fullartfile(base) -char *base; +const char * +fullartfile(const char *base) { - register char *p; + register const char *p; register char *pwdsave; pwdsave = pwd; @@ -159,9 +158,8 @@ char *base; /* - ctlfile - full pathname for a file in NEWSCTL */ -char * -ctlfile(base) -char *base; +const char * +ctlfile(const char *base) { static char *ctlf = NULL; @@ -182,9 +180,8 @@ char *base; /* - binfile - full pathname for a file in NEWSBIN */ -char * -binfile(base) -char *base; +const char * +binfile(const char *base) { static char *binf = NULL; @@ -206,8 +203,7 @@ char *base; - cd - change to a directory, with checking */ void -cd(dir) -char *dir; +cd(const char *dir) { if (pwd != NULL) free(pwd); @@ -219,8 +215,8 @@ char *dir; /* - newspath - search path for normal system commands */ -char * -newspath() +const char * +newspath(void) { DIRS(); return(path); @@ -230,7 +226,7 @@ newspath() - newsumask - suitable value of umask for news stuff */ int -newsumask() +newsumask(void) { DIRS(); return(numask); --- include/config.h.orig 1994-08-23 04:45:21 UTC +++ include/config.h @@ -2,13 +2,13 @@ * configuration-inquiry functions */ -extern char *artfile(); /* article pathname, may be relative */ -extern char *fullartfile(); /* article full pathname */ -extern char *ctlfile(); /* control-file name */ -extern char *binfile(); /* program pathname */ -extern char *newspath(); /* PATH */ -extern int newsumask(); /* umask */ +extern const char *artfile(const char *base); /* article pathname, may be relative */ +extern const char *fullartfile(const char *base); /* article full pathname */ +extern const char *ctlfile(const char *base); /* control-file name */ +extern const char *binfile(const char *base); /* program pathname */ +extern const char *newspath(void); /* PATH */ +extern int newsumask(void); /* umask */ -extern void cd(); /* chdir() with errunlock() on failure */ +extern void cd(const char *dir); /* chdir() with errunlock() on failure */ -extern void unprivileged(); /* user-supplied privilege dropper */ +extern void unprivileged(const char *reason); /* user-supplied privilege dropper */ --- relay/control.c.orig 1994-09-08 19:42:09 UTC +++ relay/control.c @@ -26,11 +26,13 @@ #include #include +#include #include #include #include #include "fixerrno.h" #include +#include #include "libc.h" #include "news.h" @@ -40,6 +42,8 @@ #include "relay.h" #include "active.h" #include "history.h" +#include "rerror.h" +#include "control.h" #define DEFMSGIDS 10 /* default msgids for awksplit */ @@ -53,8 +57,6 @@ #define SHELLMETAS "\\<>|^&;\n({$=*?[`'\"/" /* imports from news */ -extern statust snufffiles(); -extern void ihave(), sendme(); /* * In theory (RFC 1036 nee 850), we should verify that the user issuing the @@ -76,8 +78,7 @@ extern void ihave(), sendme(); * rejected as a duplicate. */ STATIC statust -cancelart(msgidstr) -char *msgidstr; +cancelart(char *msgidstr) { register char *msgid = strsave(msgidstr); register statust status = ST_OKAY; @@ -99,8 +100,7 @@ char *msgidstr; } STATIC statust -cancel(msgids) -char *msgids; +cancel(char *msgids) { register int msgidcnt, i; register statust status = ST_OKAY; @@ -129,9 +129,7 @@ char *msgids; */ /* ARGSUSED cmdstat */ STATIC void -bombctlmsg(cmd, cmdstat) -char *cmd; -int cmdstat; +bombctlmsg(char *cmd, int cmdstat) { register char *mailcmd; @@ -164,11 +162,11 @@ int cmdstat; _exit(1); } +/* true if it's safe to system(3) cmd */ boolean -safecmd(cmd) /* true if it's safe to system(3) cmd */ -register char *cmd; +safecmd(register char *cmd) { - register char *s; + register const char *s; for (s = cmd; *s != '\0'; s++) if (STREQN(s, "..", STRLEN(".."))) @@ -188,10 +186,11 @@ register char *cmd; * Enforce at least minimal security: the environment was standardised at * startup, including PATH and IFS; close non-standard file descriptors; * reject shell metacharacters in ctlcmd. + * + * child process */ STATIC void -runctlmsg(ctlcmd, inname) /* child process */ -register char *ctlcmd, *inname; +runctlmsg(register char *ctlcmd, register char *inname) { register char *cmd, *s1, *s2, *s3; register int cmdstat; @@ -221,9 +220,7 @@ register char *ctlcmd, *inname; } STATIC boolean -ismsgnamed(line, msg) -register char *line; -register char *msg; +ismsgnamed(register char *line, register char *msg) { register int msglen = strlen(msg); @@ -243,8 +240,7 @@ register char *msg; * in environment, as NEWS* variables, to save time in the scripts. */ void -ctlmsg(art) -register struct article *art; +ctlmsg(register struct article *art) { register char *inname = art->a_tmpf, *ctlcmd = art->h.h_ctlcmd; int pid, deadpid; @@ -305,8 +301,7 @@ register struct article *art; } char * -hackhybrid(line) -register char *line; +hackhybrid(register char *line) { static char stupersedes[] = "Supersedes:"; static char alsocan[] = "Also-Control: cancel "; --- relay/control.h.orig 1989-11-28 00:47:53 UTC +++ relay/control.h @@ -1,5 +1,27 @@ /* imports from control.c */ -extern void ctlmsg(); -extern char *hackhybrid(); +extern void ctlmsg(struct article *art); +extern char *hackhybrid(register char *line); +extern boolean safecmd(register char *cmd); + +/* imports from ihave.c */ +extern void ihave(char *args, struct article *art); +extern void sendme(char *args, struct article *art); + +/* imports from procart.c */ +extern statust snufffiles(char *filelist); +extern void uninsart(register struct article *art); +extern void prefuse(register struct article *art); +extern void reject(register struct article *art); +extern char *hdrcopy(register struct article *art, FILE *in); +extern void surveydamage(register struct article *art, register boolean *installedp); +extern statust cpinsart(FILE *in, register const char *inname, long maxima, boolean blvmax); + +/* imports from hdrmunge.c */ +extern statust clshdrstrm(void); + + +/* imports from hdrparse.c */ +//extern int hdrparse(register struct headers *hdrs, char *line, hdrlist hdrlst); + #define CONTROL "control" /* control message pseudo-ng. */ --- util/ctime.c.orig 1994-10-18 03:49:54 UTC +++ util/ctime.c @@ -7,17 +7,14 @@ #include #include #include +#include +#include +#include "libc.h" /* imports */ -extern char *ctime(), *asctime(); -extern struct tm *gmtime(); -extern time_t time(); -extern char *ascingmtime(); /* Forwards. */ -extern void process(); -extern int optind; -extern char *optarg; +void process(char *tms); char *progname; @@ -28,9 +25,8 @@ static int inetfmt = 0; /* - main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { register int c, errflg = 0; @@ -65,8 +61,7 @@ char *argv[]; * process - print time_t of tm */ void -process(tms) -char *tms; +process(char *tms) { time_t tm; --- libc/dateabstoks.c.orig 1992-11-06 07:55:42 UTC +++ libc/dateabstoks.c @@ -6,6 +6,7 @@ #include #include #include /* for dateconv.h */ +#include #include "dateconv.h" #include "datetok.h" @@ -210,9 +211,7 @@ datetkn dateabstoks[] = { static unsigned szdateabstoks = sizeof dateabstoks / sizeof dateabstoks[0]; datetkn * -datetoktype(s, bigvalp) -char *s; -int *bigvalp; +datetoktype(char *s, int *bigvalp) { register char *cp = s; register char c = *cp; @@ -267,10 +266,10 @@ int *bigvalp; * is WAY faster than the generic bsearch(). */ datetkn * -datebsearch(key, base, nel) -register char *key; -register datetkn *base; -unsigned int nel; +datebsearch( +register char *key, +register datetkn *base, +unsigned int nel) { register datetkn *last = base + nel - 1, *position; register int result; --- libc/dateconv.c.orig 1992-11-18 18:15:17 UTC +++ libc/dateconv.c @@ -5,15 +5,16 @@ #include #include #include +#include "dateconv.h" /* imports */ -extern time_t qmktime(); +/* forwards */ +static int validtm(register struct tm *tm); + /* turn a (struct tm) and a few variables into a time_t, with range checking */ time_t -dateconv(tm, zone) -register struct tm *tm; -int zone; +dateconv(register struct tm *tm, int zone) { tm->tm_wday = tm->tm_yday = 0; @@ -31,9 +32,8 @@ int zone; return qmktime(tm); } -int -validtm(tm) -register struct tm *tm; +static int +validtm(register struct tm *tm) { if (tm->tm_year < 0 || tm->tm_mon < 0 || tm->tm_mon > 11 || tm->tm_mday < 1 || tm->tm_hour < 0 || tm->tm_hour >= 24 || --- libc/dateconv.h.orig 1991-02-26 12:22:32 UTC +++ libc/dateconv.h @@ -1,6 +1,8 @@ /* interface to dateconv() */ -extern time_t dateconv(); +extern time_t dateconv(register struct tm *tm, int zone); +extern int tryabsdate(char *fields[], int nf, struct timeb *now, register struct tm *, int *tzp); +extern time_t qmktime(register struct tm *tp); /* * Meridian: am, pm, or 24-hour style. --- libc/datetok.h.orig 1992-11-06 08:41:13 UTC +++ libc/datetok.h @@ -59,7 +59,7 @@ typedef struct { char value; /* this may be unsigned, alas */ } datetkn; -extern datetkn *datetoktype(/* char *s */); -extern datetkn *datebsearch(/* char *key, datetkn *base, unsigned int nel */); +extern datetkn *datetoktype(char *s, int *bigvalp); +extern datetkn *datebsearch(register char *key, register datetkn *base, unsigned int nel); #endif /* DATETOK_H__ */ /* Do not add anything after this line */ --- libdbz/dbz.c.orig 1995-04-28 00:51:10 UTC +++ libdbz/dbz.c @@ -205,11 +205,11 @@ struct dbzconfig { of_t ntagless[NUSEDS]; /* how many entries went tagless today, ... */ }; static struct dbzconfig conf; -static int getconf(); -static long getno(); -static int putconf(); -static void mybytemap(); -static of_t bytemap(); +static int getconf(register FILE *df, register FILE *pf, register struct dbzconfig *cp); +static long getno(FILE *f, int *ep); +static int putconf(register FILE *f, register struct dbzconfig *cp); +static void mybytemap(int map[]); +static of_t bytemap(of_t ino, int *map1, int *map2); /* * For a program that makes many, many references to the database, it @@ -276,7 +276,7 @@ static char basebuf[SHISTBUF]; /* only needed if _IOF * bits on the descriptor. The callback routine gets a FILE * as its * parameter, and must not mess with it in dbz-visible ways. */ -static void (*callback)() = NULL; +static void (*callback)(FILE *) = NULL; /* * Data structure for recording info about searches. @@ -293,12 +293,12 @@ struct searcher { int seen; /* have we examined current location? */ int aborted; /* has i/o error aborted search? */ }; -static void start(); +static void start(register struct searcher *sp, register datum *kp, register struct searcher *osp); #define FRESH ((struct searcher *)NULL) -static of_t search(); +static of_t search(register struct searcher *sp); #define NOTFOUND ((of_t)-1) -static int okayvalue(); -static int set(); +static int okayvalue(of_t value); +static int set(register struct searcher *sp, of_t value); /* * Arguably the searcher struct for a given routine ought to be local to @@ -331,17 +331,17 @@ static int debug; /* controlled by dbzdebug() */ #endif /* misc. forwards */ -static long hash(); -static void crcinit(); -static char *cipoint(); -static char *mapcase(); -static int isprime(); -static FILE *latebase(); +static long hash(register char *name, register int size); +static void crcinit(void); +static char *cipoint(char *s, size_t siz); +static char *mapcase(char *dst, char *src, size_t siz); +static int isprime(register long x); +static FILE *latebase(void); /* file-naming stuff */ static char dir[] = ".dir"; static char pag[] = ".pag"; -static char *enstring(); +static char *enstring(char *s1, char *s2); /* central data structures */ static FILE *basef; /* descriptor for base file */ @@ -353,20 +353,20 @@ static of_t pagpos; /* posn in pagf; only search may static int pagronly; /* pagf open read-only? */ static of_t *corepag; /* incore version of .pag file, if any */ static FILE *bufpagf; /* well-buffered pagf, for incore rewrite */ -static of_t *getcore(); -static int putcore(); +static of_t *getcore(FILE *f); +static int putcore(of_t *tab, FILE *f); static int written; /* has a store() been done? */ /* - dbzfresh - set up a new database, no historical info */ int /* 0 success, -1 failure */ -dbzfresh(name, size, fs, cmap, tagmask) -char *name; /* base name; .dir and .pag must exist */ -long size; /* table size (0 means default) */ -int fs; /* field-separator character in base file */ -int cmap; /* case-map algorithm (0 means default) */ -of_t tagmask; /* 0 default, 1 no tags */ +dbzfresh( +char *name, /* base name; .dir and .pag must exist */ +long size, /* table size (0 means default) */ +int fs, /* field-separator character in base file */ +int cmap, /* case-map algorithm (0 means default) */ +of_t tagmask) /* 0 default, 1 no tags */ { register char *fn; struct dbzconfig c; @@ -470,8 +470,8 @@ of_t tagmask; /* 0 default, 1 no tags */ - dbzsize - what's a good table size to hold this many entries? */ long -dbzsize(contents) -long contents; /* 0 means what's the default */ +dbzsize( +long contents) /* 0 means what's the default */ { register long n; @@ -496,8 +496,7 @@ long contents; /* 0 means what's the default */ * This is not a terribly efficient approach. */ static int /* predicate */ -isprime(x) -register long x; +isprime(register long x) { static int quick[] = { 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 0 }; register int *ip; @@ -531,8 +530,7 @@ register long x; * This assumes that TAGENB is the high-order bit of a long. */ long -dbztagmask(filesize) -register long filesize; +dbztagmask(register long filesize) { register long m; register int nbits; @@ -565,9 +563,9 @@ register long filesize; - dbzagain - set up a new database to be a rebuild of an old one */ int /* 0 success, -1 failure */ -dbzagain(name, oldname) -char *name; /* base name; .dir and .pag must exist */ -char *oldname; /* base name; all must exist */ +dbzagain( +const char *name, /* base name; .dir and .pag must exist */ +const char *oldname) /* base name; all must exist */ { register char *fn; struct dbzconfig c; @@ -677,8 +675,7 @@ char *oldname; /* base name; all must exist */ * functions permit this, since many people consult it if dbzdbminit() fails. */ int /* 0 success, -1 failure */ -dbzdbminit(name) -char *name; +dbzdbminit(const char *name) { register int i; register size_t s; @@ -815,9 +812,7 @@ char *name; - enstring - concatenate two strings into a malloced area */ static char * /* NULL if malloc fails */ -enstring(s1, s2) -char *s1; -char *s2; +enstring(char *s1, char *s2) { register char *p; @@ -835,7 +830,7 @@ char *s2; - dbzdbmclose - close a database */ int -dbzdbmclose() +dbzdbmclose(void) { register int ret = 0; @@ -879,7 +874,7 @@ dbzdbmclose() - dbzsync - push all in-core data out to disk */ int -dbzsync() +dbzsync(void) { register int ret = 0; @@ -911,7 +906,7 @@ dbzsync() * always fflush them immediately anyway and so they never have stale data. */ int -dbzcancel() +dbzcancel(void) { if (pagf == NULL) { DEBUG(("dbzcancel: not opened!\n")); @@ -926,8 +921,7 @@ dbzcancel() - dbzfetch - fetch() with case mapping built in */ datum -dbzfetch(key) -datum key; +dbzfetch(datum key) { char buffer[DBZMAXKEY + 1]; datum mappedkey; @@ -957,8 +951,7 @@ datum key; * part of the comparison against the stored keys. */ datum /* dptr NULL, dsize 0 means failure */ -dbzdbmfetch(key) -datum key; +dbzdbmfetch(datum key) { char buffer[DBZMAXKEY + 1]; static of_t key_ptr; /* return value points here */ @@ -1011,7 +1004,7 @@ datum key; /* try it */ buffer[keysize] = '\0'; /* terminated for DEBUG */ (void) mapcase(buffer, buffer, keysize); - DEBUG(("dbzdbmfetch: buffer (%s) looking for (%s) size = %d\n", + DEBUG(("dbzdbmfetch: buffer (%s) looking for (%s) size = %ld\n", buffer, key.dptr, keysize)); if (memcmp(key.dptr, buffer, cmplen) == 0 && (*sepp == conf.fieldsep || *sepp == '\0')) { @@ -1033,7 +1026,7 @@ datum key; - latebase - try to open a base file that wasn't there at the start */ static FILE * -latebase() +latebase(void) { register FILE *it; @@ -1061,9 +1054,7 @@ latebase() - dbzstore - store() with case mapping built in */ int -dbzstore(key, data) -datum key; -datum data; +dbzstore(datum key, datum data) { char buffer[DBZMAXKEY + 1]; datum mappedkey; @@ -1089,9 +1080,7 @@ datum data; - dbzdbmstore - add an entry to the database */ int /* 0 success, -1 failure */ -dbzdbmstore(key, data) -datum key; -datum data; +dbzdbmstore(datum key, datum data) { of_t value; @@ -1140,8 +1129,7 @@ datum data; - dbzincore - control attempts to keep .pag file in core */ int /* old setting */ -dbzincore(value) -int value; +dbzincore(int value) { register int old = incore; @@ -1153,8 +1141,7 @@ int value; - dbzwritethrough - enable/disable immediate writing to disk of in-core writes */ int /* old setting */ -dbzwritethrough(value) -int value; +dbzwritethrough(int value) { register int old = writethrough; @@ -1165,12 +1152,11 @@ int value; /* - dbzfiledesc - provide hook for doing obscene things to file descriptors */ -typedef void (*fp)(); -fp -dbzfiledesc(diddler) -void (*diddler)(); /* NULL means do nothing */ +dbfuncp +dbzfiledesc( +void (*diddler)(FILE *)) /* NULL means do nothing */ { - register void (*old)() = callback; + register void (*old)(FILE *) = callback; callback = diddler; return(old); @@ -1180,10 +1166,10 @@ void (*diddler)(); /* NULL means do nothing */ - getconf - get configuration from .dir file */ static int /* 0 success, -1 failure */ -getconf(df, pf, cp) -register FILE *df; /* NULL means just give me the default */ -register FILE *pf; /* NULL means don't care about .pag */ -register struct dbzconfig *cp; +getconf( +register FILE *df, /* NULL means just give me the default */ +register FILE *pf, /* NULL means don't care about .pag */ +register struct dbzconfig *cp) { register int c; register int i; @@ -1276,9 +1262,7 @@ register struct dbzconfig *cp; - getno - get a long */ static long -getno(f, ep) -FILE *f; -int *ep; +getno(FILE *f, int *ep) { register char *p; # define MAXN 50 @@ -1315,9 +1299,7 @@ int *ep; - putconf - write configuration to .dir file */ static int /* 0 success, -1 failure */ -putconf(f, cp) -register FILE *f; -register struct dbzconfig *cp; +putconf(register FILE *f, register struct dbzconfig *cp) { register int i; register int ret = 0; @@ -1349,8 +1331,7 @@ register struct dbzconfig *cp; - getcore - try to set up an in-core copy of .pag file */ static of_t * /* pointer to copy, or NULL */ -getcore(f) -FILE *f; +getcore(FILE *f) { register of_t *p; register size_t i; @@ -1382,9 +1363,7 @@ FILE *f; - putcore - try to rewrite an in-core table */ static int /* 0 okay, -1 fail */ -putcore(tab, f) -of_t *tab; -FILE *f; +putcore(of_t *tab, FILE *f) { if (fseek(f, (of_t)0, SEEK_SET) != 0) { DEBUG(("fseek failure in putcore\n")); @@ -1399,10 +1378,10 @@ FILE *f; - start - set up to start or restart a search */ static void -start(sp, kp, osp) -register struct searcher *sp; -register datum *kp; -register struct searcher *osp; /* may be FRESH, i.e. NULL */ +start( +register struct searcher *sp, +register datum *kp, +register struct searcher *osp) /* may be FRESH, i.e. NULL */ { register long h; @@ -1427,8 +1406,7 @@ register struct searcher *osp; /* may be FRESH, i.e. - search - conduct part of a search */ static of_t /* NOTFOUND if we hit VACANT or error */ -search(sp) -register struct searcher *sp; +search(register struct searcher *sp) { register of_t dest; register of_t value; @@ -1511,8 +1489,7 @@ register struct searcher *sp; - okayvalue - check that a value can be stored */ static int /* predicate */ -okayvalue(value) -of_t value; +okayvalue(of_t value) { if (HASTAG(value)) return(0); @@ -1527,9 +1504,7 @@ of_t value; - set - store a value into a location previously found by search */ static int /* 0 success, -1 failure */ -set(sp, value) -register struct searcher *sp; -of_t value; +set(register struct searcher *sp, of_t value) { register of_t place = sp->place; register of_t v = value; @@ -1590,8 +1565,8 @@ of_t value; * is the byte number of the high-order byte in my of_t, and so forth. */ static void -mybytemap(map) -int map[]; /* -> int[SOF] */ +mybytemap( +int map[]) /* -> int[SOF] */ { union { of_t o; @@ -1624,10 +1599,7 @@ int map[]; /* -> int[SOF] */ - bytemap - transform an of_t from byte ordering map1 to map2 */ static of_t /* transformed result */ -bytemap(ino, map1, map2) -of_t ino; -int *map1; -int *map2; +bytemap(of_t ino, int *map1, int *map2) { union oc { of_t o; @@ -1675,7 +1647,7 @@ static long CrcTable[128]; - crcinit - initialize tables for hash function */ static void -crcinit() +crcinit(void) { register int i, j; register long sum; @@ -1694,9 +1666,7 @@ crcinit() - hash - Honeyman's nice hashing function */ static long -hash(name, size) -register char *name; -register int size; +hash(register char *name, register int size) { register long sum = 0L; @@ -1740,7 +1710,7 @@ static int mprimed = 0; /* has cmap been set up? */ - mapprime - set up case-mapping stuff */ static void -mapprime() +mapprime(void) { register char *lp; register char *up; @@ -1764,10 +1734,7 @@ mapprime() - casencmp - case-independent strncmp */ static int /* < == > 0 */ -casencmp(s1, s2, len) -char *s1; -char *s2; -int len; +casencmp(char *s1, char *s2, int len) { register char *p1; register char *p2; @@ -1805,10 +1772,10 @@ int len; - mapcase - do case-mapped copy */ static char * /* returns src or dst */ -mapcase(dst, src, siz) -char *dst; /* destination, used only if mapping needed */ -char *src; /* source; src == dst is legal */ -size_t siz; +mapcase( +char *dst, /* destination, used only if mapping needed */ +char *src, /* source; src == dst is legal */ +size_t siz) { register char *s; register char *d; @@ -1847,9 +1814,7 @@ size_t siz; * Forget it; none of them would come near it.) */ static char * /* pointer into s, or NULL for "nowhere" */ -cipoint(s, siz) -char *s; -size_t siz; +cipoint(char *s, size_t siz) { register char *p; static char post[] = "postmaster"; @@ -1882,8 +1847,7 @@ size_t siz; - dbzdebug - control dbz debugging at run time */ int /* old value */ -dbzdebug(value) -int value; +dbzdebug(int value) { #ifdef DBZDEBUG register int old = debug; --- libdbz/dbz.h.orig 1994-08-24 16:37:33 UTC +++ libdbz/dbz.h @@ -5,31 +5,29 @@ typedef struct { } datum; /* standard dbm functions */ -extern int dbminit(); -extern datum fetch(); -extern int store(); -extern int delete(); /* not in dbz */ -extern datum firstkey(); /* not in dbz */ -extern datum nextkey(); /* not in dbz */ -extern int dbmclose(); /* in dbz, but not in old dbm */ +extern int dbminit(char *name); +extern datum fetch(datum key); +extern int store(datum key, datum data); +extern int dbmclose(void); /* in dbz, but not in old dbm */ /* new stuff for dbz */ -extern int dbzdbminit(); -extern datum dbzdbmfetch(); -extern int dbzdbmstore(); -extern int dbzdbmclose(); -extern int dbzfresh(); -extern int dbzagain(); -extern datum dbzfetch(); -extern int dbzstore(); -extern int dbzsync(); -extern long dbzsize(); -extern long dbztagmask(); -extern int dbzincore(); -extern int dbzwritethrough(); -extern void (*dbzfiledesc())(); -extern int dbzcancel(); -extern int dbzdebug(); +extern int dbzdbminit(const char *name); +extern datum dbzdbmfetch(datum key); +extern int dbzdbmstore(datum key, datum data); +extern int dbzdbmclose(void); +extern int dbzfresh(char *name, long size, int fs, int cmap, long tagmask); +extern int dbzagain(const char *name, const char *oldname); +extern datum dbzfetch(datum key); +extern int dbzstore(datum key, datum data); +extern int dbzsync(void); +extern long dbzsize(long contents); +extern long dbztagmask(register long filesize); +extern int dbzincore(int value); +extern int dbzwritethrough(int value); +typedef void (*dbfuncp)(FILE *); +extern dbfuncp dbzfiledesc(void (*diddler)(FILE *)); +extern int dbzcancel(void); +extern int dbzdebug(int value); /* * In principle we could handle unlimited-length keys by operating a chunk --- libdbz/dbzdbm.c.orig 1993-05-27 20:21:56 UTC +++ libdbz/dbzdbm.c @@ -2,14 +2,14 @@ * dbm emulation on top of dbz */ +#include #include /* - dbminit - open a database, creating it (using defaults) if necessary */ int /* 0 success, -1 failure */ -dbminit(name) -char *name; +dbminit(char *name) { return(dbzdbminit(name)); } @@ -18,7 +18,7 @@ char *name; - dbmclose - close a database */ int -dbmclose() +dbmclose(void) { return(dbzdbmclose()); } @@ -27,8 +27,7 @@ dbmclose() - fetch - get an entry from the database */ datum /* dptr NULL, dsize 0 means failure */ -fetch(key) -datum key; +fetch(datum key) { return(dbzdbmfetch(key)); } @@ -37,9 +36,7 @@ datum key; - store - add an entry to the database */ int /* 0 success, -1 failure */ -store(key, data) -datum key; -datum data; +store(datum key, datum data) { return(dbzdbmstore(key, data)); } --- libdbz/dbzmain.c.orig 1995-04-28 01:12:17 UTC +++ libdbz/dbzmain.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #ifdef FUNNYSEEKS #include @@ -25,17 +27,16 @@ static char RCSid[] = "$Header$"; char *progname; -char *inname = "(no file)"; /* filename for messages etc. */ +const char *inname = "(no file)"; /* filename for messages etc. */ long lineno; /* line number for messages etc. */ char *base_name; char *pagname; char *dir_name; -char *str2dup(); FILE *base; int op = 'b'; /* what to do, default build a new table */ -char *badop = "only one of -a -x -c -m -v can be given"; +const char *badop = "only one of -a -x -c -m -v can be given"; int baseinput = 1; /* is the base file also the input? */ char *from = NULL; /* old table to use for dbzagain() */ @@ -67,20 +68,22 @@ char *line = lbuf; char cbuf[DEFBUF]; char *cmp = cbuf; -void fail(); -void dofile(); -void runs(); -void dosweep(); -void verify(); -void mkfiles(); -void crfile(); -void doline(); -void process(); -datum dofetch(); -int dostore(); +/* forwards */ +char *str2dup(const char *s1, const char *s2); +void fail(const char *s1, const char *s2); +void dofile(char *name); +void runs(char *file); +void dosweep(const char *fn, const char *pn); +void verify(char *dir); +void mkfiles(void); +void crfile(char *name); +void doline(char *lp, long inoffset); +void process(FILE *in, const char *name); +datum dofetch(datum key); +int dostore(datum key, datum value); #ifdef HAVERFCIZE -extern char *rfc822ize(); +#include "case.h" #else #define rfc822ize(n) (n) #endif @@ -88,9 +91,8 @@ extern char *rfc822ize(); /* - main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c; int errflg = 0; @@ -258,8 +260,7 @@ char *argv[]; - verify - just check whether the .dir file looks right or not */ void /* does not return */ -verify(dir) -char *dir; +verify(char *dir) { FILE *f; char buf[4]; @@ -282,8 +283,7 @@ char *dir; - dofile - open a file and invoke process() */ void -dofile(name) -char *name; +dofile(char *name) { register FILE *in; @@ -302,7 +302,7 @@ char *name; - mkfiles - create empty files and open them up */ void -mkfiles() +mkfiles(void) { if (op == 'b' && !dbzint) { crfile(dir_name); @@ -334,8 +334,7 @@ mkfiles() - crfile - create a file */ void -crfile(name) -char *name; +crfile(char *name) { register int f; @@ -349,9 +348,7 @@ char *name; - process - process input file */ void -process(in, name) -FILE *in; -char *name; +process(FILE *in, const char *name) { register long place; @@ -377,9 +374,7 @@ char *name; - doline - process input line */ void -doline(lp, inoffset) -char *lp; -long inoffset; +doline(char *lp, long inoffset) { register char *p; register char pc; @@ -474,8 +469,7 @@ long inoffset; - runs - print run statistics */ void -runs(file) -char *file; +runs(char *file) { register FILE *fd; long it; @@ -500,9 +494,7 @@ char *file; - dosweep - sweep pag file checking for valid offsets */ void -dosweep(fn, pn) -char *fn; -char *pn; +dosweep(const char *fn, const char *pn) { register FILE *pf; long it; @@ -534,9 +526,7 @@ char *pn; - fail - complain and die */ void -fail(s1, s2) -char *s1; -char *s2; +fail(const char *s1, const char *s2) { # define MAXS2 50 char s2buf[MAXS2+10]; @@ -556,9 +546,7 @@ char *s2; - str2dup - concatenate strings and malloc result */ char * -str2dup(s1, s2) -char *s1; -char *s2; +str2dup(const char *s1, const char *s2) { register char *p; @@ -574,8 +562,7 @@ char *s2; - dofetch - do a fetch or dbzfetch */ datum -dofetch(key) -datum key; +dofetch(datum key) { if (dbzint) return(dbzfetch(key)); @@ -587,9 +574,7 @@ datum key; - dostore - do a store or dbzstore */ int -dostore(key, value) -datum key; -datum value; +dostore(datum key, datum value) { if (dbzint) return(dbzstore(key, value)); --- inject/defaults.c.orig 1995-01-02 21:48:38 UTC +++ inject/defaults.c @@ -7,26 +7,29 @@ #include #include #include +#include +#include +#include #include "news.h" #include "config.h" #include "fgetmfs.h" +#include "inject.h" /* imports */ -extern int optind; -extern char *optarg; -extern FILE *efopen(); -extern char *getenv(), *getlogin(); -extern char *emalloc(); -extern struct passwd *getmypwent(); -extern time_t time(); /* exports */ -char *progname = ""; +const char *progname = ""; int debug; /* forwards */ -char *fullname(), *readline(), *getdomainsuf(), *getuserid(), *getfullname(); -char *getorg(); +char *readline(const char *file); +char *getdomainsuf(void); +const char *getuserid(register struct passwd *pwp); +char *getfullname(register struct passwd *pwp); +char *getorg(void); +void trimclient(void); +void getdefaults(void); +void printvar(register const char *var, register const char *value); /* privates */ int usggcos; /* strictly speaking, "BTL RJE format" */ @@ -39,9 +42,8 @@ size_t ntrimmed = 0; /* number of chars trimmed off c /* * main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c, errflg = 0; @@ -87,7 +89,8 @@ char *argv[]; - trimclient - null out (in client) common suffix of client and server * length of suffix left in ntrimmed */ -trimclient() +void +trimclient(void) { register size_t clen = strlen(client); register char *c = client + clen; @@ -108,7 +111,8 @@ trimclient() ntrimmed = clen - (c - client); } -getdefaults() +void +getdefaults(void) { register char *name, *domainsuf, *org; register struct passwd *pwp = getmypwent(); @@ -149,7 +153,7 @@ getdefaults() } char * /* malloced */ -getdomainsuf() +getdomainsuf(void) { register char *line; register char *s; @@ -170,11 +174,10 @@ getdomainsuf() return line; } -char * /* static */ -getuserid(pwp) -register struct passwd *pwp; +const char * /* static */ +getuserid(register struct passwd *pwp) { - register char *name; + register const char *name; name = getenv("LOGNAME"); if (name == NULL) @@ -185,8 +188,7 @@ register struct passwd *pwp; } char * /* malloced */ -getfullname(pwp) -register struct passwd *pwp; +getfullname(register struct passwd *pwp) { register char *line, *name; @@ -203,7 +205,7 @@ register struct passwd *pwp; } char * /* malloced */ -getorg() +getorg(void) { register char *line; @@ -221,8 +223,7 @@ getorg() } char * /* malloced */ -readline(file) -char *file; +readline(const char *file) { register FILE *fp = fopen(file, "r"); register char *line; @@ -236,8 +237,8 @@ char *file; return line; } -printvar(var, value) /* print var='value' with suitable sh quoting */ -register char *var, *value; +void /* print var='value' with suitable sh quoting */ +printvar(register const char *var, register const char *value) { (void) fputs(var, stdout); (void) putchar('='); --- readnews/defs.h.orig 1994-09-07 17:02:34 UTC +++ readnews/defs.h @@ -47,7 +47,6 @@ typedef enum booltype { false = 0, true } bool; typedef enum applytype { stop, next, nextgroup, searchgroup } applycom; -typedef applycom (*apcmfunc)(); typedef enum pheadtype { printing, passing, making } pheadcom; /* @@ -100,16 +99,57 @@ struct newsrc { newsrc *n_next; }; + +typedef applycom (*apcmfunc)(active *ap, newsrc *np, bool last, bool pushed); + /* some of these may not exist any more */ -char *itoa(), *ltoa(), *convg(), *ngsquash(), *ttoa(), *mgets(), *rconvg(); -char *newstr(), *newstr2(), *newstr3(), *newstr4(), *newstr5(), *catstr(); -char *catstr2(), *mtempnam(), *newstr6(); -char *getunique(), *getretaddr(), *getsubject(); -FILE *fopenl(), *fopenf(); -char *myalloc(), *myrealloc(); -long atot(); +#if 0 +char *itoa(), *ltoa(), *ngsquash(), *ttoa(), *rconvg(); +char *mtempnam(); +char *getunique(); +FILE *fopenl(); int strpcmp(); -active *readactive(); +#endif +/* funcs.c */ +extern char *myalloc(int size); +extern char *myrealloc(char *ptr, int size); +extern char *newstr(const char *s); +extern char *newstr2(const char *s1, const char *s2); +extern char *newstr3(const char *s1, const char *s2, const char *s3); +extern char *newstr4(const char *s1, const char *s2, const char *s3, const char *s4); +extern char *newstr5(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5); +extern char *newstr6(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6); +extern char *catstr(char *old, char *s); +extern char *catstr2(char *old, char *s1, char *s2); +extern int readnews_ngmatch(char *nglist, char *sublist); +extern FILE *fopenf(char *name, char *mode); +extern char *convg(char *s); +extern char *mgets(void); +extern char *getretaddr(header *hp); +extern char *exaddress(char *addr); +extern void convgrps(register char *sp); + +/* header.c */ +extern void gethead(FILE *f, header *hp); +extern void puthead(header *hp, FILE *f, pheadcom com); +extern void freehead(register header *hp); +extern long atot(char *s); + +/* readnews.c */ +extern char *ltoa(long l); +extern char *getsubject(register header *hp); + +/* active.c */ +extern active *readactive(void); +extern active *activep(register char *grp); + +extern void readnewsrc(void); +extern void writenewsrc(active *alist); +extern int apply(active *alist, char *group, apcmfunc func, bool dolast); +extern void gethead(FILE *f, header *hp); +extern void freehead(register header *hp); +extern void puthead(header *hp, FILE *f, pheadcom com); +extern int options(int argc, char * const argv[], bool cline); #define NIL(type) ((type *) 0) #define NEW(type) ((type *) myalloc(sizeof(type))) --- libc/dogets.c.orig 1992-04-18 04:13:50 UTC +++ libc/dogets.c @@ -3,10 +3,11 @@ * pointer, delete any trailing newline and adjust the length to match. */ +#include +#include "fgetfln.h" + char * -dogets(s, lenp) -register char *s; -register int *lenp; +dogets(register char *s, register int *lenp) { register char *nlp = s + *lenp - 1; --- util/dostatfs.c.orig 1995-04-28 00:51:39 UTC +++ util/dostatfs.c @@ -5,6 +5,9 @@ #include #include #include +#include +#include "libc.h" +#include "news.h" /* * Unfortunately, the whereabouts of the necessary struct, the exact @@ -63,21 +66,20 @@ extern int debug; -extern void error(); /* - spacefor - do the work */ long -spacefor(filesize, fileonfs, wantspace, wantinodes, bperi) -long filesize; -char *fileonfs; -long wantspace; -long wantinodes; -long bperi; +spacefor( +long filesize, +char *fileonfs, +long wantspace, +long wantinodes, +long bperi) { struct statfs info; - register long n; + register long long n; # define LOTS 10000 register long iperfile = filesize/bperi + 1; @@ -85,7 +87,7 @@ long bperi; error("cannot do statfs(%s)", fileonfs); if (debug) fprintf(stderr, "bsize %ld, avail %ld, inodes %ld\n", - info.UNIT, info.f_bavail, info.f_ffree); + (long)info.UNIT, (long)info.f_bavail, (long)info.f_ffree); n = LOTS; if (info.f_bavail <= wantspace) --- util/dowhatever.c.orig 1994-11-30 23:16:42 UTC +++ util/dowhatever.c @@ -6,7 +6,12 @@ #include #include #include +#include +#include "libc.h" +/* forwards */ +int num(char *s); + long bperi = 1000000000L; /* how many bytes per inode? */ int debug = 0; @@ -15,15 +20,13 @@ char *progname; /* - main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c; int errflg = 0; extern int optind; extern char *optarg; - long spacefor(); register long n; progname = argv[0]; @@ -59,8 +62,7 @@ char *argv[]; - num - is a string numeric? */ int /* predicate */ -num(s) -char *s; +num(char *s) { return(strspn(s, "0123456789.eE+-") == strlen(s)); } --- libc/efopen.c.orig 1991-03-12 22:53:45 UTC +++ libc/efopen.c @@ -8,16 +8,13 @@ #ifndef __STDC__ extern int errno; #endif +#include +#include "news.h" -/* imports from libc */ -extern void error(); +static const char message[] = "can't open file \"%s\" mode "; -static char message[] = "can't open file \"%s\" mode "; - FILE * -efopen(file, mode) -char *file; -char *mode; +efopen(const char *file, const char *mode) { FILE *fp; char fullmsg[sizeof(message)+10]; --- libc/emalloc.c.orig 1991-11-07 01:32:16 UTC +++ libc/emalloc.c @@ -6,12 +6,12 @@ #include #include #include "libc.h" +#include "alloc.h" +#include "news.h" -extern void error(); char * -emalloc(amount) -unsigned amount; +emalloc(unsigned amount) { register char *it; char camount[25]; /* Enough to sprintf an unsigned. */ --- libc/error.c.orig 1988-12-30 09:50:06 UTC +++ libc/error.c @@ -3,13 +3,13 @@ */ #include +#include +#include +#include "news.h" -extern void warning(); void -error(s1, s2) -char *s1; -char *s2; +error(const char *s1, const char *s2) { warning(s1, s2); exit(1); --- expire/expire.c.orig 1994-11-28 01:15:07 UTC +++ expire/expire.c @@ -17,6 +17,8 @@ #include #include #include +#include +#include #include "libc.h" #include "news.h" #include "config.h" @@ -76,7 +78,7 @@ int printexpiring = 0; /* print info line for expirin char *defarch = NULL; /* default archive dir */ int spacetight = 0; /* error-recovery actions remove evidence? */ -char *subsep = "~"; /* subfield separator in middle field */ +const char *subsep = "~"; /* subfield separator in middle field */ int checkonly = 0; /* check control information only */ int testing = 0; /* testing only, leave articles alone */ int leaders = 0; /* only first link ("leader") is hard link */ @@ -129,47 +131,44 @@ char abuf[2*1024]; /* expire reported to be tight on char abuf[8*1024]; #endif -char *progname; +const char *progname; -extern struct tm *gmtime(); -extern time_t time(); -extern time_t getindate(); - /* forwards */ -FILE *eufopen(); -void eufclose(); -char *whereexpire(); -time_t back(); -void checkadir(); -void fail(); -void die(); -void control(); -void prime(); -void checkused(); -void doit(); -void cd(); -time_t readdate(); -char *doarticle(); -void warning(); -void complain(); -void printstuff(); -int expire(); -char *readline(); -void mkparents(); -void getsubj(); -void refill(); -void printlists(); -void pctl(); -void fillin(); -void ctlline(); +FILE *eufopen(const char *name, const char *mode); +void eufclose(FILE *f, const char *name); +char *whereexpire(time_t recdate, time_t expdate, char *name); +time_t back(const char *ndaystr); +void checkadir(char *dir); +void fail(const char *s1, const char *s2); +void die(const char *s1, const char *s2); +void control(register FILE *f); +void prime(const char *afile); +void checkused(void); +void doit(void); +time_t readdate(const char *text); +char *doarticle(char *oldnames, time_t recdate, time_t expdate, char *msgid); +void printstuff(char *msgid, char *name, time_t recdate); +int expire(char *name, char *dir); +char *readline(int fd); +void mkparents(char *art, char *dir); +void getsubj(char *buf, int bsize); +void refill(int fd); +void printlists(void); +void pctl(register struct ctl *ct); +void fillin(register struct ctl *ct); +void ctlline(char *ctl, int lineno); +int doline(char *field[3], register int nf, char *subfield[3], register int nsf); +int shouldgo(time_t recdate, time_t expdate, register struct ctl *ct); +int cp(char *old, char *new); +int cploop(int in, int out); +void mainloop(register int old, register FILE *new); /* - main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { register int c; register int errflg = 0; @@ -280,8 +279,7 @@ char *argv[]; - control - pick up a control file */ void -control(f) -register FILE *f; +control(register FILE *f) { register char *p; register int gotone = 0; @@ -302,9 +300,7 @@ register FILE *f; - ctlline - process one control-file line */ void -ctlline(ctl, lineno) -char *ctl; -int lineno; +ctlline(char *ctl, int lineno) { register struct ctl *ct; char *field[4]; @@ -404,8 +400,7 @@ int lineno; - prime - prime control lists from active file */ void -prime(afile) -char *afile; +prime(const char *afile) { register char *line; register FILE *af; @@ -441,8 +436,7 @@ char *afile; - fillin - fill in a ctl struct for a newsgroup from the control-file list */ void -fillin(ct) -register struct ctl *ct; +fillin(register struct ctl *ct) { register struct ctl *cscan; char grump[100]; @@ -468,7 +462,7 @@ register struct ctl *ct; - checkused - check that all lines of the control file got used */ void -checkused() +checkused(void) { register struct ctl *cscan; char grump[100]; @@ -486,11 +480,10 @@ checkused() - doit - file manipulation and master control */ void -doit() +doit(void) { register int old; - register FILE *new; - extern void mainloop(); + register FILE *new = NULL; cd(histdir); old = open("history", 0); @@ -541,9 +534,7 @@ doit() - mainloop - main loop, reading old history file and building new one */ void -mainloop(old, new) -register int old; -register FILE *new; +mainloop(register int old, register FILE *new) { register char *line; long here; @@ -621,11 +612,11 @@ register FILE *new; - doline - handle one history line, possibly modifying it */ int /* 0 keep it, <0 don't */ -doline(field, nf, subfield, nsf) -char *field[NF]; /* fields in line */ -register int nf; -char *subfield[NSF]; /* subfields in middle field */ -register int nsf; +doline( +char *field[NF], /* fields in line */ +register int nf, +char *subfield[NSF], /* subfields in middle field */ +register int nsf) { register time_t recdate; register time_t expdate; @@ -673,7 +664,7 @@ register int nsf; sprintf(expbuf, "%ld", (long)expdate); subfield[1] = expbuf; } else - subfield[1] = "-"; + subfield[1] = (char *)"-"; return(0); } @@ -681,8 +672,7 @@ register int nsf; - readdate - turn a date into internal form */ time_t -readdate(text) -char *text; +readdate(const char *text) { register time_t ret; @@ -703,11 +693,11 @@ char *text; * Re-uses the space of its first argument. */ char * /* new name list, in space of old, or NULL */ -doarticle(oldnames, recdate, expdate, msgid) -char *oldnames; /* may be destroyed */ -time_t recdate; -time_t expdate; -char *msgid; /* for printstuff() */ +doarticle( +char *oldnames, /* may be destroyed */ +time_t recdate, +time_t expdate, +char *msgid) /* for printstuff() */ { register char *src; register char *dst; @@ -786,10 +776,7 @@ char *msgid; /* for printstuff() */ * since NULL means "to nowhere". */ char * /* archive directory, NULL, or dont */ -whereexpire(recdate, expdate, name) -time_t recdate; -time_t expdate; -char *name; +whereexpire(time_t recdate, time_t expdate, char *name) { register char *group; register char *slash; @@ -839,10 +826,7 @@ char *name; - shouldgo - should article with these dates expire now? */ int /* predicate */ -shouldgo(recdate, expdate, ct) -time_t recdate; -time_t expdate; -register struct ctl *ct; +shouldgo(time_t recdate, time_t expdate, register struct ctl *ct) { if (recdate >= ct->retain) /* within retention period */ return(0); @@ -866,9 +850,7 @@ register struct ctl *ct; - expire - expire an article */ int /* >0 success, 0 missing, <0 failure */ -expire(name, dir) -char *name; -char *dir; +expire(char *name, char *dir) { register char *old; register char *new; @@ -952,9 +934,9 @@ char *dir; - cp - try to copy an article (top level, administration) */ int /* 0 success, other character failure */ -cp(old, new) -char *old; /* pathnames good from here */ -char *new; +cp( +char *old, /* pathnames good from here */ +char *new) { register int ret; register int in, out; @@ -983,9 +965,7 @@ char *new; - cploop - try to copy an article (bottom level, copy loop) */ int /* 0 success, other character failure */ -cploop(in, out) -int in; -int out; +cploop(int in, int out) { register int ret; register int count; @@ -1013,9 +993,7 @@ int out; * since they are the output delimiters. */ void -getsubj(buf, bsize) -char *buf; -int bsize; +getsubj(char *buf, int bsize) { register char *scan; register char *limit; @@ -1064,9 +1042,9 @@ int bsize; * Assumes it can mess with first argument if it puts it all back at the end. */ void -mkparents(art, dir) -char *art; /* name relative to dir */ -char *dir; +mkparents( +char *art, /* name relative to dir */ +char *dir) { register char *cmd; register char *ocmd; @@ -1092,7 +1070,7 @@ char *dir; free(cmd); } -char *months[12] = { +const char *months[12] = { "Jan", "Feb", "Mar", @@ -1111,10 +1089,7 @@ char *months[12] = { - printstuff - print information about an expiring article */ void -printstuff(msgid, name, recdate) -char *msgid; -char *name; -time_t recdate; +printstuff(char *msgid, char *name, time_t recdate) { struct tm *gmt; @@ -1127,9 +1102,7 @@ time_t recdate; - eufopen - fopen, with fail if doesn't succeed */ FILE * -eufopen(name, mode) -char *name; -char *mode; +eufopen(const char *name, const char *mode) { FILE *f; static char grump[50] = "can't open `%s' for `"; @@ -1147,9 +1120,7 @@ char *mode; - eufclose - fclose with failure checking */ void -eufclose(f, name) -FILE *f; -char *name; +eufclose(FILE *f, const char *name) { if (nfclose(f) == EOF) fail("error in closing file `%s'", name); @@ -1159,8 +1130,7 @@ char *name; - checkadir - check archiving directory is real, writable, and full pathname */ void /* set -h if not */ -checkadir(dir) -char *dir; +checkadir(char *dir) { struct stat stbuf; register int hforce = 0; @@ -1187,8 +1157,7 @@ char *dir; * Requires that "now" be set first. */ time_t -back(ndaystr) -char *ndaystr; +back(const char *ndaystr) { register double goback; /* how far before now it is */ @@ -1206,7 +1175,7 @@ char *ndaystr; - printlists - print control lists for debugging */ void -printlists() +printlists(void) { register int i; register struct ctl *ct; @@ -1229,8 +1198,7 @@ printlists() - pctl - print one control-list entry */ void -pctl(ct) -register struct ctl *ct; +pctl(register struct ctl *ct) { # define DAYS(x) ((now-(x))/DAY) @@ -1243,8 +1211,7 @@ register struct ctl *ct; - unprivileged - no-op needed to keep the pathname stuff happy */ void -unprivileged(reason) -char *reason; +unprivileged(const char *reason) { } @@ -1252,9 +1219,7 @@ char *reason; - fail - call errunlock, possibly after cleanup */ void -fail(s1, s2) -char *s1; -char *s2; +fail(const char *s1, const char *s2) { int saveerr = errno; @@ -1273,9 +1238,7 @@ char *s2; - die - like fail, but errno contains no information */ void -die(s1, s2) -char *s1; -char *s2; +die(const char *s1, const char *s2) { errno = 0; fail(s1, s2); @@ -1291,8 +1254,8 @@ char *s2; * Minor flaw: will lose a last line which lacks a newline. */ char * /* NULL is EOF */ -readline(fd) -int fd; /* Note descriptor, not FILE *. */ +readline( +int fd) /* Note descriptor, not FILE *. */ { register char *line; /* line buffer */ register size_t linesize; @@ -1300,7 +1263,6 @@ int fd; /* Note descriptor, not FILE *. */ register char *endp; /* newline */ register size_t len; /* length of line (fragment) */ register int n; - extern void refill(); /* try for the easy case -- whole line in buffer */ endp = strchr(rest, '\n'); @@ -1361,8 +1323,7 @@ int fd; /* Note descriptor, not FILE *. */ - refill - refill readline's buffer, with locking on EOF */ void -refill(fd) -int fd; +refill(int fd) { register int ret; --- explode/explode.c.orig 1995-04-28 00:50:54 UTC +++ explode/explode.c @@ -25,26 +25,27 @@ NF == 2 && /^I/ { print msgid >>$2; next } # ihave/se #include #include "fixerrno.h" #include +#include +#include #include "libc.h" #include "news.h" #include "fgetmfs.h" #include "trbatch.h" /* imports */ -extern int optind; -extern char *optarg; -extern FILE *efopen(); /* exports */ -char *progname = ""; +const char *progname = ""; int debug; +/* forwards */ +void process(FILE *in, const char *inname); + /* * main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c, errflg = 0; @@ -84,9 +85,8 @@ char *argv[]; /* * process - process input file */ -process(in, inname) -FILE *in; -char *inname; +void +process(FILE *in, const char *inname) { register char *line, *name; register struct batchfile *bf = NULL; @@ -134,7 +134,7 @@ char *inname; for (name = line+1; isascii(*name) && isspace(*name); name++) ; - bf = bfopen(name); + bf = explode_bfopen(name); if (bf != NULL && bf->bf_str != NULL && !bfappend(bf, *line, name, path, msgid, lsize)) --- nov/expovguts.c.orig 1995-04-28 00:51:30 UTC +++ nov/expovguts.c @@ -8,27 +8,26 @@ #include #include #include +#include #include "fgetfln.h" #include "news.h" int debug = 0; -char *progname; +const char *progname; char *inname; char *tmpname; -extern void error(); #define mkprogname(a) (((a) == NULL) ? "?noname?" : (a)) -void mapfill(); -void filter(); +void mapfill(char *map, long start, long stop, FILE *f); +void filter(FILE *in, FILE *out, char *map, long start, long stop); /* - main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c; int errflg = 0; @@ -38,7 +37,6 @@ char *argv[]; FILE *out; extern int optind; extern char *optarg; - extern FILE *efopen(); progname = mkprogname(argv[0]); @@ -63,7 +61,7 @@ char *argv[]; inname = argv[optind+2]; if (start == 0) { fprintf(stderr, "%s: in expiring `%s',\n", progname, inname); - fprintf(stderr, "\tfound problem in active file: min == 0\n", + fprintf(stderr, "\tfound problem in active file: min (%s) == 0\n", argv[optind+1]); exit(2); } @@ -82,7 +80,7 @@ char *argv[]; amap = malloc((size_t)(stop - start)); if (amap == NULL) error("cannot allocate map", ""); - memset(amap, (size_t)(stop - start), 0); + memset(amap, 0, (size_t)(stop - start)); mapfill(amap, start, stop, stdin); @@ -104,11 +102,7 @@ char *argv[]; - mapfill - fill in the map with the input filenames */ void -mapfill(map, start, stop, f) -char *map; -long start; -long stop; -FILE *f; +mapfill(char *map, long start, long stop, FILE *f) { register char *line; register char *p; @@ -145,12 +139,7 @@ FILE *f; - filter - pass overview file through, checking against map */ void -filter(in, out, map, start, stop) -FILE *in; -FILE *out; -char *map; -long start; -long stop; +filter(FILE *in, FILE *out, char *map, long start, long stop) { char *line; register char *p; --- libdbz/fake.c.orig 1994-11-30 23:16:34 UTC +++ libdbz/fake.c @@ -9,6 +9,7 @@ #include #include #include +#include #define MAXSTR 500 /* For sizing strings -- DON'T use BUFSIZ! */ #define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) @@ -27,16 +28,16 @@ char *progname; char *inname; /* filename for messages etc. */ long lineno; /* line number for messages etc. */ -void doline(); -void addchars(); -void seed(); +void doline(char *buf); +void addchars(char *buf, int len); +extern int range(int min, int max); +extern void seed(long n); /* - main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c; int errflg = 0; @@ -44,7 +45,6 @@ char *argv[]; struct stat statbuf; extern int optind; extern char *optarg; - void process(); register long no; char line[MAXSTR]; @@ -89,8 +89,7 @@ char *argv[]; - doline - generate random history pseudo-line */ void -doline(buf) -char *buf; +doline(char *buf) { char tagch[2]; @@ -124,9 +123,7 @@ char *buf; - addchars - generate n random characters suitable for history file */ void -addchars(buf, len) -char *buf; -int len; +addchars(char *buf, int len) { register int i; register char *p = buf + strlen(buf); --- libcnews/fakeftime.c.orig 1995-04-28 00:51:07 UTC +++ libcnews/fakeftime.c @@ -14,9 +14,9 @@ - secswest - intuit the timezone, portably */ static long /* seconds west of GMT, or DUNNO */ -secswest(now, localp) -time_t now; -struct tm *localp; /* result of localtime(&now) */ +secswest( +time_t now, +struct tm *localp) /* result of localtime(&now) */ { struct tm localt; struct tm gmt; @@ -85,8 +85,7 @@ struct tm *localp; /* result of localtime(&now) */ } int -ftime(tb) -struct timeb *tb; +ftime(struct timeb *tb) { struct timeval tv; int ret; --- libc/fgetfln.c.orig 1993-03-09 06:22:54 UTC +++ libc/fgetfln.c @@ -6,9 +6,10 @@ #include #include #include +#include #include -#include -#include +#include "fgetfln.h" +#include "hdbm.h" #define max(a,b) ((a) > (b)? (a): (b)) #define min(a,b) ((a) < (b)? (a): (b)) @@ -24,9 +25,6 @@ #define YES 1 #define NO 0 -/* forwards */ -static void setup(); - struct stream { char *line; /* currently allocated input line */ unsigned allocn; /* bytes currently allocated (in line) */ @@ -39,6 +37,9 @@ struct stream { }; static HASHTABLE *streamtab; +/* forwards */ +static void setup(register struct stream *stp, register int limit); + /* * `fget flagged line' with limit on bytes read. * The limit is like fgets's; limit-1 bytes can be read. -1 means "no limit". @@ -46,10 +47,10 @@ static HASHTABLE *streamtab; * The length of the string is returned via lengthp. */ char * -fgetfln(fp, limit, lengthp) -FILE *fp; -register int limit; /* TODO: make this long? */ -int *lengthp; +fgetfln( +FILE *fp, +register int limit, /* TODO: make this long? */ +int *lengthp) { register int thislen; register struct stream *stp; @@ -62,7 +63,7 @@ int *lengthp; * One would like this mapping to be very fast. */ if (streamtab == NULL) - streamtab = hdbmcreate(30, (unsigned (*)())NULL); + streamtab = hdbmcreate(30, (unsigned (*)(HDBMDATUM key))NULL); strkey.dat_ptr = (char *)&fp; strkey.dat_len = sizeof fp; strdata = hdbmfetch(streamtab, strkey); @@ -136,10 +137,9 @@ int *lengthp; return stp->line; } +/* compute maxrd, morep */ static void -setup(stp, limit) /* compute maxrd, morep */ -register struct stream *stp; -register int limit; +setup(register struct stream *stp, register int limit) { stp->maxrd = (islimit(limit)? min(stp->allocn, limit): stp->allocn); stp->morep = stp->line + stp->maxrd - 2; --- include/fgetfln.h.orig 1992-03-01 06:54:58 UTC +++ include/fgetfln.h @@ -1,7 +1,10 @@ -extern char *fgetfln(); /* internal interface */ +extern char *fgetfln(FILE *fp, register int limit, int *length); /* internal interface */ /* external interfaces */ #define fgetln(fp) fgetfln(fp, -1, (int *)NULL) /* unbounded read */ #define cfgetln(fp) csfgetln(fp, -1, 1) /* unbounded cont.d read; toss space */ -extern char *csfgetln(), *dogets(), *fgetline(); +extern char *csfgetln(FILE *fp, register int limit, int skipflag); +extern char *dogets(register char *s, register int *lenp); +extern char *fgetline(FILE *fp, register size_t *lenp); + --- libfake/fgetline.c.orig 1994-01-03 04:37:01 UTC +++ libfake/fgetline.c @@ -7,9 +7,7 @@ #include char * -fgetline(fp, lenp) -FILE *fp; -register size_t *lenp; +fgetline(FILE *fp, register size_t *lenp) { int len; register char *line = fgetfln(fp, -1, &len); --- libc/fgetmfs.c.orig 1993-09-12 01:52:21 UTC +++ libc/fgetmfs.c @@ -10,10 +10,7 @@ #include /* compatibility header */ char * -fgetmfs(fp, limit, cont) -FILE *fp; -int limit; -int cont; +fgetmfs(FILE *fp, int limit, int cont) { if (cont == CONT_NOSPC && limit == -1) return cfgetms(fp); @@ -31,8 +28,7 @@ int cont; } char * -fgetms(fp) -FILE *fp; +fgetms(FILE *fp) { register char *line = fgetln(fp); @@ -40,8 +36,7 @@ FILE *fp; } char * -cfgetms(fp) -FILE *fp; +cfgetms(FILE *fp) { return cfgetln(fp); } --- include/fgetmfs.h.orig 1992-03-01 06:42:22 UTC +++ include/fgetmfs.h @@ -4,4 +4,7 @@ #define CONT_NOSPC 1 /* continue & remove leading whitespace */ #define CONT_SPC 2 /* continue & keep leading whitespace */ -extern char *fgetmfs(), *fgetms(), *cfgetms(); +extern char *fgetmfs(FILE *fp, int limit, int cont); +extern char *fgetms(FILE *fp); +extern char *cfgetms(FILE *fp); + --- relay/fileart.c.orig 2023-03-05 13:15:39 UTC +++ relay/fileart.c @@ -54,6 +54,7 @@ #include "fixerrno.h" #include #include +#include #include "libc.h" #include "news.h" @@ -64,6 +65,10 @@ #include "history.h" #include "ngmatch.h" #include "system.h" +#include "mkdirs.h" +#include "rerror.h" +#include "fileart.h" +#include "control.h" #define XREFDELIM ':' @@ -79,12 +84,11 @@ #define tmplink(art) (art)->a_unlink /* imports */ -extern void prefuse(); /* privates */ struct link { char *l_grp; /* group name, not directory */ - char *l_num; /* NULL or article number */ + const char *l_num; /* NULL or article number */ char l_type; /* 's', 'l' or '\0' */ boolean l_fillme; /* still needs work? */ dev_t l_dev; /* -1 if not known */ @@ -111,34 +115,32 @@ static char logxcl[] = "all groups `%s' excluded in ac static char dbgcopy[] = "couldn't link or symlink; copying `%s' to `%s'... "; /* forward */ -STATIC int lnkcmp(); +STATIC int lnkcmp(const void *a1, const void *a2); void -filedebug(state) /* set debugging state */ -boolean state; +filedebug(boolean state) /* set debugging state */ { debug = state; } /* Append ng/artnumstr to art's list of files, and bump goodngs. */ STATIC void -gotgoodng(art, lp) -struct article *art; -struct link *lp; +gotgoodng(struct article *art, struct link *lp) { ++goodngs; histupdfiles(art, lp->l_grp, lp->l_num); } -STATIC -filllink(lp, grp, num, type, fillme, dev) -register struct link *lp; -char *grp, *num; -char type; -boolean fillme; -dev_t dev; +STATIC void +filllink( +register struct link *lp, +const char *grp, +const char *num, +char type, +boolean fillme, +dev_t dev) { - lp->l_grp = grp; + lp->l_grp = strdup(grp); lp->l_num = num; lp->l_type = type; lp->l_fillme = fillme; @@ -146,8 +148,7 @@ dev_t dev; } STATIC char * /* malloced */ -linkname(lp) -register struct link *lp; +linkname(register struct link *lp) { register char *name; @@ -161,9 +162,10 @@ register struct link *lp; } STATIC int -trylink(olp, artname, lp) -char *artname; -register struct link *olp, *lp; +trylink( +register struct link *olp, +char *artname, +register struct link *lp) { register int worked = NO; @@ -183,9 +185,10 @@ register struct link *olp, *lp; } STATIC int -trysymlink(olp, artname, lp) -char *artname; -register struct link *olp, *lp; +trysymlink( +register struct link *olp, +char *artname, +register struct link *lp) { register int worked = NO; @@ -217,9 +220,7 @@ register struct link *olp, *lp; * so just make empty links for now; later on, we will copy into them. */ STATIC int -trycopy(artname, lp) -char *artname; -register struct link *lp; +trycopy(char *artname, register struct link *lp) { register FILE *out; register int worked = NO; @@ -249,9 +250,10 @@ register struct link *lp; * If all else fails, make a copy; with luck a later link can be made to it. */ STATIC int -tryanything(olp, artname, lp) -char *artname; -register struct link *olp, *lp; +tryanything( +register struct link *olp, +char *artname, +register struct link *lp) { register int worked = NO; register struct link *plp; @@ -268,7 +270,7 @@ register struct link *olp, *lp; for (plp = link1; plp < lp; plp++) if (plp->l_dev == lp->l_dev && plp->l_dev != (dev_t)-1) break; - if (plp < lp) /* yes, we do */ + if (plp < lp) { /* yes, we do */ if (plp->l_type == 'l') { worked = trylink(plp, artname, lp); if (!worked) @@ -276,13 +278,15 @@ register struct link *olp, *lp; /* else make a copy */ } else if (plp->l_type == 's' && olp->l_type != 's') worked = trysymlink(link1, artname, lp); + } if (!worked) worked = trycopy(artname, lp); return worked; } -filetmp(art) /* make temporary link */ -register struct article *art; +/* make temporary link */ +void +filetmp(register struct article *art) { if (art->a_artf == NULL) { nnfree(&art->a_tmpf); @@ -295,11 +299,12 @@ register struct article *art; } } +/* create first permanent link */ STATIC boolean -fileopen(art, lp, artname) /* create first permanent link */ -register struct article *art; -register struct link *lp; -char *artname; +fileopen( +register struct article *art, +register struct link *lp, +char *artname) { register boolean worked = NO; struct stat statb; @@ -326,10 +331,11 @@ char *artname; * Result goes in "lp". */ STATIC boolean -openorlink(artname, art, olp, lp) -register char *artname; -register struct article *art; -struct link *olp, *lp; +openorlink( +register char *artname, +register struct article *art, +struct link *olp, +struct link *lp) { register boolean worked = NO; /* open or link worked? */ @@ -344,11 +350,12 @@ struct link *olp, *lp; if (!worked && errno != ENOENT) /* e.g. v7 over fs's, Plan 9 */ worked = tryanything(olp, artname, lp); } - if (debug) + if (debug) { if (worked) (void) fprintf(stderr, "success.\n"); else warning("failed.", ""); + } return worked; } @@ -367,11 +374,12 @@ struct link *olp, *lp; * the necessary directories cannot be made. */ STATIC boolean -mkonelink(art, olp, lp, lnkstatp, artname) -register struct article *art; -struct link *olp, *lp; -statust *lnkstatp; -register char *artname; +mkonelink( +register struct article *art, +struct link *olp, +struct link *lp, +statust *lnkstatp, +register char *artname) { if (openorlink(artname, art, olp, lp)) return YES; @@ -399,10 +407,11 @@ register char *artname; * Return value is the same as mkonelink's. */ STATIC boolean -tryartnum(art, olp, lp, lnkstatp) -struct article *art; -register struct link *olp, *lp; -statust *lnkstatp; +tryartnum( +struct article *art, +register struct link *olp, +register struct link *lp, +statust *lnkstatp) { register char *artname; /* article file name */ register boolean ret; @@ -428,9 +437,10 @@ statust *lnkstatp; * fopen artname and store the result in art->a_artf. */ STATIC statust -asgnartnum(art, olp, lp) -register struct article *art; -register struct link *olp, *lp; +asgnartnum( +register struct article *art, +register struct link *olp, +register struct link *lp) { statust lnkstat = ST_OKAY; @@ -468,8 +478,7 @@ register struct link *olp, *lp; * (e.g. rec.drugs,talk.chew-the-fat). */ STATIC void -mkjunklink(art) -register struct article *art; +mkjunklink(register struct article *art) { register statust lnkstat = ST_OKAY; struct link jlink; @@ -512,9 +521,9 @@ register struct article *art; } } +/* hack up Xref: value and return ng:num pairs */ static char * -xrefngs(art) /* hack up Xref: value and return ng:num pairs */ -register struct article *art; +xrefngs(register struct article *art) { register char *ngs = NULL, *site, *groups; @@ -539,8 +548,7 @@ register struct article *art; } static char * -histngs(art) -register struct article *art; +histngs(register struct article *art) { register char *ngs = NULL, *site, *groups = NULL, *histent = NULL; static char *lasthist; @@ -578,8 +586,7 @@ register struct article *art; * (e.g. comp.lang.c:25780,general:12). */ static char * -extngs(art) -register struct article *art; +extngs(register struct article *art) { register char *ngs = NULL, *groups; @@ -597,7 +604,7 @@ register struct article *art; stranslit(groups, ' ', '\0'); /* kill args */ stranslit(groups, '\t', '\0'); if (!actlook(groups)) { - groups = CONTROL; + groups = strdup(CONTROL); } } else groups = art->h.h_ngs; @@ -621,9 +628,10 @@ register struct article *art; } STATIC boolean -linkonce(art, olp, lp) -register struct article *art; -register struct link *olp, *lp; +linkonce( +register struct article *art, +register struct link *olp, +register struct link *lp) { register statust lst = asgnartnum(art, olp, lp); register boolean ret; @@ -638,8 +646,7 @@ register struct link *olp, *lp; } STATIC struct link * /* malloced */ -parsengs(ngs) /* parse ngs into links array */ -register char *ngs; +parsengs(register char *ngs) /* parse ngs into links array */ { register char *ng, *comma, *numb; register struct link *lp; @@ -686,8 +693,7 @@ register char *ngs; * single group was refused (by asgnartnum). */ STATIC void -mklinks(art) -register struct article *art; +mklinks(register struct article *art) { register struct link *lp, *olp; register char *ngs; @@ -739,8 +745,7 @@ register struct article *art; } STATIC int -lnkcmp(a1, a2) -char *a1, *a2; +lnkcmp(const void *a1, const void *a2) { return strcmp(((struct link *)a1)->l_grp, ((struct link *)a2)->l_grp); } @@ -751,8 +756,7 @@ char *a1, *a2; * (N.B.: Thus must be called before emitting any article body!) */ void -fileart(art) -register struct article *art; +fileart(register struct article *art) { mklinks(art); if (goodngs == 0) @@ -767,10 +771,11 @@ register struct article *art; * so just make empty links for now; later on, we will copy into them. */ STATIC int -fill(oname, in, artname, lp) -char *oname, *artname; -FILE *in; -register struct link *lp; +fill( +char *oname, +FILE *in, +char *artname, +register struct link *lp) { register FILE *out; register int worked = NO; @@ -796,8 +801,9 @@ register struct link *lp; return worked; } -mkcopies(art) /* if copies must be made, fill them in here */ -register struct article *art; +/* if copies must be made, fill them in here */ +void +mkcopies(register struct article *art) { register struct link *lp; --- relay/fileart.h.orig 1989-11-28 00:47:53 UTC +++ relay/fileart.h @@ -1,5 +1,7 @@ /* imports from fileart.c */ -extern void filedebug(); -extern void fileart(); +extern void filedebug(boolean state); +extern void fileart(register struct article *art); +extern void filetmp(register struct article *art); +extern void mkcopies(register struct article *art); #define JUNK "junk" /* lost+found pseudo-ng. */ --- libcnews/fnlockfile.c.orig 1991-07-16 05:37:20 UTC +++ libcnews/fnlockfile.c @@ -1,8 +1,9 @@ #include +#include +#include "news.h" int -fnlockfile(fp) -FILE *fp; +fnlockfile(FILE *fp) { return 1; } --- libcnews/fopenclex.c.orig 1993-11-21 03:49:45 UTC +++ libcnews/fopenclex.c @@ -7,9 +7,9 @@ #include #include "news.h" +/* open name; close-on-exec if OK, else warning */ FILE * -fopenwclex(name, mode) /* open name; close-on-exec if OK, else warning */ -char *name, *mode; +fopenwclex(const char *name, const char *mode) { register FILE *fp; @@ -18,9 +18,9 @@ char *name, *mode; return fp; } +/* open file and if OK, close-on-exec */ FILE * -fopenclex(file, mode) /* open file and if OK, close-on-exec */ -char *file, *mode; +fopenclex(const char *file, const char *mode) { register FILE *fp; --- libcnews/fopenexcl.c.orig 1995-04-28 00:51:06 UTC +++ libcnews/fopenexcl.c @@ -19,9 +19,11 @@ static struct stat testbuf; -1) #endif +#include +#include "news.h" + FILE * -fopenexcl(name) -register char *name; +fopenexcl(register char *name) { register int fd; --- relay/fsys.c.orig 1995-04-28 00:51:34 UTC +++ relay/fsys.c @@ -16,41 +16,38 @@ extern struct system *currsys, *firstsys; static struct system *thissys = NULL; void -remmysys(sys) /* remember this system */ -struct system *sys; +remmysys(struct system *sys) /* remember this system */ { thissys = sys; } struct system * -mysysincache() /* optimisation */ +mysysincache(void) /* optimisation */ { return thissys; } void -setupsys(fp) -FILE *fp; +setupsys(FILE *fp) { rewind(fp); } boolean -donesys() +donesys(void) { return NO; } /* ARGSUSED */ void -rewsys(fp) -FILE *fp; +rewsys(FILE *fp) { currsys = firstsys; } void -advcurrsys() /* advance currsys to the next in-core sys entry, if any. */ +advcurrsys(void) /* advance currsys to the next in-core sys entry, if any. */ { if (currsys != NULL) currsys = currsys->sy_next; --- inject/fullname.c.orig 1993-08-18 23:11:18 UTC +++ inject/fullname.c @@ -6,14 +6,14 @@ #include #include #include +#include +#include "alloc.h" +#include "inject.h" -/* imports */ -extern char *getenv(), *emalloc(); - -char * -fullname(pwp, usggcos) -register struct passwd *pwp; -int usggcos; /* strictly speaking, "BTL RJE format" */ +const char * +fullname( +register struct passwd *pwp, +int usggcos) /* strictly speaking, "BTL RJE format" */ { register char *name, *gcos, *delim; --- readnews/funcs.c.orig 1994-09-08 19:38:24 UTC +++ readnews/funcs.c @@ -1,52 +1,47 @@ #include "defs.h" +#include "readnews_error.h" /* * string handling functions */ char * -myalloc(size) -int size; +myalloc(int size) { register char *cp; if ((cp = malloc((unsigned) size)) == NIL(char)) - error("No more memory."); + readnews_error("No more memory."); return cp; } char * -myrealloc(ptr, size) -char *ptr; -int size; +myrealloc(char *ptr, int size) { register char *cp; if ((cp = realloc(ptr, (unsigned) size)) == NIL(char)) - error("No more memory."); + readnews_error("No more memory."); return cp; } char * -newstr(s) -char *s; +newstr(const char *s) { return strcpy(myalloc(strlen(s) + 1), s); } char * -newstr2(s1, s2) -char *s1, *s2; +newstr2(const char *s1, const char *s2) { return strcat(strcpy(myalloc(strlen(s1) + strlen(s2) + 1), s1), s2); } char * -newstr3(s1, s2, s3) -char *s1, *s2, *s3; +newstr3(const char *s1, const char *s2, const char *s3) { return strcat(strcat(strcpy(myalloc(strlen(s1) + strlen(s2) + strlen(s3) + 1), s1), s2), s3); @@ -54,8 +49,7 @@ char *s1, *s2, *s3; char * -newstr4(s1, s2, s3, s4) -char *s1, *s2, *s3, *s4; +newstr4(const char *s1, const char *s2, const char *s3, const char *s4) { return strcat(strcat(strcat(strcpy(myalloc(strlen(s1) + strlen(s2) + strlen(s3) + strlen(s4) + 1), s1), s2), s3), s4); @@ -63,8 +57,7 @@ char *s1, *s2, *s3, *s4; char * -newstr5(s1, s2, s3, s4, s5) -char *s1, *s2, *s3, *s4, *s5; +newstr5(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5) { return strcat(strcat(strcat(strcat(strcpy(myalloc(strlen(s1) + strlen(s2) + strlen(s3) + strlen(s4) + strlen(s5) + 1), s1), s2), s3), s4), s5); @@ -72,8 +65,7 @@ char *s1, *s2, *s3, *s4, *s5; char * -newstr6(s1, s2, s3, s4, s5, s6) -char *s1, *s2, *s3, *s4, *s5, *s6; +newstr6(const char *s1, const char *s2, const char *s3, const char *s4, const char *s5, const char *s6) { return strcat(strcat(strcat(strcat(strcat(strcpy(myalloc(strlen(s1) + strlen(s2) + strlen(s3) + strlen(s4) + strlen(s5) + strlen(s6) + 1), @@ -82,16 +74,14 @@ char *s1, *s2, *s3, *s4, *s5, *s6; char * -catstr(old, s) -char *old, *s; +catstr(char *old, char *s) { return strcat(myrealloc(old, strlen(old) + strlen(s) + 1), s); } char * -catstr2(old, s1, s2) -char *old, *s1, *s2; +catstr2(char *old, char *s1, char *s2) { return strcat(strcat(myrealloc(old, strlen(old) + strlen(s1) + strlen(s2) + 1), s1), s2); @@ -102,9 +92,8 @@ char *old, *s1, *s2; * Compare two newsgroups for equality. * The first one may be a "meta" newsgroup. */ -static -ptrncmp(ng1, ng2) -register char *ng1, *ng2; +static int +ptrncmp(register char *ng1, register char *ng2) { while (1) { @@ -149,8 +138,8 @@ register char *ng1, *ng2; * sublist uses "all" like shell uses "*", and "." like shell uses "/" * if subscription X matches Y, it also matches Y.anything */ -ngmatch(nglist, sublist) -char *nglist, *sublist; +int +readnews_ngmatch(char *nglist, char *sublist) { register char *n, *s, *nd, *sd; register int rc; @@ -158,11 +147,11 @@ char *nglist, *sublist; rc = 0; n = nglist; while (*n && rc == 0) { - if (nd = strchr(n, NGSEPCHAR)) + if ((nd = strchr(n, NGSEPCHAR))) *nd = '\0'; s = sublist; while (*s) { - if (sd = strchr(s, NGSEPCHAR)) + if ((sd = strchr(s, NGSEPCHAR))) *sd = '\0'; if (*s != NEGCHAR) rc |= ptrncmp(s, n); @@ -186,13 +175,12 @@ char *nglist, *sublist; * open a file */ FILE * -fopenf(name, mode) -char *name, *mode; +fopenf(char *name, char *mode) { register FILE *f; if ((f = fopen(name, mode)) == NULL) - error("Can't %s %s", *mode == 'r' ? "open" : "create", name); + readnews_error("Can't %s %s", *mode == 'r' ? "open" : "create", name); return f; } @@ -201,13 +189,12 @@ char *name, *mode; * replace all '.''s with '/' */ char * -convg(s) -register char *s; +convg(char *s) { register char *sav; sav = s; - while (s = strchr(s, '.')) + while ((s = strchr(s, '.'))) *s = '/'; return sav; } @@ -218,7 +205,7 @@ register char *s; * trim leading and trailing blanks */ char * -mgets() +mgets(void) { register char *s; static char buf[BUFSIZ]; @@ -228,7 +215,7 @@ mgets() (void) printf("\n"); return NIL(char); } - if (s = strchr(buf, '\n')) + if ((s = strchr(buf, '\n'))) while (isspace(*s) && s > buf) *s-- = '\0'; else { @@ -242,6 +229,7 @@ mgets() } +#if 0 /* * apply the given function to each member in the newsgroup */ @@ -256,7 +244,7 @@ char *arg1; err = 0; while (*ng) { - if (delim = strchr(ng, NGSEPCHAR)) + if ((delim = strchr(ng, NGSEPCHAR))) *delim = '\0'; err += (*func)(ng, arg1); if (delim) @@ -266,19 +254,17 @@ char *arg1; } return err; } +#endif /* * generate a return address */ char * -getretaddr(hp) -header *hp; +getretaddr(header *hp) { register char *ra; - extern char *exaddress(); - if (hp->h_replyto) ra = exaddress(hp->h_replyto); else if (hp->h_from) @@ -295,8 +281,7 @@ header *hp; * try and make a proper address */ char * -exaddress(addr) -char *addr; +exaddress(char *addr) { register char *space, *dot, *at; register char *raddr; @@ -305,7 +290,7 @@ char *addr; raddr = NIL(char); if (strcmp(mailvia, "") == 0) return raddr; - if (space = strchr(addr, ' ')) + if ((space = strchr(addr, ' '))) *space = '\0'; if (mailvia[0] != '\0' && (at = strchr(addr, '@')) != NULL) { *at = '\0'; @@ -323,8 +308,8 @@ char *addr; * remove extra spaces, and insert separators if necessary in * newsgroups specification */ -convgrps(sp) -register char *sp; +void +convgrps( register char *sp) { register char *sep = NULL; --- libc/getabsdate.c.orig 2023-07-13 15:07:53 UTC +++ libc/getabsdate.c @@ -10,15 +10,17 @@ #include #include "dateconv.h" #include "datetok.h" +#include "libc.h" #define MAXDATEFIELDS 25 /* imports */ -extern int parsetime(); /* forwards */ -int prsabsdate(); +static int prsabsdate(char *timestr, struct timeb *now, register struct tm *tm, int *tzp); + + /* exports */ extern int dtok_numparsed; @@ -26,9 +28,7 @@ extern int dtok_numparsed; * parse and convert absolute date in timestr (the normal interface) */ time_t -getabsdate(timestr, now) -char *timestr; -struct timeb *now; +getabsdate(char *timestr, struct timeb *now) { int tz = 0; struct tm date; @@ -40,12 +40,12 @@ struct timeb *now; /* * just parse the absolute date in timestr and get back a broken-out date. */ -int -prsabsdate(timestr, now, tm, tzp) -char *timestr; -struct timeb *now; -register struct tm *tm; -int *tzp; +static int +prsabsdate( +char *timestr, +struct timeb *now, +register struct tm *tm, +int *tzp) { register int nf; char *fields[MAXDATEFIELDS]; @@ -80,12 +80,12 @@ int *tzp; * try to parse pre-split timestr as an absolute date */ int -tryabsdate(fields, nf, now, tm, tzp) -char *fields[]; -int nf; -struct timeb *now; -register struct tm *tm; -int *tzp; +tryabsdate( +char *fields[], +int nf, +struct timeb *now, +register struct tm *tm, +int *tzp) { register int i; register datetkn *tp; --- util/getabsdate.c.orig 1994-11-30 23:16:39 UTC +++ util/getabsdate.c @@ -8,6 +8,9 @@ #include #include #include +#include +#include "alloc.h" +#include "libc.h" /* privates */ static struct timeb ftnow; @@ -16,23 +19,15 @@ static int exitstatus = 0; char *progname; /* imports */ -extern struct tm *gmtime(); -extern time_t time(); -extern int optind; -extern char *optarg; -extern char *strsave(); -extern time_t getabsdate(); - /* Forwards. */ -extern void process(); +void process(char *timestr); /* - main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { register int c, errflg = 0; @@ -60,8 +55,7 @@ char *argv[]; * process - print time_t of tm */ void -process(timestr) -char *timestr; +process(char *timestr) { register time_t tstime; register char *copy = strsave(timestr); @@ -76,6 +70,6 @@ char *timestr; progname, timestr); exitstatus = 1; } else - (void) printf("%ld\n", tstime); + (void) printf("%ld\n", (long)tstime); free(copy); } --- libcnews/gethdr.c.orig 1994-01-12 04:45:20 UTC +++ libcnews/gethdr.c @@ -14,8 +14,8 @@ static int rfc = 1036; -sethdrrfc(newrfc) -int newrfc; +void +sethdrrfc(int newrfc) { rfc = newrfc; } @@ -24,8 +24,7 @@ int newrfc; * make longlimit fit in an int. for now, restrict it to 30000 if it won't fit. */ STATIC int -intlimit(longlimit) -register long longlimit; +intlimit(register long longlimit) { register int limit = (int)longlimit; /* hmm, could overflow */ @@ -41,10 +40,10 @@ register long longlimit; * *limitp is updated by subtracting the number of bytes read. */ char * /* malloced; caller must not free */ -gethdr(in, limitp, ishdrp) -FILE *in; -register long *limitp; -int *ishdrp; +gethdr( +FILE *in, +register long *limitp, +int *ishdrp) { register int c, hdrlen, contlen, limitset = *limitp >= 0; register char *contin = NULL; @@ -88,8 +87,7 @@ int *ishdrp; * If a colon is seen before whitespace, it is. */ int -ishdr(s) -register char *s; +ishdr(register char *s) { register char *cp = s; register int c; --- libc/getindate.c.orig 2023-03-05 10:57:38 UTC +++ libc/getindate.c @@ -8,9 +8,16 @@ #include #include #include +#include #include "dateconv.h" #include "datetok.h" +#include "libc.h" + +/* forwards */ +static int prsindate(register char *line, register struct tm *tm, int *tzp); +int parsetime(register char *time, register struct tm *tm); + /* STREQ is an optimised strcmp(a,b)==0 */ #define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0) @@ -53,9 +60,9 @@ */ /* ARGSUSED */ time_t -getindate(line, now) -register char *line; /* can be modified */ -struct timeb *now; /* unused; for getdate compatibility */ +getindate( +register char *line, /* can be modified */ +struct timeb *now) /* unused; for getdate compatibility */ { int tz = 0; struct tm date; @@ -65,12 +72,11 @@ struct timeb *now; /* unused; for getdate compatibil /* * just parse the Internet date in timestr and get back a broken-out date. + * + * register char *line can be modified */ -int -prsindate(line, tm, tzp) -register char *line; /* can be modified */ -register struct tm *tm; -int *tzp; +static int +prsindate(register char *line, register struct tm *tm, int *tzp) { register int c; register char ch; /* used by SKIPTOSPC */ @@ -218,9 +224,7 @@ int *tzp; /* return -1 on failure */ int -parsetime(time, tm) -register char *time; -register struct tm *tm; +parsetime(register char *time, register struct tm *tm) { register char c; register int x; --- inject/getmypwent.c.orig 1994-02-01 03:29:19 UTC +++ inject/getmypwent.c @@ -5,18 +5,16 @@ #include #include +#include +#include "inject.h" -/* imports */ -extern char *getlogin(); -/* extern struct passwd *getpwuid(), *getpwnam(); */ - /* * Note: this is the canonical way to determine your userid, * as per V7's getlogin(3). It sure would be nice if everyone * who does only half the job were to do the whole job. */ struct passwd * -getmypwent() +getmypwent(void) { register char *login = getlogin(); --- libc/getreldate.c.orig 1994-11-30 23:16:32 UTC +++ libc/getreldate.c @@ -36,12 +36,12 @@ #include "datetok.h" #include "dateconv.h" +#include "libc.h" #define STREQ(a, b) (*(a) == *(b) && strcmp(a, b) == 0) #define MAXDATEFIELDS 50 -extern time_t time(); extern datetkn datereltoks[]; extern unsigned int szdatereltoks; @@ -52,13 +52,14 @@ struct parsestate { time_t lastnum; }; +/* forwards */ +static int prsreldate(char *timestr, struct timeb *now, register struct tm *tm, int *tzp); + /* * parse and convert relative date in timestr (the normal interface) */ time_t -getreldate(timestr, now) -char *timestr; -struct timeb *now; +getreldate(char *timestr, struct timeb *now) { int tz = 0; struct tm date; @@ -69,12 +70,12 @@ struct timeb *now; /* try to parse "now" or an absolute date */ static int -trydate(fields, nf, now, tm, tzp) -register char **fields; -int nf; -struct timeb *now; -struct tm *tm; -int *tzp; +trydate( +register char **fields, +int nf, +struct timeb *now, +struct tm *tm, +int *tzp) { if (nf == 1 && (STREQ(fields[0], "now") || STREQ(fields[0], "today") || @@ -98,14 +99,14 @@ int *tzp; /* TODO: absdate may not be DEC date */ static int /* token type, 0 for done, -1 for failure */ -prsrdtoken(fields, nf, i, now, tm, tzp, psp) -register char **fields; -int nf; -register int i; -struct timeb *now; -register struct tm *tm; -int *tzp; -register struct parsestate *psp; +prsrdtoken( +register char **fields, +int nf, +register int i, +struct timeb *now, +register struct tm *tm, +int *tzp, +register struct parsestate *psp) { register char c; @@ -151,11 +152,13 @@ register struct parsestate *psp; psp->lastnum = -1; break; case NUMBER: - if (psp->lastnum != -1) - if (trydate(fields, nf, now, tm, tzp) == -1) + if (psp->lastnum != -1) { + if (trydate(fields, nf, now, tm, tzp) == -1) { return -1; - else + } else { return NUMBER; + } + } psp->lastnum = 1; break; case BEFORE: @@ -183,12 +186,8 @@ register struct parsestate *psp; * parse it, then hop back appropriate number of months and secs. Note * that we first hop back by months, then by secs. */ -int -prsreldate(timestr, now, tm, tzp) -char *timestr; -struct timeb *now; -register struct tm *tm; -int *tzp; +static int +prsreldate(char *timestr, struct timeb *now, register struct tm *tm, int *tzp) { register int i; struct parsestate ps; @@ -213,7 +212,6 @@ int *tzp; type = prsrdtoken(fields, nf, 0, now, tm, tzp, psp); if (type == ORDINAL) { /* TODO: finish this up */ - int ord = psp->lastnum; type = prsrdtoken(fields, nf, 1, now, tm, tzp, psp); switch (type) { --- util/gngp.c.orig 1992-03-02 07:03:05 UTC +++ util/gngp.c @@ -6,16 +6,18 @@ #include #include #include +#include #include #include "libc.h" #include "news.h" #include "fgetfln.h" #include "ngmatch.h" -/* imports */ -extern FILE *efopen(); +/* forwards */ +int process(register char *pattern, register FILE *in, const char *inname); +int gngp(register char *pattern, register char *text); -char *progname; +const char *progname; int debug = 0; /* @@ -29,9 +31,8 @@ static NGPAT *ngpat; /* * main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c, status = 0, errflg = 0; char *patarg; @@ -83,10 +84,8 @@ char *argv[]; /* * process - process input file */ -process(pattern, in, inname) -register char *pattern; -register FILE *in; -char *inname; +int +process(register char *pattern, register FILE *in, const char *inname) { register char *line; register int status = 0; @@ -104,8 +103,7 @@ char *inname; } int -gngp(pattern, text) -register char *pattern, *text; +gngp(register char *pattern, register char *text) { register int returned; register char *whitesp; --- libc/hash.c.orig 1993-03-09 06:05:45 UTC +++ libc/hash.c @@ -10,8 +10,7 @@ #ifdef notdef static unsigned /* not yet taken modulus table size */ -hashdef(key) -register HASHDATUM key; +hashdef(register HASHDATUM key) { register unsigned hash = 0; register char c; @@ -23,15 +22,14 @@ register HASHDATUM key; #endif HASHTABLE * -hashcreate(size, hashfunc) -unsigned size; /* a crude guide to size */ -unsigned (*hashfunc)(); +hashcreate( +unsigned size, /* a crude guide to size */ +unsigned (*hashfunc)(HDBMDATUM key)) { return hdbmcreate(size, hashfunc); } -hashdestroy(tbl) -register HASHTABLE *tbl; +void hashdestroy(register HASHTABLE *tbl) { hdbmdestroy(tbl); } @@ -41,9 +39,7 @@ register HASHTABLE *tbl; * for the life of the table. */ int -hashstore(tbl, key, data) -HASHTABLE *tbl; -register HASHDATUM key, data; +hashstore(HASHTABLE *tbl, register HASHDATUM key, register HASHDATUM data) { register HDBMDATUM hdbmkey, hdbmdata; @@ -54,11 +50,11 @@ register HASHDATUM key, data; return hdbmstore(tbl, hdbmkey, hdbmdata); } -static HASHDATUM (*hashalloc)(); +static HASHDATUM (*hashalloc)(HASHDATUM key); +/* hdbm->hash->hdbm allocator translator */ static HDBMDATUM -hdbmalloc(key) /* hdbm->hash->hdbm allocator translator */ -HDBMDATUM key; +hdbmalloc(HDBMDATUM key) { register HDBMDATUM hdbmdata; @@ -69,10 +65,10 @@ HDBMDATUM key; /* return any existing entry for key; otherwise call allocator to make one */ HASHDATUM -hashentry(tbl, key, allocator) -register HASHTABLE *tbl; -HASHDATUM key; -HASHDATUM (*allocator)(); +hashentry( +register HASHTABLE *tbl, +HASHDATUM key, +HASHDATUM (*allocator)(HASHDATUM key)) { register HDBMDATUM hdbmkey, hdbmdata; @@ -84,9 +80,7 @@ HASHDATUM (*allocator)(); } HASHDATUM /* data corresponding to key */ -hashfetch(tbl, key) -HASHTABLE *tbl; -register HASHDATUM key; +hashfetch(HASHTABLE *tbl, register HASHDATUM key) { register HDBMDATUM hdbmkey, hdbmdata; @@ -97,9 +91,7 @@ register HASHDATUM key; } int -hashdelete(tbl, key) -HASHTABLE *tbl; -register HASHDATUM key; +hashdelete(HASHTABLE *tbl, register HASHDATUM key) { register HDBMDATUM hdbmkey; @@ -110,16 +102,15 @@ register HASHDATUM key; struct translate { char *realhook; - int (*func)(); + int (*func)(HASHDATUM key, HASHDATUM data, char *hook); }; -static -hdbmtohash(key, data, hook) -HDBMDATUM key, data; -char *hook; +static int +hdbmtohash(HDBMDATUM key, HDBMDATUM data, char *hook) { register struct translate *thp = (struct translate *)hook; + return (*thp->func)(key.dat_ptr, data.dat_ptr, thp->realhook); } @@ -128,10 +119,11 @@ char *hook; * HDBMDATUM arguments to HASHDATUM arguments. this also demonstrates * how to use the hook argument. */ -hashwalk(tbl, nodefunc, hook) -HASHTABLE *tbl; -int (*nodefunc)(); -char *hook; /* (void *) really */ +void +hashwalk( +HASHTABLE *tbl, +int (*nodefunc)(HASHDATUM key, HASHDATUM data, char *hook), +char *hook) /* (void *) really */ { struct translate transhook; register struct translate *tp = &transhook; --- include/hash.h.orig 1991-11-07 20:44:48 UTC +++ include/hash.h @@ -8,7 +8,10 @@ typedef char *HASHDATUM; /* #define won't do due to #define HASHTABLE struct hashtable #endif -extern HASHTABLE *hashcreate(); -extern hashdestroy(), hashwalk(); -extern int hashstore(), hashdelete(); -extern HASHDATUM hashfetch(), hashentry(); +extern HASHTABLE *hashcreate(unsigned size, unsigned (*hashfunc)(HDBMDATUM key)); +extern void hashdestroy(register HASHTABLE *tbl); +extern void hashwalk(HASHTABLE *tbl, int (*nodefunc)(HASHDATUM key, HASHDATUM data, char *hook), char *hook); +extern int hashstore(HASHTABLE *tbl, register HASHDATUM key, register HASHDATUM data); +extern int hashdelete(HASHTABLE *tbl, register HASHDATUM key); +extern HASHDATUM hashfetch(HASHTABLE *tbl, register HASHDATUM key); +extern HASHDATUM hashentry(register HASHTABLE *tbl, HASHDATUM key, HASHDATUM (*allocator)(HASHDATUM key)); --- libc/hdbm.c.orig 1993-03-09 06:04:52 UTC +++ libc/hdbm.c @@ -19,8 +19,7 @@ static HASHENT *hereuse = NULL; static int reusables = 0; static unsigned /* not yet taken modulus table size */ -hdbmdef(key) -HDBMDATUM key; +hdbmdef(HDBMDATUM key) { register char *s = key.dat_ptr; register unsigned len = key.dat_len; @@ -32,9 +31,9 @@ HDBMDATUM key; } HASHTABLE * -hdbmcreate(size, hashfunc) -register unsigned size; /* a crude guide to size */ -unsigned (*hashfunc)(); +hdbmcreate( +register unsigned size, /* a crude guide to size */ +unsigned (*hashfunc)(HDBMDATUM key)) { register HASHTABLE *tbl; register HASHENT **hepp; @@ -64,9 +63,9 @@ unsigned (*hashfunc)(); return tbl; } -static -hefree(hp) /* free a hash entry */ -register HASHENT *hp; +/* free a hash entry */ +static void +hefree(register HASHENT *hp) { if (reusables >= RETAIN) /* compost heap is full? */ free((char *)hp); /* yup, just pitch this one */ @@ -81,8 +80,8 @@ register HASHENT *hp; * free all the memory associated with tbl, erase the pointers to it, and * invalidate tbl to prevent further use via other pointers to it. */ -hdbmdestroy(tbl) -register HASHTABLE *tbl; +void +hdbmdestroy(register HASHTABLE *tbl) { register unsigned idx; register HASHENT *hp, *next; @@ -113,9 +112,7 @@ register HASHTABLE *tbl; * to be inserted, if insertion is desired. */ static HASHENT ** -hdbmfind(tbl, key) -register HASHTABLE *tbl; -HDBMDATUM key; +hdbmfind(register HASHTABLE *tbl, HDBMDATUM key) { register HASHENT *hp, *prevhp = NULL; register char *hpkeydat, *keydat = key.dat_ptr; @@ -140,7 +137,7 @@ HDBMDATUM key; } static HASHENT * -healloc() /* allocate a hash entry */ +healloc(void) /* allocate a hash entry */ { register HASHENT *hp; @@ -159,9 +156,7 @@ healloc() /* allocate a hash entry */ * for the life of the table. */ int -hdbmstore(tbl, key, data) -register HASHTABLE *tbl; -HDBMDATUM key, data; +hdbmstore(register HASHTABLE *tbl, HDBMDATUM key, HDBMDATUM data) { register HASHENT *hp; register HASHENT **nextp; @@ -186,10 +181,10 @@ HDBMDATUM key, data; /* return any existing entry for key; otherwise call allocator to make one */ HDBMDATUM -hdbmentry(tbl, key, allocator) -register HASHTABLE *tbl; -HDBMDATUM key; -HDBMDATUM (*allocator)(); +hdbmentry( +register HASHTABLE *tbl, +HDBMDATUM key, +HDBMDATUM (*allocator)(HDBMDATUM key)) { register HASHENT *hp; register HASHENT **nextp; @@ -214,9 +209,7 @@ HDBMDATUM (*allocator)(); } int -hdbmdelete(tbl, key) -register HASHTABLE *tbl; -HDBMDATUM key; +hdbmdelete(register HASHTABLE *tbl, HDBMDATUM key) { register HASHENT *hp; register HASHENT **nextp; @@ -235,9 +228,7 @@ HDBMDATUM key; } HDBMDATUM /* data corresponding to key */ -hdbmfetch(tbl, key) -register HASHTABLE *tbl; -HDBMDATUM key; +hdbmfetch(register HASHTABLE *tbl, HDBMDATUM key) { register HASHENT *hp; register HASHENT **nextp; @@ -260,10 +251,11 @@ HDBMDATUM key; * arguments. hook is an attempt to allow side-effects and reentrancy at * the same time. */ -hdbmwalk(tbl, nodefunc, hook) -HASHTABLE *tbl; -register int (*nodefunc)(); -register char *hook; /* (void *) really */ +void +hdbmwalk( +HASHTABLE *tbl, +register int (*nodefunc)(register HDBMDATUM key, register HDBMDATUM data, register char *hook), +register char *hook) /* (void *) really */ { register unsigned idx; register HASHENT *hp; --- include/hdbm.h.orig 1991-11-07 20:44:14 UTC +++ include/hdbm.h @@ -12,7 +12,10 @@ HDBMDATUM { #define HASHTABLE struct hashtable #endif -extern HASHTABLE *hdbmcreate(); -extern hdbmdestroy(), hdbmwalk(); -extern int hdbmstore(), hdbmdelete(); -extern HDBMDATUM hdbmfetch(), hdbmentry(); +extern HASHTABLE *hdbmcreate(register unsigned size, unsigned (*hashfunc)(HDBMDATUM key)); +extern void hdbmdestroy(register HASHTABLE *tbl); +extern void hdbmwalk(HASHTABLE *tbl, register int (*nodefunc)(register HDBMDATUM key, register HDBMDATUM data, register char *hook), register char *hook); +extern int hdbmstore(HASHTABLE *tbl, register HDBMDATUM key, register HDBMDATUM data); +extern int hdbmdelete(register HASHTABLE *tbl, HDBMDATUM key); +extern HDBMDATUM hdbmfetch(register HASHTABLE *tbl, HDBMDATUM key); +extern HDBMDATUM hdbmentry(register HASHTABLE *tbl, HDBMDATUM key, HDBMDATUM (*allocator)(HDBMDATUM key)); --- libc/hdbmint.h.orig 1991-11-07 11:32:29 UTC +++ libc/hdbmint.h @@ -21,5 +21,5 @@ HASHTABLE { HASHENT **ht_addr; /* array of HASHENT pointers */ unsigned ht_size; char ht_magic; - unsigned (*ht_hash)(); + unsigned (*ht_hash)(HDBMDATUM key); }; --- relay/hdrdefs.c.orig 1994-10-18 03:49:53 UTC +++ relay/hdrdefs.c @@ -104,15 +104,14 @@ hdrlist hdrvilest = { boolean headdebug = NO; void -hdrdebug(state) -int state; +hdrdebug(int state) { headdebug = state; } +/* zero all elements of hdrs */ void -hdrinit(hdrs) /* zero all elements of hdrs */ -register struct headers *hdrs; +hdrinit(register struct headers *hdrs) { hdrs->h_subj = NULL; hdrs->h_ngs = NULL; @@ -130,9 +129,9 @@ register struct headers *hdrs; hdrs->h_xref = NULL; } +/* free (assumed) malloced storage */ void -freeheaders(hdrs) /* free (assumed) malloced storage */ -register struct headers *hdrs; +freeheaders(register struct headers *hdrs) { nnfree(&hdrs->h_subj); nnfree(&hdrs->h_ngs); --- relay/hdrint.h.orig 1992-03-18 04:00:38 UTC +++ relay/hdrint.h @@ -17,3 +17,17 @@ extern struct hdrdef pathhdr, xrefhdr; extern hdrlist reqdhdrs, opthdrs, hdrvilest; extern boolean headdebug; + +/* imports from hdrparse.c */ +extern int hdrparse(register struct headers *hdrs, char *line, hdrlist hdrlst); +extern void hdrdeflt(register struct headers *hdrs); +extern char *hdrreq(register struct headers *hdrs); + +/* imports from hdrmunge.c */ +extern void wrhdrstrm(register struct article *art, char *hdr, register int hdrlen); +extern void flshdrstrm(register struct article *art); +extern statust clshdrstrm(void); +extern void emitxref(register struct article *art); +extern void hdrdump(register struct article *art); +extern void hdrdigest(register struct article *art, register char *line, int hdrlen); + --- relay/hdrmunge.c.orig 1993-03-13 07:10:28 UTC +++ relay/hdrmunge.c @@ -29,7 +29,13 @@ #include "relay.h" #include "hdrint.h" #include "msgs.h" +#include "rerror.h" +#include "fileart.h" +#include "history.h" +#include "control.h" +/* imports */ + /* * HDRMEMSIZ is the length of a header-stashing buffer, which is used * only during article-header copying. @@ -53,10 +59,8 @@ static char nmhdrstrm[] = "headers"; /* name of same * * write hdr to the accumulated header stream * (for the benefit of threaded newsreaders). */ -wrhdrstrm(art, hdr, hdrlen) -register struct article *art; -char *hdr; -register int hdrlen; +void +wrhdrstrm(register struct article *art, char *hdr, register int hdrlen) { if (hdrfp == NULL) hdrfp = fopenclex(ctlfile(nmhdrstrm), "a"); @@ -72,10 +76,7 @@ register int hdrlen; * adjust art->a_charswritten to match. */ STATIC void -writehdr(art, hdr, hdrlen) -register struct article *art; -char *hdr; -register int hdrlen; +writehdr(register struct article *art, char *hdr, register int hdrlen) { if (fwrite(hdr, hdrlen, 1, art->a_artf) != 1) fulldisk(art, spoolnm(art)); @@ -84,8 +85,8 @@ register int hdrlen; wrhdrstrm(art, hdr, hdrlen); } -flshdrstrm(art) -register struct article *art; +void +flshdrstrm(register struct article *art) { if (hdrfp != NULL) { (void) putc('\n', hdrfp); /* blank line to separate articles */ @@ -95,7 +96,7 @@ register struct article *art; } statust -clshdrstrm() +clshdrstrm(void) { statust status = ST_OKAY; @@ -112,8 +113,7 @@ clshdrstrm() * Turn slashes in art->a_files into colons in Xref:. */ void -emitxref(art) -register struct article *art; +emitxref(register struct article *art) { register char *slashp, *xrefs, *nhdr, *s1, *s2; @@ -143,10 +143,7 @@ register struct article *art; * (Don't change Path: if we are replicating news.) */ STATIC void -emithdr(art, hdr, hdrlen) -register struct article *art; -register char *hdr; -int hdrlen; +emithdr(register struct article *art, register char *hdr, int hdrlen) { if (!opts.blvxref && CISTREQN(hdr, pathhdr.hdrnm, (int)pathhdr.hdrlen)) { @@ -176,12 +173,11 @@ int hdrlen; * to have one active at a time, and there is no memory saving in allocating * and deallocating it, particularly since copyart's (header) buffer must * coexist with hdrstore. + * + * register int hdrlen for optimisation only */ STATIC void -hdrsave(art, hdr, hdrlen) -register struct article *art; -char *hdr; -register int hdrlen; /* optimisation only */ +hdrsave(register struct article *art, char *hdr, register int hdrlen) { if (art->a_artf != NULL) { emithdr(art, hdr, hdrlen); @@ -235,11 +231,11 @@ register int hdrlen; /* optimisation only */ * art->a_artf may be NULL, and may get set by hdrsave. */ STATIC void -hdrmunge(art, buffer, hdrlen, hdrlst) -register struct article *art; -register char *buffer; -int hdrlen; /* optimisation only */ -hdrlist hdrlst; /* headers of negative utility: snuff 'em */ +hdrmunge( +register struct article *art, +register char *buffer, +int hdrlen, /* optimisation only */ +hdrlist hdrlst) /* headers of negative utility: snuff 'em */ { register struct hdrdef **vhp; @@ -265,8 +261,7 @@ hdrlist hdrlst; /* headers of negative utility: snuf * there (it will get filed later by hdrdump(...,ALLHDRS) or in insart()). */ void -hdrdump(art) -register struct article *art; +hdrdump(register struct article *art) { if (art->a_artf != NULL && art->a_haccum != NULL && art->a_haccum[0] != '\0') { @@ -308,10 +303,7 @@ register struct article *art; * hdrdump counts art->a_charswritten. */ void -hdrdigest(art, line, hdrlen) -register struct article *art; -register char *line; -int hdrlen; +hdrdigest(register struct article *art, register char *line, int hdrlen) { register int match; --- relay/hdrparse.c.orig 1993-02-09 03:10:50 UTC +++ relay/hdrparse.c @@ -11,6 +11,7 @@ #include "relay.h" #include "case.h" #include "hdrint.h" +#include "control.h" #undef RFC1036 /* alters hdrparse behaviour */ @@ -23,10 +24,10 @@ * freeheader() will free this memory. */ int /* NO, YES or YES+1 (error) */ -hdrparse(hdrs, line, hdrlst) -register struct headers *hdrs; -char *line; -hdrlist hdrlst; /* headers of positive utility */ +hdrparse( +register struct headers *hdrs, +char *line, +hdrlist hdrlst) /* headers of positive utility */ { register struct hdrdef **hpp; register char *hackline = hackhybrid(line); @@ -71,8 +72,7 @@ hdrlist hdrlst; /* headers of positive utility */ * Article-I.D.: gets the transformed Article-I.D. as its Message-ID:. */ void -hdrdeflt(hdrs) -register struct headers *hdrs; +hdrdeflt(register struct headers *hdrs) { if (hdrs->h_distr == NULL) hdrs->h_distr = strsave(DEFDIST); @@ -88,8 +88,7 @@ register struct headers *hdrs; * require the headers required by RFC 1036. */ char * /* error string */ -hdrreq(hdrs) -register struct headers *hdrs; +hdrreq(register struct headers *hdrs) { register struct hdrdef **hpp; static char errbuf[100]; --- readnews/header.c.orig 1994-08-25 20:15:09 UTC +++ readnews/header.c @@ -4,6 +4,7 @@ #include "defs.h" #include +#include "libc.h" extern char systemid[]; extern long now; @@ -72,22 +73,23 @@ static field fields[] = }; -char *weekdays[7] = +const char *weekdays[7] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" }; -char *months[12] = +const char *months[12] = { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; +/* forwards */ +static char *hfgets(char *buf, int len, FILE *fp); -static -fieldcmp(a, b) -field *a, *b; +static int +fieldcmp(const field *a, const field *b) { return CMP(a->f_name, b->f_name); } @@ -98,20 +100,22 @@ field *a, *b; * * Written by J. S. Rugaber; rewritten by L. Rosler, Dept. 45175, August, 1981. */ -char * -search(key, base, nel, width, compar) +static void * +search(const field *key, const field *base, unsigned nel, unsigned width, int (*compar)(const field *s1, const field *s2)) +#if 0 char *key; /* Key to be located */ char *base; /* Beginning of table */ unsigned nel; /* Number of elements in the table */ unsigned width; /* Width of an element (bytes) */ -int (*compar)(); /* Comparison function */ +int (*compar)(const char *s1, const char *s2); /* Comparison function */ +#endif { int two_width = width + width; - char *last = base + width * (nel - 1); /* Last element in table */ + const field *last = &(base[nel - 1]); /* Last element in table */ while (last >= base) { - register char *p = base + width * ((last - base)/two_width); + register const field *p = &(base[((last - base)/two_width)]); register int res = (*compar)(key, p); if (res == 0) @@ -129,15 +133,13 @@ int (*compar)(); /* Comparison function */ * extract headers from file, * position file to start of body */ -gethead(f, hp) -FILE *f; -header *hp; +void +gethead(FILE *f, header *hp) { register char *colon, *space, *s; register field *fp; field af; char buf[BUFLEN*2]; - char *hfgets(); memset((char *) hp, 0, sizeof(header)); while (hfgets(buf, sizeof(buf), f)) { @@ -147,7 +149,7 @@ header *hp; (space = strchr(buf, ' ')) && (colon + 1 == space)) { *colon = '\0'; af.f_name = buf; - fp = (field * )search((char *)&af, (char *)fields, + fp = search(&af, fields, sizeof fields/sizeof fields[0], sizeof fields[0], fieldcmp); *colon = ':'; @@ -159,7 +161,7 @@ header *hp; else hp->h_others = newstr(buf); else { - if (colon = strchr(space + 1, '\n')) + if ((colon = strchr(space + 1, '\n'))) *colon = '\0'; s = newstr(space + 1); switch (fp->f_type) { @@ -225,15 +227,12 @@ header *hp; /* * put headers to file + * pheadcom com; actually ignored now */ -puthead(hp, f, com) -header *hp; -FILE *f; -pheadcom com; /* actually ignored now */ +void +puthead(header *hp, FILE *f, pheadcom com) { register char *s; - char *getunique(); - extern char *getenv(); if (hp->h_relayversion) (void) fprintf(f, hform, t_relayversion, hp->h_relayversion); @@ -299,8 +298,8 @@ pheadcom com; /* actually ignored now */ /* * free all strings allocated to header */ -freehead(hp) -register header *hp; +void +freehead(register header *hp) { if (hp->h_relayversion) free(hp->h_relayversion); @@ -349,11 +348,8 @@ register header *hp; * received, the remainder of the line is thrown away * instead of treated like a second line. */ -char * -hfgets(buf, len, fp) -char *buf; -int len; -FILE *fp; +static char * +hfgets(char *buf, int len, FILE *fp) { register int c; register char *cp, *tp; @@ -398,10 +394,7 @@ FILE *fp; * return 0L on error */ long -atot(s) -char *s; +atot(char *s) { - extern long getindate(); - return getindate(s, (struct timeb *)NULL); } --- relay/headers.h.orig 1993-01-13 21:20:45 UTC +++ relay/headers.h @@ -33,12 +33,11 @@ struct headers { }; /* common */ -extern void hdrdebug(), hdrinit(), freeheaders(); +extern void hdrdebug(int state); +extern void hdrinit(register struct headers *hdrs); +extern void freeheaders(register struct headers *hdrs); -/* munge */ -extern void emitxref(), hdrdump(), hdrdigest(); - /* parse */ -extern void hdrdeflt(); -extern boolean ishdr(), contin(); -extern char *hdrreq(); +extern void hdrdeflt(register struct headers *hdrs); +extern char *hdrreq(register struct headers *hdrs); + --- maint/histinfo.c.orig 1995-01-02 21:48:43 UTC +++ maint/histinfo.c @@ -3,6 +3,8 @@ */ #include +#include +#include #include #include /* for modified time (date received) */ #include @@ -12,22 +14,26 @@ #include "fgetfln.h" #include "alloc.h" #include "case.h" +#include "news.h" +#undef STRLEN #define STRLEN(s) (sizeof(s) - 1) /* s must be a char array */ -char *progname; +/* forwards */ +void process(FILE *in, char *inname); + +const char *progname; int debug; -char *spdir; +const char *spdir; int spdirlen; /* * main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c; int errflg = 0; @@ -72,9 +78,8 @@ char *argv[]; /* * process - process input file */ -process(in, inname) -FILE *in; -char *inname; +void +process(FILE *in, char *inname) { char *name; char *line; @@ -148,7 +153,6 @@ char *inname; * unprivileged - no-op to keep pathname stuff happy */ void -unprivileged(reason) -char *reason; +unprivileged(const char *reason) { } --- relay/history.c.orig 1993-03-13 07:22:02 UTC +++ relay/history.c @@ -17,6 +17,7 @@ #include #include #include /* for memcpy */ +#include #include #include "fixerrno.h" #include @@ -29,6 +30,8 @@ #include "relay.h" #include "history.h" #include "msgs.h" +#include "rerror.h" +#include "control.h" #define HISTNAME "history" /* name of the history file in $NEWSCTL */ #define FIELDSEP '\t' @@ -46,14 +49,15 @@ static char *filename; /* absolute name of the ascii static boolean writable; /* libdbm imports */ -extern int dbminit(), store(); -extern datum fetch(); /* other imports */ -extern void prefuse(); +/* forwards */ +int msgidok(register struct article *art); + + STATIC void -histname() +histname(void) { if (filename == NULL) filename = strsave(ctlfile(HISTNAME)); @@ -65,7 +69,7 @@ histname() * so that this routine can be used by any user to read history files. */ STATIC boolean -openhist() +openhist(void) { histname(); if (fp == NULL) { @@ -95,8 +99,7 @@ openhist() * Turn \n & FIELDSEP into ' ' in s. */ STATIC void -sanitise(s) -register char *s; +sanitise(register char *s) { for (; *s != '\0'; ++s) if (*s == FIELDSEP || *s == '\n') @@ -107,15 +110,14 @@ register char *s; * Turn SUBFIELDSEP into ' ' in s. */ STATIC void -subsanitise(s) -register char *s; +subsanitise(register char *s) { stranslit(s, SUBFIELDSEP, ' '); } +/* return seek offset of history entry */ STATIC datum -getposhist(msgid) /* return seek offset of history entry */ -char *msgid; +getposhist(char *msgid) { register char *clnmsgid; datum msgidkey, keypos; @@ -133,9 +135,9 @@ char *msgid; return keypos; } +/* return true if found in the data base */ boolean -alreadyseen(msgid) /* return true if found in the data base */ -char *msgid; +alreadyseen(char *msgid) { datum posdatum; @@ -143,9 +145,10 @@ char *msgid; return posdatum.dptr != NULL; } -char * /* NULL if no history entry; else malloced */ -gethistory(msgid) /* return existing history entry, if any */ -char *msgid; +/* NULL if no history entry; else malloced */ +/* return existing history entry, if any */ +char * +gethistory(char *msgid) { long pos = 0; datum posdatum; @@ -168,8 +171,7 @@ char *msgid; * Side-effect: trims \n from the history entry. */ char * -findfiles(histent) -char *histent; +findfiles(char *histent) { register char *tabp; @@ -193,10 +195,7 @@ char *histent; * The fflush is crash-proofing. */ STATIC void -mkhistent(art, msgid, now, expiry) -register struct article *art; -char *msgid, *expiry; -time_t now; +mkhistent(register struct article *art, char *msgid, time_t now, char *expiry) { long pos; datum msgidkey, posdatum; @@ -233,9 +232,7 @@ time_t now; * (transmit() prints site names). */ void -history(art, startlog) -register struct article *art; -boolean startlog; +history(register struct article *art, boolean startlog) { register char *msgid, *expiry; time_t now; @@ -268,18 +265,18 @@ boolean startlog; free(expiry); } +/* mark art as undesirable */ void -decline(art) /* mark art as undesirable */ -struct article *art; +decline(struct article *art) { transient(art, '\0', "article is a turkey", ""); if (!opts.okrefusal) art->a_status |= ST_DROPPED; } -char * -ismsgidbad(msgid) /* if bad, return error */ -register char *msgid; +/* if bad, return error */ +const char * +ismsgidbad(register char *msgid) { if (msgid == NULL || msgid[0] == '\0') return "missing Message-ID"; @@ -293,11 +290,11 @@ register char *msgid; return NULL; } +/* if bad, complain in log */ int -msgidok(art) /* if bad, complain in log */ -register struct article *art; +msgidok(register struct article *art) { - register char *err = ismsgidbad(art->h.h_msgid); + register const char *err = ismsgidbad(art->h.h_msgid); if (err == NULL) return YES; @@ -314,8 +311,7 @@ register struct article *art; * value, and a "file" list ("net.foo/123"). */ statust -fakehist(fkmsgid, fkexpiry, fkfiles) -char *fkmsgid, *fkexpiry, *fkfiles; +fakehist(char *fkmsgid, char *fkexpiry, char *fkfiles) { struct article art; @@ -329,10 +325,7 @@ char *fkmsgid, *fkexpiry, *fkfiles; /* Append "group/artnumstr" to the file list in *art. */ void -histupdfiles(art, group, artnumstr) -register struct article *art; -register char *group; -register char *artnumstr; +histupdfiles(register struct article *art, register char *group, register char *artnumstr) { unsigned addlen = strlen(group) + STRLEN(SFNDELIM) + strlen(artnumstr) + SIZENUL; @@ -353,7 +346,7 @@ register char *artnumstr; } statust -closehist() +closehist(void) { register statust status = ST_OKAY; --- relay/history.h.orig 1990-03-05 23:44:59 UTC +++ relay/history.h @@ -1,8 +1,14 @@ /* imports from history.c */ -extern char *findfiles(), *gethistory(); -extern boolean alreadyseen(); -extern statust fakehist(), closehist(); -extern void history(), histupdfiles(); +extern boolean alreadyseen(char *msgid); +extern char *gethistory(char *msgid); +extern char *findfiles(char *histent); +extern void history(register struct article *art, boolean startlog); +extern void decline(struct article *art); +extern const char *ismsgidbad(register char *); +extern int msgidok(register struct article *art); +extern statust fakehist(char *fkmsgid, char *fkexpiry, char *fkfiles); +extern void histupdfiles(register struct article *art, register char *group, register char *artnumstr); +extern statust closehist(void); #define STARTLOG YES #define NOLOG NO --- libcnews/hostname.c.orig 1993-11-21 02:24:17 UTC +++ libcnews/hostname.c @@ -7,6 +7,7 @@ */ #include +#include #include #include "libc.h" @@ -18,7 +19,7 @@ #endif char * -hostname() /* return this Usenet machine's name */ +hostname(void) /* return this Usenet machine's name */ { static char name[MAXHOST]; --- relay/ihave.c.orig 1993-03-13 07:24:02 UTC +++ relay/ihave.c @@ -19,6 +19,8 @@ #include "history.h" #include "fgetmfs.h" #include "msgs.h" +#include "rerror.h" +#include "control.h" #ifndef AVEARTSIZE #define AVEARTSIZE 3000 @@ -34,21 +36,16 @@ #define PROTO_SENDME 1 /* imports */ -extern char *ismsgidbad(); /* * write the name of the article file on the batch file appropriate to * this remotesys and protocol. */ STATIC void -appmsgnmtonxtbatfile(art, remotesys, proto) -register struct article *art; -char *remotesys; -int proto; +appmsgnmtonxtbatfile(register struct article *art, char *remotesys, int proto) { register char *batchname; register FILE *batf; - extern boolean safecmd(); if (!safecmd(remotesys)) { /* nasty site name? a bit paranoid */ errno = 0; @@ -69,10 +66,7 @@ int proto; } STATIC void -doproto(args, art, proto) -char *args; -register struct article *art; -int proto; +doproto(char *args, register struct article *art, int proto) { register char *argscp = skipsp(args), *remotesys, *p; char *myname; @@ -118,9 +112,7 @@ int proto; * "to.remotesys" in sys, which had better have the I flag on. */ void -ihave(args, art) -char *args; -struct article *art; +ihave(char *args, struct article *art) { doproto(args, art, PROTO_IHAVE); } @@ -132,9 +124,7 @@ struct article *art; * "to.remotesys/sendme" in sys, which will typically name a batch file. */ void -sendme(args, art) -char *args; -struct article *art; +sendme(char *args, struct article *art) { doproto(args, art, PROTO_SENDME); } --- include/inject.h.orig 2023-02-12 17:08:16 UTC +++ include/inject.h @@ -0,0 +1,5 @@ + +const char *fullname(register struct passwd *pwp, int usggcos); +extern void intcode(time_t tm); +extern struct passwd *getmypwent(void); + --- inject/intcode.c.orig 1991-09-12 05:09:59 UTC +++ inject/intcode.c @@ -6,6 +6,7 @@ #include #include +#include "inject.h" /* private data */ #ifdef notdef @@ -25,8 +26,8 @@ static char alphabet[] = "0123456789ABCDEFGHIJKLMnopqr #define RADIX (sizeof alphabet - 1) -intcode(tm) -time_t tm; +void +intcode(time_t tm) { register time_t nextl = tm / RADIX; --- relay/io.c.orig 1994-01-31 05:20:09 UTC +++ relay/io.c @@ -9,16 +9,17 @@ #include "relay.h" #include "msgs.h" #include "active.h" +#include "rerror.h" +#include "transmit.h" +#include "io.h" +#include "caches.h" /* * If *fpp is non-null, fclose it and check for errors. * On error, call fulldisk(art, name). */ void -nnfclose(art, fpp, name) -struct article *art; -register FILE **fpp; -char *name; +nnfclose(struct article *art, register FILE **fpp, const char *name) { if (*fpp != NULL) { if (nfclose(*fpp) == EOF) @@ -28,7 +29,7 @@ char *name; } statust -synccaches() /* force dirty in-core caches to disk */ +synccaches(void) /* force dirty in-core caches to disk */ { return actsync() | trclose(); } --- relay/io.h.orig 1989-01-22 09:13:18 UTC +++ relay/io.h @@ -1,2 +1,3 @@ /* imports from io.c */ -extern void nnfclose(); +extern void nnfclose(struct article *art, register FILE **fpp, const char *name); + --- include/libc.h.orig 1994-10-18 03:49:34 UTC +++ include/libc.h @@ -4,6 +4,7 @@ * declarations of (supposedly) standard C library functions and types. */ +#if 0 extern time_t time(); /* sys/timeb.h? time.h sez POSIX */ extern FILE *popen(); /* stdio.h */ @@ -16,7 +17,23 @@ extern char *mktemp(); extern int optind; extern char *optarg; +#endif #include "alloc.h" #include +#include + +extern char *ascingmtime(register struct tm *tm); +extern int awksplit(char *string, register char ***fieldsp, register int nfields, const char *sep); +extern void closeall(int leavestd); +extern char *dogets(register char *s, register int *lenp); +extern time_t getabsdate(char *timestr, struct timeb *now); +extern time_t getindate(register char *line, struct timeb *now); +extern time_t getreldate(char *timestr, struct timeb *now); +extern int mkdirs(register char *name, int uid, int gid); +extern int parsetime(register char *time, register struct tm *tm); +extern long spacefor(long filesize, char *fileonfs, long wantspace, long wantinodes, long bperi); +extern void morefds(void); +extern int split(char *string, char *fields[], int nfields, const char *sep); + #endif /* LIBC_H */ --- libcnews/lock.c.orig 1994-01-31 05:27:13 UTC +++ libcnews/lock.c @@ -9,9 +9,11 @@ #include #include "fixerrno.h" #include +#include #include "libc.h" #include "news.h" #include "config.h" +#include "rerror.h" #define LOCKNAME "LOCK" #define LOCKTEMP "L.XXXXXX" @@ -23,8 +25,7 @@ static boolean debug = NO; static boolean mylock = NO; void -lockdebug(state) -boolean state; +lockdebug(boolean state) { debug = state; } @@ -35,7 +36,7 @@ boolean state; * repeatedly try to link the temporary name to LOCKNAME. */ void -newslock() +newslock(void) { register char *tempnm, *lockfile; register FILE *tempfp; @@ -68,7 +69,7 @@ newslock() } void -newsunlock() +newsunlock(void) { if (mylock) { (void) unlink(ctlfile(LOCKNAME)); @@ -76,14 +77,15 @@ newsunlock() } } -nolock() /* called in a child process to prevent lock release on error */ +void +nolock(void) /* called in a child process to prevent lock release on error */ { mylock = NO; } +/* like error(3), but unlock before exit */ void -errunlock(fmt, s) /* like error(3), but unlock before exit */ -char *fmt, *s; +errunlock(const char *fmt, const char *s) { warning(fmt, s); /* logaudit? */ newsunlock(); --- libcnews/ltoza.c.orig 1990-02-10 23:50:46 UTC +++ libcnews/ltoza.c @@ -6,6 +6,10 @@ * with printf on V7, due to a bug in V7's printf. */ +#include +#include +#include "news.h" + #define RADIX 10 /* @@ -14,10 +18,7 @@ * returns true iff the value fits in width characters. */ int /* boolean */ -ltozan(outstr, value, width) -char *outstr; -long value; -int width; +ltozan(char *outstr, long value, int width) { register char *op = outstr; register long wval = value; @@ -41,10 +42,10 @@ int width; * zeros on the left (after any sign); terminate with a NUL. */ int /* boolean */ -ltoza(outstr, value, width) -register char *outstr; /* char outstr[width+1]; */ -long value; -register int width; +ltoza( +register char *outstr, /* char outstr[width+1]; */ +long value, +register int width) { register int fits = ltozan(outstr, value, width); --- libc/mkdirs.c.orig 1992-12-06 18:16:05 UTC +++ libc/mkdirs.c @@ -6,6 +6,8 @@ #include #include #include +#include +#include "libc.h" #define YES 1 #define NO 0 @@ -18,9 +20,7 @@ * Returns success. */ int -mkdirs(name, uid, gid) -register char *name; -int uid, gid; +mkdirs(register char *name, int uid, int gid) { register char *cp; register int isthere = YES; --- relay/mkdirs.c.orig 1991-10-24 03:08:46 UTC +++ relay/mkdirs.c @@ -6,8 +6,7 @@ #include #include #include -#include "libc.h" -#include "news.h" +#include "mkdirs.h" /* * Given a/b/c/d, try to make any of a, a/b, a/b/c and a/b/c/d which are missing; --- relay/mkdirs.h.orig 1989-05-31 04:04:39 UTC +++ relay/mkdirs.h @@ -1,2 +1,2 @@ /* imports from mkdirs.c */ -extern boolean mkdirs(); +extern boolean mkdirsb(register char *name, int uid, int gid); --- libcnews/mkinperm.c.orig 1994-11-28 01:15:29 UTC +++ libcnews/mkinperm.c @@ -8,6 +8,7 @@ #include #include #include +#include #include #include "fixerrno.h" #ifndef EEXIST @@ -23,28 +24,29 @@ #endif int mkinpdebug = 0; -char *progname; +extern const char *progname; int /* true iff succeeded */ -mkinperm(tmpname, grade, class) -char *tmpname; -char *grade; /* 3 chars = digit, period, NUL */ -char *class; /* suffix for filename, default is plain text */ +mkinperm( +char *tmpname, +char *grade, /* 3 chars = digit, period, NUL */ +const char *class) /* suffix for filename, default is plain text */ { + register const char *f; register char *p; register char *name; register int ntries; register time_t now; register int uniq = '0'; - p = fullartfile("in.coming/"); - name = nemalloc(strlen(p) + 20); /* plenty for a number */ - (void) strcpy(name, p); + f = fullartfile("in.coming/"); + name = nemalloc(strlen(f) + 20); /* plenty for a number */ + (void) strcpy(name, f); p = name + strlen(name); now = time((time_t *)NULL); for (ntries = 0; ; ntries++) { - (void) sprintf(p, "%s%ld%c%s", grade, now, uniq, class); + (void) sprintf(p, "%s%ld%c%s", grade, (long)now, uniq, class); if (mkinpdebug) (void) fprintf(stderr, "trying renaming to %s\n", name); if (link(tmpname, name) >= 0) --- nov/mkov.c.orig 1994-10-18 03:49:48 UTC +++ nov/mkov.c @@ -13,23 +13,23 @@ #include #include #include +#include +#include "libc.h" +#include "news.h" #define DEFXREF 50 -#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) - /* imports */ -extern int optind; -extern char *optarg; -extern char *gethdr(), *strsave(); -extern FILE *efopen(); /* exports */ -char *progname = ""; +const char *progname = ""; int debug; /* forwards */ -char *str(), *parsehdrs(); +char *str(char *hdrln, register int xref); +void process(FILE *in, const char *inname); +int artname(char *s); +void putextfld(const char *keywd, const char *extfld); /* privates */ struct headers { @@ -54,12 +54,16 @@ static time_t oldtime = 0; static int prgrps = 0; /* if true, print group name(s) first, even under -a */ static int readnames = 0; /* if true, read filenames from stdin */ +char *parsehdrs(FILE *in, register struct headers *hdrp); +void prhdrs(register struct headers *hdrp); +void prstridx(register struct headers *hdrp); +void freehdrs(register struct headers *hdrp); + /* * main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c, errflg = 0; char *older = NULL; @@ -141,8 +145,7 @@ char *argv[]; } int -artname(s) -char *s; +artname(char *s) { register char *base = strrchr(s, '/'); @@ -156,12 +159,11 @@ char *s; /* * process - process input file */ -process(in, inname) -FILE *in; -char *inname; +void +process(FILE *in, const char *inname) { register char *hdr; - char *base = strrchr(inname, '/'), *artnumstr; + const char *base = strrchr(inname, '/'), *artnumstr; char bytes[25]; struct headers hdrs; @@ -215,9 +217,7 @@ char *inname; } char * /* NULL at EOF, or malloced, don't free */ -parsehdrs(in, hdrp) -FILE *in; -register struct headers *hdrp; +parsehdrs(FILE *in, register struct headers *hdrp) { register char *hdr; int ishdr = 0; @@ -266,22 +266,22 @@ register struct headers *hdrp; return hdr; } -prfld(fld) -register char *fld; +static void +prfld(register char *fld) { if (fld != NULL) (void) fputs(fld, stdout); } -putfld(fld) -char *fld; +static void +putfld(char *fld) { (void) putchar('\t'); prfld(fld); } -putextfld(keywd, extfld) -char *keywd, *extfld; +void +putextfld(const char *keywd, const char *extfld) { (void) putchar('\t'); if (extfld != NULL) { @@ -291,8 +291,8 @@ char *keywd, *extfld; } } -prhdrs(hdrp) -register struct headers *hdrp; +void +prhdrs(register struct headers *hdrp) { register char *p; @@ -319,8 +319,9 @@ register struct headers *hdrp; (void) putchar('\n'); } -prstridx(hdrp) /* print index lines from header stream */ -register struct headers *hdrp; +/* print index lines from header stream */ +void +prstridx(register struct headers *hdrp) { register int i, nxrefs; char *xref[DEFXREF]; @@ -352,33 +353,32 @@ register struct headers *hdrp; } } -nnfree(s) -register char *s; +static void +mkov_nnfree(register char *s) { if (s != NULL) free(s); } -freehdrs(hdrp) -register struct headers *hdrp; +void +freehdrs(register struct headers *hdrp) { - nnfree(hdrp->h_num); - nnfree(hdrp->h_subj); - nnfree(hdrp->h_from); - nnfree(hdrp->h_date); - nnfree(hdrp->h_msgid); - nnfree(hdrp->h_refs); - nnfree(hdrp->h_bytes); - nnfree(hdrp->h_lines); - nnfree(hdrp->h_xref); + mkov_nnfree(hdrp->h_num); + mkov_nnfree(hdrp->h_subj); + mkov_nnfree(hdrp->h_from); + mkov_nnfree(hdrp->h_date); + mkov_nnfree(hdrp->h_msgid); + mkov_nnfree(hdrp->h_refs); + mkov_nnfree(hdrp->h_bytes); + mkov_nnfree(hdrp->h_lines); + mkov_nnfree(hdrp->h_xref); /* don't free h_intxref here; it's special */ /* step 4 of 4: free new header before this line */ } +/* strip leading & trailing whitespace */ char * /* malloced */ -str(hdrln, xref) /* strip leading & trailing whitespace */ -char *hdrln; -register int xref; +str(char *hdrln, register int xref) { register char *p, *kwp, *copy; register char c; --- explode/morefds.c.orig 1991-07-13 04:11:48 UTC +++ explode/morefds.c @@ -1,4 +1,6 @@ -int -morefds() +#include "libc.h" + +void +morefds(void) { } --- relay/morefds.c.orig 1993-03-13 06:07:14 UTC +++ relay/morefds.c @@ -1,3 +1,6 @@ -morefds() +#include "libc.h" + +void +morefds(void) { } --- libcnews/msgs.c.orig 1993-03-10 04:40:52 UTC +++ libcnews/msgs.c @@ -6,10 +6,14 @@ #include #include "news.h" #include "msgs.h" +#include "../relay/headers.h" +#include "../relay/relay.h" +#include "rerror.h" + +/* complain & return bad status */ statust -prfulldisk(file) /* complain & return bad status */ -char *file; +prfulldisk(const char *file) { persistent(NOART, 'f', "error writing `%s'", file); return ST_DISKFULL|ST_NEEDATTN|ST_DROPPED; /* disk full? */ --- include/msgs.h.orig 1991-10-31 04:27:14 UTC +++ include/msgs.h @@ -1,2 +1,3 @@ /* imports from msgs.c */ -extern statust prfulldisk(); +extern statust prfulldisk(const char *file); + --- libcnews/nemalloc.c.orig 1991-11-07 01:34:45 UTC +++ libcnews/nemalloc.c @@ -1,9 +1,11 @@ #include #include +#include +#include "news.h" +/* news emalloc - calls errunlock on error */ char * -nemalloc(size) /* news emalloc - calls errunlock on error */ -unsigned size; +nemalloc(unsigned size) { register char *result = malloc(size); --- include/news.h.orig 1993-12-16 23:19:38 UTC +++ include/news.h @@ -110,30 +110,81 @@ register char **mempp; /* pointer to malloc'ed ptr. #define DEFEXP "-" /* default expiry period */ /* imports from news */ -extern char *progname; +extern const char *progname; -extern FILE *fopenexcl(); /* from ../libos */ +/* from ../libcnews/fopenexcl.c */ +extern FILE *fopenexcl(register char *name); /* from ../libos */ -extern FILE *fopenclex(), *fopenwclex(); /* from ../libcnews/fopenclex.c */ -extern char *gethdr(); /* from ../libcnews/gethdr.c */ -extern char *hostname(); /* from ../libcnews/hostname.c */ -extern void lockdebug(), newslock(), newsunlock(); /* from ../libcnews/lock.c */ -extern void errunlock(); /* from ../libcnews/lock.c */ -extern void matchdebug(); /* from ../libcnews/ngmatch.c */ -extern boolean ngmatch(); /* from ../libcnews/ngmatch.c */ -extern void mkfilenm(); /* from ../libcnews/string.c */ -extern char *trim(); /* from ../libcnews/string.c */ -extern boolean anyhostin(), hostin(); /* from ../libcnews/string.c */ -extern char *skipsp(), *first(), *strsvto(); /* from ../libcnews/string.c */ -extern char *sendersite(), *nullify(); /* from ../libcnews/string.c */ -extern char *canonpath(); /* from ../libcnews/string.c */ -extern void timestamp(); /* from ../libcnews/time.c */ +/* from ../libcnews/fopenclex.c */ +extern FILE *fopenclex(const char *file, const char *mode); +extern FILE *fopenwclex(const char *name, const char *mode); -extern void warning(), error(); /* from ../libc */ -extern void closeall(); /* from ../libc */ -extern void stdfdopen(); /* from ../libc */ +/* from ../libcnews/gethdr.c */ +extern void sethdrrfc(int newrfc); +extern char *gethdr(FILE *in, register long *limitp, int *ishdrp); +extern int ishdr(register char *s); +/* from ../libcnews/hostname.c */ +extern char *hostname(void); + +/* from ../libcnews/lock.c */ +extern void lockdebug(boolean state); +extern void newslock(void); +extern void newsunlock(void); +extern void nolock(void); +extern void errunlock(const char *fmt, const char *s); + +/* from ../libcnews/ngmatch.c */ +extern void matchdebug(boolean state); +extern boolean ngmatch(char *ngpat, char *ngs); + +/* from ../libcnews/string.c */ +extern int spacein(register const char *s); +extern void stranslit(register char *s, register char from, register char to); +extern char *first(char *tokens); +extern void mkfilenm(register char *ng); +extern char *trim(char *s); +extern char *skipsp(register char *s); +extern char *strsvto(char *s, int c); +extern int charcount(register char *s, register int c); +extern char *nullify(register char *s); +extern boolean anyhostin(char *hosts, char *s); +extern boolean hostin(register char *host, register char *s); +extern int hopcount(register char *path); +extern char *sendersite(register char *path); +extern char *canonpath(char *rawpath, char *approved, char *sender); + +/* from ../libcnews/time.c */ +extern void timestamp(FILE *fp, time_t *timep); + +/* from ../libc */ +extern void warning(const char *s1, const char *s2); +extern void error(const char *s1, const char *s2); +extern void closeall(int leavestd); +extern void stdfdopen(void); + #include "alloc.h" /* ugh */ -#define NOART ((struct article *)NULL) +#define NOART ((void *)NULL) -extern char *strsave(), *str3save(); +/* from ../libc/efopen.c */ +extern FILE *efopen(const char *file, const char *mode); + +/* from ../libc/nfclose.c */ +extern int nfclose(register FILE *stream); + +/* from ../libcnews/fnlockfile.c */ +extern int fnlockfile(FILE *fp); + +/* from ../libcnews/ltoza.c */ +extern int ltoza(register char *outstr, long value, register int width); +extern int ltozan(char *outstr, long value, int width); + +/* from ../libcnews/mkinperm.c */ +extern int mkinperm(char *tmpname, char *grade, const char *class); + +/* from ../libcnews/complain.c */ +extern void complain(const char *s1, const char *s2); + +/* from ../libcnews/strlower.c */ +extern void strlower(register char *s); + --- util/newslock.c.orig 1989-05-22 02:12:16 UTC +++ util/newslock.c @@ -4,10 +4,11 @@ * (System V has broken ln(1) itself.) */ #include +#include +#include -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { if (argc != 3) { fprintf(stderr, "Usage: %s tempname lockname\n", argv[0]); --- include/newsoverview.h.orig 1992-12-17 05:57:06 UTC +++ include/newsoverview.h @@ -25,7 +25,9 @@ struct novart { struct novart *a_nxtnum; /* next in numeric order */ }; -struct novgroup *novopen(), *novstream(); /* open a new group */ -struct novart *novall(), *novnext(); /* return overview data for a group */ +struct novgroup *novopen(char *grp); /* open a new group */ +struct novgroup *novstream(register FILE *fp); +struct novart *novall(register struct novgroup *gp); /* return overview data for a group */ +struct novart *novnext(register struct novgroup *gp); /* novthread(ngroup); built threads linkage; see g_roots */ /* novclose(ngroup); frees resources associated with ngroup */ --- readnews/newsrc.c.orig 1995-04-28 01:12:19 UTC +++ readnews/newsrc.c @@ -3,6 +3,7 @@ */ #include "defs.h" +#include "readnews_error.h" static char nrcname[] = NEWSRC; @@ -13,27 +14,29 @@ static newsrc *lastrc; /* last newsrc struct in list static int rclineno; /* current lineno in .newsrc */ static bool sortrc; /* if we should sort on output */ -static newsrc *findnewsrc(); -static int getline(); -static int dooptions(); -static int dorcline(); -static int writengline(); +static newsrc *findnewsrc(register char *name); +static int get_line(register FILE *f, char *w, char *r); +static int dooptions(char *s); +static void dorcline(char *w, char *r); +static void writengline(FILE *f, register newsrc *np); -readnewsrc() + +void +readnewsrc(void) { register FILE *f; static char option[] = "options"; - char word[BUFSIZ], rest[BUFSIZ]; /* getline knows sizes */ - extern char *getenv(); + char word[BUFSIZ], rest[BUFSIZ]; /* get_line knows sizes */ if ((rcname = getenv("HOME")) == NULL) - error("No $HOME in environment."); + readnews_error("No $HOME in environment."); + rcname = newstr3(rcname, "/", nrcname); if ((f = fopen(rcname, "r")) == NULL) return; rclineno = 0; - while (getline(f, word, rest)) + while (get_line(f, word, rest)) if (CMP(word, option) == 0) dooptions(rest); else @@ -47,9 +50,7 @@ readnewsrc() * This is a poor design, as w & r are unchecked for overrun. */ static int -getline(f, w, r) -register FILE *f; -char *w, *r; +get_line(register FILE *f, char *w, char *r) { register int c; register char *s; @@ -65,7 +66,7 @@ char *w, *r; } *s = '\0'; if (n <= 0) - error("%s line %d too long", rcname, rclineno); + readnews_error("%s line %d too long", rcname, rclineno); if (c != EOF) { s = r; @@ -77,11 +78,11 @@ char *w, *r; } *s = '\0'; if (n <= 0) - error("%s line %d too long", rcname, rclineno); + readnews_error("%s line %d too long", rcname, rclineno); } if (c != '\n' && c != EOF) - error("Bad format: %s line %d: %s", rcname, rclineno, w); + readnews_error("Bad format: %s line %d: %s", rcname, rclineno, w); return c != EOF; } @@ -90,8 +91,7 @@ char *w, *r; * Parse s into words and simulate command line arguments with them. */ static int -dooptions(s) -char *s; +dooptions(char *s) { register char *cp; register int argc; @@ -101,11 +101,11 @@ char *s; while (isspace(*cp)) cp++; if (!*cp) - return; + return 0; argc = 2; argv = (char **) myalloc(2 * sizeof(char *)); - argv[0] = "options"; + argv[0] = (char *)"options"; argv[argc - 1] = cp; while (*cp && (cp = strpbrk(cp, " \t")) != NULL) { while (*cp == ' ' || *cp == '\t') @@ -118,16 +118,16 @@ char *s; } } if (options(argc, argv, false) < 0) - error("Bad options: %s line %d: %s", rcname, rclineno, s); + readnews_error("Bad options: %s line %d: %s", rcname, rclineno, s); free((char *) argv); + return 0; } /* * Parse w & r together as a .newsrc newsgroup line. */ -static int -dorcline(w, r) -char *w, *r; +static void +dorcline(char *w, char *r) { register char lastw; register int len; @@ -143,10 +143,10 @@ char *w, *r; if (strncmp(r, "1-", sizeof "1-"-1) == 0) r += sizeof "1-"-1; /* skip usual `1-' */ if (*r == '\0') /* rn's: `news.trash: ' */ - r = "0"; /* fake a zero */ + strcpy(r, "0"); /* fake a zero */ if (lastw != ':' && lastw != NEGCHAR || !isdigit(*r)) - error("Bad line: %s line %d: %s", rcname, rclineno, w); + readnews_error("Bad line: %s line %d: %s", rcname, rclineno, w); np = NEW(newsrc); np->n_subscribe = (bool) (lastw == ':'); /* colon or bang? */ @@ -166,11 +166,12 @@ char *w, *r; * list, and has messages to be read, call func * if no mention in newsrc file, make new entry */ -apply(alist, group, func, dolast) -active *alist; -char *group; -applycom (*func)(); -bool dolast; +int +apply( +active *alist, +char *group, +apcmfunc func, +bool dolast) { register active *ap; register newsrc *np; @@ -183,7 +184,7 @@ bool dolast; for (ap = alist; ap; ap = ap->a_next) { if (ap->a_seq == 0 || ap->a_low > ap->a_seq) continue; /* empty group */ - if (!ngmatch(ap->a_name, group)) + if (!readnews_ngmatch(ap->a_name, group)) continue; if ((np = findnewsrc(ap->a_name)) == NULL) { np = NEW(newsrc); @@ -210,7 +211,7 @@ bool dolast; donesome = true; switch (act = (*func)(ap, np, false, false)) { case stop: - return; + return 0; case next: continue; case nextgroup: @@ -226,6 +227,7 @@ bool dolast; if (act != searchgroup && dolast && donesome) act = (*func)(NIL(active), NIL(newsrc), true, false); } while (act == searchgroup); + return 0; } /* @@ -237,8 +239,7 @@ bool dolast; * so it can be sorted at the end of the session */ static newsrc * -findnewsrc(name) -register char *name; +findnewsrc(register char *name) { register newsrc *np, *start; register bool found; @@ -271,8 +272,8 @@ register char *name; /* * rewrite the newsrc file */ -writenewsrc(alist) -active *alist; +void +writenewsrc(active *alist) { register FILE *f; register active *ap; @@ -295,7 +296,7 @@ active *alist; * history/newsrc comparisons will be faster */ for (ap = alist; ap; ap = ap->a_next) - if (np = findnewsrc(ap->a_name)) + if ((np = findnewsrc(ap->a_name))) writengline(f, np); } else for (np = rc; np; np = np->n_next) @@ -303,11 +304,10 @@ active *alist; (void) fclose(f); } -static int -writengline(f, np) /* write .newsrc n.g. line in normal form on f */ -FILE *f; -register newsrc *np; +/* write .newsrc n.g. line in normal form on f */ +static void +writengline(FILE *f, register newsrc *np) { - (void) fprintf(f, "%s%c 1-%d\n", np->n_name, + (void) fprintf(f, "%s%c 1-%ld\n", np->n_name, (np->n_subscribe? ':': NEGCHAR), np->n_last); } --- input/newsspool.c.orig 1995-04-28 00:50:59 UTC +++ input/newsspool.c @@ -8,6 +8,7 @@ #include #include #include +#include #include "fixerrno.h" #include "libc.h" #include "news.h" @@ -22,9 +23,8 @@ static char RCSid[] = "$Header$"; #endif int debug = 0; -char *progname; +const char *progname; -extern void error(); #ifdef UTZOOERR extern char *mkprogname(); #else @@ -32,21 +32,21 @@ extern char *mkprogname(); #endif char buf[BUFSIZ*16]; /* try to get a batch in a few gulps */ -char *suffix = ".t"; /* suffix for filename, default is plain text */ +const char *suffix = ".t"; /* suffix for filename, default is plain text */ char grade[3] = ""; /* 3 = digit, period, NUL */ -void process(); -FILE *outopen(); -void outclose(); -extern time_t time(); -char *outname(); +/* forwards */ +void process(FILE *in, const char *inname); +FILE *outopen(char *name); +void outclose(FILE *f, char *tmpname, int wrotesome); +char *outname(void); +int cunskip(char *bufp, int count); /* - main - parse arguments and handle options */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c; int errflg = 0; @@ -54,8 +54,6 @@ char *argv[]; struct stat statbuf; extern int optind; extern char *optarg; - extern FILE *efopen(); - void process(); progname = mkprogname(argv[0]); @@ -111,9 +109,7 @@ char *argv[]; */ /* ARGSUSED */ void -process(in, inname) -FILE *in; -char *inname; +process(FILE *in, const char *inname) { register int count; register int firstblock; @@ -151,7 +147,7 @@ char *inname; - outname - construct name for the temporary output file */ char * -outname() +outname(void) { register char *p; @@ -164,8 +160,7 @@ outname() - outopen - acquire an output file */ FILE * -outopen(name) -char *name; +outopen(char *name) { FILE *f; @@ -182,12 +177,10 @@ char *name; - outclose - close output file, moving it to the right place * * Names are based on the current time in hopes of keeping input in order. + * int wrotesome; did anything actually get written to it? */ void -outclose(f, tmpname, wrotesome) -FILE *f; -char *tmpname; -int wrotesome; /* did anything actually get written to it? */ +outclose(FILE *f, char *tmpname, int wrotesome) { register char *p; register char *name; @@ -211,9 +204,7 @@ int wrotesome; /* did anything actually get written - cunskip - inspect block for silly #! cunbatch headers, classify input */ int /* number of chars at start to skip */ -cunskip(bufp, count) -char *bufp; -int count; +cunskip(char *bufp, int count) { static char goop[] = "cunbatch"; # define GOOPLEN (sizeof(goop)-1) /* strlen(goop) */ @@ -273,8 +264,7 @@ int count; */ /* ARGSUSED */ void -unprivileged(reason) -char *reason; +unprivileged(const char *reason) { setgid(getgid()); setuid(getuid()); --- libc/nfclose.c.orig 1988-12-11 08:15:37 UTC +++ libc/nfclose.c @@ -6,10 +6,11 @@ */ #include +#include +#include "news.h" int -nfclose(stream) -register FILE *stream; +nfclose(register FILE *stream) { register int ret = 0; --- libcnews/ngmatch.c.orig 1993-01-15 10:54:24 UTC +++ libcnews/ngmatch.c @@ -48,6 +48,7 @@ #include #include +#include #include #include "news.h" #include "ngmatch.h" @@ -78,7 +79,7 @@ NGPAT { }; /* exports */ -char *ngerr = NULL; /* if non-NULL, contains error string */ +const char *ngerr = NULL; /* if non-NULL, contains error string */ /* private */ static boolean debug = NO; @@ -102,14 +103,13 @@ static long kids[MAXKIDS]; #endif void -matchdebug(state) -boolean state; +matchdebug(boolean state) { debug = state; } STATIC NGPAT * -patalloc() /* allocate a pattern node */ +patalloc(void) /* allocate a pattern node */ { register NGPAT *np = patreuse; @@ -123,9 +123,10 @@ patalloc() /* allocate a pattern node */ } } +/* free a pattern node */ STATIC -patfree(np) /* free a pattern node */ -register NGPAT *np; +void +patfree(register NGPAT *np) { if (reusables >= RETAIN) /* compost heap is full? */ free((char *)np); /* yup, just pitch this one */ @@ -149,10 +150,10 @@ register NGPAT *np; * This function is a profiling hot spot. */ STATIC NGPAT * -treesearch(np, word, len) -register NGPAT *np; /* better not be NULL */ -register char *word; -register int len; +treesearch( +register NGPAT *np, /* better not be NULL */ +register const char *word, +register int len) { register char *npword; register char word1stc = word[0]; @@ -174,12 +175,13 @@ register int len; * keep a cache of (string, tree node) pairs for each level in the tree. */ STATIC NGPAT * -addatom(curnp, word, len, level, wcp, cachematchp) -register NGPAT *curnp; /* may be NULL */ -register char *word; -register int len, level; -register struct wordcache *wcp; -register int *cachematchp; +addatom( +register NGPAT *curnp, /* may be NULL */ +register char *word, +register int len, +register int level, +register struct wordcache *wcp, +register int *cachematchp) { /* * look up this word in the cache (finds 40%). if absent, @@ -237,9 +239,9 @@ register int *cachematchp; * modifies p, which must persist until we are done with this tree. */ STATIC NGPAT * -addpat(curnp, p) -register NGPAT *curnp; /* may be NULL for first pattern */ -char *p; +addpat( +register NGPAT *curnp, /* may be NULL for first pattern */ +char *p) { register char *word, *period = p; register char c; @@ -267,16 +269,18 @@ char *p; /* one last pattern */ curnp = addatom(curnp, word, period - 1 - word, level, wcp, &cachematching); - if (curnp->n_match != UNKNOWN) - if (curnp->n_match == leafmatch) + if (curnp->n_match != UNKNOWN) { + if (curnp->n_match == leafmatch) { ngerr = "redundant pattern"; - else + } else { ngerr = "contradictory pattern"; + } + } curnp->n_match = leafmatch; return tree; } -FORWARD int matscore(); +FORWARD int matscore(register NGPAT *pat, register int defmatch, const char *ngpfx, register int ngplen, char *sfx, register int realscore, register int nominalscore, int incr); /* * match group suffix ngsfx against the patterns in the tree pat. @@ -288,13 +292,15 @@ FORWARD int matscore(); * a match with a non-"UNKNOWN" message). */ STATIC int /* (depth of match) * sign(match) */ -treematch(pat, defmatch, ngsfx, realscore, nominalscore) -register NGPAT *pat; /* pattern subtree; may be NULL */ -register int defmatch; /* inherited match value */ -char *ngsfx; /* newsgroup suffix */ -register int realscore, nominalscore; +treematch( +register NGPAT *pat, /* pattern subtree; may be NULL */ +register int defmatch, /* inherited match value */ +char *ngsfx, /* newsgroup suffix */ +register int realscore, +register int nominalscore) { - register char *period, *sfx; + register char *period; + register const char *sfx; register int ret, litscore, wildscore, ngplen; if (debug) { @@ -358,8 +364,7 @@ register int realscore, nominalscore; * break the list into NUL-terminated patterns. add them to the parse tree. */ NGPAT * -ngparse(ngpat) -char *ngpat; +ngparse(char *ngpat) { register char *p, *comma; register char c; @@ -391,22 +396,20 @@ struct prhook { short first; }; -FORWARD prnode(); +FORWARD void prnode(register NGPAT *np, register struct prhook *hook); /* print the pattern tree, internal version */ STATIC -nginprpat(np, hook) -register NGPAT *np; -register struct prhook *hook; +void +nginprpat(register NGPAT *np, register struct prhook *hook) { for (; np != NULL; np = np->n_next) prnode(np, hook); } STATIC -prnode(np, hook) -register NGPAT *np; -register struct prhook *hook; +void +prnode(register NGPAT *np, register struct prhook *hook) { register char *newgrp, *period; @@ -442,9 +445,8 @@ register struct prhook *hook; } /* print a pattern tree */ -ngprint(pat, stream) -NGPAT *pat; -FILE *stream; +void +ngprint(NGPAT *pat, FILE *stream) { static struct prhook hook; @@ -454,17 +456,18 @@ FILE *stream; } +#if 0 #ifndef STATS /* ARGSUSED */ -ngprstats(stream) -FILE *stream; +void +ngprstats(stream FILE *stream) { } #else /* STATS */ /* collect tree statistics */ STATIC -ngstatpat(np) -register NGPAT *np; +void +ngstatpat(register NGPAT *np) { for (; np != NULL; np = np->n_next) { if (np->n_nkids >= MAXKIDS - 1) @@ -477,8 +480,9 @@ register NGPAT *np; } /* print the tree statistics */ -ngprstats(stream) -FILE *stream; +STATIC +void +ngprstats(FILE *stream) { register int n; @@ -487,6 +491,7 @@ FILE *stream; (void) fprintf(stream, "%d\t%ld\n", n, kids[n]); } #endif /* STATS */ +#endif struct matchook { @@ -501,13 +506,15 @@ struct matchook { * the pat or its siblings, if any. */ STATIC int -matscore(pat, defmatch, ngpfx, ngplen, sfx, realscore, nominalscore, incr) -register NGPAT *pat; /* pattern subtree */ -register int defmatch; /* inherited match value */ -char *ngpfx, *sfx; /* newsgroup prefix & suffix */ -register int ngplen; -register int nominalscore, realscore; -int incr; +matscore( +register NGPAT *pat, /* pattern subtree */ +register int defmatch, /* inherited match value */ +const char *ngpfx, /* newsgroup prefix */ +register int ngplen, +char *sfx, /* newsgroup suffix */ +register int realscore, +register int nominalscore, +int incr) { register NGPAT *wdnp; register int ret; @@ -555,9 +562,7 @@ int incr; * greater magnitude indicates a deeper match). */ int -ngpatscore(pat, ngs) -register NGPAT *pat; -register char *ngs; +ngpatscore(register NGPAT *pat, register char *ngs) { register char *ngp; /* point at current group */ register char *ngcomma; @@ -583,17 +588,14 @@ register char *ngs; /* match groups ngs against the patterns in the tree pat */ boolean -ngpatmat(pat, ngs) -NGPAT *pat; -char *ngs; +ngpatmat(NGPAT *pat, char *ngs) { return ngpatscore(pat, ngs) > 0; } /* compatibility interface; not a very fast way to match */ boolean -ngmatch(ngpat, ngs) -char *ngpat, *ngs; +ngmatch(char *ngpat, char *ngs) { register NGPAT *pat; register boolean match = NO; @@ -620,8 +622,8 @@ char *ngpat, *ngs; /* tear down a pattern tree and free the nodes */ -ngfree(np) -register NGPAT *np; +void +ngfree(register NGPAT *np) { register NGPAT *next = np, *kids; --- include/ngmatch.h.orig 1992-02-21 03:45:37 UTC +++ include/ngmatch.h @@ -1,11 +1,11 @@ /* newsgroup matching */ #define NGPAT struct ngpatnode -extern boolean ngmatch(); /* old, slow interface */ +extern boolean ngmatch(char *ngpat, char *ngs); /* old, slow interface */ -extern NGPAT *ngparse(); /* parse newsgroup pattern into a tree */ -extern ngprint(); /* print a pattern tree */ -extern boolean ngpatmat(); /* match a pattern against a group list */ -extern int ngpatscore(); /* as ngpatmat, but return the score */ -extern ngfree(); /* destroy a tree */ -extern char *ngerr; /* error string, if non-NULL */ +extern NGPAT *ngparse(char *ngpat); /* parse newsgroup pattern into a tree */ +extern void ngprint(NGPAT *pat, FILE *stream); /* print a pattern tree */ +extern boolean ngpatmat(NGPAT *pat, char *ngs); /* match a pattern against a group list */ +extern int ngpatscore(register NGPAT *pat, register char *ngs); /* as ngpatmat, but return the score */ +extern void ngfree(register NGPAT *np); /* destroy a tree */ +extern const char *ngerr; /* error string, if non-NULL */ --- util/now.c.orig 1995-04-28 00:51:46 UTC +++ util/now.c @@ -5,15 +5,15 @@ #include #include #include +#include #include #include "libc.h" /* - main - do it all */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { register time_t now; register char c; --- nov/ovsplit.c.orig 1994-08-29 03:11:17 UTC +++ nov/ovsplit.c @@ -10,17 +10,11 @@ #include #include #include +#include +#include "news.h" -#define STREQ(a, b) (*(a) == *(b) && strcmp((a), (b)) == 0) - -/* imports */ -extern int optind; -extern char *optarg; -extern char *strsave(), *str3save(); -extern FILE *efopen(); - /* exports */ -char *progname = ""; +const char *progname = ""; int debug; char *dirname = NULL; @@ -30,9 +24,8 @@ FILE *ov = NULL; /* * main - do it */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c, errflg = 0; char *line; --- relay/procart.c.orig 1993-03-13 22:31:24 UTC +++ relay/procart.c @@ -7,6 +7,8 @@ #include #include #include /* solely for getindate call */ +#include +#include #include "libc.h" #include "news.h" @@ -17,6 +19,12 @@ #include "msgs.h" #include "ngmatch.h" #include "system.h" +#include "rerror.h" +#include "transmit.h" +#include "control.h" +#include "fileart.h" +#include "io.h" +#include "hdrint.h" #define DAY (24L*60L*60L) @@ -44,7 +52,6 @@ #endif /* COPYSIZE */ /* imports */ -extern void decline(); /* * Unlink all files in filelist, and optionally return article numbers. @@ -54,9 +61,9 @@ extern void decline(); * subject and generated a fake history entry). */ STATIC statust -snuffmayreturn(filelist, artret) -char *filelist; -boolean artret; /* return article numbers & note unlink errors? */ +snuffmayreturn( +char *filelist, +boolean artret) /* return article numbers & note unlink errors? */ { register statust status = ST_OKAY; register char *arts, *spacep, *slashp, *artnm; @@ -90,9 +97,9 @@ boolean artret; /* return article numbers & note unli return status; } +/* just unlink all files in filelist */ statust -snufffiles(filelist) /* just unlink all files in filelist */ -char *filelist; +snufffiles(char *filelist) { /* don't return article numbers (NO) & return unlink errors */ return snuffmayreturn(filelist, NO); @@ -107,8 +114,7 @@ char *filelist; * insart() need not be called first. */ void -uninsart(art) -register struct article *art; +uninsart(register struct article *art) { if (art->a_unlink && art->a_tmpf != NULL) { (void) unlink(art->a_tmpf); /* I don't wanna know... */ @@ -128,8 +134,7 @@ register struct article *art; * and generate log lines for cancels and ihave/sendme. */ STATIC void -insart(art) -register struct article *art; +insart(register struct article *art) { if (!(art->a_status&(ST_DROPPED|ST_REFUSED|ST_NEEDATTN))) { if (!art->a_filed) /* paranoia */ @@ -163,8 +168,7 @@ register struct article *art; * print the leader of a refusal message about the article in "art". */ void -prefuse(art) -register struct article *art; +prefuse(register struct article *art) { timestamp(stdout, (time_t *)NULL); (void) printf(" %s - %s ", sendersite(nullify(art->h.h_path)), @@ -179,15 +183,13 @@ register struct article *art; * in rejections. */ void -reject(art) -register struct article *art; +reject(register struct article *art) { register struct headers *hdrs = &art->h; register char *ngs = hdrs->h_ngs; register char *errstr; register time_t date; static time_t now, datestale; - extern time_t getindate(); if (art->a_status&ST_REFUSED) return; /* already rejected */ @@ -268,9 +270,7 @@ register struct article *art; * and throw off our byte count, thus buggering unbatching. */ char * /* first body line, from gethdr */ -hdrcopy(art, in) -register struct article *art; -FILE *in; +hdrcopy(register struct article *art, FILE *in) { register char *hdr = NULL; long limit = art->a_unread + SIZENUL; @@ -310,9 +310,7 @@ FILE *in; * The ST_NEEDATTN status will prevent a history entry being generated later. */ void -surveydamage(art, installedp) -register struct article *art; -register boolean *installedp; +surveydamage(register struct article *art, register boolean *installedp) { if (art->a_unread > 0 && art->a_blvmax) { char bytes[30]; @@ -329,7 +327,6 @@ register boolean *installedp; #ifdef WATCHCORE { char stbot; - extern char *sbrk(); (void) printf("debugging memory use: top of data=%u", (unsigned)sbrk(0)); @@ -356,10 +353,7 @@ register boolean *installedp; * Some people think the loop is ugly; I'm not sure why. */ STATIC void -cpybody(art, in, body) -register struct article *art; -FILE *in; -register char *body; +cpybody(register struct article *art, FILE *in, register char *body) { register int readcnt; register FILE *out = art->a_artf; @@ -395,10 +389,7 @@ register char *body; */ /* ARGSUSED inname */ STATIC void -copyart(art, in, inname) -register struct article *art; -register FILE *in; -char *inname; +copyart(register struct article *art, register FILE *in, const char *inname) { boolean installed = YES; char *body = hdrcopy(art, in); @@ -444,13 +435,11 @@ char *inname; * * copyart() may reject() the article, and may fill the disk. * it calls fileart and logs rejected articles. it may call uninsart. + * + * boolean blvmax believe maxima? */ statust -cpinsart(in, inname, maxima, blvmax) -FILE *in; -register char *inname; -long maxima; -boolean blvmax; /* believe maxima? */ +cpinsart(FILE *in, register const char *inname, long maxima, boolean blvmax) { struct article art; register struct article *artp = &art; --- libc/qmktime.c.orig 1991-12-10 23:23:11 UTC +++ libc/qmktime.c @@ -5,6 +5,7 @@ #include #include #include +#include "dateconv.h" #define EPOCH 1970 #define DAYS_PER_400YRS (time_t)146097 @@ -28,8 +29,7 @@ static short mdays[] = { * and tm_yday. */ time_t -qmktime(tp) -register struct tm *tp; +qmktime(register struct tm *tp) { register int mon = tp->tm_mon + 1; /* convert to 1-origin */ register int day = tp->tm_mday, year = tp->tm_year + 1900; --- libdbz/random.c.orig 1990-04-01 00:24:21 UTC +++ libdbz/random.c @@ -1,3 +1,7 @@ + +extern int range(int min, int max); +extern void seed(long n); + /* * random-number generator for testing */ @@ -9,9 +13,7 @@ static unsigned long next = 1; * Algorithm from ANSI C standard. Limitation: max-min <= 32767. */ int -range(min, max) -int min; -int max; +range(int min, int max) { register int temp; @@ -24,8 +26,7 @@ int max; - seed - seed random number generator */ void -seed(n) -long n; +seed(long n) { next = (unsigned long)n; } --- readnews/readnews.c.orig 1995-04-28 01:12:21 UTC +++ readnews/readnews.c @@ -4,14 +4,18 @@ * Michael Rourke (UNSW) April 1984 */ +#include +#include +#include #include "defs.h" +#include "readnews_error.h" #define ARTSEP "/" char admsub[BUFLEN] = "general"; char dfltsub[BUFLEN] = "general"; char mailvia[BUFLEN] = ""; -char *mailpath = MAIL; +const char *mailpath = MAIL; #define MAXARGV 10 /* used in building argv[]s below */ @@ -33,20 +37,39 @@ extern newsrc *rc; /* internal .newsrc */ active *alist; /* internal active list */ -long now; /* current time */ +time_t now; /* current time */ bool interrupt; /* if interrupt hit */ char *newsdir; /* %news */ bool su; /* if super user (not used) */ -applycom list(), check(), commands(); -void onintr(); -bool ureject(), seen(), subs(), subsub(); +applycom list(active *ap, newsrc *np, bool last, bool pushed); +applycom check(active *ap, newsrc *np, bool last, bool pushed); +applycom commands(active *ap, newsrc *np, bool last, bool pushed); +void onintr(int dummy); +bool subs(void); +bool subsub(char *grp, char *slist); +bool seen(FILE *f, ino_t *ino); -char *progname; +const char *progname; -main(argc, argv) -int argc; -char *argv[]; +/* extern */ + +/* forwards */ +int options(int argc, char * const argv[], bool cline); +void getctl(void); +void readnews_print(header *hp, FILE *f); +void help(void); +void reply(header *hp, char *fname); +void followup(header *hp, char *fname); +void pnews(char *group); +void save(header *hp, FILE *f, const char *s); +void run(const char *com, char * const argv[], bool closein); +static int put(int c); +void page(FILE *f); + + +int +main(int argc, char * const *argv) { char buf[BUFSIZ], *p; @@ -71,10 +94,10 @@ char *argv[]; nflag = dfltsub; if (rcgrps) convgrps(rcgrps); - if (!n_on_cline && !ngmatch(admsub, nflag)) + if (!n_on_cline && !readnews_ngmatch(admsub, nflag)) nflag = newstr3(admsub, NGSEPS, nflag); if ((int) sflag + (int) lflag + (int) cflag + (int) pflag > 1) - error("-clpsC flags are mutually exclusive."); + readnews_error("-clpsC flags are mutually exclusive."); /* user has private mailer? */ if ((p = getenv("MAILER")) != NULL) @@ -108,19 +131,17 @@ char *argv[]; /* * if newsgroup "ng" isn't subscribed to, add it to subscription list */ -addsub(ng, slist) -char *ng; -char **slist; +int +addsub(chnar *ng, char **slist) { - if (!ngmatch(ng, *slist)) + if (!readnews_ngmatch(ng, *slist)) *slist = newstr3(ng, NGSEPS, *slist); } #endif /* ARGSUSED */ void -onintr(dummy) -int dummy; +onintr(int dummy) { if (signal(SIGINT, SIG_IGN) != SIG_IGN) (void) signal(SIGINT, onintr); @@ -134,10 +155,7 @@ int dummy; * can be called from readnewsrc() */ int /* < 0 failure, otherwise success */ -options(argc, argv, cline) -int argc; -char *argv[]; -bool cline; +options(int argc, char * const *argv, bool cline) { int c; extern int optind; @@ -206,7 +224,7 @@ bool cline; * return true if newsrc is to be re-written */ bool -subs() +subs(void) { register newsrc *np; register active *ap; @@ -218,7 +236,7 @@ subs() (void) printf("%s: Illegal char in newsgroup.\n", sarg); return false; } - if (ngmatch(sarg, nflag)) { + if (readnews_ngmatch(sarg, nflag)) { /* * normally we subscribe, check for an exclusion */ @@ -252,7 +270,7 @@ subs() */ tmp = newstr2(NEGS, sarg); subsub(tmp, rcgrps); - if (!ngmatch(sarg, rcgrps)) + if (!readnews_ngmatch(sarg, rcgrps)) /* * didn't work, so add explicit subscription */ @@ -263,7 +281,7 @@ subs() } else { (void) printf("Subscription list: %s", nflag); for (np = rc; np; np = np->n_next) - if (!np->n_subscribe && ngmatch(np->n_name, nflag)) + if (!np->n_subscribe && readnews_ngmatch(np->n_name, nflag)) (void) printf(",!%s", np->n_name); (void) printf("\n"); } @@ -276,14 +294,12 @@ subs() * return true if successful */ bool -subsub(grp, slist) -char *grp; -char *slist; +subsub(char *grp, char *slist) { register char *delim; while (*slist) { - if (delim = strchr(slist, NGSEPCHAR)) + if ((delim = strchr(slist, NGSEPCHAR))) *delim = '\0'; if (CMP(grp, slist) == 0) { if (delim) @@ -303,8 +319,7 @@ char *slist; } char * -ltoa(l) -long l; +ltoa(long l) { static char buf[30]; @@ -316,9 +331,7 @@ long l; * list titles command (-l) */ applycom -list(ap, np) -active *ap; -newsrc *np; +list(active *ap, newsrc *np, bool last, bool pushed) { static active *lastap; static bool first = true; @@ -343,7 +356,7 @@ newsrc *np; if (lastap != ap) (void) printf(" %s:\n", ap->a_name); lastap = ap; - (void) printf(" %-4d %s\n", np->n_last, h.h_subject); + (void) printf(" %-4ld %s\n", np->n_last, h.h_subject); (void) fclose(f); freehead(&h); if (ino) @@ -355,9 +368,7 @@ newsrc *np; * check command (-c or -C) */ applycom -check(ap, np) -active *ap; -newsrc *np; +check(active *ap, newsrc *np, bool last, bool pushed) { static bool done; @@ -407,13 +418,9 @@ newsrc *np; * .!comd shell escape */ applycom -commands(ap, np, last, pushed) -active *ap; -newsrc *np; -bool last; -bool pushed; +commands(active *ap, newsrc *np, bool last, bool pushed) { - register char *com, *arg; + register const char *com, *arg; register int c, size; register long i; register FILE *f; @@ -423,8 +430,8 @@ bool pushed; ino_t ino; bool printed, pheader, verbose, hadinterrupt; applycom nextact; - static char errmess[] = "Unknown command; type `?' for help.\n"; - static char form[] = "%s: %s\n"; + static const char errmess[] = "Unknown command; type `?' for help.\n"; + static const char form[] = "%s: %s\n"; static char savedsys[BUFSIZ / 2]; static active *lastap, *rlastap; static newsrc lastn; @@ -433,7 +440,6 @@ bool pushed; extern char t_from[], t_subject[], t_date[]; extern char t_newsgroups[], t_path[], t_sender[]; extern char t_replyto[], t_organization[]; - extern active *activep(); if (last) { /* @@ -445,7 +451,7 @@ bool pushed; wantap = NIL(active); if (!ap || pflag) return stop; - } else if (wantap) + } else if (wantap) { /* * doing an "n newsgroup" command */ @@ -453,6 +459,7 @@ bool pushed; return nextgroup; else wantap = NULL; + } fname = convg(newstr5(newsdir, "/", ap->a_name, ARTSEP, ltoa(np->n_last + 1))); @@ -537,7 +544,7 @@ bool pushed; } interrupt = false; if ((com = mgets()) == NIL(char)) { - if (interrupt) + if (interrupt) { if (!hadinterrupt) { clearerr(stdin); (void) printf("Interrupt\n"); @@ -547,6 +554,7 @@ bool pushed; } else exit(1); + } nextact = stop; break; } @@ -577,10 +585,10 @@ bool pushed; */ if (*com && !isdigit(*com) && com[1] && (!isspace(com[1]) || strchr("Nsm", *com) == NULL)) { - (void) printf(errmess); + (void) printf("%s", errmess); continue; } - if (c = *com) { + if ((c = *com)) { arg = com; while (isspace(*++arg)) ; @@ -592,7 +600,7 @@ bool pushed; if (!printed || c == '.') { if (pflag) (void) printf("\n"); - print(&h, f); + readnews_print(&h, f); if (pflag) { nextact = next; break; @@ -618,7 +626,7 @@ bool pushed; pnews(ap->a_name); continue; case 'U': - if (ngmatch(np->n_name, admsub)) { + if (readnews_ngmatch(np->n_name, admsub)) { (void) printf( "Group \"%s\" can't be unsubscribed.\n", np->n_name); @@ -636,7 +644,7 @@ bool pushed; (void) printf("%s: non-existent newsgroup.\n", arg); continue; } - if (!ngmatch(arg, nflag)) { + if (!readnews_ngmatch(strdup(arg), nflag)) { (void) printf("%s: is not subscribed to!\n", arg); wantap = NULL; continue; @@ -692,7 +700,7 @@ bool pushed; i = i * 10 + *arg++ - '0'; } if (!isdigit(c) || *arg != '\0') { - (void) printf(errmess); + (void) printf("%s", errmess); continue; } number[0] = '\0'; @@ -742,9 +750,7 @@ bool pushed; * again to put *ino in memory */ bool -seen(f, ino) -FILE *f; -ino_t *ino; +seen(FILE *f, ino_t *ino) { static int num; static ino_t *ilist; @@ -774,11 +780,12 @@ ino_t *ino; /* * print out help file */ -help() +void +help(void) { register FILE *f; register int c; - register char *helppath; + register const char *helppath; helppath = ctlfile("readnews.help"); if ((f = fopen(helppath, "r")) == NIL(FILE)) { @@ -794,33 +801,35 @@ help() * reply to sender by mail */ /* ARGSUSED fname */ -reply(hp, fname) -header *hp; -char *fname; +void +reply(header *hp, char *fname) { char *argv[MAXARGV]; + char *retaddr; register int argc; argc = 0; - argv[argc++] = "mail"; + argv[argc++] = (char *)"mail"; #ifdef UNSWMAIL - argv[argc++] = "-s"; + argv[argc++] = (char *)"-s"; if ((argv[argc++] = getsubject(hp)) == NIL(char)) return; - argv[argc++] = "-i"; + argv[argc++] = (char *)"-i"; argv[argc++] = fname; #endif - if ((argv[argc++] = getretaddr(hp)) == NIL(char)) { + retaddr = getretaddr(hp); + if (retaddr == NIL(char)) { (void) printf("Can't work out an address!\n"); return; } + argv[argc++] = retaddr; argv[argc++] = NIL(char); run(mailpath, argv, false); - free(argv[argc - 2]); + free(retaddr); } @@ -829,9 +838,8 @@ char *fname; * generate correct headers for a followup article * then call postnews. */ -followup(hp, fname) -header *hp; -char *fname; +void +followup(header *hp, char *fname) { char tmpf[50]; register FILE *fo; @@ -843,7 +851,7 @@ char *fname; (void) mktemp(tmpf); fo = fopen(tmpf, "w"); if (fo == NULL) - error("can't create `%s'", tmpf); + readnews_error("can't create `%s'", tmpf); fprintf(fo, "Newsgroups: %s\n", (hp->h_followupto) ? hp->h_followupto : hp->h_newsgroups); fprintf(fo, "Subject: %s\n", s); @@ -865,8 +873,7 @@ char *fname; * get correct "Subject: Re: .." line */ char * -getsubject(hp) -register header *hp; +getsubject(register header *hp) { register char *s; @@ -889,10 +896,8 @@ register header *hp; /* * run a command, optionally closing stdin */ -run(com, argv, closein) -char *com; -char *argv[]; -bool closein; +void +run(const char *com, char * const *argv, bool closein) { int pid, status, r; @@ -905,11 +910,11 @@ bool closein; if (closein) close(fileno(stdin)); execvp(com, argv); - error("can't exec %s", com); + readnews_error("can't exec %s", com); exit(1); case -1: - error("can't fork"); + readnews_error("can't fork"); } if (signal(SIGINT, SIG_IGN) != SIG_IGN) @@ -929,8 +934,8 @@ bool closein; /* * call postnews */ -pnews(group) -char *group; +void +pnews(char *group) { register char *s = newstr3(binfile("inject/postnews"), " ", group); system(s); @@ -940,18 +945,15 @@ char *group; /* * save an article */ -save(hp, f, s) -header *hp; -FILE *f; -char *s; +void +save(header *hp, FILE *f, const char *s) { register long pos; register int c; register char *cp; register FILE *sf; register char *aname; - long then; - extern char *getenv(); + time_t then; if (!*s) { if ((aname = getenv("HOME")) == NIL(char)) { @@ -969,7 +971,7 @@ char *s; free(aname); pos = ftell(f); rewind(f); - if (cp = strchr(hp->h_from, ' ')) + if ((cp = strchr(hp->h_from, ' '))) *cp = '\0'; if (hp->h_date) then = atot(hp->h_date); @@ -988,9 +990,9 @@ char *s; /* * put - like putchar, but filtering control characters */ +static int /* like putchar */ -put(c) -int c; +put(int c) { register int trimc = c & 0177; /* trim off top bit */ register int newc; @@ -1008,9 +1010,8 @@ int c; * print an article, if it's long enough call page() */ /* ARGSUSED */ -print(hp, f) -header *hp; -FILE *f; +void +readnews_print(header *hp, FILE *f) { register int c; register long pos; @@ -1028,8 +1029,8 @@ FILE *f; /* * copy article text to stdout, and break into pages */ -page(f) -FILE *f; +void +page(FILE *f) { register int c; register unsigned lineno; @@ -1059,12 +1060,18 @@ FILE *f; fastexit: ; } -/* VARARGS1 */ -error(s, a0, a1, a2, a3) -char *s; +void +#ifdef __GNUC__ +__attribute__ ((format(printf, 1, 2))) +#endif +readnews_error(const char *s, ...) { + va_list args; + (void) fprintf(stderr, "readnews: "); - (void) fprintf(stderr, s, a0, a1, a2, a3); + va_start(args, s); + (void) vfprintf(stderr, s, args); + va_end(args); (void) fprintf(stderr, "\n"); fflush(stdout); /* just on principle */ exit(1); @@ -1073,10 +1080,11 @@ char *s; /* - getctl - pick up control file for subscriptions etc. */ -getctl() +void +getctl(void) { register FILE *f; - register char *fname; + register const char *fname; char line[BUFLEN]; register char *p; --- include/readnews_error.h.orig 2023-03-05 10:11:24 UTC +++ include/readnews_error.h @@ -0,0 +1,9 @@ + +#include + +void +#ifdef __GNUC__ +__attribute__ ((format(printf, 1, 2))) +#endif +readnews_error(const char *s, ...); + --- relay/relay.h.orig 1993-11-21 02:04:28 UTC +++ relay/relay.h @@ -35,7 +35,7 @@ struct options { char *blvsite; /* ... for this site only. */ boolean dupsokay; /* iff true, allow duplicates ... */ char *dupsite; /* ... from this site only. */ - char *currdir; + const char *currdir; }; extern struct options opts; @@ -46,13 +46,11 @@ extern struct options opts; #define JUNK "junk" /* lost+found pseudo-ng. */ /* imports */ -extern void artinit(), artfree(); -extern statust loadcaches(), synccaches(); -extern void ctlmsg(); -extern char *hackhybrid(); -extern void filedebug(), fileart(); -extern void nnfclose(); -extern boolean mkdirs(); -extern void fulldisk(); -extern statust trclose(); -extern void transdebug(), transmit(), trcmd(), trbatch(); +extern void artinit(register struct article *art); +extern void artfree(register struct article *art); + +/* munge */ +extern void emitxref(register struct article *art); +extern void hdrdump(register struct article *art); +extern void hdrdigest(register struct article *art, register char *line, int hdrlen); + --- relay/relaynews.c.orig 1995-04-28 00:51:37 UTC +++ relay/relaynews.c @@ -36,6 +36,7 @@ #include "fixerrno.h" #include #include +#include #include "libc.h" #include "news.h" @@ -45,15 +46,17 @@ #include "headers.h" #include "relay.h" #include "history.h" +#include "fileart.h" +#include "transmit.h" +#include "caches.h" +#include "io.h" +#include "rerror.h" +#include "control.h" /* imports */ -extern int optind; /* set by getopt */ -extern char *optarg; -extern statust cpinsart(); /* from procart.c */ -extern statust clshdrstrm(); /* exports */ -char *progname = "relaynews"; +const char *progname = "relaynews"; struct options opts; struct newsconf newsconf; char *slinkfile = NULL; @@ -65,9 +68,7 @@ static boolean uunlink = NO; * SystemV getcwd simulation, courtesy peter honeyman */ static char * -getpwd(path, size) -register char *path; -int size; +getpwd(register char *path, int size) { register FILE *fp; @@ -86,10 +87,8 @@ int size; * in malloced memory, in opts.currdir. * then change directory to the spool directory ($NEWSARTS). */ -void -getwdandcd(argc, argv) -int argc; -char **argv; +static void +getwdandcd(int argc, char **argv) { register int argind; boolean needpwd = NO; @@ -114,9 +113,8 @@ char **argv; * user & group ids. May exit, so call before locking the news system. */ /* ARGSUSED argv */ -void -prelude(argv) /* setuid daemon prelude */ -char **argv; +static void +prelude(char **argv) /* setuid daemon prelude */ { register char *newpath; @@ -127,16 +125,15 @@ char **argv; if (newpath == NULL) exit(1); /* no chatter until stdfdopen */ if (putenv(newpath) || - putenv("SHELL=/bin/sh") || - putenv("IFS= \t\n")) + putenv(strdup("SHELL=/bin/sh")) || + putenv(strdup("IFS= \t\n"))) exit(1); /* no chatter until stdfdopen */ closeall(1); /* closes all but std descriptors */ stdfdopen(); /* ensure open standard descriptors */ } STATIC boolean -debugon(dbopt) -register char *dbopt; +debugon(register char *dbopt) { statust status = YES; @@ -169,11 +166,8 @@ register char *dbopt; /* * parse options and set flags */ -void -procopts(argc, argv, optsp) -int argc; -char **argv; -register struct options *optsp; +static void +procopts(int argc, char **argv, register struct options *optsp) { int c, errflg = 0; @@ -236,10 +230,8 @@ register struct options *optsp; * If so, return the count through charcntp. * This is slightly less convenient than sscanf, but a lot smaller. */ -boolean -batchln(line, charcntp) -register char *line; -register long *charcntp; +static boolean +batchln(register char *line, register long *charcntp) { static char numbang[] = "#!"; static char rnews[] = "rnews"; @@ -267,10 +259,8 @@ register long *charcntp; * If the unbatcher gets out of sync with the input batch, the unbatcher * will print and discard each input line until it gets back in sync. */ -statust -unbatch(in, inname) -register FILE *in; -char *inname; +static statust +unbatch(register FILE *in, const char *inname) { register int c; /* register */ char *line; @@ -304,7 +294,7 @@ char *inname; * like casts in initialisers, or otherwise miscompute. */ STATIC long -maxlong() +maxlong(void) { register int bits = 0; register unsigned word = 1; /* "unsigned" avoids overflow */ @@ -328,10 +318,8 @@ maxlong() * If it starts with '#', assume it's a batch and unravel it, * else it's a single article, so just inject it. */ -statust -process(in, inname) -FILE *in; -char *inname; +static statust +process(FILE *in, const char *inname) { register int c; @@ -349,9 +337,8 @@ char *inname; * process a (relative) file name. * in unlink mode, try to unlink good batches, but not very hard. */ -statust -relnmprocess(name) -char *name; +static statust +relnmprocess(char *name) { register statust status = ST_OKAY; register FILE *in; @@ -372,10 +359,8 @@ char *name; /* * process files named as arguments (or implied) */ -statust -procargs(argc, argv) -int argc; -char **argv; +static statust +procargs(int argc, char **argv) { register statust status = ST_OKAY; @@ -392,9 +377,7 @@ char **argv; * handle options, lock news system, process files & unlock news system. */ int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char **argv) { statust status = ST_OKAY; --- libcnews/rerror.c.orig 1994-09-19 03:26:08 UTC +++ libcnews/rerror.c @@ -16,15 +16,18 @@ #include "headers.h" #include "relay.h" #include "msgs.h" +#include "rerror.h" /* common log reporting */ static -log(stream, art, code, fmt, arg, sverrno) -register FILE *stream; -register struct article *art; -int code; -char *fmt, *arg; -register int sverrno; +void +cnews_log( +register FILE *stream, +register struct article *art, +int code, +const char *fmt, +const char *arg, +register int sverrno) { time_t now; @@ -55,24 +58,28 @@ register int sverrno; * log an audit report and continue * article status unaffected */ -logaudit(art, code, fmt, arg) -struct article *art; -int code; -char *fmt, *arg; +void +logaudit( +struct article *art, +int code, +const char *fmt, +const char *arg) { - log(stdout, art, code, fmt, arg, 0); + cnews_log(stdout, art, code, fmt, arg, 0); } /* * log a complaint about bad input and continue * set ST_REFUSED in article status */ -transient(art, code, fmt, arg) -register struct article *art; -int code; -char *fmt, *arg; +void +transient( +register struct article *art, +int code, +const char *fmt, +const char *arg) { - log(stdout, art, code, fmt, arg, 0); + cnews_log(stdout, art, code, fmt, arg, 0); if (art != NULL) art->a_status |= ST_REFUSED; } @@ -81,12 +88,14 @@ char *fmt, *arg; * the news system needs attention; complain and shut down gracefully * sets ST_NEEDATTN and ST_DROPPED in article status */ -persistent(art, code, fmt, arg) -register struct article *art; -int code; -char *fmt, *arg; +void +persistent( +register struct article *art, +int code, +const char *fmt, +const char *arg) { - log(stderr, art, code, fmt, arg, errno); + cnews_log(stderr, art, code, fmt, arg, errno); if (art != NULL) art->a_status |= ST_NEEDATTN|ST_DROPPED; } @@ -96,19 +105,21 @@ char *fmt, *arg; * either quits or sets ST_NEEDATTN and ST_DROPPED in article status */ /* ARGSUSED art code */ -canthappen(art, code, fmt, arg) -struct article *art; -int code; -char *fmt, *arg; +void +canthappen( +struct article *art, +int code, +const char *fmt, +const char *arg) { errunlock(fmt, arg); /* NOTREACHED */ } + +/* complain once & set status bits */ void -fulldisk(art, file) /* complain once & set status bits */ -register struct article *art; -char *file; +fulldisk(register struct article *art, const char *file) { if (!(art->a_status&ST_DISKFULL)) art->a_status |= prfulldisk(file); --- include/rerror.h.orig 2023-02-12 17:08:16 UTC +++ include/rerror.h @@ -0,0 +1,7 @@ + +extern void logaudit(struct article *art, int code, const char *fmt, const char *arg); +extern void transient(register struct article *art, int code, const char *fmt, const char *arg); +extern void persistent(struct article *art, int code, const char *fmt, const char *arg); +extern void canthappen(struct article *art, int code, const char *fmt, const char *arg); +extern void fulldisk(register struct article *art, const char *file); + --- util/sizeof.c.orig 1994-10-18 03:49:55 UTC +++ util/sizeof.c @@ -11,20 +11,19 @@ #include #include #include +#include +#include int debug = 0; int indiv = 0; off_t multiplier = 1; char *progname; -extern void error(); - /* - main - do it all */ -main(argc, argv) -int argc; -char *argv[]; +int +main(int argc, char **argv) { int c; int errflg = 0; --- libc/split.c.orig 1991-09-05 19:17:28 UTC +++ libc/split.c @@ -1,15 +1,16 @@ #include #include +#include "libc.h" /* * split - divide a string into fields, like awk split() */ int /* number of fields, including overflow */ -split(string, fields, nfields, sep) -char *string; -char *fields[]; /* list is not NULL-terminated */ -int nfields; /* number of entries available in fields[] */ -char *sep; /* "" white, "c" single char, "ab" [ab]+ */ +split( +char *string, +char *fields[], /* list is not NULL-terminated */ +int nfields, /* number of entries available in fields[] */ +const char *sep) /* "" white, "c" single char, "ab" [ab]+ */ { register char *p = string; register char c; /* latest character */ @@ -17,7 +18,7 @@ char *sep; /* "" white, "c" single char, "ab" [ab]+ register char sepc2; register int fn; register char **fp = fields; - register char *sepp; + register const char *sepp; register int trimtrail; /* white space */ @@ -147,9 +148,7 @@ char *sep; /* "" white, "c" single char, "ab" [ab]+ * pgm str sep n splits str by sep n times */ int -main(argc, argv) -int argc; -char *argv[]; +main(int argc, char **argv) { char buf[512]; register int n; @@ -178,9 +177,8 @@ char *argv[]; exit(0); } -dosplit(string, seps) -char *string; -char *seps; +void +dosplit(char *string, char *seps) { # define NF 5 char *fields[NF]; @@ -190,10 +188,11 @@ char *seps; print(nf, NF, fields); } -print(nf, nfp, fields) -int nf; -int nfp; -char *fields[]; +void +print( +int nf, +int nfp, +char *fields[]) { register int fn; register int bound; @@ -273,7 +272,8 @@ struct { NULL, NULL, 0, { NULL }, }; -regress() +void +regress(void) { char buf[512]; register int n; --- libc/stdfdopen.c.orig 1990-10-28 07:20:54 UTC +++ libc/stdfdopen.c @@ -4,19 +4,22 @@ */ #include +#include +#include #include #ifndef __STDC__ extern int errno; #endif #include #include +#include "news.h" #ifndef NSYSFILE #define NSYSFILE 3 /* hmm, not on V8 */ #endif void -stdfdopen() /* ensure standard descriptors are open */ +stdfdopen(void) /* ensure standard descriptors are open */ { register int fd; struct stat stbuf; --- libcnews/str3save.c.orig 1993-11-21 04:41:16 UTC +++ libcnews/str3save.c @@ -9,13 +9,13 @@ * This may seem kind of ad-hoc, but it's just right for filename work. */ char * -str3save(s1, s2, s3) -char *s1; -char *s2; -char *s3; +str3save( +const char *s1, +const char *s2, +const char *s3) { register char *p; - static char *empty = ""; + static const char *empty = ""; if (s1 == NULL) s1 = empty; --- libcnews/string.c.orig 1993-09-12 01:54:50 UTC +++ libcnews/string.c @@ -10,15 +10,14 @@ #include "news.h" int -spacein(s) -register char *s; +spacein(register const char *s) { return strchr(s, ' ') != NULL || strchr(s, '\t') != NULL; } -stranslit(s, from, to) /* simple tr: change `from' to `to' in `s' */ -register char *s; -register char from, to; +/* simple tr: change `from' to `to' in `s' */ +void +stranslit(register char *s, register char from, register char to) { for (; *s != '\0'; s++) if (*s == from) @@ -30,8 +29,7 @@ register char from, to; * Words are delimited by spaces. */ char * -first(tokens) -char *tokens; +first(char *tokens) { return strsvto(tokens, ' '); } @@ -40,15 +38,14 @@ char *tokens; * Turn a newsgroup name into a file name, in place. */ void -mkfilenm(ng) -register char *ng; +mkfilenm(register char *ng) { stranslit(ng, NGDELIM, FNDELIM); } +/* trim trailing newline */ char * -trim(s) /* trim trailing newline */ -char *s; +trim(char *s) { register char *nl; @@ -59,19 +56,18 @@ char *s; return s; } +/* skip any whitespace at *s */ char * -skipsp(s) /* skip any whitespace at *s */ -register char *s; +skipsp(register char *s) { while (iswhite(*s)) s++; return s; } +/* save s up to (but excluding) c */ char * -strsvto(s, c) /* save s up to (but excluding) c */ -char *s; -int c; +strsvto(char *s, int c) { register char *endp, *copy; @@ -84,10 +80,9 @@ int c; return copy; } +/* how many c's in s? */ int -charcount(s, c) /* how many c's in s? */ -register char *s; -register int c; +charcount(register char *s, register int c) { register int count = 0; @@ -102,11 +97,11 @@ register int c; return count; } +/* return s or "" if NULL */ char * -nullify(s) /* return s or "" if NULL */ -register char *s; +nullify(register char *s) { - return (s == NULL? "": s); + return (s == NULL? strdup("") : s); } @@ -131,7 +126,8 @@ static int setishostchar = NO; * disallows blanks in hostnames. */ STATIC -doinitishostchar() +void +doinitishostchar(void) { if (!setishostchar) { register char *p; @@ -149,8 +145,7 @@ doinitishostchar() * hosts are separated by non-hostname characters. */ boolean -anyhostin(hosts, s) -char *hosts, *s; +anyhostin(char *hosts, char *s) { register char *host = hosts; @@ -184,8 +179,7 @@ char *hosts, *s; * This function is a profiling hot spot, so it has been optimised. */ STATIC char * -findhost(host, path) -register char *host, *path; +findhost(register char *host, register char *path) { register char *pathp, *nxpathp; register int hostlen = strlen(host); @@ -208,8 +202,7 @@ register char *host, *path; * of legal hostname characters immediately adjacent. */ boolean -hostin(host, s) -register char *host, *s; +hostin(register char *host, register char *s) { return findhost(host, s) != NULL; } @@ -220,8 +213,7 @@ register char *host, *s; * See anyhostin() for the rules, and the macros. */ int -hopcount(path) -register char *path; +hopcount(register char *path) { register int count = 0; @@ -234,8 +226,7 @@ register char *path; } char * -sendersite(path) -register char *path; +sendersite(register char *path) { register char *p; static char *sender = NULL; @@ -245,7 +236,7 @@ register char *path; for (p = path; hostchar(*p); p++) ; if (*p == '\0') /* only a user name */ - return "(local)"; /* a local posting */ + return strdup("(local)"); /* a local posting */ else { register int delim = *p; @@ -264,11 +255,10 @@ register char *path; * This is also a profiling hot spot. */ char * -canonpath(rawpath, approved, sender) -char *rawpath, *approved, *sender; +canonpath(char *rawpath, char *approved, char *sender) { register char *newpath = strsave(nullify(rawpath)); /* costly */ - register char *p, *lastdelim = newpath, *site = NULL; + register char *p, *lastdelim = newpath, *site = NULL; initishostchar(); for (p = newpath; *p != '\0'; ++p) --- libcnews/strlower.c.orig 1987-08-04 00:33:46 UTC +++ libcnews/strlower.c @@ -3,9 +3,12 @@ */ #include +#include +#include +#include "news.h" -strlower(s) -register char *s; +void +strlower(register char *s) { for (; *s != '\0'; ++s) if (isascii(*s) && isupper(*s)) --- libcnews/strsave.c.orig 1993-11-21 04:40:52 UTC +++ libcnews/strsave.c @@ -14,8 +14,7 @@ * else return the address of the malloced memory. */ char * -strsave(s) -register char *s; +strsave(register const char *s) { register char *news = nemalloc((unsigned)strlen(s) + SIZENUL); --- relay/sys.c.orig 1993-02-17 00:22:49 UTC +++ relay/sys.c @@ -25,9 +25,6 @@ #define CMDSFX "!rnews" /* suffix of same */ /* imports */ -extern boolean donesys(); -extern struct system *mysysincache(); -extern void rewsys(), remmysys(), advcurrsys(), setupsys(); /* exports */ struct system *firstsys = NULL; /* cache: 1st sys of in-core sys file */ @@ -41,7 +38,7 @@ static struct parsing { /* parsing state */ } parsing; struct system * -oursys() /* return our sys entry */ +oursys(void) /* return our sys entry */ { register struct system *sys = mysysincache(); static struct system fakesys; @@ -57,11 +54,11 @@ oursys() /* return our sys entry */ sys = &fakesys; sys->sy_name = host; sys->sy_excl = NULL; - sys->sy_ngs = "all"; + sys->sy_ngs = strdup("all"); sys->sy_distr = sys->sy_ngs; sys->sy_flags = 0; sys->sy_lochops = 0; - sys->sy_cmd = ""; + sys->sy_cmd = strdup(""); sys->sy_trngs = ngparse(strsave(sys->sy_ngs)); sys->sy_trdistr = sys->sy_trngs; sys->sy_next = NULL; @@ -77,9 +74,7 @@ oursys() /* return our sys entry */ * "delim" was present. */ STATIC char * -reparse(field, delim) -char *field; -register int delim; +reparse(char *field, register int delim) { register char *delimp; @@ -94,8 +89,7 @@ register int delim; * return NULL or ptr. to byte after colon. */ STATIC char * -parsecolon(line) -char *line; +parsecolon(char *line) { return reparse(line, ':'); } @@ -105,7 +99,7 @@ char *line; * (freed iff on a small system, in readsys(), see freecursys()). */ STATIC char * -parse() +parse(void) { register char *curr = parsing.next; @@ -118,9 +112,7 @@ parse() * Parse sys file flags into sysp. */ STATIC void -parseflags(flags, sysp) -register char *flags; -register struct system *sysp; +parseflags(register char *flags, register struct system *sysp) { sysp->sy_flags = 0; sysp->sy_lochops = 0; /* default L value */ @@ -175,9 +167,8 @@ register struct system *sysp; } /* if s contains whitespace, complain and exit */ -badspace(s, part, sysp) -char *s, *part; -struct system *sysp; +void +badspace(const char *s, const char *part, struct system *sysp) { if (spacein(s)) { char *err = str3save("whitespace in ", part, @@ -195,8 +186,7 @@ struct system *sysp; * Side-effect: sysline has a trailing newline removed. */ STATIC void -parsesysln(sysline) -register char *sysline; +parsesysln(register char *sysline) { register struct system *sysp =(struct system *)nemalloc(sizeof *sysp); char *flagstring; @@ -250,7 +240,7 @@ register char *sysline; * continued lines of arbitrary length. */ STATIC void -readsys() +readsys(void) { register char *sysline, *nonblank; @@ -278,7 +268,7 @@ readsys() * sys file on big systems, so the common code in this file is subtle. */ struct system * -nextsys() +nextsys(void) { struct system *retsys; @@ -292,10 +282,9 @@ nextsys() return retsys; } +/* replace sysp->sy_cmd with artfile(file) */ STATIC void -newartfile(sysp, file) /* replace sysp->sy_cmd with artfile(file) */ -register struct system *sysp; -register char *file; +newartfile(register struct system *sysp, register char *file) { free(sysp->sy_cmd); /* malloced by parse */ #ifdef BATCHSPOOL /* UUNET special */ @@ -317,8 +306,7 @@ register char *file; * (This *is* yucky and uucp-version-dependent.) */ void -sysdeflt(sysp) -register struct system *sysp; +sysdeflt(register struct system *sysp) { if (STREQ(sysp->sy_name, "ME")) { free(sysp->sy_name); /* malloced by parse */ @@ -342,7 +330,7 @@ register struct system *sysp; } void -rewndsys() +rewndsys(void) { rewsys(fp); } --- relay/system.h.orig 1991-11-15 03:41:33 UTC +++ relay/system.h @@ -26,5 +26,19 @@ struct system { #define FLG_NBATCH (1<<6) /* n: NNTP batch: filename & msg-id */ /* imports from system.c */ -extern struct system *oursys(), *nextsys(); -extern void sysdeflt(), rewndsys(); +extern struct system *oursys(void); +extern struct system *nextsys(void); +extern void sysdeflt(register struct system *sysp); +extern void rewndsys(void); + +/* imports from fsys.c */ +void remmysys(struct system *sys); +struct system *mysysincache(void); +void setupsys(FILE *fp); +boolean donesys(void); +void rewsys(FILE *fp); +void advcurrsys(void); + +/* imports from sys.c */ +extern void badspace(const char *s, const char *part, struct system *sysp); + --- libcnews/time.c.orig 1990-03-05 18:42:00 UTC +++ libcnews/time.c @@ -5,17 +5,20 @@ #include #include #include +#include #include "libc.h" #include "news.h" +int ltoza(register char *outstr, long value, register int width); + /* * Write a timestamp of the form "Jun 12 12:34:56.789" on fp. * N.B.: no trailing newline is written. */ void -timestamp(fp, timep) -FILE *fp; -time_t *timep; /* if non-null, return time() here for later use */ +timestamp( +FILE *fp, +time_t *timep) /* if non-null, return time() here for later use */ { struct timeb ftnow; char ms[STRLEN("123") + SIZENUL]; --- include/sys/timeb.fake.orig 1994-10-18 03:49:33 UTC +++ include/sys/timeb.fake @@ -8,3 +8,4 @@ struct timeb { #undef ftime #endif #define ftime(x) fakeftime(x) +int fakeftime(struct timeb *tp); --- relay/transmit.c.orig 1993-03-13 22:31:35 UTC +++ relay/transmit.c @@ -19,13 +19,14 @@ #include "ngmatch.h" #include "system.h" #include "trbatch.h" +#include "rerror.h" +#include "transmit.h" /* private */ static boolean debug = NO; void -transdebug(state) -boolean state; +transdebug(boolean state) { debug = state; } @@ -44,12 +45,11 @@ boolean state; * * If m flag is on, group(s) must be moderated; if u flag is on, * must be unmoderated. (If both are on, act as if neither is on.) + * + * char *exclude no copy to him */ STATIC boolean -oktransmit(art, sys, exclude) -register struct article *art; -register struct system *sys; -char *exclude; /* no copy to him */ +oktransmit(register struct article *art, register struct system *sys, char *exclude) { register int flags = sys->sy_flags; register char *site = sys->sy_name; @@ -82,10 +82,11 @@ char *exclude; /* no copy to him */ /* * We avoid sprintf if syscmd contains no %, thus avoiding the 128-byte * restriction on printf output (see printf(3) BUGS, at least in V7). + * + * copy cmd, replace %s in it with file, return copy */ STATIC char * /* malloced storage */ -pctsubst(cmd, file) /* copy cmd, replace %s in it with file, return copy */ -char *cmd, *file; +pctsubst(const char *cmd, const char *file) { register char *copy = NULL, *percent, *pcent2 = NULL; register int format; @@ -125,10 +126,7 @@ char *cmd, *file; * is filename by default. */ void -trcmd(art, sys, filename) -struct article *art; -struct system *sys; -char *filename; +trcmd(struct article *art, struct system *sys, const char *filename) { register char *cmd, *substcmd; int exitstat; @@ -170,11 +168,7 @@ char *filename; * and formatting flags for batch file "bf". */ STATIC void -trappend(art, sys, bf, artname) -register struct article *art; -register struct system *sys; -struct batchfile *bf; -char *artname; +trappend(register struct article *art, register struct system *sys, struct batchfile *bf, const char *artname) { int flag = (sys->sy_flags&FLG_IHAVE? 'I': (sys->sy_flags&FLG_NBATCH? 'n': @@ -191,11 +185,7 @@ char *artname; * descriptors. */ void -trbatch(art, sys, filename, bsysno) -register struct article *art; -struct system *sys; -char *filename; -register int bsysno; +trbatch(register struct article *art, struct system *sys, const char *filename, register int bsysno) { register struct batchfile *bf = bfopen(sys->sy_cmd, bsysno); @@ -216,10 +206,7 @@ register int bsysno; * Side-effect: prints the system name on stdout for logging. */ STATIC void -ejaculate(art, sys, bsysno) -register struct article *art; -register struct system *sys; -int bsysno; +ejaculate(register struct article *art, register struct system *sys, int bsysno) { register char *fullname; register char *filename = first(art->a_files); @@ -244,11 +231,11 @@ int bsysno; * For each system in "sys" other than this one, * transmit this article when its ng pattern matches * art->h.h_distr (which may be just a copy of art->h.h_ngs). + * + * char *exclude no copy to this site */ void -transmit(art, exclude) -register struct article *art; -char *exclude; /* no copy to this site */ +transmit(register struct article *art, char *exclude) { register struct system *sys; register int bsysno = 0; /* ordinal # of batch sys entry */ @@ -278,9 +265,7 @@ char *exclude; /* no copy to this site */ * really close all the open batch files */ statust -trclose() +trclose(void) { - extern statust trrealclose(); - return trrealclose(); } --- relay/transmit.h.orig 1989-05-26 07:51:35 UTC +++ relay/transmit.h @@ -1,3 +1,7 @@ /* imports from transmit.c */ -extern statust trclose(); -extern void transdebug(), transmit(), trcmd(), trbatch(); +extern statust trclose(void); +extern void transdebug(boolean state); +extern void trcmd(register struct article *art, struct system *sys, const char *filename); +extern void trbatch(register struct article *art, struct system *sys, const char *filename, register int bsysno); +extern void transmit(register struct article *art, char *exclude); + --- explode/trbatch.c.orig 1994-11-30 22:09:10 UTC +++ explode/trbatch.c @@ -5,6 +5,7 @@ #include #include "fixerrno.h" #include +#include #include "hdbm.h" #include "hash.h" #include "libc.h" @@ -23,6 +24,9 @@ static HASHTABLE *nmbftbl; /* name -> batchfile mapping */ +static struct batchfile *bfisopen(char *name), *bfincache(char *name); +static statust explode_bfrclose(void); + /* * open "name" for appending. * @@ -31,8 +35,7 @@ static HASHTABLE *nmbftbl; /* name -> batchfile mappi * batchfile stream and retry the open. */ struct batchfile * -bfopen(name) -register char *name; +explode_bfopen(register char *name) { register struct batchfile *bf; @@ -42,7 +45,7 @@ register char *name; bf->bf_str = fopenclex(name, "a"); /* silent try */ if (bf->bf_str == NULL && errno == EMFILE) { /* try to free up a descriptor */ - if (bfrclose() != ST_OKAY) + if (explode_bfrclose() != ST_OKAY) return NULL; errno = 0; warning( @@ -60,13 +63,13 @@ register char *name; } STATIC -hfinstall(name) -char *name; +void +hfinstall(char *name) { register struct batchfile *bf; if (nmbftbl == NULL) - nmbftbl = hashcreate(HASHFILSZ, (unsigned (*)())NULL); + nmbftbl = hashcreate(HASHFILSZ, (unsigned (*)(HDBMDATUM key))NULL); bf = (struct batchfile *)hashfetch(nmbftbl, name); if (bf != NULL) return; /* error: name present */ @@ -86,9 +89,8 @@ char *name; /* * returns a batchfile, never NULL, corresponding to name. */ -struct batchfile * -bfincache(name) -char *name; +static struct batchfile * +bfincache(char *name) { register struct batchfile *bf; @@ -111,11 +113,13 @@ char *name; * don't check putc return value for portability; use ferror. */ int /* boolean */ -bfappend(bf, flag, batname, artname, msgid, size) -register struct batchfile *bf; -int flag; -char *batname, *artname, *msgid; -long size; +bfappend( +register struct batchfile *bf, +int flag, +const char *batname, +const char *artname, +const char *msgid, +long size) { register FILE *bfstr = bf->bf_str; @@ -144,24 +148,23 @@ struct closehook { }; STATIC int -closefirst(key, data, hook) -HASHDATUM key, data; -char *hook; +closefirst(HASHDATUM key, HASHDATUM data, char *hook) { register struct closehook *chp = (struct closehook *)hook; register struct batchfile *bf; if (chp->closedone) - return; + return 0; bf = (struct batchfile *)data; if (bf->bf_str == NULL) - return; + return 0; chp->status = bfclose(bf); chp->closedone = YES; + return 0; } STATIC statust -bfrclose() /* close an arbitrary batchfile */ +explode_bfrclose(void) /* close an arbitrary batchfile */ { struct closehook closehook; register struct closehook *chp = &closehook; @@ -179,6 +182,7 @@ bfrclose() /* close an arbitrary batchfile */ return chp->status; } +#if 0 STATIC int closeone(key, data, hook) /* close a given open batch file */ HASHDATUM key, data; @@ -194,6 +198,7 @@ char *hook; #endif if (!hashdelete(nmbftbl, key)) error("can't delete hash key `%s'", key); /* canthappen */ + return 0; } STATIC statust @@ -207,6 +212,7 @@ bfrealclose() /* close all open batch files */ hashwalk(nmbftbl, closeone, (char *)chp); return chp->status; } +#endif /* @@ -214,8 +220,7 @@ bfrealclose() /* close all open batch files */ * open master batch file, if any. */ STATIC struct batchfile * -bfisopen(name) -char *name; +bfisopen(char *name) { return nmbftbl == NULL? NULL: (struct batchfile *)hashfetch(nmbftbl, name); --- relay/trbatch.c.orig 1993-01-15 04:27:11 UTC +++ relay/trbatch.c @@ -3,6 +3,7 @@ */ #include #include +#include #include #include "fixerrno.h" #include @@ -14,6 +15,8 @@ #include "msgs.h" #include "trbatch.h" +static struct batchfile *bfincache(char *name, int ord); + /* tunable parameters */ #ifndef MASTERDIR #define MASTERDIR artfile("out.master") @@ -67,8 +70,7 @@ static HASHTABLE *nmordtbl; /* name -> mbf ordinal ma * open master batch file, if any. */ STATIC struct batchfile * -bfisopen(name) -register char *name; +bfisopen(register char *name) { register struct hashfilename *hf; @@ -78,18 +80,16 @@ register char *name; return (hf == NULL? NULL: &batchfile[hf->hf_mbf]); } -STATIC -hfinstall(name, mbford, ord) -char *name; -int mbford, ord; +STATIC int +hfinstall(char *name, int mbford, int ord) { register struct hashfilename *hf; if (nmordtbl == NULL) - nmordtbl = hashcreate(HASHFILSZ, (unsigned (*)())NULL); + nmordtbl = hashcreate(HASHFILSZ, (unsigned (*)(HDBMDATUM key))NULL); hf = (struct hashfilename *)hashfetch(nmordtbl, name); if (hf != NULL) - return; /* error: name present */ + return 0; /* error: name present */ /* allocate, append & initialise a new entry */ hf = (struct hashfilename *)nemalloc(sizeof *hf); hf->hf_mbf = mbford; @@ -97,14 +97,13 @@ int mbford, ord; errunlock("can't store under hash key `%s'", name); ordtombfs[ord] = mbford; otomvalid[ord] = YES; + return 0; } /* establish new mapping for a new master batch file */ STATIC struct batchfile * -bfinstall(name, ord) -int ord; -char *name; +bfinstall(char *name, int ord) { register struct batchfile *bf = &batchfile[ord]; @@ -131,11 +130,11 @@ char *name; * if ord isn't mapped, search the batchfile cache for name; * If ord & name are unmapped; find free mbf slot, opening new mbf if needed, * and map the name and ord. + * + * register int ord batch file ord */ STATIC struct batchfile * -bfincache(name, ord) -register char *name; -register int ord; /* batch file ord */ +bfincache(register char *name, register int ord) { register struct batchfile *mbf; @@ -188,9 +187,7 @@ register int ord; /* batch file ord */ * batchfile stream and retry the open. */ struct batchfile * -bfopen(name, ord) -register char *name; -register int ord; +bfopen(register char *name, register int ord) { register struct batchfile *bf; @@ -203,12 +200,13 @@ register int ord; if (bf == NULL) bf = fakebf((FILE *)NULL, name); #endif + return NULL; } else bf = bfincache(name, ord); if (bf->bf_str == NULL) { register char *bfname = - (bf->bf_name != NULL? bf->bf_name: "fake"); + (bf->bf_name != NULL? bf->bf_name: (char *)"fake"); /* TODO: may want to use popenclex here for exploders */ bf->bf_str = fopenclex(bfname, "a"); /* silent try */ @@ -233,11 +231,13 @@ register int ord; * don't check putc return value for portability; use ferror. */ int /* boolean */ -bfappend(bf, flag, batname, artname, msgid, size) -register struct batchfile *bf; -int flag; -char *batname, *artname, *msgid; -long size; +bfappend( +register struct batchfile *bf, +int flag, +const char *batname, +const char *artname, +const char *msgid, +long size) { register FILE *bfstr = bf->bf_str; @@ -275,7 +275,7 @@ long size; } statust -trrealclose() +trrealclose(void) { register int i; --- include/trbatch.h.orig 1993-12-16 23:17:03 UTC +++ include/trbatch.h @@ -23,12 +23,19 @@ struct batchfile { }; /* imports from trbatch.c */ -extern struct batchfile *bfopen(), *bfisopen(); -extern statust bffkclose(), bfrealclose(); -extern int bfflush(); +extern struct batchfile *bfopen(register char *name, register int ord); +extern int bfappend(register struct batchfile *bf, int flag, const char *batname, const char *artname, const char *msgid, long size); +extern struct batchfile *explode_bfopen(register char *name); +extern statust trrealclose(void); + /* imports from trbatcomm.c */ -extern statust bfclose(), bfrclose(); -extern struct batchfile *bfincache(), *fakebf(); +extern void bfsetup(register struct batchfile *bf); +extern statust bffkclose(int ord); +extern statust bfclose(register struct batchfile *bf); +extern struct batchfile *fakebf(FILE *stream, char *name); +extern int bfflush(register struct batchfile *bf); +extern statust bfrclose(void); +extern statust bfrealclose(void); extern struct batchfile batchfile[]; /* try to keep open always */ #define lastbf &batchfile[NOPENBFS-1] --- libcnews/trbatcomm.c.orig 1993-03-13 06:17:14 UTC +++ libcnews/trbatcomm.c @@ -22,18 +22,18 @@ struct batchfile *ordtobfs[NOPENBFS]; /* * any stream-specific set up (reserved for future use) */ -bfsetup(bf) -register struct batchfile *bf; +void +bfsetup(register struct batchfile *bf) { if (!fnlockfile(bf->bf_str)) /* UUNET: lock against exploder */ warning("can't lock master batch file `%s'", bf->bf_name); /* persistent? */ } +/* close current (ord's) batchfile, if fake */ /* ARGSUSED ord */ statust -bffkclose(ord) /* close current (ord's) batchfile, if fake */ -int ord; +bffkclose(int ord) { register statust status = ST_OKAY; @@ -43,8 +43,7 @@ int ord; } statust -bfclose(bf) -register struct batchfile *bf; +bfclose(register struct batchfile *bf) { register statust status = ST_OKAY; @@ -55,9 +54,7 @@ register struct batchfile *bf; } struct batchfile * -fakebf(stream, name) -FILE *stream; -char *name; +fakebf(FILE *stream, char *name) { fakebatf.bf_name = name; fakebatf.bf_str = stream; @@ -68,8 +65,7 @@ char *name; * a performance hack: only fflush bf->bf_str every FLUSHEVERY calls. */ int -bfflush(bf) -register struct batchfile *bf; +bfflush(register struct batchfile *bf) { register int ret = 0; @@ -81,7 +77,7 @@ register struct batchfile *bf; } statust -bfrclose() /* close an arbitrary batchfile */ +bfrclose(void) /* close an arbitrary batchfile */ { register struct batchfile *bf; register statust status = ST_OKAY; @@ -95,7 +91,7 @@ bfrclose() /* close an arbitrary batchfile */ } statust -bfrealclose() /* close all open batch files */ +bfrealclose(void) /* close all open batch files */ { register struct batchfile *bf; register statust status = ST_OKAY; --- libcnews/unprivileged.c.orig 1991-09-20 01:41:55 UTC +++ libcnews/unprivileged.c @@ -2,9 +2,10 @@ * default unprivileged handler - does nothing */ +#include "config.h" + /* ARGSUSED */ void -unprivileged(reason) -char *reason; +unprivileged(const char *reason) { } --- libc/warning.c.orig 1991-01-09 19:12:55 UTC +++ libc/warning.c @@ -3,21 +3,20 @@ */ #include +#include #include #ifndef __STDC__ extern int errno; #endif #include +#include +#include "news.h" void -warning(s1, s2) -char *s1; -char *s2; +warning(const char *s1, const char *s2) { char *cmdname; register int saverrno = errno; - extern char *progname; - extern char *getenv(); (void) fflush(stdout); /* hack */ cmdname = getenv("CMDNAME");