9os

Experimental kernel using plan9 ideas for embedded device
git clone git://git.simple-cc.org/9os
Log | Files | Refs | README | LICENSE

memrchr.c (187B)


      1 #include <string.h>
      2 
      3 #undef memrchr
      4 
      5 void *
      6 memrchr(const void *s, int c, size_t n)
      7 {
      8 	unsigned char *p = s;
      9 
     10 	for (p += n-1; n > 0 && *p != c; --p)
     11 		n--;
     12 	return (n == 0) ? NULL : p;
     13 }