diff -Naur cdb-0.75-orig/alloc.c cdb-0.75/alloc.c --- cdb-0.75-orig/alloc.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/alloc.c 2024-01-29 18:02:17.255282366 +0300 @@ -1,6 +1,6 @@ +#include #include "alloc.h" #include "error.h" -extern char *malloc(); extern void free(); #define ALIGNMENT 16 /* XXX: assuming that this alignment is enough */ diff -Naur cdb-0.75-orig/auto_home.c cdb-0.75/auto_home.c --- cdb-0.75-orig/auto_home.c 1970-01-01 03:00:00.000000000 +0300 +++ cdb-0.75/auto_home.c 2024-01-29 18:20:40.024793094 +0300 @@ -0,0 +1,3 @@ +char auto_home[] = "\ +\057\165\163\162\ +"; diff -Naur cdb-0.75-orig/auto-str.c cdb-0.75/auto-str.c --- cdb-0.75-orig/auto-str.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/auto-str.c 2024-01-29 18:20:39.008136111 +0300 @@ -1,17 +1,17 @@ +#include #include "buffer.h" -#include "readwrite.h" #include "exit.h" char buf1[256]; buffer ss1 = BUFFER_INIT(write,1,buf1,sizeof(buf1)); -void puts(s) +void puts_djb(s) char *s; { if (buffer_puts(&ss1,s) == -1) _exit(111); } -main(argc,argv) +void main(argc,argv) int argc; char **argv; { @@ -25,20 +25,20 @@ value = argv[2]; if (!value) _exit(100); - puts("char "); - puts(name); - puts("[] = \"\\\n"); + puts_djb("char "); + puts_djb(name); + puts_djb("[] = \"\\\n"); while (ch = *value++) { - puts("\\"); + puts_djb("\\"); octal[3] = 0; octal[2] = '0' + (ch & 7); ch >>= 3; octal[1] = '0' + (ch & 7); ch >>= 3; octal[0] = '0' + (ch & 7); - puts(octal); + puts_djb(octal); } - puts("\\\n\";\n"); + puts_djb("\\\n\";\n"); if (buffer_flush(&ss1) == -1) _exit(111); _exit(0); } diff -Naur cdb-0.75-orig/buffer_0.c cdb-0.75/buffer_0.c --- cdb-0.75-orig/buffer_0.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/buffer_0.c 2024-01-29 18:20:12.538388318 +0300 @@ -1,4 +1,3 @@ -#include "readwrite.h" #include "buffer.h" int buffer_0_read(fd,buf,len) int fd; char *buf; int len; diff -Naur cdb-0.75-orig/buffer_1.c cdb-0.75/buffer_1.c --- cdb-0.75-orig/buffer_1.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/buffer_1.c 2024-01-29 18:19:57.141868341 +0300 @@ -1,4 +1,3 @@ -#include "readwrite.h" #include "buffer.h" char buffer_1_space[BUFFER_OUTSIZE]; diff -Naur cdb-0.75-orig/buffer_1s.c cdb-0.75/buffer_1s.c --- cdb-0.75-orig/buffer_1s.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/buffer_1s.c 2024-01-29 18:20:20.941641588 +0300 @@ -1,4 +1,3 @@ -#include "readwrite.h" #include "buffer.h" char buffer_1small_space[256]; diff -Naur cdb-0.75-orig/buffer_2.c cdb-0.75/buffer_2.c --- cdb-0.75-orig/buffer_2.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/buffer_2.c 2024-01-29 18:19:43.355333023 +0300 @@ -1,4 +1,3 @@ -#include "readwrite.h" #include "buffer.h" char buffer_2_space[256]; diff -Naur cdb-0.75-orig/buffer.c cdb-0.75/buffer.c --- cdb-0.75-orig/buffer.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/buffer.c 2024-01-29 17:35:39.497062737 +0300 @@ -1,6 +1,6 @@ #include "buffer.h" -void buffer_init(buffer *s,int (*op)(),int fd,char *buf,unsigned int len) +void buffer_init(buffer *s,ssize_t (*op)(),int fd,char *buf,unsigned int len) { s->x = buf; s->fd = fd; diff -Naur cdb-0.75-orig/buffer_get.c cdb-0.75/buffer_get.c --- cdb-0.75-orig/buffer_get.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/buffer_get.c 2024-01-29 17:39:07.078425236 +0300 @@ -2,9 +2,9 @@ #include "byte.h" #include "error.h" -static int oneread(int (*op)(),int fd,char *buf,unsigned int len) +static int oneread(long int (*op)(),int fd,char *buf,unsigned int len) { - int r; + long int r; for (;;) { r = op(fd,buf,len); diff -Naur cdb-0.75-orig/buffer.h cdb-0.75/buffer.h --- cdb-0.75-orig/buffer.h 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/buffer.h 2024-01-29 18:00:22.499697768 +0300 @@ -1,19 +1,21 @@ #ifndef BUFFER_H #define BUFFER_H +#include + typedef struct buffer { char *x; unsigned int p; unsigned int n; int fd; - int (*op)(); + ssize_t (*op)(); } buffer; -#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) } +#define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (long(*)())(op) } #define BUFFER_INSIZE 8192 #define BUFFER_OUTSIZE 8192 -extern void buffer_init(buffer *,int (*)(),int,char *,unsigned int); +extern void buffer_init(buffer *,ssize_t (*)(),int,char *,unsigned int); extern int buffer_flush(buffer *); extern int buffer_put(buffer *,char *,unsigned int); diff -Naur cdb-0.75-orig/buffer_put.c cdb-0.75/buffer_put.c --- cdb-0.75-orig/buffer_put.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/buffer_put.c 2024-01-29 17:38:33.422078109 +0300 @@ -3,9 +3,9 @@ #include "byte.h" #include "error.h" -static int allwrite(int (*op)(),int fd,char *buf,unsigned int len) +static int allwrite(long int (*op)(),int fd,char *buf,unsigned int len) { - int w; + long int w; while (len) { w = op(fd,buf,len); diff -Naur cdb-0.75-orig/cdb.c cdb-0.75/cdb.c --- cdb-0.75-orig/cdb.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/cdb.c 2024-01-29 18:19:26.512160170 +0300 @@ -3,7 +3,6 @@ #include #include #include -#include "readwrite.h" #include "error.h" #include "seek.h" #include "byte.h" diff -Naur cdb-0.75-orig/cdbdump.c cdb-0.75/cdbdump.c --- cdb-0.75-orig/cdbdump.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/cdbdump.c 2024-01-29 18:02:30.278492897 +0300 @@ -58,7 +58,7 @@ char strnum[FMT_ULONG]; -main() +void main() { uint32_t eod; uint32_t klen; diff -Naur cdb-0.75-orig/cdbget.c cdb-0.75/cdbget.c --- cdb-0.75-orig/cdbget.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/cdbget.c 2024-01-29 17:32:02.852452955 +0300 @@ -23,7 +23,7 @@ static struct cdb c; char buf[1024]; -main(int argc,char **argv) +void main(int argc,char **argv) { char *key; int r; diff -Naur cdb-0.75-orig/cdb.h cdb-0.75/cdb.h --- cdb-0.75-orig/cdb.h 2024-01-29 16:35:41.446888088 +0300 +++ cdb-0.75/cdb.h 2024-01-29 17:32:49.595342506 +0300 @@ -3,6 +3,7 @@ #ifndef CDB_H #define CDB_H +#include #include "uint32.h" #define CDB_HASHSTART 5381 diff -Naur cdb-0.75-orig/cdb_make.c cdb-0.75/cdb_make.c --- cdb-0.75-orig/cdb_make.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/cdb_make.c 2024-01-29 18:19:35.382075657 +0300 @@ -1,6 +1,5 @@ /* Public domain. */ -#include "readwrite.h" #include "seek.h" #include "error.h" #include "alloc.h" diff -Naur cdb-0.75-orig/cdbmake.c cdb-0.75/cdbmake.c --- cdb-0.75-orig/cdbmake.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/cdbmake.c 2024-01-29 18:01:01.169333137 +0300 @@ -36,7 +36,7 @@ static struct cdb_make c; -main(int argc,char **argv) +void main(int argc,char **argv) { unsigned int klen; unsigned int dlen; diff -Naur cdb-0.75-orig/cdb_make.h cdb-0.75/cdb_make.h --- cdb-0.75-orig/cdb_make.h 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/cdb_make.h 2024-01-29 18:01:31.469047433 +0300 @@ -3,6 +3,7 @@ #ifndef CDB_MAKE_H #define CDB_MAKE_H +#include #include "buffer.h" #include "uint32.h" diff -Naur cdb-0.75-orig/cdbstats.c cdb-0.75/cdbstats.c --- cdb-0.75-orig/cdbstats.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/cdbstats.c 2024-01-29 18:02:56.978241147 +0300 @@ -3,6 +3,7 @@ #include "buffer.h" #include "strerr.h" #include "seek.h" +#include "str.h" #include "cdb.h" #define FATAL "cdbstats: fatal: " @@ -68,7 +69,7 @@ static unsigned long numrecords; static unsigned long numd[11]; -main() +void main() { uint32_t eod; uint32_t klen; diff -Naur cdb-0.75-orig/cdbtest.c cdb-0.75/cdbtest.c --- cdb-0.75-orig/cdbtest.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/cdbtest.c 2024-01-29 18:03:33.524563199 +0300 @@ -3,6 +3,7 @@ #include "buffer.h" #include "strerr.h" #include "seek.h" +#include "str.h" #include "cdb.h" #define FATAL "cdbtest: fatal: " @@ -66,7 +67,7 @@ static struct cdb c; -main() +void main() { uint32_t eod; uint32_t klen; diff -Naur cdb-0.75-orig/FILES cdb-0.75/FILES --- cdb-0.75-orig/FILES 2024-01-29 16:35:41.446888088 +0300 +++ cdb-0.75/FILES 2024-01-29 18:22:00.367360964 +0300 @@ -55,12 +55,12 @@ fmt.h fmt_ulong.c hier.c +hier.h install.c instcheck.c open.h open_read.c open_trunc.c -readwrite.h scan.h scan_ulong.c seek.h diff -Naur cdb-0.75-orig/hier.c cdb-0.75/hier.c --- cdb-0.75-orig/hier.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/hier.c 2024-01-29 18:06:26.052929530 +0300 @@ -1,4 +1,5 @@ #include "auto_home.h" +#include "hier.h" void hier() { diff -Naur cdb-0.75-orig/hier.h cdb-0.75/hier.h --- cdb-0.75-orig/hier.h 1970-01-01 03:00:00.000000000 +0300 +++ cdb-0.75/hier.h 2024-01-29 18:11:07.070252037 +0300 @@ -0,0 +1,8 @@ +#ifndef HIER_H +#define HIER_H + +void h(char *home,int uid,int gid,int mode); +void d(char *home,char *subdir,int uid,int gid,int mode); +void c(char *home,char *subdir,char *file,int uid,int gid,int mode); + +#endif diff -Naur cdb-0.75-orig/install.c cdb-0.75/install.c --- cdb-0.75-orig/install.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/install.c 2024-01-29 18:20:30.548216721 +0300 @@ -1,8 +1,8 @@ +#include #include "buffer.h" #include "strerr.h" #include "error.h" #include "open.h" -#include "readwrite.h" #include "exit.h" extern void hier(); @@ -137,7 +137,7 @@ strerr_die6sys(111,FATAL,"unable to chmod .../",subdir,"/",file,": "); } -main() +void main() { fdsourcedir = open_read("."); if (fdsourcedir == -1) diff -Naur cdb-0.75-orig/instcheck.c cdb-0.75/instcheck.c --- cdb-0.75-orig/instcheck.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/instcheck.c 2024-01-29 18:20:46.688062938 +0300 @@ -1,8 +1,8 @@ #include #include +#include #include "strerr.h" #include "error.h" -#include "readwrite.h" #include "exit.h" extern void hier(); @@ -101,7 +101,7 @@ perm("",home,"/",file,S_IFREG,uid,gid,mode); } -main() +void main() { hier(); _exit(0); diff -Naur cdb-0.75-orig/Makefile cdb-0.75/Makefile --- cdb-0.75-orig/Makefile 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/Makefile 2024-01-29 18:22:13.737233570 +0300 @@ -17,7 +17,7 @@ ./load auto-str buffer.a unix.a byte.a auto-str.o: \ -compile auto-str.c buffer.h readwrite.h exit.h +compile auto-str.c buffer.h exit.h ./compile auto-str.c auto_home.c: \ @@ -40,19 +40,19 @@ ./compile buffer.c buffer_0.o: \ -compile buffer_0.c readwrite.h buffer.h +compile buffer_0.c buffer.h ./compile buffer_0.c buffer_1.o: \ -compile buffer_1.c readwrite.h buffer.h +compile buffer_1.c buffer.h ./compile buffer_1.c buffer_1s.o: \ -compile buffer_1s.c readwrite.h buffer.h +compile buffer_1s.c buffer.h ./compile buffer_1s.c buffer_2.o: \ -compile buffer_2.c readwrite.h buffer.h +compile buffer_2.c buffer.h ./compile buffer_2.c buffer_copy.o: \ @@ -91,7 +91,7 @@ ./makelib cdb.a cdb.o cdb_hash.o cdb_make.o cdb.o: \ -compile cdb.c readwrite.h error.h seek.h byte.h cdb.h uint32.h +compile cdb.c error.h seek.h byte.h cdb.h uint32.h ./compile cdb.c cdb_hash.o: \ @@ -99,7 +99,7 @@ ./compile cdb_hash.c cdb_make.o: \ -compile cdb_make.c readwrite.h seek.h error.h alloc.h cdb.h uint32.h \ +compile cdb_make.c seek.h error.h alloc.h cdb.h uint32.h \ cdb_make.h buffer.h uint32.h ./compile cdb_make.c @@ -184,7 +184,7 @@ ./compile fmt_ulong.c hier.o: \ -compile hier.c auto_home.h +compile hier.c hier.h auto_home.h ./compile hier.c install: \ @@ -192,7 +192,7 @@ ./load install hier.o auto_home.o buffer.a unix.a byte.a install.o: \ -compile install.c buffer.h strerr.h error.h open.h readwrite.h exit.h +compile install.c buffer.h strerr.h error.h open.h exit.h ./compile install.c instcheck: \ @@ -200,7 +200,7 @@ ./load instcheck hier.o auto_home.o buffer.a unix.a byte.a instcheck.o: \ -compile instcheck.c strerr.h error.h readwrite.h exit.h +compile instcheck.c strerr.h error.h exit.h ./compile instcheck.c it: \ diff -Naur cdb-0.75-orig/makelib cdb-0.75/makelib --- cdb-0.75-orig/makelib 1970-01-01 03:00:00.000000000 +0300 +++ cdb-0.75/makelib 2024-01-29 17:32:19.615627143 +0300 @@ -0,0 +1,6 @@ +#!/bin/sh +# WARNING: This file was auto-generated. Do not edit! +main="$1"; shift +rm -f "$main" +x86_64-pc-linux-gnu-ar cr "$main" ${1+"$@"} +x86_64-pc-linux-gnu-ranlib "$main" diff -Naur cdb-0.75-orig/readwrite.h cdb-0.75/readwrite.h --- cdb-0.75-orig/readwrite.h 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/readwrite.h 1970-01-01 03:00:00.000000000 +0300 @@ -1,7 +0,0 @@ -#ifndef READWRITE_H -#define READWRITE_H - -extern int read(); -extern int write(); - -#endif diff -Naur cdb-0.75-orig/seek.h cdb-0.75/seek.h --- cdb-0.75-orig/seek.h 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/seek.h 2024-01-29 18:00:47.309463827 +0300 @@ -1,6 +1,8 @@ #ifndef SEEK_H #define SEEK_H +#include + typedef unsigned long seek_pos; extern seek_pos seek_cur(int); diff -Naur cdb-0.75-orig/testzero.c cdb-0.75/testzero.c --- cdb-0.75-orig/testzero.c 2024-01-29 16:35:41.450221354 +0300 +++ cdb-0.75/testzero.c 2024-01-29 18:04:02.340958141 +0300 @@ -14,7 +14,7 @@ static char data[65536]; struct cdb_make c; -main(int argc,char **argv) +void main(int argc,char **argv) { int fd; unsigned long loop;