diff --git a/toys/posix/find.c b/toys/posix/find.c index ac1488161..3dea5fb27 100644 --- a/toys/posix/find.c +++ b/toys/posix/find.c @@ -421,7 +421,7 @@ static int do_find(struct dirtree *new) test = *arg; } - } else if (strchr("acm", *s) + } else if (stridx("acm", *s) != -1 && (!strcmp(s+1, "time") || !strcmp(s+1, "min"))) { if (check) { diff --git a/toys/posix/printf.c b/toys/posix/printf.c index c80e6fe40..08f860a3f 100644 --- a/toys/posix/printf.c +++ b/toys/posix/printf.c @@ -97,7 +97,7 @@ void printf_main(void) // Parse width.precision between % and type indicator. *to++ = '%'; - while (strchr("-+# '0", *f) && (to-toybuf)<10) *to++ = *f++; + while (stridx("-+# '0", *f) != -1 && (to-toybuf)<10) *to++ = *f++; for (;;) { if (chrstart(&f, '*')) { if (*arg) wp[i] = atolx(*arg++); @@ -118,7 +118,7 @@ void printf_main(void) continue; } else if (c == 'c') printf(toybuf, wp[0], wp[1], *aa); else if (c == 's') printf(toybuf, wp[0], wp[1], aa); - else if (strchr("diouxX", c)) { + else if (stridx("diouxX", c) != -1) { long long ll; if (*aa == '\'' || *aa == '"') ll = aa[1]; @@ -126,7 +126,7 @@ void printf_main(void) sprintf(to, "*.*ll%c", c); printf(toybuf, wp[0], wp[1], ll); - } else if (strchr("feEgG", c)) { + } else if (stridx("feEgG", c) != -1) { long double ld = strtold(aa, &end); sprintf(to, "*.*L%c", c); diff --git a/toys/posix/sed.c b/toys/posix/sed.c index 085884957..9fa545eac 100644 --- a/toys/posix/sed.c +++ b/toys/posix/sed.c @@ -719,7 +719,7 @@ static char *unescape_delimited_string(char **pstr, char *delim) if (!mode) { mode = ']'; if (from[1]=='-' || from[1]==']') *(to++) = *(from++); - } else if (mode == ']' && strchr(".=:", from[1])) { + } else if (mode == ']' && stridx(".=:", from[1]) != -1) { *(to++) = *(from++); mode = *from; }