/* from Henry Spencer's stringlib */ /* modified by ERS */ #include /* * strchr - find first occurrence of a character in a string */ #ifdef __GNUC__ __asm__(".text; .even; .globl _index; _index:"); /* dept of dirty tricks */ #else char * index(s, charwanted) const char *s; char charwanted; { return strchr(s, charwanted); } #endif char * /* found char, or NULL if none */ strchr(s, charwanted) const char *s; register char charwanted; { register char c; /* * The odd placement of the two tests is so NUL is findable. */ while ((c = *s++) != charwanted) if (c == 0) return NULL; return((char *)--s); }