home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
GEMini Atari
/
GEMini_Atari_CD-ROM_Walnut_Creek_December_1993.iso
/
zip
/
mint
/
mntlib16.lzh
/
MNTLIB16
/
STRCHR.C
< prev
next >
Wrap
C/C++ Source or Header
|
1993-08-03
|
670b
|
34 lines
/* from Henry Spencer's stringlib */
/* modified by ERS */
#include <string.h>
/*
* 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);
}