about summary refs log tree commit diff
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2023-09-22 15:24:51 +0000
committerLaurent Bercot <ska@appnovation.com>2023-09-22 15:24:51 +0000
commit5be24a3642c294e4fcec465c9c6f19d66cf2220d (patch)
tree7d4207b2fcd8a3673ba1c853d658995b1080e5c0
parentf3d781e6a2c83bf014611301cb8e0466fa3b52d0 (diff)
downloads6-portable-utils-5be24a3642c294e4fcec465c9c6f19d66cf2220d.tar.gz
s6-portable-utils-5be24a3642c294e4fcec465c9c6f19d66cf2220d.tar.xz
s6-portable-utils-5be24a3642c294e4fcec465c9c6f19d66cf2220d.zip
Remove case_str use
Signed-off-by: Laurent Bercot <ska@appnovation.com>
-rw-r--r--src/s6-portable-utils/s6-grep.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/s6-portable-utils/s6-grep.c b/src/s6-portable-utils/s6-grep.c
index ebfa064..98bde99 100644
--- a/src/s6-portable-utils/s6-grep.c
+++ b/src/s6-portable-utils/s6-grep.c
@@ -1,9 +1,10 @@
 /* ISC license. */
 
+#include <skalibs/nonposix.h>
+
 #include <string.h>
 #include <errno.h>
 #include <regex.h>
-#include <string.h>
 
 #include <skalibs/posixplz.h>
 #include <skalibs/bytestr.h>
@@ -66,7 +67,6 @@ int main (int argc, char const *const *argv)
     stralloc line = STRALLOC_ZERO ;
     regex_t re ;
     unsigned int num = 0 ;
-    size_t arglen = strlen(argv[0]) ;
     if (!flags.fixed)
     {
       int e = skalibs_regcomp(&re, argv[0], REG_NOSUB | (flags.extended ? REG_EXTENDED : 0) | (flags.ignorecase ? REG_ICASE : 0)) ;
@@ -93,7 +93,7 @@ int main (int argc, char const *const *argv)
       if (flags.fixed)
       {
         if (flags.ignorecase)
-          r = case_str(line.s, argv[0]) >= arglen ;
+          r = !strcasestr(line.s, argv[0]) ;
         else
           r = !strstr(line.s, argv[0]) ;
       }