xref: /relibc/tests/string/strtok_r.c (revision be35961d82cd98f2a2e61c4f1869271b9f4af571)
1 #include <string.h>
2 #include <stdio.h>
3 
4 #include "test_helpers.h"
5 
6 int main(void) {
7     char source[] = "I'd just like to interject for a moment.  What you're referring to as Linux, "
8                     "is in fact, GNU/Linux, or as I've recently taken to calling it, GNU plus Linux.\n";
9     char* sp;
10 
11     char* token = strtok_r(source, " ", &sp);
12     while (token) {
13         printf("%s", token);
14         if ((token = strtok_r(NULL, " ", &sp))) {
15             printf("_");
16         }
17     }
18 }
19