mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-17 03:35:21 +00:00
Escape spaces in the cmdline args with "\\ " so that parse can handle it.
Original commit message from CVS: Escape spaces in the cmdline args with "\\ " so that parse can handle it.
This commit is contained in:
parent
704918c3fa
commit
86bdfc6663
1 changed files with 11 additions and 0 deletions
|
@ -10,6 +10,7 @@ main(int argc, char *argv[])
|
|||
GstElement *pipeline;
|
||||
char **argvn;
|
||||
gchar *cmdline;
|
||||
int i;
|
||||
|
||||
gst_init (&argc, &argv);
|
||||
|
||||
|
@ -18,6 +19,16 @@ main(int argc, char *argv[])
|
|||
// make a null-terminated version of argv
|
||||
argvn = g_new0 (char *,argc);
|
||||
memcpy (argvn, argv+1, sizeof (char*) * (argc-1));
|
||||
|
||||
// escape spaces
|
||||
for (i=0; i<argc-1; i++) {
|
||||
gchar **split;
|
||||
|
||||
split = g_strsplit (argvn[i], " ", 0);
|
||||
|
||||
argvn[i] = g_strjoinv ("\\ ", split);
|
||||
g_strfreev (split);
|
||||
}
|
||||
// join the argvs together
|
||||
cmdline = g_strjoinv (" ", argvn);
|
||||
// free the null-terminated argv
|
||||
|
|
Loading…
Reference in a new issue