1 #include <u.h> 2 #include <libc.h> 3 4 char* strchr(char * s,int c)5 strchr(char *s, int c) 6 { 7 char c0 = c; 8 char c1; 9 10 if(c == 0) { 11 while(*s++) 12 ; 13 return s-1; 14 } 15 16 while(c1 = *s++) 17 if(c1 == c0) 18 return s-1; 19 return 0; 20 } 21