From acfbb13661f425631ee7e7f01daa1eb2f3169945 Mon Sep 17 00:00:00 2001 From: Elliott Hughes Date: Wed, 28 Nov 2018 12:27:14 -0800 Subject: macOS: replace local strnstr with strcasestr. bionic, glibc, macOS, and musl all have strcasestr (see http://man7.org/linux/man-pages/man3/strstr.3.html). macOS (via BSD) has a strnstr that does what strnstr sounds like it should do by analogy with strnlen and strncpy. So we at least need to rename strnstr, but it probably makes more sense just to switch to strcasestr instead. --- toys/posix/grep.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'toys/posix') diff --git a/toys/posix/grep.c b/toys/posix/grep.c index f0332cee..14cebf95 100644 --- a/toys/posix/grep.c +++ b/toys/posix/grep.c @@ -152,7 +152,7 @@ static void do_grep(int fd, char *name) fseek.arg = s = line; break; } - if (toys.optflags & FLAG_i) s = strnstr(line, seek->arg); + if (toys.optflags & FLAG_i) s = strcasestr(line, seek->arg); else s = strstr(line, seek->arg); if (s) break; } -- cgit v1.2.3