shithub: riscv

ref: 9e8fc02528d531c922e75395b5a7037904445d4b
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;
}