From: Antonio Ospite Date: Tue, 22 May 2012 14:23:10 +0000 (+0200) Subject: am7xxx-play: check if strtok_r is available X-Git-Tag: v0.1.3~26 X-Git-Url: https://git.ao2.it/libam7xxx.git/commitdiff_plain/83597605a10608165103f6e6ed61889fbb928511?ds=sidebyside am7xxx-play: check if strtok_r is available On Windows systems, where strtok_r is not available, strtok_s could be used but this needs the C Run-Time library (msvcrt.dll or msvcr80.dll) and we can't distribute it. So for now, when strtok_r is not available, just print a message to warn the user that the '-o' options is not available. --- diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index e24442b..64f15c0 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -37,6 +37,11 @@ if(BUILD_AM7XXX-PLAY) if (HAVE_SIGACTION) add_definitions("-DHAVE_SIGACTION") endif() + + check_symbol_exists(strtok_r "string.h" HAVE_STRTOK_R) + if (HAVE_STRTOK_R) + add_definitions("-DHAVE_STRTOK_R") + endif() set(CMAKE_REQUIRED_DEFINITIONS) # xcb is used to retrieve the full screen dimensions when using x11grab diff --git a/examples/am7xxx-play.c b/examples/am7xxx-play.c index 352ba2f..324ed89 100644 --- a/examples/am7xxx-play.c +++ b/examples/am7xxx-play.c @@ -632,6 +632,7 @@ int main(int argc, char *argv[]) input_path = strdup(optarg); break; case 'o': +#ifdef HAVE_STRTOK_R /* * parse suboptions, the expected format is something * like: @@ -648,6 +649,9 @@ int main(int argc, char *argv[]) av_dict_set(&options, subopt_name, subopt_value, 0); } free(subopts_saved); +#else + fprintf(stderr, "Option '-o' not implemented\n"); +#endif break; case 's': rescale_method = atoi(optarg);