--- agrep.h.orig	1992-01-18 06:15:13.000000000 +1100
+++ agrep.h	2012-09-22 17:00:23.000000000 +1000
@@ -1,10 +1,10 @@
 #include <stdio.h>
 #include <math.h>
 #include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
 #include "re.h"
 
-extern unsigned char *strcpy(), *strncpy(), *strcat();
-extern int strlen();
 #define CHAR	unsigned char
 #define MAXPAT 128
 #define MAXPATT 256
--- compat.c.orig	2012-09-22 17:07:23.000000000 +1000
+++ compat.c	2012-09-22 17:11:54.000000000 +1000
@@ -1,5 +1,6 @@
 /* test the conflicts between options */
 #include <stdio.h>
+#include <stdlib.h>
 
 extern int FILENAMEONLY, APPROX, PAT_FILE, COUNT, INVERSE, BESTMATCH;
 extern FILEOUT;
@@ -16,7 +17,7 @@ compat()
 int i, j, k;
 	if(BESTMATCH)  if(COUNT || FILENAMEONLY || APPROX || PAT_FILE) {
 		BESTMATCH = 0;
-		fprintf(stderr, "WARNING!!! -B option ignored when -c, -l, -f, or -# is on\n", Progname);
+		fprintf(stderr, "WARNING!!! -B option ignored when -c, -l, -f, or -# is on\n");
 	}
 	if(PAT_FILE)   {
 		if(APPROX)  {
--- follow.c.orig	1992-01-18 06:14:42.000000000 +1100
+++ follow.c	2012-09-22 17:21:26.000000000 +1000
@@ -3,14 +3,12 @@
    construction.						*/
 
 #include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
 #include "re.h"
 
-extern char *strncpy(), *strcat(), *strcpy();
-extern int  strlen();
-
 #define TRUE	1
 
-extern char *malloc();
 extern Pset pset_union(); 
 extern int pos_cnt;
 extern Re_node parse();
--- parse.c.orig	1992-01-18 06:14:43.000000000 +1100
+++ parse.c	2012-09-22 17:52:04.000000000 +1000
@@ -3,6 +3,7 @@
    tree for that regular expression.				*/
 
 #include <stdio.h>
+#include <stdlib.h>
 #include "re.h"
 
 #define FALSE	0
--- sgrep.c.orig	2012-09-22 18:40:26.000000000 +1000
+++ sgrep.c	2012-09-22 18:42:06.000000000 +1000
@@ -1,6 +1,8 @@
 /* Copyright (c) 1991 Sun Wu and Udi Manber.  All Rights Reserved. */
 #include <stdio.h>
 #include <ctype.h>
+#include <string.h>
+#include <stdlib.h>
 #define MAXSYM  256
 #define MAXMEMBER 8192
 #define	CHARTYPE	unsigned char
--- utilities.c.orig	1992-01-18 06:14:43.000000000 +1100
+++ utilities.c	2012-09-22 19:09:47.000000000 +1000
@@ -2,6 +2,7 @@
    and manipulating regular expression syntax trees.	*/
 
 #include <stdio.h>
+#include <stdlib.h>
 #include "re.h"
 
 /************************************************************************/
--- mgrep.c.orig	2012-09-22 19:17:16.000000000 +1000
+++ mgrep.c	2012-09-22 19:19:21.000000000 +1000
@@ -2,6 +2,8 @@
 /* multipattern matcher */
 #include <stdio.h>
 #include <ctype.h>
+#include <stdlib.h>
+#include <string.h>
 #define MAXPAT  256
 #define MAXLINE 1024
 #define MAXSYM  256
@@ -86,7 +88,7 @@ int fp;
 	if(p!=0 && p < p_size) p_size = p;
     }
     if(p_size == 0) {
-	fprintf(stderr, "%s: the pattern file is empty\n");
+	fprintf(stderr, "%s: the pattern file is empty\n", Progname);
 	exit(2);
     }
     if(length > 400 && p_size > 2) LONG = 1;