summaryrefslogtreecommitdiffstats
path: root/subopt-helper.c
diff options
context:
space:
mode:
Diffstat (limited to 'subopt-helper.c')
-rw-r--r--subopt-helper.c13
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)];