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.

This commit is contained in:
Moritz Bunkus 2003-04-23 13:10:43 +00:00
parent 742e029de2
commit 2336f76230
2 changed files with 7 additions and 6 deletions

View File

@ -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:

View File

@ -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 <moritz @ bunkus.org>
*/
@ -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);