From 2336f762304fd4d5d43bbd4d53c4bdc21745e4e6 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Wed, 23 Apr 2003 13:10:43 +0000 Subject: [PATCH] Lines read from an option file are only split on the first space if the line starts with "-". Otherwise filenames with spaces in them would require an additional argument before them. --- mkvmerge.1 | 6 +++--- mkvmerge.cpp | 7 ++++--- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/mkvmerge.1 b/mkvmerge.1 index 400f7cd11..79b9d833c 100644 --- a/mkvmerge.1 +++ b/mkvmerge.1 @@ -109,9 +109,9 @@ Show version information. Reads additional command line arguments from the file \fIoptionsfile\fR. Lines whose first non-whitespace character is a hash mark (#) are treated as comments and ignored. Whitespaces at the start and end of a line will -be stripped. If a space is encountered then the line will be split into -exactly two arguments - the string before the space and the string after -it. There is no meta character escaping. +be stripped. If a space is encountered and the line starts with '\-' then +the line will be split into exactly two arguments - the string before the +space and the string after it. There is no meta character escaping. .br The command line \fBmkvmerge \-o "my file.mkv" -A "a movie.avi" sound.ogg\fR could be converted into the following option file: diff --git a/mkvmerge.cpp b/mkvmerge.cpp index ce6c74837..054f93251 100644 --- a/mkvmerge.cpp +++ b/mkvmerge.cpp @@ -13,7 +13,7 @@ /*! \file - \version \$Id: mkvmerge.cpp,v 1.42 2003/04/21 08:29:50 mosu Exp $ + \version \$Id: mkvmerge.cpp,v 1.43 2003/04/23 13:10:43 mosu Exp $ \brief command line parameter parsing, looping, output handling \author Moritz Bunkus */ @@ -818,10 +818,11 @@ static char **read_args_from_file(int &num_args, char **args, char *filename) { continue; space = strchr(buffer, ' '); - if (space != NULL) { + if ((space != NULL) && (buffer[0] == '-')) { *space = 0; space++; - } + } else + space = NULL; args = add_string(num_args, args, buffer); if (space != NULL) args = add_string(num_args, args, space);