diff -ru binhex/binhex.c binhex/binhex.c
--- binhex/binhex.c	2021-09-21 22:22:24.000000000 -0600
+++ binhex/binhex.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,14 +1,16 @@
+#include <stdlib.h>
 #include <stdio.h>
+#include <unistd.h>
+#include <string.h>
+
 #include "../fileio/machdr.h"
 #include "../fileio/rdfile.h"
+#include "../fileio/rdfileopt.h"
 #include "../util/patchlevel.h"
+#include "../util/util.h"
 
-extern char *malloc();
-extern char *realloc();
-extern char *strcat();
 extern void exit();
 extern void transname();
-extern void do_indent();
 extern void dofile();
 
 #define LOCALOPT	"RilqVH"
diff -ru binhex/dofile.c binhex/dofile.c
--- binhex/dofile.c	2021-09-21 22:22:24.000000000 -0600
+++ binhex/dofile.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,5 @@
+#include <stdio.h>
+
 #include "../fileio/machdr.h"
 #include "../fileio/rdfile.h"
 
diff -ru comm/from.c comm/from.c
--- comm/from.c	2021-09-21 22:22:24.000000000 -0600
+++ comm/from.c	2021-09-21 22:22:28.000000000 -0600
@@ -11,6 +11,8 @@
 extern unsigned long binhex_updcrc();
 extern unsigned long binhex_crcinit;
 
+extern void cleanup(int);
+
 static int receive_rec();
 static int receive_block();
 
diff -ru comm/frommac.c comm/frommac.c
--- comm/frommac.c	2021-09-21 22:22:24.000000000 -0600
+++ comm/frommac.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,10 +1,16 @@
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <unistd.h>
+
 #include "comm.h"
+#include "../util/util.h"
 #include "../util/patchlevel.h"
 #include "../fileio/machdr.h"
 #include "globals.h"
 #include "../fileio/fileglob.h"
 #include "../fileio/wrfile.h"
+#include "../fileio/wrfileopt.h"
 
 #ifndef DEBUG
 #define LOCALOPT	"lmMxXyYzoTVH"
@@ -13,8 +19,11 @@
 #endif /* DEBUG */
 
 extern void exit();
+extern void transname();
 extern void setup_tty();
 extern void reset_tty();
+extern void xm_from();
+extern void ym_from();
 
 char info[INFOBYTES];
 
diff -ru comm/to.c comm/to.c
--- comm/to.c	2021-09-21 22:22:24.000000000 -0600
+++ comm/to.c	2021-09-21 22:22:28.000000000 -0600
@@ -10,6 +10,7 @@
 extern void tputrec();
 extern unsigned long binhex_updcrc();
 extern unsigned long binhex_crcinit;
+extern void cleanup(int);
 
 static void send_rec();
 
diff -ru comm/tomac.c comm/tomac.c
--- comm/tomac.c	2021-09-21 22:22:24.000000000 -0600
+++ comm/tomac.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,19 +1,22 @@
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
 #include "comm.h"
 #include "../fileio/machdr.h"
 #include "../fileio/rdfile.h"
+#include "../fileio/rdfileopt.h"
 #include "../util/patchlevel.h"
+#include "../util/util.h"
 #include "globals.h"
 
-extern char *malloc();
-extern char *realloc();
-extern char *strcat();
 extern void exit();
 extern void transname();
-extern void do_indent();
 extern void dofile();
 extern void setup_tty();
 extern void reset_tty();
+extern void xm_to();
+extern void ym_to();
 
 #ifndef DEBUG
 #define LOCALOPT	"ilqMxXyYzoTVH"
diff -ru comm/tty.c comm/tty.c
--- comm/tty.c	2021-09-21 22:22:24.000000000 -0600
+++ comm/tty.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,5 +1,7 @@
 #include <stdio.h>
 #include <signal.h>
+#include <unistd.h>
+#include <stdlib.h>
 #ifndef TERMIOS_H
 #include <sgtty.h>
 #else /* TERMIOS_H */
