2 Copyright © 1995-2012, The AROS Development Team. All rights reserved.
8 #include "__stdc_intbase.h"
9 #include <aros/symbolsets.h>
11 /*****************************************************************************
23 Separates a string by the characters in sep.
26 str - The string to check or NULL if the next word in
27 the last string is to be searched.
28 sep - Characters which separate "words" in str.
31 The first word in str or the next one if str is NULL.
34 The function changes str !
39 strcpy (buffer, "Hello, this is a test.");
41 // Init. Returns "Hello"
42 strtok (str, " \t,.");
44 // Next word. Returns "this"
45 strtok (NULL, " \t,.");
47 // Next word. Returns "is"
50 // Next word. Returns "a"
53 // Next word. Returns "test."
56 // Next word. Returns NULL.
65 ******************************************************************************/
67 struct StdCIntBase
*StdCBase
= (struct StdCIntBase
*)__aros_getbase_StdCBase();
74 str
+= strspn (str
, sep
);
81 StdCBase
->last
+= strcspn (str
, sep
);
83 if (*StdCBase
->last
!= '\0')
84 *StdCBase
->last
++ = '\0';
90 static int __strtok_init(struct StdCIntBase
*StdCBase
)
92 StdCBase
->last
= NULL
;
97 ADD2OPENLIB(__strtok_init
, 0);