From 4dd43ae647795df44933bcfc8bb46fe56205a1e6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Manuel=20P=C3=A9gouri=C3=A9-Gonnard?= Date: Mon, 2 Nov 2015 06:52:52 +0900 Subject: [PATCH] Use own implementation of strsep() --- tests/suites/test_suite_x509parse.function | 31 +++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/tests/suites/test_suite_x509parse.function b/tests/suites/test_suite_x509parse.function index 8f22312a0..e2b89778e 100644 --- a/tests/suites/test_suite_x509parse.function +++ b/tests/suites/test_suite_x509parse.function @@ -22,6 +22,35 @@ int verify_all( void *data, x509_cert *crt, int certificate_depth, int *flags ) return 0; } +/* strsep() not available on Windows */ +char *mystrsep(char **stringp, const char *delim) +{ + const char *p; + char *ret = *stringp; + + if( *stringp == NULL ) + return( NULL ); + + for( ; ; (*stringp)++ ) + { + if( **stringp == '\0' ) + { + *stringp = NULL; + goto done; + } + + for( p = delim; *p != '\0'; p++ ) + if( **stringp == *p ) + { + **stringp = '\0'; + (*stringp)++; + goto done; + } + } + +done: + return( ret ); +} END_HEADER BEGIN_DEPENDENCIES @@ -288,7 +317,7 @@ x509_crt_verify_chain:chain_paths_str:trusted_ca:flags_result chain_paths = strdup( {chain_paths_str} ); TEST_ASSERT( chain_paths != NULL ); - while( ( act = strsep( &chain_paths, " " ) ) != NULL ) + while( ( act = mystrsep( &chain_paths, " " ) ) != NULL ) TEST_ASSERT( x509parse_crtfile( &chain, act ) == 0 ); TEST_ASSERT( x509parse_crtfile( &trusted, {trusted_ca} ) == 0 );