diff -ru comm/xm_from.c comm/xm_from.c
--- comm/xm_from.c	2021-09-21 22:22:24.000000000 -0600
+++ comm/xm_from.c	2021-09-21 22:22:28.000000000 -0600
@@ -5,6 +5,7 @@
 #ifdef XM
 #include "../fileio/machdr.h"
 #include "../fileio/wrfile.h"
+#include "../util/util.h"
 #include "../util/masks.h"
 #include "globals.h"
 #include "protocol.h"
@@ -13,6 +14,10 @@
 extern void tputc();
 extern char info[];
 
+extern void transname();
+
+extern void cleanup();
+
 extern void receive_part();
 static int receive_sync();
 
diff -ru comm/ym_from.c comm/ym_from.c
--- comm/ym_from.c	2021-09-21 22:22:24.000000000 -0600
+++ comm/ym_from.c	2021-09-21 22:22:28.000000000 -0600
@@ -5,6 +5,7 @@
 #ifdef YM
 #include "../fileio/machdr.h"
 #include "../fileio/wrfile.h"
+#include "../util/util.h"
 #include "../util/masks.h"
 #include "globals.h"
 #include "protocol.h"
@@ -13,6 +14,10 @@
 extern void tputc();
 extern char info[];
 
+extern void transname();
+
+extern void cleanup();
+
 extern void receive_part();
 static int receive_sync();
 

diff -ru fileio/rdfile.c fileio/rdfile.c
--- fileio/rdfile.c	2021-09-21 22:22:24.000000000 -0600
+++ fileio/rdfile.c	2021-09-21 22:22:28.000000000 -0600
@@ -42,12 +42,11 @@
 #define RSRC_FORMAT	2
 #define UNIX_FORMAT	3
 
-extern char *malloc();
-extern char *realloc();
-extern char *strcpy();
-extern char *strncpy();
-extern char *strcat();
-extern void exit();
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+
+extern void backtrans(char *macname, char *name);
 
 static void check_files();
 static void read_file();
diff -ru fileio/wrfile.c fileio/wrfile.c
--- fileio/wrfile.c	2021-09-21 22:22:24.000000000 -0600
+++ fileio/wrfile.c	2021-09-21 22:22:28.000000000 -0600
@@ -35,12 +35,9 @@
 #define MACI 9
 #endif /* SCAN */
 
-extern char *malloc();
-extern char *realloc();
-extern char *strcpy();
-extern char *strncpy();
-extern char *strcat();
-extern void exit();
+#include <stdlib.h>
+#include <strings.h>
+#include <unistd.h>
 
 #ifdef UNDEF /* Do not declare sprintf; not portable (but lint will complain) */
 char *sprintf();
diff -ru fileio/wrfileopt.h fileio/wrfileopt.h
--- fileio/wrfileopt.h	2021-09-21 22:22:24.000000000 -0600
+++ fileio/wrfileopt.h	2021-09-21 22:22:28.000000000 -0600
@@ -1,5 +1,6 @@
 extern int wrfileopt();
 extern void give_wrfileopt();
+extern char *get_wrfileopt();
 extern void set_wrfileopt();
 extern void set_s_wrfileopt();
 extern char *get_wrfileopt();
diff -ru hexbin/buffer.c hexbin/buffer.c
--- hexbin/buffer.c	2021-09-21 22:22:24.000000000 -0600
+++ hexbin/buffer.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,12 +1,11 @@
+
+#include <stdlib.h>
+
 #include "globals.h"
 #include "../util/util.h"
 #include "buffer.h"
 #include "../fileio/wrfile.h"
 
-extern char *malloc();
-extern char *realloc();
-extern void exit();
-
 char *data_fork, *rsrc_fork;
 int data_size, rsrc_size;
 static int max_data_size, max_rsrc_size;
diff -ru hexbin/hexbin.c hexbin/hexbin.c
--- hexbin/hexbin.c	2021-09-21 22:22:24.000000000 -0600
+++ hexbin/hexbin.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,6 @@
+#include <unistd.h>
+#include <stdio.h>
+
 #ifdef TYPES_H
 #include <sys/types.h>
 #endif /* TYPES_H */
