diff options
author | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
---|---|---|
committer | Norbert Preining <norbert@preining.info> | 2019-09-02 13:46:59 +0900 |
commit | e0c6872cf40896c7be36b11dcc744620f10adf1d (patch) | |
tree | 60335e10d2f4354b0674ec22d7b53f0f8abee672 /fonts/utilities/mff-29/stritem.c |
Initial commit
Diffstat (limited to 'fonts/utilities/mff-29/stritem.c')
-rw-r--r-- | fonts/utilities/mff-29/stritem.c | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/fonts/utilities/mff-29/stritem.c b/fonts/utilities/mff-29/stritem.c new file mode 100644 index 0000000000..a6de73c236 --- /dev/null +++ b/fonts/utilities/mff-29/stritem.c @@ -0,0 +1,37 @@ +/* stritem.c 2.9.0 92/07/06 -- like strtok except different */ + +/* + * This is a replacement for the SysV strtok(3C) function. + * (It has a different signature.) See stritem(3). + */ + +/* - Damian Cugley <pdc@prg.ox.ac.uk> Thur. 20 June 1991 +----------------------------------------------------------------------- + This software module copyright (c) 1991 Damian Cugley. + It is provided for free on an "as-is" basis. + See the file COPYING for more information. +----------------------------------------------------------------------- +*/ + +#include "strmisc.h" + +char * +stritem(s, c, state) + char *s; + int c; + char **state; +{ + char *result; + register char *p; + + result = (s ? s : *state); + if (!result || !*result) return (char *)NULL; + + for (p = result; *p && *p != c; p++) + ; + if (*p) + *state = p + 1, *p = '\0'; + else + *state = (char *)NULL; /* next call will return NULL */ + return result; +} |