/* * s t r c h r . c */ /*)LIBRARY */ #ifdef DOCUMENTATION title strchr Find First Instance of a Character in a String index Find first instance of a character in a string synopsis .s.nf char * strchr(stng, chr) char *stng; /* String to search in */ char chr; /* Byte to search for */ .s.f Description If chr is in stng, return a pointer to it. If not, return NULL. Bugs #endif #define EOS 0 #define NULL 0 char * strchr(stng, chr) register char *stng; register char chr; /* * Locate chr in stng. */ { while (*stng != chr) { if (*stng++ == EOS) return (NULL); } return (stng); }