diff --git a/crack.c b/crack.c
index 4dc9e9e..aa3c80b 100644
--- a/crack.c
+++ b/crack.c
@@ -76,13 +76,13 @@ int crack(argc, argv, flags, ign)
 	    pv = pvcon;
 	else
 	    {
-	    if (++arg_index >= argc) return(NULL); 
+	    if (++arg_index >= argc) return(0); 
 	    pv = argv[arg_index];
 	    if (*pv != '-') 
-		return(NULL);
+		return(0);
 	    }
 	pv++;		/* skip '-' or prev. flag */
-	if (*pv != NULL)
+	if (*pv != 0)
 	    {
 	    if ((flgp=strchr(flags,*pv)) != NULL)
 		{
@@ -100,6 +100,6 @@ int crack(argc, argv, flags, ign)
 	    }
 	pvcon = NULL;
 	}
-    return(NULL);
+    return(0);
     }
 
diff --git a/mf2t.c b/mf2t.c
index 365e126..b76105c 100644
--- a/mf2t.c
+++ b/mf2t.c
@@ -6,8 +6,11 @@
  */
 
 #include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 #include <ctype.h>
 #include <fcntl.h>
+#include <errno.h>
 #include "midifile.h"
 
 static int TrkNr;
@@ -39,6 +42,7 @@ int filegetc()
 	return(getc(F));
 }
 
+void
 main(argc,argv)
 int argc;
 char **argv;
@@ -119,14 +123,13 @@ char *mode;
 {
 	FILE *f;
 	extern int errno;
-	extern char *sys_errlist[];
 	extern int sys_nerr;
 	char *errmess;
 
 	if ( (f=fopen(name,mode)) == NULL ) {
 		(void) fprintf(stderr,"*** ERROR *** Cannot open '%s'!\n",name);
 		if ( errno <= sys_nerr )
-			errmess = sys_errlist[errno];
+			errmess = strerror(errno);
 		else
 			errmess = "Unknown error!";
 		(void) fprintf(stderr,"************* Reason: %s\n",errmess);
diff --git a/midifile.c b/midifile.c
index efdf004..f24bc0c 100644
--- a/midifile.c
+++ b/midifile.c
@@ -107,6 +107,18 @@ static int to16bit();
 static char *msg();
 static void readheader();
 
+static int readmt(char*);
+static int egetc();
+static int readtrack();
+static int badbyte(int);
+static int metaevent(int);
+static int sysex();
+static int chanmessage(int,int,int);
+static int msginit();
+static int msgleng();
+static int msgadd(int);
+static int biggermsg();
+
 mfread()	 	/* The only non-static function in this file. */
 {
 	if ( Mf_getc == NULLFUNC )
diff --git a/t2mf.c b/t2mf.c
index 9f9f9ea..60734e9 100644
--- a/t2mf.c
+++ b/t2mf.c
@@ -10,6 +10,9 @@
 #include <stdio.h>
 #include <ctype.h>
 #include <setjmp.h>
+#include <stdlib.h>
+#include <errno.h>
+#include <string.h>
 /*#include <memory.h>*/
 #include "t2mf.h"
 
@@ -114,14 +117,13 @@ char *mode;
 {
     FILE *f;
     extern int errno;
-    extern char *sys_errlist[];
     extern int sys_nerr;
     char *errmess;
 
     if ( (f=fopen(name,mode)) == NULL ) {
         (void) fprintf(stderr,"*** ERROR *** Cannot open '%s'!\n",name);
         if ( errno <= sys_nerr )
-            errmess = sys_errlist[errno];
+            errmess = strerror(errno);
         else
             errmess = "Unknown error!";
         (void) fprintf(stderr,"************* Reason: %s\n",errmess);
diff --git a/t2mflex.c b/t2mflex.c
index 55d0a60..bc2425e 100644
--- a/t2mflex.c
+++ b/t2mflex.c
@@ -7,6 +7,7 @@
 #define FLEX_SCANNER
 
 #include <stdio.h>
+#include <stdlib.h>
 
 void *malloc( size_t );
 void free( void* );
