home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fred Fish Collection 1.5
/
ffcollection-1-5-1992-11.iso
/
ff_disks
/
200-299
/
ff218.lzh
/
EdLib
/
strtok.c
< prev
next >
Wrap
C/C++ Source or Header
|
1989-06-04
|
906b
|
30 lines
/*
* edlib v1.1 Copyright 1989 Edwin Hoogerbeets
* This code is freely redistributable as long as no charge other than
* reasonable copying fees are levied for it.
*/
#define STRING_END '\0'
#ifndef NULL
#define NULL 0L
#endif
char *strtok(buf, separators)
register char *buf, *separators;
{
register char *token, *end; /* Start and end of token. */
extern char *strpbrk();
static char *fromLastTime;
if (token = buf ? buf : fromLastTime) {
token += strspn(token, separators); /* Find token! */
if (*token == STRING_END)
return(NULL);
fromLastTime = ((end = strpbrk(token,separators))
? &end[1]
: NULL);
*end = STRING_END; /* Cut it short! */
}
return(token);
}