shithub: riscv

ref: 73e115aab038880a68c9f73b5c49d8fa12d0e5e2
dir: /sys/src/ape/lib/ap/gen/strchr.c/

View raw version
#include <string.h>

char*
strchr(const char *s, int c)
{
	char c1;

	if(c == 0) {
		while(*s++)
			;
		return s-1;
	}

	while(c1 = *s++)
		if(c1 == c)
			return s-1;
	return 0;
}