am7xxx-play: check if strtok_r is available
authorAntonio Ospite <ospite@studenti.unina.it>
Tue, 22 May 2012 14:23:10 +0000 (16:23 +0200)
committerAntonio Ospite <ospite@studenti.unina.it>
Tue, 22 May 2012 14:41:40 +0000 (16:41 +0200)
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.

examples/CMakeLists.txt
examples/am7xxx-play.c

index e24442b..64f15c0 100644 (file)
@@ -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
index 352ba2f..324ed89 100644 (file)
@@ -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);