diff options
author | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-06-16 09:03:11 +0000 |
---|---|---|
committer | reimar <reimar@b3059339-0415-0410-9bf9-f77b7e298cf2> | 2005-06-16 09:03:11 +0000 |
commit | 1d0e6ef7cc82ec7933447c02aef16d652e202b55 (patch) | |
tree | b1035aba76a36380eee1c24f406e6a03f9c7e54e /subopt-helper.c | |
parent | a1d7876900be567fe0f2d9b161a08a7cde423b29 (diff) | |
download | mpv-1d0e6ef7cc82ec7933447c02aef16d652e202b55.tar.bz2 mpv-1d0e6ef7cc82ec7933447c02aef16d652e202b55.tar.xz |
support lenght-quoting of strings in subopt parser.
git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@15734 b3059339-0415-0410-9bf9-f77b7e298cf2
Diffstat (limited to 'subopt-helper.c')
-rw-r--r-- | subopt-helper.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/subopt-helper.c b/subopt-helper.c index 611af73e1f..0356e036c4 100644 --- a/subopt-helper.c +++ b/subopt-helper.c @@ -247,10 +247,21 @@ static char const * parse_int( char const * const str, int * const valp ) return endp; } -static char const * parse_str( char const * const str, strarg_t * const valp ) +#define QUOTE_CHAR '%' +static char const * parse_str( char const * str, strarg_t * const valp ) { char const * match = strchr( str, ':' ); + if (str[0] == QUOTE_CHAR) { + int len = 0; + str = &str[1]; + len = (int)strtol(str, (char **)&str, 0); + if (!str || str[0] != QUOTE_CHAR || (len > strlen(str) - 1)) + return NULL; + str = &str[1]; + match = &str[len]; + } + else if ( !match ) match = &str[strlen(str)]; |