]> git.sesse.net Git - vlc/blobdiff - bin/cachegen.c
Always build and use "our" getopt
[vlc] / bin / cachegen.c
index 5792ea19658154ed0369b90f237cb3bd0c6f51ca..8c96f08735fe2caf8fe9834254c83ff58ca5323b 100644 (file)
 #include <vlc/vlc.h>
 #include <stdio.h>
 #include <stdlib.h>
-#include <locale.h>
+
+#ifdef HAVE_SETLOCALE
+# include <locale.h>
+#endif
 
 #ifdef HAVE_GETOPT_H
 # include <getopt.h>
@@ -56,7 +59,9 @@ int main (int argc, char *argv[])
         { NULL,         no_argument,       NULL, '\0'}
     };
 
+#ifdef HAVE_SETLOCALE
     setlocale (LC_CTYPE, ""); /* needed by FromLocale() */
+#endif
 
     int c;
     while ((c = getopt_long (argc, argv, "hV", opts, NULL)) != -1)
@@ -85,14 +90,13 @@ int main (int argc, char *argv[])
         const char *const vlc_argv[] = {
             "--ignore-config",
             "--quiet",
+            "--no-media-library",
             arg,
             NULL,
         };
+        size_t vlc_argc = sizeof (vlc_argv) / sizeof (vlc_argv[0]) - 1;
 
-        libvlc_exception_t ex;
-        libvlc_exception_init (&ex);
-
-        libvlc_instance_t *vlc = libvlc_new (3, vlc_argv, &ex);
+        libvlc_instance_t *vlc = libvlc_new (vlc_argc, vlc_argv);
         if (vlc != NULL)
             libvlc_release (vlc);
         free (arg);