diff -ru hexbin/readline.h hexbin/readline.h
--- hexbin/readline.h	2021-09-21 22:22:24.000000000 -0600
+++ hexbin/readline.h	2021-09-21 22:22:28.000000000 -0600
@@ -1,2 +1,2 @@
 extern char line[];
-
+extern int readline();
diff -ru macunpack/bin.c macunpack/bin.c
--- macunpack/bin.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/bin.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,5 @@
+#include <string.h>
+
 #include "macunpack.h"
 #ifdef BIN
 #include "globals.h"
diff -ru macunpack/cpt.c macunpack/cpt.c
--- macunpack/cpt.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/cpt.c	2021-09-21 22:22:28.000000000 -0600
@@ -21,9 +21,9 @@
 #define ESC1SEEN	1
 #define ESC2SEEN	2
 
-extern char *malloc();
-extern char *realloc();
-extern int free();
+#include <stdlib.h>
+
+extern int gethuffbyte(node *l_nodelist);
 
 static void cpt_uncompact();
 static unsigned char *cpt_data;
diff -ru macunpack/dd.c macunpack/dd.c
--- macunpack/dd.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/dd.c	2021-09-21 22:22:28.000000000 -0600
@@ -9,10 +9,9 @@
 #include "../util/masks.h"
 #include "../util/util.h"
 
-extern char *malloc();
-extern char *realloc();
-extern char *strcpy();
-extern char *strncpy();
+#include <stdlib.h>
+#include <string.h>
+
 extern void cpt_wrfile1();
 extern void core_compress();
 extern void de_compress();
diff -ru macunpack/de_huffman.c macunpack/de_huffman.c
--- macunpack/de_huffman.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/de_huffman.c	2021-09-21 22:22:28.000000000 -0600
@@ -33,6 +33,8 @@
 
 static int bit;
 
