From 65a3713605a4a0cee3cc3a5633da10ee090a3ff5 Mon Sep 17 00:00:00 2001
From: tg <tg@mirbsd.org>
Date: Sat, 5 Dec 2009 22:19:42 +0000
Subject: [PATCH] strchr related fixes

---
 edit.c | 4 ++--
 sh.h   | 3 ++-
 2 files changed, 4 insertions(+), 3 deletions(-)

diff --git a/edit.c b/edit.c
index 60fd5d1..dc01285 100644
--- a/edit.c
+++ b/edit.c
@@ -25,7 +25,7 @@
 
 #include "sh.h"
 
-__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.185 2009/12/05 17:43:44 tg Exp $");
+__RCSID("$MirOS: src/bin/mksh/edit.c,v 1.186 2009/12/05 22:19:41 tg Exp $");
 
 /* tty driver characters we are interested in */
 typedef struct {
@@ -3891,7 +3891,7 @@ vi_cmd(int argcnt, const char *cmd)
 					return (-1);
 				/* check if this is a recursive call... */
 				if ((p = (char *)macro.p))
-					while ((p = strchr(p, '\0')) && p[1])
+					while ((p = strnul(p)) && p[1])
 						if (*++p == cmd[1])
 							return (-1);
 				/* insert alias into macro buffer */
diff --git a/sh.h b/sh.h
index af3769e..4c19996 100644
--- a/sh.h
+++ b/sh.h
@@ -134,7 +134,7 @@
 #endif
 
 #ifdef EXTERN
-__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.368 2009/12/05 17:43:49 tg Exp $");
+__RCSID("$MirOS: src/bin/mksh/sh.h,v 1.369 2009/12/05 22:19:42 tg Exp $");
 #endif
 #define MKSH_VERSION "R39 2009/12/05"
 
@@ -392,6 +392,7 @@ union mksh_ccphack {
     !defined(__INTEL_COMPILER) && !defined(__SUNPRO_C)
 char *ucstrchr(char *, int);
 char *ucstrstr(char *, const char *);
+#undef strchr
 #define strchr ucstrchr
 #define strstr ucstrstr
 #define cstrchr(s,c) ({			\