From 21cd0846eec29e7f9cae8e5faab0c6f4461d3e4d Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 16 Feb 2002 03:24:50 +0000 Subject: [PATCH] workaround for old popt versions, maybe this is the best way anyway (not alowing for command line args that are not p... Original commit message from CVS: workaround for old popt versions, maybe this is the best way anyway (not alowing for command line args that are not parsed with popt) --- gst/gst.c | 25 +++++++++++++++++++++---- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/gst/gst.c b/gst/gst.c index 45d379c..f68ac06 100644 --- a/gst/gst.c +++ b/gst/gst.c @@ -21,6 +21,7 @@ */ #include +#include #include "gst_private.h" @@ -114,13 +115,13 @@ void gst_init (int *argc, char **argv[]) { poptContext context; - gint nextopt; + gint nextopt, i, j, nstrip; const struct poptOption *options = gst_init_get_popt_table (); + gchar **temp; context = poptGetContext ("GStreamer", *argc, (const char**)*argv, options, 0); - while ((nextopt = poptGetNextOpt (context)) > 0 || nextopt == POPT_ERROR_BADOPT) - /* do nothing */ ; + while ((nextopt = poptGetNextOpt (context)) > 0); /* do nothing, it's all callbacks */ if (nextopt != -1) { g_print ("Error on option %s: %s.\nRun '%s --help' to see a full list of available command line options.\n", @@ -129,7 +130,23 @@ gst_init (int *argc, char **argv[]) (*argv)[0]); exit (1); } - *argc = poptStrippedArgv (context, *argc, *argv); + + /* let's do this once there are 1.6.3 popt debs out + *argc = poptStrippedArgv (context, *argc, *argv); */ + + /* until then we'll do a very basic arg permutation + this will break gst-launch -o */ + temp = *argv + 1; + i = 1; + nstrip = 0; + g_assert (*argc > 0); + while (i++ < *argc && *temp[0]=='-') { + for (j = 1; j < *argc - 1; j++) + (*argv)[j] = (*argv)[j+1]; + (*argv)[*argc-1] = *temp; + nstrip++; + } + *argc -= nstrip; } static void -- 2.7.4