This is version 3 of the m4 patch.

Apply by doing:
        cd /usr/src
        patch -p0 < 003_m4.patch
	cd usr.bin/m4
	make
	make install

Index: usr.bin/m4/eval.c
===================================================================
RCS file: /cvs/src/usr.bin/m4/eval.c,v
retrieving revision 1.17
retrieving revision 1.19
diff -u -p -r1.17 -r1.19
--- usr.bin/m4/eval.c	1999/09/14 08:35:16	1.17
+++ usr.bin/m4/eval.c	1999/11/17 14:57:21	1.19
@@ -155,8 +155,7 @@ eval(argv, argc, td)
 	 * dolen - find the length of the
 	 * argument
 	 */
-		if (argc > 2)
-			pbnum((argc > 2) ? strlen(argv[2]) : 0);
+		pbnum((argc > 2) ? strlen(argv[2]) : 0);
 		break;
 
 	case INCRTYPE:
@@ -776,19 +775,26 @@ map(dest, src, from, to)
 	char *to;
 {
 	char *tmp;
-	char sch, dch;
-	static char mapvec[128] = {
-		0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
-		12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23,
-		24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
-		36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47,
-		48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59,
-		60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71,
-		72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83,
-		84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95,
-		96, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107,
-		108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119,
-		120, 121, 122, 123, 124, 125, 126, 127
+	unsigned char sch, dch;
+	static unsigned char mapvec[256] = {
+	    0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
+	    19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
+	    36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+	    53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69,
+	    70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86,
+	    87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99, 100, 101, 102,
+	    103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115,
+	    116, 117, 118, 119, 120, 121, 122, 123, 124, 125, 126, 127, 128,
+	    129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141,
+	    142, 143, 144, 145, 146, 147, 148, 149, 150, 151, 152, 153, 154,
+	    155, 156, 157, 158, 159, 160, 161, 162, 163, 164, 165, 166, 167,
+	    168, 169, 170, 171, 172, 173, 174, 175, 176, 177, 178, 179, 180,
+	    181, 182, 183, 184, 185, 186, 187, 188, 189, 190, 191, 192, 193,
+	    194, 195, 196, 197, 198, 199, 200, 201, 202, 203, 204, 205, 206,
+	    207, 208, 209, 210, 211, 212, 213, 214, 215, 216, 217, 218, 219,
+	    220, 221, 222, 223, 224, 225, 226, 227, 228, 229, 230, 231, 232,
+	    233, 234, 235, 236, 237, 238, 239, 240, 241, 242, 243, 244, 245,
+	    246, 247, 248, 249, 250, 251, 252, 253, 254, 255
 	};
 
 	if (*src) {
@@ -798,25 +804,26 @@ map(dest, src, from, to)
 	 * "to"
 	 */
 		while (*from)
-			mapvec[*from++] = (*to) ? *to++ : (char) 0;
+			mapvec[(unsigned char)(*from++)] = (*to) ? 
+				(unsigned char)(*to++) : 0;
 
 		while (*src) {
-			sch = *src++;
+			sch = (unsigned char)(*src++);
 			dch = mapvec[sch];
 			while (dch != sch) {
 				sch = dch;
 				dch = mapvec[sch];
 			}
-			if ((*dest = dch))
+			if ((*dest = (char)dch))
 				dest++;
 		}
 	/*
 	 * restore all the changed characters
 	 */
 		while (*tmp) {
-			mapvec[*tmp] = *tmp;
+			mapvec[(unsigned char)(*tmp)] = (unsigned char)(*tmp);
 			tmp++;
 		}
 	}
-	*dest = (char) 0;
+	*dest = '\0';
 }
Index: usr.bin/m4/expr.c
===================================================================
RCS file: /cvs/src/usr.bin/m4/expr.c,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -p -r1.8 -r1.9
--- usr.bin/m4/expr.c	1999/09/16 20:19:34	1.8
+++ usr.bin/m4/expr.c	1999/11/15 22:12:00	1.9
@@ -516,7 +516,7 @@ num()
 	for(;;) {
 		switch(c) {
 			case '8': case '9':
-				if (base != OCTAL) 
+				if (base == OCTAL) 
 					goto bad_digit;
 				/*FALLTHRU*/
 			case '0': case '1': case '2': case '3': 
Index: usr.bin/m4/misc.c
===================================================================
RCS file: /cvs/src/usr.bin/m4/misc.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -p -r1.12 -r1.13
--- usr.bin/m4/misc.c	1999/09/14 08:35:17	1.12
+++ usr.bin/m4/misc.c	1999/11/17 14:51:05	1.13
@@ -243,6 +243,7 @@ getdiv(n)
 	while ((c = getc(outfile[n])) != EOF)
 		putc(c, active);
 	(void) fclose(outfile[n]);
+	outfile[n] = NULL;
 }
 
 void
Index: usr.bin/m4/stdd.h
===================================================================
RCS file: /cvs/src/usr.bin/m4/stdd.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -p -r1.3 -r1.4
--- usr.bin/m4/stdd.h	1999/09/06 13:07:36	1.3
+++ usr.bin/m4/stdd.h	1999/11/09 18:16:18	1.4
@@ -52,8 +52,8 @@
  * STREQ is an optimised strcmp(a,b)==0 
  * STREQN is an optimised strncmp(a,b,n)==0; assumes n > 0 
  */
-#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp((a)+1, (b)+1) == 0)
-#define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp((a)+1, (b)+1, (n)-1) == 0)
+#define STREQ(a, b) ((a)[0] == (b)[0] && strcmp(a, b) == 0)
+#define STREQN(a, b, n) ((a)[0] == (b)[0] && strncmp(a, b, n) == 0)
 
 #define YES 1
 #define NO 0
