Hi tech@ --
Noticed this yesterday reviewing brynet@'s vi diff.
We have the "appropriate" isblank(3) in ctype.h but the header
wasn't being included in all the files that used it so vi was
falling back to a #define in common/key.h for one set of files and
using isblank(3) from ctype.h in other files.
This diff removes the #define from common/key.h and adds the header
to the .c files that need it.
OK?
~Brian
Index: common/key.h
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/key.h,v
retrieving revision 1.4
diff -u -p -r1.4 key.h
--- common/key.h 8 Jan 2006 21:05:39 -0000 1.4
+++ common/key.h 28 Mar 2015 04:10:46 -0000
@@ -136,19 +136,6 @@ extern KEYLIST keylist[];
(KEYS_WAITING(sp) && \
F_ISSET(&(sp)->gp->i_event[(sp)->gp->i_next].e_ch, CH_MAPPED))
-/*
- * Ex/vi commands are generally separated by whitespace characters. We
- * can't use the standard isspace(3) macro because it returns true for
- * characters like ^K in the ASCII character set. The 4.4BSD isblank(3)
- * macro does exactly what we want, but it's not portable yet.
- *
- * XXX
- * Note side effect, ch is evaluated multiple times.
- */
-#ifndef isblank
-#define isblank(ch) ((ch) == ' ' || (ch) == '\t')
-#endif
-
/* The "standard" tab width, for displaying things to users. */
#define STANDARD_TAB 6
Index: common/util.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/common/util.c,v
retrieving revision 1.10
diff -u -p -r1.10 util.c
--- common/util.c 16 Jan 2015 06:40:14 -0000 1.10
+++ common/util.c 28 Mar 2015 04:10:46 -0000
@@ -14,6 +14,7 @@
#include <sys/queue.h>
#include <bitstring.h>
+#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <stdio.h>
Index: ex/ex_shell.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/ex/ex_shell.c,v
retrieving revision 1.14
diff -u -p -r1.14 ex_shell.c
--- ex/ex_shell.c 16 Jan 2015 06:40:14 -0000 1.14
+++ ex/ex_shell.c 28 Mar 2015 04:10:46 -0000
@@ -15,6 +15,7 @@
#include <sys/wait.h>
#include <bitstring.h>
+#include <ctype.h>
#include <errno.h>
#include <limits.h>
#include <signal.h>
Index: vi/v_match.c
===================================================================
RCS file: /cvs/src/usr.bin/vi/vi/v_match.c,v
retrieving revision 1.7
diff -u -p -r1.7 v_match.c
--- vi/v_match.c 12 Nov 2014 04:28:41 -0000 1.7
+++ vi/v_match.c 28 Mar 2015 04:10:46 -0000
@@ -16,6 +16,7 @@
#include <sys/time.h>
#include <bitstring.h>
+#include <ctype.h>
#include <limits.h>
#include <stdio.h>
#include <string.h>