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