Mostly compile on clang-18.1.8 Fixed: -Wdeprecated-non-prototype: Clang does not recognize split function signatures: ``` -int subfd_readsmall(fd,buf,len) int fd; char *buf; int len; +ssize_t subfd_readsmall(int fd, const void *buf, size_t len) { ... } ``` -Wincompatible-pointer-types: The mix of char* and void* is considered incompatible here. Not fixed: -Wincompatible-pointer-types-discards-qualifiers: many unconstify warnings Signed-off-by: Robin H. Johnson Reference: https://bugs.gentoo.org/929081 Reference: https://bugs.gentoo.org/934407 diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/alloc.c safecat-1.13/alloc.c --- safecat-1.13.orig/alloc.c 2024-11-28 13:53:10.703141456 -0800 +++ safecat-1.13/alloc.c 2024-11-30 08:39:56.415251673 -0800 @@ -10,8 +10,7 @@ #define space ((char *) realspace) static unsigned int avail = SPACE; /* multiple of ALIGNMENT; 0<=avail<=SPACE */ -/*@null@*//*@out@*/char *alloc(n) -unsigned int n; +/*@null@*//*@out@*/char *alloc(size_t n) { char *x; n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */ @@ -21,8 +20,7 @@ return x; } -void alloc_free(x) -char *x; +void alloc_free(char *x) { if (x >= space) if (x < space + SPACE) diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/alloc.h safecat-1.13/alloc.h --- safecat-1.13.orig/alloc.h 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/alloc.h 2024-11-30 08:11:15.520904375 -0800 @@ -1,8 +1,10 @@ #ifndef ALLOC_H #define ALLOC_H -extern /*@null@*//*@out@*/char *alloc(); -extern void alloc_free(); -extern int alloc_re(); +#include + +extern /*@null@*//*@out@*/char *alloc(size_t n); +extern void alloc_free(char *x); +extern int alloc_re(char **x,size_t m,size_t n); #endif diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/alloc_re.c safecat-1.13/alloc_re.c --- safecat-1.13.orig/alloc_re.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/alloc_re.c 2024-11-30 08:40:05.798572217 -0800 @@ -1,10 +1,7 @@ #include "alloc.h" #include "byte.h" -int alloc_re(x,m,n) -char **x; -unsigned int m; -unsigned int n; +int alloc_re(char **x,size_t m,size_t n) { char *y; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/auto-str.c safecat-1.13/auto-str.c --- safecat-1.13.orig/auto-str.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/auto-str.c 2024-11-30 08:40:26.555210588 -0800 @@ -5,15 +5,12 @@ char buf1[256]; substdio ss1 = SUBSTDIO_FDBUF(write,1,buf1,sizeof(buf1)); -void puts(s) -char *s; +void puts(char *s) { if (substdio_puts(&ss1,s) == -1) _exit(111); } -void main(argc,argv) -int argc; -char **argv; +void main(int argc,char **argv) { char *name; char *value; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/byte_chr.c safecat-1.13/byte_chr.c --- safecat-1.13.orig/byte_chr.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/byte_chr.c 2024-11-30 08:40:39.195193358 -0800 @@ -1,9 +1,6 @@ #include "byte.h" -unsigned int byte_chr(s,n,c) -char *s; -register unsigned int n; -int c; +unsigned int byte_chr(char *s,unsigned int n,int c) { register char ch; register char *t; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/byte_copy.c safecat-1.13/byte_copy.c --- safecat-1.13.orig/byte_copy.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/byte_copy.c 2024-11-30 08:40:59.835165215 -0800 @@ -1,10 +1,9 @@ #include "byte.h" -void byte_copy(to,n,from) -register char *to; -register unsigned int n; -register char *from; +void byte_copy(const char *to_,size_t n,const char *from_) { + char* to = to_; + char* from = from_; for (;;) { if (!n) return; *to++ = *from++; --n; if (!n) return; *to++ = *from++; --n; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/byte_cr.c safecat-1.13/byte_cr.c --- safecat-1.13.orig/byte_cr.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/byte_cr.c 2024-11-30 08:41:06.618489300 -0800 @@ -1,10 +1,9 @@ #include "byte.h" -void byte_copyr(to,n,from) -register char *to; -register unsigned int n; -register char *from; +void byte_copyr(const char *to_, size_t n,const char *from_) { + char* to = to_; + char* from = from_; to += n; from += n; for (;;) { diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/byte_diff.c safecat-1.13/byte_diff.c --- safecat-1.13.orig/byte_diff.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/byte_diff.c 2024-11-30 08:41:10.455150735 -0800 @@ -1,9 +1,6 @@ #include "byte.h" -int byte_diff(s,n,t) -register char *s; -register unsigned int n; -register char *t; +int byte_diff(char *s,unsigned int n,char *t) { for (;;) { if (!n) return 0; if (*s != *t) break; ++s; ++t; --n; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/byte.h safecat-1.13/byte.h --- safecat-1.13.orig/byte.h 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/byte.h 2024-11-30 08:13:25.567397823 -0800 @@ -1,12 +1,13 @@ #ifndef BYTE_H #define BYTE_H +#include -extern unsigned int byte_chr(); -extern unsigned int byte_rchr(); -extern void byte_copy(); -extern void byte_copyr(); -extern int byte_diff(); -extern void byte_zero(); +extern unsigned int byte_chr(char *s,unsigned int n,int c); +//extern unsigned int byte_rchr(); // undefined upstream +extern void byte_copy(const char *to,size_t n,const char *from); +extern void byte_copyr(const char *to, size_t n,const char *from); +extern int byte_diff(char *s,unsigned int n,char *t); +extern void byte_zero(char *s,unsigned int n); #define byte_equal(s,n,t) (!byte_diff((s),(n),(t))) diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/byte_zero.c safecat-1.13/byte_zero.c --- safecat-1.13.orig/byte_zero.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/byte_zero.c 2024-11-30 08:41:13.881812727 -0800 @@ -1,8 +1,6 @@ #include "byte.h" -void byte_zero(s,n) -char *s; -register unsigned int n; +void byte_zero(char *s,unsigned int n) { for (;;) { if (!n) break; *s++ = 0; --n; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/env.h safecat-1.13/env.h --- safecat-1.13.orig/env.h 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/env.h 2024-11-28 22:35:25.538899068 -0800 @@ -7,10 +7,10 @@ extern int env_put(); extern int env_put2(); extern int env_unset(); -extern /*@null@*/char *env_get(); +extern /*@null@*/char *env_get(char *s); extern char *env_pick(); extern void env_clear(); -extern char *env_findeq(); +extern char *env_findeq(char *s); extern char **environ; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/envread.c safecat-1.13/envread.c --- safecat-1.13.orig/envread.c 2001-02-12 18:27:42.000000000 -0800 +++ safecat-1.13/envread.c 2024-11-30 08:41:20.838469904 -0800 @@ -1,8 +1,7 @@ #include "env.h" #include "str.h" -extern /*@null@*/char *env_get(s) -char *s; +extern /*@null@*/char *env_get(char *s) { int i; unsigned int slen; @@ -20,8 +19,7 @@ return environ[0]; } -extern char *env_findeq(s) -char *s; +extern char *env_findeq(char *s) { for (;*s;++s) if (*s == '=') diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/error_no.h2 safecat-1.13/error_no.h2 --- safecat-1.13.orig/error_no.h2 2003-10-07 13:02:57.000000000 -0700 +++ safecat-1.13/error_no.h2 2024-11-28 21:39:02.014007789 -0800 @@ -1 +1,2 @@ -extern int errno; +#include +//extern int errno; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/fmt.h safecat-1.13/fmt.h --- safecat-1.13.orig/fmt.h 2002-05-26 19:18:40.000000000 -0700 +++ safecat-1.13/fmt.h 2024-11-30 08:30:54.759320817 -0800 @@ -4,7 +4,9 @@ #define FMT_ULONG 40 /* enough space to hold 2^128 - 1 in decimal, plus \0 */ #define FMT_LEN ((char *) 0) /* convenient abbreviation */ -extern unsigned int fmt_uint64(); +#include "uint64.h" + +extern unsigned int fmt_uint64(char *s,uint64 u); extern unsigned int fmt_uint(); extern unsigned int fmt_uint0(); extern unsigned int fmt_xint(); diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/fmt_uint64.c safecat-1.13/fmt_uint64.c --- safecat-1.13.orig/fmt_uint64.c 2002-05-26 19:26:01.000000000 -0700 +++ safecat-1.13/fmt_uint64.c 2024-11-30 08:41:35.675116332 -0800 @@ -1,7 +1,7 @@ #include "fmt.h" #include "uint64.h" -unsigned int fmt_uint64(s,u) register char *s; register uint64 u; +unsigned int fmt_uint64(char *s, uint64 u) { register unsigned int len; register uint64 q; len = 1; q = u; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/gen_allocdefs.h safecat-1.13/gen_allocdefs.h --- safecat-1.13.orig/gen_allocdefs.h 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/gen_allocdefs.h 2024-11-30 08:22:03.570037592 -0800 @@ -1,8 +1,11 @@ #ifndef GEN_ALLOC_DEFS_H #define GEN_ALLOC_DEFS_H +#define GEN_ALLOC_PROTO_ready(ta,type,field,len,a,i,n,x,base,ta_ready) \ +int ta_ready(ta *x,unsigned int n) /* register ta *x; register unsigned int n;*/ + #define GEN_ALLOC_ready(ta,type,field,len,a,i,n,x,base,ta_ready) \ -int ta_ready(x,n) register ta *x; register unsigned int n; \ +GEN_ALLOC_PROTO_ready(ta,type,field,len,a,i,n,x,base,ta_ready) \ { register unsigned int i; \ if (x->field) { \ i = x->a; \ @@ -14,8 +17,11 @@ x->len = 0; \ return !!(x->field = (type *) alloc((x->a = n) * sizeof(type))); } +#define GEN_ALLOC_PROTO_readyplus(ta,type,field,len,a,i,n,x,base,ta_rplus) \ +int ta_rplus(ta *x,unsigned int n) /* register ta *x; register unsigned int n;*/ + #define GEN_ALLOC_readyplus(ta,type,field,len,a,i,n,x,base,ta_rplus) \ -int ta_rplus(x,n) register ta *x; register unsigned int n; \ +GEN_ALLOC_PROTO_readyplus(ta,type,field,len,a,i,n,x,base,ta_rplus) \ { register unsigned int i; \ if (x->field) { \ i = x->a; n += x->len; \ @@ -27,8 +33,11 @@ x->len = 0; \ return !!(x->field = (type *) alloc((x->a = n) * sizeof(type))); } +#define GEN_ALLOC_PROTO_append(ta,type,field,len,a,i,n,x,base,ta_rplus,ta_append) \ +int ta_append(ta *x,type *i) /* register ta *x; register type *i; */ + #define GEN_ALLOC_append(ta,type,field,len,a,i,n,x,base,ta_rplus,ta_append) \ -int ta_append(x,i) register ta *x; register type *i; \ +GEN_ALLOC_PROTO_append(ta,type,field,len,a,i,n,x,base,ta_rplus,ta_append) \ { if (!ta_rplus(x,1)) return 0; x->field[x->len++] = *i; return 1; } #endif diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/getln2.c safecat-1.13/getln2.c --- safecat-1.13.orig/getln2.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/getln2.c 2024-11-30 08:41:48.255099169 -0800 @@ -3,12 +3,7 @@ #include "byte.h" #include "getln.h" -int getln2(ss,sa,cont,clen,sep) -register substdio *ss; -register stralloc *sa; -/*@out@*/char **cont; -/*@out@*/unsigned int *clen; -int sep; +int getln2(substdio *ss,stralloc *sa,/*@out@*/char **cont,/*@out@*/unsigned int *clen, int sep) { register char *x; register unsigned int i; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/getln.c safecat-1.13/getln.c --- safecat-1.13.orig/getln.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/getln.c 2024-11-30 08:41:51.578427968 -0800 @@ -3,11 +3,7 @@ #include "stralloc.h" #include "getln.h" -int getln(ss,sa,match,sep) -register substdio *ss; -register stralloc *sa; -int *match; -int sep; +int getln(substdio *ss,stralloc *sa,int *match,int sep) { char *cont; unsigned int clen; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/getln.h safecat-1.13/getln.h --- safecat-1.13.orig/getln.h 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/getln.h 2024-11-30 07:59:54.905139582 -0800 @@ -1,7 +1,7 @@ #ifndef GETLN_H #define GETLN_H -extern int getln(); -extern int getln2(); +extern int getln(substdio *ss,stralloc *sa,int *match,int sep); +extern int getln2(substdio *ss,stralloc *sa,/*@out@*/char **cont,/*@out@*/unsigned int *clen, int sep); #endif diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/stralloc_arts.c safecat-1.13/stralloc_arts.c --- safecat-1.13.orig/stralloc_arts.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/stralloc_arts.c 2024-11-30 08:43:34.154970663 -0800 @@ -2,9 +2,7 @@ #include "str.h" #include "stralloc.h" -int stralloc_starts(sa,s) -stralloc *sa; -char *s; +int stralloc_starts(stralloc *sa,char *s) { int len; len = str_len(s); diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/stralloc_catb.c safecat-1.13/stralloc_catb.c --- safecat-1.13.orig/stralloc_catb.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/stralloc_catb.c 2024-11-30 08:43:37.268300315 -0800 @@ -1,10 +1,7 @@ #include "stralloc.h" #include "byte.h" -int stralloc_catb(sa,s,n) -stralloc *sa; -char *s; -unsigned int n; +int stralloc_catb(stralloc *sa,char *s,unsigned int n) { if (!sa->s) return stralloc_copyb(sa,s,n); if (!stralloc_readyplus(sa,n + 1)) return 0; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/stralloc_cat.c safecat-1.13/stralloc_cat.c --- safecat-1.13.orig/stralloc_cat.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/stralloc_cat.c 2024-11-30 08:43:49.128286299 -0800 @@ -1,9 +1,7 @@ #include "byte.h" #include "stralloc.h" -int stralloc_cat(sato,safrom) -stralloc *sato; -stralloc *safrom; +int stralloc_cat(stralloc *sato,stralloc *safrom) { return stralloc_catb(sato,safrom->s,safrom->len); } diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/stralloc_cats.c safecat-1.13/stralloc_cats.c --- safecat-1.13.orig/stralloc_cats.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/stralloc_cats.c 2024-11-30 08:43:50.974950781 -0800 @@ -2,9 +2,7 @@ #include "str.h" #include "stralloc.h" -int stralloc_cats(sa,s) -stralloc *sa; -char *s; +int stralloc_cats(stralloc *sa,char *s) { return stralloc_catb(sa,s,str_len(s)); } diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/stralloc_copy.c safecat-1.13/stralloc_copy.c --- safecat-1.13.orig/stralloc_copy.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/stralloc_copy.c 2024-11-30 08:43:53.418281226 -0800 @@ -1,9 +1,7 @@ #include "byte.h" #include "stralloc.h" -int stralloc_copy(sato,safrom) -stralloc *sato; -stralloc *safrom; +int stralloc_copy(stralloc *sato,stralloc *safrom) { return stralloc_copyb(sato,safrom->s,safrom->len); } diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/stralloc.h safecat-1.13/stralloc.h --- safecat-1.13.orig/stralloc.h 2024-11-28 13:53:10.703141456 -0800 +++ safecat-1.13/stralloc.h 2024-11-30 08:34:46.582339808 -0800 @@ -5,21 +5,21 @@ GEN_ALLOC_typedef(stralloc,char,s,len,a) -extern int stralloc_ready(); -extern int stralloc_readyplus(); +extern int stralloc_ready(stralloc* x, unsigned int n); +extern int stralloc_readyplus(stralloc* x, unsigned int n); extern int stralloc_copy(stralloc *sato, stralloc *safrom); extern int stralloc_cat(stralloc *sato, stralloc *safrom); -extern int stralloc_copys(); +extern int stralloc_copys(stralloc *sa,char *s); extern int stralloc_cats(stralloc *sa, char *s); extern int stralloc_copyb(stralloc *sa, char *s, unsigned int n); extern int stralloc_catb(stralloc *sa, char *s, unsigned int n); -extern int stralloc_append(); /* beware: this takes a pointer to 1 char */ +extern int stralloc_append(stralloc *x, char *i); /* beware: this takes a pointer to 1 char */ extern int stralloc_starts(stralloc *sa, char *s); #define stralloc_0(sa) stralloc_append(sa,"") -extern int stralloc_catulong0(); -extern int stralloc_catlong0(); +extern int stralloc_catulong0(stralloc *sa,unsigned long u,unsigned int n); +extern int stralloc_catlong0(stralloc *sa,long l,unsigned int n); #define stralloc_catlong(sa,l) (stralloc_catlong0((sa),(l),0)) #define stralloc_catuint0(sa,i,n) (stralloc_catulong0((sa),(unsigned long) (i),(n))) diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/stralloc_num.c safecat-1.13/stralloc_num.c --- safecat-1.13.orig/stralloc_num.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/stralloc_num.c 2024-11-30 08:44:10.661594167 -0800 @@ -1,9 +1,6 @@ #include "stralloc.h" -int stralloc_catulong0(sa,u,n) -stralloc *sa; -unsigned long u; -unsigned int n; +int stralloc_catulong0(stralloc *sa,unsigned long u,unsigned int n) { unsigned int len; unsigned long q; @@ -22,10 +19,7 @@ return 1; } -int stralloc_catlong0(sa,l,n) -stralloc *sa; -long l; -unsigned int n; +int stralloc_catlong0(stralloc *sa,long l,unsigned int n) { if (l < 0) { if (!stralloc_append(sa,"-")) return 0; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/stralloc_opyb.c safecat-1.13/stralloc_opyb.c --- safecat-1.13.orig/stralloc_opyb.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/stralloc_opyb.c 2024-11-30 08:44:14.728256021 -0800 @@ -1,10 +1,7 @@ #include "stralloc.h" #include "byte.h" -int stralloc_copyb(sa,s,n) -stralloc *sa; -char *s; -unsigned int n; +int stralloc_copyb(stralloc *sa,char *s,unsigned int n) { if (!stralloc_ready(sa,n + 1)) return 0; byte_copy(sa->s,n,s); diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/stralloc_opys.c safecat-1.13/stralloc_opys.c --- safecat-1.13.orig/stralloc_opys.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/stralloc_opys.c 2024-11-30 08:44:17.538252696 -0800 @@ -2,9 +2,7 @@ #include "str.h" #include "stralloc.h" -int stralloc_copys(sa,s) -stralloc *sa; -char *s; +int stralloc_copys(stralloc *sa,char *s) { return stralloc_copyb(sa,s,str_len(s)); } diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/str_diffn.c safecat-1.13/str_diffn.c --- safecat-1.13.orig/str_diffn.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/str_diffn.c 2024-11-30 08:44:25.174910325 -0800 @@ -1,9 +1,6 @@ #include "str.h" -int str_diffn(s,t,len) -register char *s; -register char *t; -unsigned int len; +int str_diffn(char *s,char *t,unsigned int len) { register char x; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/strerr_die.c safecat-1.13/strerr_die.c --- safecat-1.13.orig/strerr_die.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/strerr_die.c 2024-11-30 08:44:34.588232518 -0800 @@ -3,9 +3,7 @@ #include "exit.h" #include "strerr.h" -void strerr_warn(x1,x2,x3,x4,x5,x6,se) -char *x1; char *x2; char *x3; char *x4; char *x5; char *x6; -struct strerr *se; +void strerr_warn(char *x1,char *x2,char *x3,char *x4,char *x5,char *x6,struct strerr *se) { strerr_sysinit(); @@ -27,10 +25,7 @@ substdio_flush(subfderr); } -void strerr_die(e,x1,x2,x3,x4,x5,x6,se) -int e; -char *x1; char *x2; char *x3; char *x4; char *x5; char *x6; -struct strerr *se; +void strerr_die(int e, char *x1,char *x2,char *x3,char *x4,char *x5,char *x6,struct strerr *se) { strerr_warn(x1,x2,x3,x4,x5,x6,se); _exit(e); diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/strerr.h safecat-1.13/strerr.h --- safecat-1.13.orig/strerr.h 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/strerr.h 2024-11-30 08:08:40.987776379 -0800 @@ -14,8 +14,8 @@ extern void strerr_sysinit(); extern char *strerr(); -extern void strerr_warn(); -extern void strerr_die(); +extern void strerr_warn(char *x1,char *x2,char *x3,char *x4,char *x5,char *x6,struct strerr *se); +extern void strerr_die(int e, char *x1,char *x2,char *x3,char *x4,char *x5,char *x6,struct strerr *se); #define STRERR(r,se,a) \ { se.who = 0; se.x = a; se.y = 0; se.z = 0; return r; } diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/subfderr.c safecat-1.13/subfderr.c --- safecat-1.13.orig/subfderr.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/subfderr.c 2024-11-28 13:56:49.699671736 -0800 @@ -3,5 +3,5 @@ #include "subfd.h" char subfd_errbuf[256]; -static substdio it = SUBSTDIO_FDBUF(write,2,subfd_errbuf,256); +static substdio it = SUBSTDIO_FDBUF(write,2,subfd_errbuf,(size_t)(256)); substdio *subfderr = ⁢ diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/subfd.h safecat-1.13/subfd.h --- safecat-1.13.orig/subfd.h 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/subfd.h 2024-11-28 21:08:01.088260229 -0800 @@ -2,6 +2,7 @@ #define SUBFD_H #include "substdio.h" +#include extern substdio *subfdin; extern substdio *subfdinsmall; @@ -9,7 +10,7 @@ extern substdio *subfdoutsmall; extern substdio *subfderr; -extern int subfd_read(); -extern int subfd_readsmall(); +extern ssize_t subfd_read(int fd, const void *buf, size_t len); +extern ssize_t subfd_readsmall(int fd, const void *buf, size_t len); #endif diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/subfdin.c safecat-1.13/subfdin.c --- safecat-1.13.orig/subfdin.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/subfdin.c 2024-11-28 21:08:01.088260229 -0800 @@ -2,12 +2,14 @@ #include "substdio.h" #include "subfd.h" -int subfd_read(fd,buf,len) int fd; char *buf; int len; +#include + +ssize_t subfd_read(int fd, const void *buf, size_t len) { if (substdio_flush(subfdout) == -1) return -1; return read(fd,buf,len); } char subfd_inbuf[SUBSTDIO_INSIZE]; -static substdio it = SUBSTDIO_FDBUF(subfd_read,0,subfd_inbuf,SUBSTDIO_INSIZE); +static substdio it = SUBSTDIO_FDBUF(subfd_read,0,subfd_inbuf,(size_t)(SUBSTDIO_INSIZE)); substdio *subfdin = ⁢ diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/subfdins.c safecat-1.13/subfdins.c --- safecat-1.13.orig/subfdins.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/subfdins.c 2024-11-28 21:08:43.378240952 -0800 @@ -1,8 +1,9 @@ #include "readwrite.h" #include "substdio.h" #include "subfd.h" +#include -int subfd_readsmall(fd,buf,len) int fd; char *buf; int len; +ssize_t subfd_readsmall(int fd, const void *buf, size_t len) { if (substdio_flush(subfdoutsmall) == -1) return -1; return read(fd,buf,len); diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/subfdouts.c safecat-1.13/subfdouts.c --- safecat-1.13.orig/subfdouts.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/subfdouts.c 2024-11-28 13:56:19.939682790 -0800 @@ -3,5 +3,5 @@ #include "subfd.h" char subfd_outbufsmall[256]; -static substdio it = SUBSTDIO_FDBUF(write,1,subfd_outbufsmall,256); +static substdio it = SUBSTDIO_FDBUF(write,1,subfd_outbufsmall,(size_t)(256)); substdio *subfdoutsmall = ⁢ diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/substdi.c safecat-1.13/substdi.c --- safecat-1.13.orig/substdi.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/substdi.c 2024-11-30 08:45:07.108194010 -0800 @@ -2,11 +2,7 @@ #include "byte.h" #include "error.h" -static int oneread(op,fd,buf,len) -register int (*op)(); -register int fd; -register char *buf; -register int len; +static int oneread(substdio_op op,int fd,const void* buf,size_t len) { register int r; @@ -17,10 +13,7 @@ } } -static int getthis(s,buf,len) -register substdio *s; -register char *buf; -register int len; +static int getthis(substdio *s,const void *buf, size_t len) { register int r; register int q; @@ -28,13 +21,12 @@ r = s->p; q = r - len; if (q > 0) { r = len; s->p = q; } else s->p = 0; - byte_copy(buf,r,s->x + s->n); + byte_copy(buf,r,(const void*)(s->x + s->n)); s->n += r; return r; } -int substdio_feed(s) -register substdio *s; +int substdio_feed(substdio *s) { register int r; register int q; @@ -50,10 +42,7 @@ return r; } -int substdio_bget(s,buf,len) -register substdio *s; -register char *buf; -register int len; +int substdio_bget(substdio *s,const void *buf, size_t len) { register int r; @@ -63,10 +52,7 @@ return getthis(s,buf,len); } -int substdio_get(s,buf,len) -register substdio *s; -register char *buf; -register int len; +int substdio_get(substdio *s,const void *buf,size_t len) { register int r; @@ -76,15 +62,12 @@ return getthis(s,buf,len); } -char *substdio_peek(s) -register substdio *s; +const void* substdio_peek(substdio *s) { - return s->x + s->n; + return (s->x + s->n); } -void substdio_seek(s,len) -register substdio *s; -register int len; +void substdio_seek(substdio *s,size_t len) { s->n += len; s->p -= len; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/substdio.c safecat-1.13/substdio.c --- safecat-1.13.orig/substdio.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/substdio.c 2024-11-30 08:45:18.781513505 -0800 @@ -1,11 +1,6 @@ #include "substdio.h" -void substdio_fdbuf(s,op,fd,buf,len) -register substdio *s; -register int (*op)(); -register int fd; -register char *buf; -register int len; +void substdio_fdbuf(substdio *s, substdio_op op, int fd, const void *buf, size_t len) { s->x = buf; s->fd = fd; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/substdio_copy.c safecat-1.13/substdio_copy.c --- safecat-1.13.orig/substdio_copy.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/substdio_copy.c 2024-11-30 08:45:21.271510552 -0800 @@ -1,8 +1,6 @@ #include "substdio.h" -int substdio_copy(ssout,ssin) -register substdio *ssout; -register substdio *ssin; +int substdio_copy(substdio *ssout,substdio *ssin) { register int n; register char *x; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/substdio.h safecat-1.13/substdio.h --- safecat-1.13.orig/substdio.h 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/substdio.h 2024-11-30 08:05:35.511355835 -0800 @@ -1,32 +1,36 @@ #ifndef SUBSTDIO_H #define SUBSTDIO_H +#include + +typedef ssize_t (*substdio_op)(int, const void *, size_t); + typedef struct substdio { - char *x; + const void *x; int p; int n; int fd; - int (*op)(); + substdio_op op; } substdio; -#define SUBSTDIO_FDBUF(op,fd,buf,len) { (buf), 0, (len), (fd), (op) } +#define SUBSTDIO_FDBUF(op,fd,buf,len) { (buf), 0, (size_t)(len), (fd), (op) } -extern void substdio_fdbuf(); +extern void substdio_fdbuf(substdio *s,substdio_op op,int fd,const void *buf,size_t len); -extern int substdio_flush(); -extern int substdio_put(); -extern int substdio_bput(); -extern int substdio_putflush(); -extern int substdio_puts(); -extern int substdio_bputs(); -extern int substdio_putsflush(); - -extern int substdio_get(); -extern int substdio_bget(); -extern int substdio_feed(); +extern int substdio_flush(substdio *s); +extern int substdio_put(substdio *s,const void *buf,size_t len); +extern int substdio_bput(substdio *s,const void *buf,size_t len); +extern int substdio_putflush(substdio *s, const void *buf, size_t len); +extern int substdio_puts(substdio *s,const void *buf); +extern int substdio_bputs(substdio *s,const void *buf); +extern int substdio_putsflush(substdio *s,const void *buf); + +extern int substdio_get(substdio *s,const void *buf,size_t len); +extern int substdio_bget(substdio *s,const void *buf, size_t len); +extern int substdio_feed(substdio *s); -extern char *substdio_peek(); -extern void substdio_seek(); +extern const void *substdio_peek(substdio *s); +extern void substdio_seek(substdio *s,size_t len); #define substdio_fileno(s) ((s)->fd) @@ -42,6 +46,6 @@ : substdio_bput((s),&(c),1) \ ) -extern int substdio_copy(); +extern int substdio_copy(substdio *ssout,substdio *ssin); #endif diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/substdo.c safecat-1.13/substdo.c --- safecat-1.13.orig/substdo.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/substdo.c 2024-11-30 08:45:41.634819742 -0800 @@ -3,11 +3,7 @@ #include "byte.h" #include "error.h" -static int allwrite(op,fd,buf,len) -register int (*op)(); -register int fd; -register char *buf; -register int len; +static int allwrite(substdio_op op,int fd,const void *buf,size_t len) { register int w; @@ -17,15 +13,14 @@ if (errno == error_intr) continue; return -1; /* note that some data may have been written */ } - if (w == 0) ; /* luser's fault */ + if (w == 0) {}; /* luser's fault */ buf += w; len -= w; } return 0; } -int substdio_flush(s) -register substdio *s; +int substdio_flush(substdio *s) { register int p; @@ -35,10 +30,7 @@ return allwrite(s->op,s->fd,s->x,p); } -int substdio_bput(s,buf,len) -register substdio *s; -register char *buf; -register int len; +int substdio_bput(substdio *s,const void *buf,size_t len) { register int n; @@ -52,10 +44,7 @@ return 0; } -int substdio_put(s,buf,len) -register substdio *s; -register char *buf; -register int len; +int substdio_put(substdio *s,const void *buf,size_t len) { register int n; @@ -77,32 +66,23 @@ return 0; } -int substdio_putflush(s,buf,len) -register substdio *s; -register char *buf; -register int len; +int substdio_putflush(substdio *s, const void *buf, size_t len) { if (substdio_flush(s) == -1) return -1; return allwrite(s->op,s->fd,buf,len); } -int substdio_bputs(s,buf) -register substdio *s; -register char *buf; +int substdio_bputs(substdio *s,const void *buf) { return substdio_bput(s,buf,str_len(buf)); } -int substdio_puts(s,buf) -register substdio *s; -register char *buf; +int substdio_puts(substdio *s,const void *buf) { return substdio_put(s,buf,str_len(buf)); } -int substdio_putsflush(s,buf) -register substdio *s; -register char *buf; +int substdio_putsflush(substdio *s,const void *buf) { return substdio_putflush(s,buf,str_len(buf)); } diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/taia_fmtfrac.c safecat-1.13/taia_fmtfrac.c --- safecat-1.13.orig/taia_fmtfrac.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/taia_fmtfrac.c 2024-11-30 08:45:47.924812274 -0800 @@ -1,8 +1,6 @@ #include "taia.h" -unsigned int taia_fmtfrac(s,t) -char *s; -struct taia *t; +unsigned int taia_fmtfrac(char *s,struct taia *t) { unsigned long x; diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/taia.h safecat-1.13/taia.h --- safecat-1.13.orig/taia.h 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/taia.h 2024-11-30 08:29:28.912770325 -0800 @@ -9,9 +9,9 @@ unsigned long atto; /* 0...999999999 */ } ; -extern void taia_tai(); +extern void taia_tai(struct taia *ta,struct tai *t); -extern void taia_now(); +extern void taia_now(struct taia *t); extern double taia_approx(); extern double taia_frac(); @@ -26,6 +26,6 @@ extern void taia_unpack(); #define TAIA_FMTFRAC 19 -extern unsigned int taia_fmtfrac(); +extern unsigned int taia_fmtfrac(char *s,struct taia *t); #endif diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/taia_now.c safecat-1.13/taia_now.c --- safecat-1.13.orig/taia_now.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/taia_now.c 2024-11-30 08:45:50.588142448 -0800 @@ -4,8 +4,7 @@ /* XXX: breaks tai encapsulation */ -void taia_now(t) -struct taia *t; +void taia_now(struct taia *t) { struct timeval now; gettimeofday(&now,(struct timezone *) 0); diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/taia_tai.c safecat-1.13/taia_tai.c --- safecat-1.13.orig/taia_tai.c 2000-02-28 20:10:12.000000000 -0800 +++ safecat-1.13/taia_tai.c 2024-11-30 08:45:52.531473476 -0800 @@ -1,8 +1,6 @@ #include "taia.h" -void taia_tai(ta,t) -struct taia *ta; -struct tai *t; +void taia_tai(struct taia *ta,struct tai *t) { *t = ta->sec; } diff '--color=auto' -Nuar --exclude-from safecat-1.13/TARGETS --exclude conf-ar --exclude conf-cc --exclude conf-ld --exclude conf-root safecat-1.13.orig/writefile.c safecat-1.13/writefile.c --- safecat-1.13.orig/writefile.c 2001-02-12 19:01:09.000000000 -0800 +++ safecat-1.13/writefile.c 2024-11-30 08:46:11.968117064 -0800 @@ -20,8 +20,8 @@ substdio ssout; /* Prepare substdio buffers for reading and writing. */ - substdio_fdbuf(&ssin,read,0,inbuf,sizeof(inbuf)); - substdio_fdbuf(&ssout,write,fd,outbuf,sizeof(outbuf)); + substdio_fdbuf(&ssin,(substdio_op)read,0,inbuf,sizeof(inbuf)); + substdio_fdbuf(&ssout,(substdio_op)write,fd,outbuf,sizeof(outbuf)); /* Print DTLINE and RPLINE, if supplied. */ dtline = env_get("DTLINE");