home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Datafile PD-CD 4
/
DATAFILE_PDCD4.iso
/
unix
/
unixlib36d
/
src
/
c
/
strchr
< prev
next >
Wrap
Text File
|
1994-03-08
|
1KB
|
78 lines
#ifdef __STDC__
static char sccs_id[] = "@(#) strchr.c 1.1 " __DATE__ " HJR";
#else
static char sccs_id[] = "@(#) strchr.c 1.1 26/9/90 HJR";
#endif
/* strchr.c (c) Copyright 1990 H.Rogers */
#ifndef __STDC__
#include "sys/types.h"
#endif
#include <string.h>
#ifdef __STDC__
char *
strchr (register const char *s, register int c)
#else
char *
strchr (s, c)
register const char *s;
register int c;
#endif
{
register int i;
while ((i = *s) && (i != c))
s++;
if (i == c)
return ((char *) s);
else
return (0);
}
#ifdef __STDC__
char *
strrchr (register const char *s, register int c)
#else
char *
strrchr (s, c)
register const char *s;
register int c;
#endif
{
register int i;
register const char *_s;
_s = 0;
do
if ((i = *s) == c)
_s = s;
while (s++, i);
return ((char *) _s);
}
#ifdef __STDC__
char *(index) (register const char *s, register int c)
#else
char *(index) (s, c)
register const char *s;
register int c;
#endif
{
return (index (s, c));
}
#ifdef __STDC__
char *(rindex) (register const char *s, register int c)
#else
char *(rindex) (s, c)
register const char *s;
register int c;
#endif
{
return (rindex (s, c));
}