Since clang16 implicit function declarations and implicit integers
result in a compilation error.

Bug: https://bugs.gentoo.org/882307 
Patch has been sent upstream via mail

Pascal Jäger <pascal.jaeger@leimstift.de> (2023-10-03)

--- a/clockspeed.c
+++ b/clockspeed.c
@@ -1,6 +1,7 @@
+#include <stdio.h>
+#include <sys/stat.h>
 #include <sys/types.h>
 #include <sys/time.h>
-#include "readwrite.h"
 #include "exit.h"
 #include "select.h"
 #include "scan.h"
@@ -11,11 +12,12 @@
 #include "error.h"
 #include "auto_home.h"
 #include "timing.h"
+#include "unistd.h"
 
 #ifndef HASRDTSC
 #ifndef HASGETHRTIME
 
-  Error! Need an unadjusted hardware clock.
+#error Need an unadjusted hardware clock.
 
 #endif
 #endif
--- a/clockview.c
+++ b/clockview.c
@@ -1,3 +1,4 @@
+#include <sys/time.h>
 #include <sys/types.h>
 #include <time.h>
 #include "substdio.h"
--- a/hier.c
+++ b/hier.c
@@ -1,5 +1,24 @@
 #include "auto_home.h"
 
+extern void h(char *home,
+int uid,
+int gid,
+int mode);
+
+extern void d(char *home,
+char *subdir,
+int uid,
+int gid,
+int mode);
+
+extern void c(
+char *home,
+char *subdir,
+char *file,
+int uid,
+int gid,
+int mode);
+
 void hier()
 {
   d("/var/lib","clockspeed",-1,-1,0755);
--- a/install.c
+++ b/install.c
@@ -2,8 +2,9 @@
 #include "strerr.h"
 #include "error.h"
 #include "open.h"
-#include "readwrite.h"
 #include "exit.h"
+#include <sys/stat.h>
+#include <unistd.h>
 
 extern void hier();
 
--- a/instcheck.c
+++ b/instcheck.c
@@ -2,8 +2,9 @@
 #include <sys/stat.h>
 #include "strerr.h"
 #include "error.h"
-#include "readwrite.h"
 #include "exit.h"
+#include <sys/stat.h>
+#include <unistd.h>
 
 extern void hier();
 
--- a/leapsecs_read.c
+++ b/leapsecs_read.c
@@ -1,7 +1,9 @@
+#include <stdlib.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <unistd.h>
 #include "tai.h"
 #include "leapsecs.h"
 
--- a/sntpclock.c
+++ b/sntpclock.c
@@ -3,12 +3,12 @@
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <unistd.h>
 #include "strerr.h"
 #include "ip.h"
 #include "str.h"
 #include "byte.h"
 #include "substdio.h"
-#include "readwrite.h"
 #include "select.h"
 #include "scan.h"
 #include "leapsecs.h"
@@ -79,7 +79,7 @@ int flagleap;
 }
 
 char outbuf[16];
-substdio ssout = SUBSTDIO_FDBUF(write,1,outbuf,sizeof outbuf);
+substdio ssout = SUBSTDIO_FDBUF((int(*)())write,1,outbuf,sizeof outbuf);
 
 #define FATAL "sntpclock: fatal: "
 #define WARNING "sntpclock: warning: "
--- a/taiclock.c
+++ b/taiclock.c
@@ -3,17 +3,17 @@
 #include <sys/param.h>
 #include <sys/socket.h>
 #include <netinet/in.h>
+#include <unistd.h>
 #include "strerr.h"
 #include "ip.h"
 #include "str.h"
 #include "byte.h"
 #include "substdio.h"
-#include "readwrite.h"
 #include "select.h"
 #include "taia.h"
 
 char outbuf[16];
-substdio ssout = SUBSTDIO_FDBUF(write,1,outbuf,sizeof outbuf);
+substdio ssout = SUBSTDIO_FDBUF((int(*)())write,1,outbuf,sizeof outbuf);
 
 #define FATAL "taiclock: fatal: "
 #define WARNING "taiclock: warning: "

--- a/auto-str.c
+++ b/auto-str.c
@@ -5,7 +5,7 @@
 char buf1[256];
 substdio ss1 = SUBSTDIO_FDBUF(write,1,buf1,sizeof(buf1));
 
-void puts(s)
+void myputs(s)
 char *s;
 {
   if (substdio_puts(&ss1,s) == -1) _exit(111);
@@ -25,20 +25,20 @@ char **argv;
   value = argv[2];
   if (!value) _exit(100);
 
-  puts("char ");
-  puts(name);
-  puts("[] = \"\\\n");
+  myputs("char ");
+  myputs(name);
+  myputs("[] = \"\\\n");
 
   while (ch = *value++) {
-    puts("\\");
+    myputs("\\");
     octal[3] = 0;
     octal[2] = '0' + (ch & 7); ch >>= 3;
     octal[1] = '0' + (ch & 7); ch >>= 3;
     octal[0] = '0' + (ch & 7);
-    puts(octal);
+    myputs(octal);
   }
 
-  puts("\\\n\";\n");
+  myputs("\\\n\";\n");
   if (substdio_flush(&ss1) == -1) _exit(111);
   _exit(0);
 }
--- a/trygethr.c
+++ b/trygethr.c
@@ -1,7 +1,7 @@
 #include <sys/types.h>
 #include <sys/time.h>
 
-main()
+int main()
 {
   hrtime_t t;
 
--- a/tryrdtsc.c
+++ b/tryrdtsc.c
@@ -1,4 +1,6 @@
-main()
+#include <unistd.h>
+
+int main()
 {
   unsigned long x[2];
   unsigned long y[2];