3 Copyright (c) 2003-2015 HandBrake Team
4 This file is part of the HandBrake source code
5 Homepage: <http://handbrake.fr/>.
6 It may be used under the terms of the GNU General Public License v2.
7 For full terms see the file COPYING file or visit http://www.gnu.org/licenses/gpl-2.0.html
12 #ifdef HB_NEED_STRTOK_R
15 char *strtok_r(char *s
, const char *delim
, char **save_ptr
)
19 if (s
== NULL
) s
= *save_ptr
;
21 /* Scan leading delimiters. */
22 s
+= strspn(s
, delim
);
23 if (*s
== '\0') return NULL
;
25 /* Find the end of the token. */
27 s
= strpbrk(token
, delim
);
30 /* This token finishes the string. */
31 *save_ptr
= strchr(token
, '\0');
35 /* Terminate the token and make *save_ptr point past it. */
42 #endif // HB_NEED_STRTOK_R