diff --git a/FILES b/FILES
index 40d266d..cdc5db5 100644
--- a/FILES
+++ b/FILES
@@ -50,7 +50,6 @@ pathexec_run.c
 print-cc.sh
 prot.c
 prot.h
-readwrite.h
 str.h
 str_chr.c
 str_len.c
diff --git a/Makefile b/Makefile
index 9a68187..be114d7 100644
--- a/Makefile
+++ b/Makefile
@@ -17,7 +17,7 @@ load auto-str.o unix.a byte.a
 	./load auto-str 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: \
@@ -33,7 +33,7 @@ compile buffer.c buffer.h
 	./compile buffer.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: \
@@ -148,7 +148,7 @@ load install.o hier.o auto_home.o unix.a byte.a
 	./load install hier.o auto_home.o 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: \
@@ -156,7 +156,7 @@ load instcheck.o hier.o auto_home.o unix.a byte.a
 	./load instcheck hier.o auto_home.o 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 --git a/alloc.c b/alloc.c
index b94e23a..18ffc5c 100644
--- a/alloc.c
+++ b/alloc.c
@@ -1,4 +1,5 @@
 #include <stdlib.h>
+
 #include "alloc.h"
 #include "error.h"
 
@@ -10,8 +11,7 @@ static aligned realspace[SPACE / ALIGNMENT];
 #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@*/void *alloc(unsigned int n)
 {
   char *x;
   n = ALIGNMENT + n - (n & (ALIGNMENT - 1)); /* XXX: could overflow */
@@ -21,11 +21,10 @@ unsigned int n;
   return x;
 }
 
-void alloc_free(x)
-char *x;
+void alloc_free(void *x)
 {
-  if (x >= space)
-    if (x < space + SPACE)
+  if ((char *)x >= space)
+    if ((char *)x < space + SPACE)
       return; /* XXX: assuming that pointers are flat */
   free(x);
 }
diff --git a/alloc.h b/alloc.h
index 1b1d893..dc43a5c 100644
--- a/alloc.h
+++ b/alloc.h
@@ -1,8 +1,8 @@
 #ifndef ALLOC_H
 #define ALLOC_H
 
-extern /*@null@*//*@out@*/char *alloc();
-extern void alloc_free();
-extern int alloc_re();
+extern /* @null@*//* @out@*/void *alloc(unsigned int);
+extern void alloc_free(void *);
+extern int alloc_re(char **, unsigned int, unsigned int);
 
 #endif
