Noticed test was marked as 'UTF-8 support' instead of 'implicit UTF-8
support' in README. utflen() was being used to check for zero length
vs nonzero length strings. No need for that, a null byte is a null
byte, just check whether the first byte is null or not.

-emg
From ebf480d8b31027f72860132f3088e916453c4a4c Mon Sep 17 00:00:00 2001
From: Evan Gates <evan.ga...@gmail.com>
Date: Fri, 20 Feb 2015 11:19:02 -0800
Subject: [PATCH] no need for libutf in test, a null byte is a null byte

---
 README | 2 +-
 test.c | 5 ++---
 2 files changed, 3 insertions(+), 4 deletions(-)

diff --git a/README b/README
index f60d19d..fdd81df 100644
--- a/README
+++ b/README
@@ -73,7 +73,7 @@ The following tools are implemented ('*' == finished, '#' == 
UTF-8 support,
 =* tail            yes                          none
 =* tar             non-posix                    none
 =* tee             yes                          none
-#* test            yes                          none
+=* test            yes                          none
 =* touch           yes                          none
 #* tr              yes                          none
 =* true            yes                          none
diff --git a/test.c b/test.c
index c96adc8..660048a 100644
--- a/test.c
+++ b/test.c
@@ -4,7 +4,6 @@
 #include <string.h>
 #include <unistd.h>
 
-#include "utf.h"
 #include "util.h"
 
 #define STOI(s) enstrtonum(2, s, LLONG_MIN, LLONG_MAX)
@@ -20,8 +19,8 @@ static int unary_S(char *s) { struct stat buf; if ( stat(s, 
&buf)) return 0; ret
 static int unary_s(char *s) { struct stat buf; if ( stat(s, &buf)) return 0; 
return           buf.st_size ; }
 static int unary_u(char *s) { struct stat buf; if ( stat(s, &buf)) return 0; 
return S_ISUID & buf.st_mode ; }
 
-static int unary_n(char *s) { return  utflen(s); }
-static int unary_z(char *s) { return !utflen(s); }
+static int unary_n(char *s) { return  *s; }
+static int unary_z(char *s) { return !*s; }
 
 static int unary_e(char *s) { return access(s, F_OK); }
 static int unary_r(char *s) { return access(s, R_OK); }
-- 
2.3.0

Reply via email to