2 Copyright © 1995-2013, The AROS Development Team. All rights reserved.
5 POSIX.1-2001 function strtok_r().
8 /*****************************************************************************
21 Separates a string by the characters in sep.
24 str - The string to check or NULL if the next word in
25 the last string is to be searched.
26 sep - Characters which separate "words" in str.
27 saveptr - internal context for next scan
30 The first word in str or the next one if str is NULL.
33 The function changes str !
39 strcpy (buffer, "Hello, this is a test.");
41 // Init. Returns "Hello"
42 strtok_r (str, " \t,.", &ptr);
44 // Next word. Returns "this"
45 strtok_r (NULL, " \t,.", &ptr);
47 // Next word. Returns "is"
48 strtok_r (NULL, " \t", &ptr);
50 // Next word. Returns "a"
51 strtok_r (NULL, " \t", &ptr);
53 // Next word. Returns "test."
54 strtok_r (NULL, " \t", &ptr);
56 // Next word. Returns NULL.
57 strtok_r (NULL, " \t", &ptr);
65 ******************************************************************************/
74 str
+= strspn (str
, sep
);
81 t
+= strcspn (str
, sep
);