+int gethuffbyte(node *l_nodelist);
+
 void de_huffman(obytes)
 unsigned long obytes;
 {
diff -ru macunpack/dia.c macunpack/dia.c
--- macunpack/dia.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/dia.c	2021-09-21 22:22:28.000000000 -0600
@@ -9,8 +9,8 @@
 #include "../fileio/kind.h"
 #include "../util/util.h"
 
-extern char *malloc();
-extern char *realloc();
+#include <stdlib.h>
+#include <string.h>
 
 static unsigned char *dia_archive;
 static int dia_archive_size;
diff -ru macunpack/dir.c macunpack/dir.c
--- macunpack/dir.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/dir.c	2021-09-21 22:22:28.000000000 -0600
@@ -4,8 +4,8 @@
 #include "../util/util.h"
 #include "../util/masks.h"
 
-extern char *malloc();
-extern char *realloc();
+#include <stdlib.h>
+#include <unistd.h>
 
 static char *dir_stack;
 static int dir_ptr = -64;
diff -ru macunpack/lzc.c macunpack/lzc.c
--- macunpack/lzc.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/lzc.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,5 @@
+#include <string.h>
+
 #include "macunpack.h"
 #ifdef LZC
 #include "globals.h"
diff -ru macunpack/lzh.c macunpack/lzh.c
--- macunpack/lzh.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/lzh.c	2021-09-21 22:22:28.000000000 -0600
@@ -17,8 +17,9 @@
 #define LZSMASK		4095
 #define LZBUFFSIZE	8192	/* Max of above buffsizes */
 
-extern char *malloc();
-extern char *realloc();
+#include <stdlib.h>
+#include <string.h>
+
 extern void de_lzah();
 extern unsigned char (*lzah_getbyte)();
 extern void de_lzh();
diff -ru macunpack/lzh.h macunpack/lzh.h
--- macunpack/lzh.h	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/lzh.h	2021-09-21 22:22:28.000000000 -0600
@@ -58,10 +58,4 @@
 #define	lz5	7
 #define	lzs	8
 
-extern char *lzh_pointer;
-extern char *lzh_data;
-extern char *lzh_finfo;
-extern int lzh_fsize;
-extern int lzh_kind;
-extern char *lzh_file;
 
diff -ru macunpack/macbinary.c macunpack/macbinary.c
--- macunpack/macbinary.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/macbinary.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,5 @@
+#include <string.h>
+
 #include "macunpack.h"
 #include "globals.h"
 #include "../fileio/machdr.h"
diff -ru macunpack/macunpack.c macunpack/macunpack.c
--- macunpack/macunpack.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/macunpack.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,5 @@
+#include <unistd.h>
+
 #include "macunpack.h"
 #include "globals.h"
 #include "../util/patchlevel.h"
diff -ru macunpack/pit.c macunpack/pit.c
--- macunpack/pit.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/pit.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,5 @@
+#include <string.h>
+
 #include "macunpack.h"
 #ifdef PIT
 #include "../fileio/wrfile.h"
@@ -15,6 +17,8 @@
 extern void de_huffman();
 extern void set_huffman();
 
+extern int getihuffbyte();
+
 static int pit_filehdr();
 static void pit_wrfile();
 static void pit_nocomp();
diff -ru macunpack/sit.c macunpack/sit.c
--- macunpack/sit.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/sit.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,5 @@
+#include <string.h>
+
 #include "macunpack.h"
 #ifdef SIT
 #include "globals.h"
diff -ru macunpack/stf.c macunpack/stf.c
--- macunpack/stf.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/stf.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,5 @@
+#include <string.h>
+
 #include "macunpack.h"
 #ifdef STF
 #include "stf.h"
diff -ru macunpack/zma.c macunpack/zma.c
--- macunpack/zma.c	2021-09-21 22:22:24.000000000 -0600
+++ macunpack/zma.c	2021-09-21 22:22:28.000000000 -0600
@@ -9,8 +9,9 @@
 #include "../util/masks.h"
 #include "../util/util.h"
 
-extern char *malloc();
-extern char *realloc();
+#include <stdlib.h>
+#include <string.h>
+
 extern void de_lzh();
 
 /* We do allow for possible backpointing, so we allocate the archive in core */
diff -ru mixed/macsave.c mixed/macsave.c
--- mixed/macsave.c	2021-09-21 22:22:24.000000000 -0600
+++ mixed/macsave.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,5 @@
+#include <unistd.h>
+
 #include "globals.h"
 #include "../util/patchlevel.h"
 #include "../fileio/wrfile.h"
diff -ru mixed/macstream.c mixed/macstream.c
--- mixed/macstream.c	2021-09-21 22:22:24.000000000 -0600
+++ mixed/macstream.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,15 +1,16 @@
+#include <stdlib.h>
 #include <stdio.h>
+#include <string.h>
+#include <unistd.h>
+
 #include "../fileio/machdr.h"
 #include "../fileio/rdfile.h"
 #include "../fileio/rdfileopt.h"
 #include "../util/patchlevel.h"
+#include "../util/util.h"
 
-extern char *malloc();
-extern char *realloc();
-extern char *strcat();
 extern void exit();
 extern void transname();
-extern void do_indent();
 
 #define LOCALOPT	"ilqVH"
 
diff -ru mixed/mcb.c mixed/mcb.c
--- mixed/mcb.c	2021-09-21 22:22:24.000000000 -0600
+++ mixed/mcb.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,3 +1,5 @@
+#include <string.h>
+
 #include "globals.h"
 #include "../macunpack/macunpack.h"
 #include "../fileio/machdr.h"
diff -ru util/util.c util/util.c
--- util/util.c	2021-09-21 22:22:24.000000000 -0600
+++ util/util.c	2021-09-21 22:22:28.000000000 -0600
@@ -1,4 +1,5 @@
 #include <stdio.h>
+#include <unistd.h>
 #include "../fileio/fileglob.h"
 #include "masks.h"
 #include "util.h"
diff -ru util/util.h util/util.h
--- util/util.h	2021-09-21 22:22:24.000000000 -0600
+++ util/util.h	2021-09-21 22:22:28.000000000 -0600
@@ -17,6 +17,7 @@
 extern void put4();
 extern void put2();
 extern void do_indent();
+extern int do_query();
 extern real_time set_time();
 extern unsigned long tomactime();
 extern real_time frommactime();