diff --git a/alloc_re.c b/alloc_re.c
index feb8b49..b2ff3cf 100644
--- a/alloc_re.c
+++ b/alloc_re.c
@@ -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, unsigned int m, unsigned int n)
 {
   char *y;
  
diff --git a/auto-str.c b/auto-str.c
index 1340591..16dc137 100644
--- a/auto-str.c
+++ b/auto-str.c
@@ -1,16 +1,17 @@
+#include <unistd.h>
+
 #include "buffer.h"
-#include "readwrite.h"
 #include "exit.h"
 
 char bspace[256];
 buffer b = BUFFER_INIT(write,1,bspace,sizeof bspace);
 
-void puts(char *s)
+void puts_str(char *s)
 {
   if (buffer_puts(&b,s) == -1) _exit(111);
 }
 
-main(int argc,char **argv)
+int main(int argc,char **argv)
 {
   char *name;
   char *value;
@@ -22,20 +23,20 @@ main(int argc,char **argv)
   value = argv[2];
   if (!value) _exit(100);
 
-  puts("const char ");
-  puts(name);
-  puts("[] = \"\\\n");
+  puts_str("const char ");
+  puts_str(name);
+  puts_str("[] = \"\\\n");
 
   while (ch = *value++) {
-    puts("\\");
+    puts_str("\\");
     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_str(octal);
   }
 
-  puts("\\\n\";\n");
+  puts_str("\\\n\";\n");
   if (buffer_flush(&b) == -1) _exit(111);
   _exit(0);
 }
diff --git a/buffer.c b/buffer.c
index f44a697..159f5c8 100644
--- a/buffer.c
+++ b/buffer.c
@@ -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,buffer_op op,int fd,char *buf,unsigned int len)
 {
   s->x = buf;
   s->fd = fd;
diff --git a/buffer.h b/buffer.h
index 12539b3..e4e0a5c 100644
--- a/buffer.h
+++ b/buffer.h
@@ -1,19 +1,22 @@
 #ifndef BUFFER_H
 #define BUFFER_H
+#include <sys/types.h>
+
+typedef ssize_t (*buffer_op)(int, const void *, size_t);
 
 typedef struct buffer {
   char *x;
   unsigned int p;
   unsigned int n;
   int fd;
-  int (*op)();
+  buffer_op op;
 } buffer;
 
 #define BUFFER_INIT(op,fd,buf,len) { (buf), 0, (len), (fd), (op) }
 #define BUFFER_INSIZE 8192
 #define BUFFER_OUTSIZE 8192
 
-extern void buffer_init(buffer *,int (*)(),int,char *,unsigned int);
+extern void buffer_init(buffer *,buffer_op,int,char *,unsigned int);
 
 extern int buffer_flush(buffer *);
 extern int buffer_put(buffer *,char *,unsigned int);
diff --git a/buffer_2.c b/buffer_2.c
index 297825c..bdeb5b9 100644
--- a/buffer_2.c
+++ b/buffer_2.c
@@ -1,4 +1,5 @@
-#include "readwrite.h"
+#include <unistd.h>
+
 #include "buffer.h"
 
 char buffer_2_space[256];
diff --git a/buffer_get.c b/buffer_get.c
index 937b75e..2794afa 100644
--- a/buffer_get.c
+++ b/buffer_get.c
@@ -2,7 +2,7 @@
 #include "byte.h"
 #include "error.h"
 
-static int oneread(int (*op)(),int fd,char *buf,unsigned int len)
+static int oneread(buffer_op op,int fd,char *buf,unsigned int len)
 {
   int r;
 
diff --git a/buffer_put.c b/buffer_put.c
index a05e1f5..283a5c3 100644
--- a/buffer_put.c
+++ b/buffer_put.c
@@ -3,7 +3,7 @@
 #include "byte.h"
 #include "error.h"
 
-static int allwrite(int (*op)(),int fd,char *buf,unsigned int len)
+static int allwrite(buffer_op op,int fd,char *buf,unsigned int len)
 {
   int w;
 
diff --git a/byte.h b/byte.h
index de06c69..3a4bf50 100644
--- a/byte.h
+++ b/byte.h
@@ -3,9 +3,9 @@
 
 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_copy(register char *, register unsigned int, register char *);
+extern void byte_copyr(register char *, register unsigned int, register char *);
+extern int byte_diff(register char *, register unsigned int, register char *);
 extern void byte_zero();
 
 #define byte_equal(s,n,t) (!byte_diff((s),(n),(t)))
diff --git a/byte_copy.c b/byte_copy.c
index eaad11b..9331064 100644
--- a/byte_copy.c
+++ b/byte_copy.c
@@ -1,9 +1,6 @@
 #include "byte.h"
 
-void byte_copy(to,n,from)
-register char *to;
-register unsigned int n;
-register char *from;
+void byte_copy(register char *to, register unsigned int n, register char *from)
 {
   for (;;) {
     if (!n) return; *to++ = *from++; --n;
diff --git a/byte_cr.c b/byte_cr.c
index 3e7a1d5..8e5e482 100644
--- a/byte_cr.c
+++ b/byte_cr.c
@@ -1,9 +1,6 @@
 #include "byte.h"
 
-void byte_copyr(to,n,from)
-register char *to;
-register unsigned int n;
-register char *from;
+void byte_copyr(register char *to, register unsigned int n, register char *from)
 {
   to += n;
   from += n;
diff --git a/byte_diff.c b/byte_diff.c
index cdbd760..408ba4c 100644
--- a/byte_diff.c
+++ b/byte_diff.c
@@ -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(register char *s, register unsigned int n, register char *t)
 {
   for (;;) {
     if (!n) return 0; if (*s != *t) break; ++s; ++t; --n;
diff --git a/checkpassword.c b/checkpassword.c
index dd7233a..767820e 100644
--- a/checkpassword.c
+++ b/checkpassword.c
@@ -5,7 +5,6 @@
 #include "pathexec.h"
 #include "prot.h"
 
-extern char *crypt();
 #include <pwd.h>
 static struct passwd *pw;
 
@@ -24,8 +23,7 @@ static struct userpw *upw;
 static char up[513];
 static int uplen;
 
-int
-main(int argc,char **argv)
+int main(int argc,char **argv)
 {
   char *login;
   char *password;
diff --git a/chkshsgr.c b/chkshsgr.c
index 57f9183..605d17f 100644
--- a/chkshsgr.c
+++ b/chkshsgr.c
@@ -2,10 +2,9 @@
 #include <unistd.h>
 #include "exit.h"
 
-int
-main()
+int main()
 {
-  short x[4];
+  gid_t x[4];
 
   x[0] = x[1] = 0;
   if (getgroups(1,x) == 0) if (setgroups(1,x) == -1) _exit(1);
diff --git a/error.c b/error.c
index 14adef0..b85d130 100644
--- a/error.c
+++ b/error.c
@@ -1,4 +1,3 @@
-#include <errno.h>
 #include "error.h"
 
 /* warning: as coverage improves here, should update error_{str,temp} */
diff --git a/exit.h b/exit.h
index 39011c8..614f9d1 100644
--- a/exit.h
+++ b/exit.h
@@ -1,6 +1,6 @@
 #ifndef EXIT_H
 #define EXIT_H
 
-extern void _exit();
+extern void _exit(int);
 
 #endif
diff --git a/hier.c b/hier.c
index f11d108..97d9b1b 100644
--- a/hier.c
+++ b/hier.c
@@ -1,5 +1,7 @@
 #include "auto_home.h"
 
+void c(const char *home,char *subdir,char *file,int uid,int gid,int mode);
+
 void hier()
 {
   c(auto_home,"bin","checkpassword",-1,-1,0700);
diff --git a/install.c b/install.c
index f98417f..0525db8 100644
--- a/install.c
+++ b/install.c
@@ -1,11 +1,10 @@
 #include <sys/stat.h>
-#include <sys/types.h>
 #include <unistd.h>
+
 #include "buffer.h"
 #include "strerr.h"
 #include "error.h"
 #include "open.h"
-#include "readwrite.h"
 #include "exit.h"
 
 extern void hier();
@@ -14,11 +13,7 @@ extern void hier();
 
 int fdsourcedir = -1;
 
-void h(home,uid,gid,mode)
-char *home;
-int uid;
-int gid;
-int mode;
+void h(char *home, int uid, int gid, int mode)
 {
   if (mkdir(home,0700) == -1)
     if (errno != error_exist)
@@ -29,12 +24,7 @@ int mode;
     strerr_die4sys(111,FATAL,"unable to chmod ",home,": ");
 }
 
-void d(home,subdir,uid,gid,mode)
-char *home;
-char *subdir;
-int uid;
-int gid;
-int mode;
+void d(char *home, char *subdir, int uid, int gid, int mode)
 {
   if (chdir(home) == -1)
     strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
@@ -52,13 +42,7 @@ char outbuf[BUFFER_OUTSIZE];
 buffer ssin;
 buffer ssout;
 
-void c(home,subdir,file,uid,gid,mode)
-char *home;
-char *subdir;
-char *file;
-int uid;
-int gid;
-int mode;
+void c(char *home, char *subdir, char *file, int uid, int gid, int mode)
 {
   int fdin;
   int fdout;
@@ -69,7 +53,7 @@ int mode;
   fdin = open_read(file);
   if (fdin == -1)
     strerr_die4sys(111,FATAL,"unable to read ",file,": ");
-  buffer_init(&ssin,read,fdin,inbuf,sizeof inbuf);
+  buffer_init(&ssin,(buffer_op)read,fdin,inbuf,sizeof inbuf);
 
   if (chdir(home) == -1)
     strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
@@ -102,14 +86,7 @@ int mode;
     strerr_die6sys(111,FATAL,"unable to chmod .../",subdir,"/",file,": ");
 }
 
-void z(home,subdir,file,len,uid,gid,mode)
-char *home;
-char *subdir;
-char *file;
-int len;
-int uid;
-int gid;
-int mode;
+void z(char *home, char *subdir, char *file, int len, int uid, int gid, int mode)
 {
   int fdout;
 
@@ -140,8 +117,7 @@ int mode;
     strerr_die6sys(111,FATAL,"unable to chmod .../",subdir,"/",file,": ");
 }
 
-int
-main()
+int main()
 {
   fdsourcedir = open_read(".");
   if (fdsourcedir == -1)
diff --git a/instcheck.c b/instcheck.c
index 0c0dd43..5ebaa5e 100644
--- a/instcheck.c
+++ b/instcheck.c
@@ -1,8 +1,7 @@
-#include <sys/types.h>
 #include <sys/stat.h>
+#include <unistd.h>
 #include "strerr.h"
 #include "error.h"
-#include "readwrite.h"
 #include "exit.h"
 
 extern void hier();
@@ -10,15 +9,7 @@ extern void hier();
 #define FATAL "instcheck: fatal: "
 #define WARNING "instcheck: warning: "
 
-void perm(prefix1,prefix2,prefix3,file,type,uid,gid,mode)
-char *prefix1;
-char *prefix2;
-char *prefix3;
-char *file;
-int type;
-int uid;
-int gid;
-int mode;
+void perm(char *prefix1, char *prefix2, char *prefix3, char *file, int type, int uid, int gid, int mode)
 {
   struct stat st;
 
@@ -40,46 +31,26 @@ int mode;
     strerr_warn6(WARNING,prefix1,prefix2,prefix3,file," has wrong type",0);
 }
 
-void h(home,uid,gid,mode)
-char *home;
-int uid;
-int gid;
-int mode;
+void h(char *home, int uid, int gid, int mode)
 {
   perm("","","",home,S_IFDIR,uid,gid,mode);
 }
 
-void d(home,subdir,uid,gid,mode)
-char *home;
-char *subdir;
-int uid;
-int gid;
-int mode;
+void d(char *home, char *subdir, int uid, int gid, int mode)
 {
   if (chdir(home) == -1)
     strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
   perm("",home,"/",subdir,S_IFDIR,uid,gid,mode);
 }
 
-void p(home,fifo,uid,gid,mode)
-char *home;
-char *fifo;
-int uid;
-int gid;
-int mode;
+void p(char *home, char *fifo, int uid, int gid, int mode)
 {
   if (chdir(home) == -1)
     strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
   perm("",home,"/",fifo,S_IFIFO,uid,gid,mode);
 }
 
-void c(home,subdir,file,uid,gid,mode)
-char *home;
-char *subdir;
-char *file;
-int uid;
-int gid;
-int mode;
+void c(char *home, char *subdir, char *file, int uid, int gid, int mode)
 {
   if (chdir(home) == -1)
     strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
@@ -88,21 +59,14 @@ int mode;
   perm(".../",subdir,"/",file,S_IFREG,uid,gid,mode);
 }
 
-void z(home,file,len,uid,gid,mode)
-char *home;
-char *file;
-int len;
-int uid;
-int gid;
-int mode;
+void z(char *home, char *file, int len, int uid, int gid, int mode)
 {
   if (chdir(home) == -1)
     strerr_die4sys(111,FATAL,"unable to switch to ",home,": ");
   perm("",home,"/",file,S_IFREG,uid,gid,mode);
 }
 
-int
-main()
+int main()
 {
   hier();
   _exit(0);
diff --git a/pathexec_run.c b/pathexec_run.c
index 256d8e5..a1f746d 100644
--- a/pathexec_run.c
+++ b/pathexec_run.c
@@ -1,4 +1,5 @@
 #include <unistd.h>
+
 #include "error.h"
 #include "stralloc.h"
 #include "str.h"
diff --git a/prot.c b/prot.c
index 1c56e9c..ff9724f 100644
--- a/prot.c
+++ b/prot.c
@@ -1,5 +1,6 @@
 #include <grp.h>
 #include <unistd.h>
+
 #include "hasshsgr.h"
 #include "prot.h"
 
diff --git a/readwrite.h b/readwrite.h
deleted file mode 100644
index 9423ad6..0000000
--- a/readwrite.h
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef READWRITE_H
-#define READWRITE_H
-
-#include <unistd.h>
-
-#endif
diff --git a/trycpp.c b/trycpp.c
index 3ab455b..690f2f3 100644
--- a/trycpp.c
+++ b/trycpp.c
@@ -1,4 +1,4 @@
-main()
+int main()
 {
 #ifdef NeXT
   printf("nextstep\n"); exit(0);
diff --git a/trycrypt.c b/trycrypt.c
index fbce408..c32bd40 100644
--- a/trycrypt.c
+++ b/trycrypt.c
@@ -1,4 +1,4 @@
-main()
+int main()
 {
   ;
 }
diff --git a/tryshadow.c b/tryshadow.c
index fbce408..c32bd40 100644
--- a/tryshadow.c
+++ b/tryshadow.c
@@ -1,4 +1,4 @@
-main()
+int main()
 {
   ;
 }
diff --git a/tryshsgr.c b/tryshsgr.c
index f55ff60..81b395c 100644
--- a/tryshsgr.c
+++ b/tryshsgr.c
@@ -1,4 +1,4 @@
-main()
+int main()
 {
   short x[4];
  
diff --git a/tryslib.c b/tryslib.c
index fbce408..c32bd40 100644
--- a/tryslib.c
+++ b/tryslib.c
@@ -1,4 +1,4 @@
-main()
+int main()
 {
   ;
 }
diff --git a/tryspnam.c b/tryspnam.c
index 622ba8b..8b7c402 100644
--- a/tryspnam.c
+++ b/tryspnam.c
@@ -1,6 +1,7 @@
+#include <stdio.h>
 #include <shadow.h>
 
-void main()
+int main()
 {
   struct spwd *spw;
 
diff --git a/x86cpuid.c b/x86cpuid.c
index 900d7d5..98e37db 100644
--- a/x86cpuid.c
+++ b/x86cpuid.c
@@ -5,7 +5,7 @@ void nope()
   exit(1);
 }
 
-main()
+int main()
 {
   unsigned long x[4];
   unsigned long y[4];
