[MPlayer-cvslog] CVS: main subopt-helper.c,1.5,1.6

Reimar Döffinger CVS syncmail at mplayerhq.hu
Thu Jun 16 11:03:13 CEST 2005


CVS change done by Reimar Döffinger CVS

Update of /cvsroot/mplayer/main
In directory mail:/var2/tmp/cvs-serv15289

Modified Files:
	subopt-helper.c 
Log Message:
support lenght-quoting of strings in subopt parser.


Index: subopt-helper.c
===================================================================
RCS file: /cvsroot/mplayer/main/subopt-helper.c,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- subopt-helper.c	19 Feb 2005 20:14:00 -0000	1.5
+++ subopt-helper.c	16 Jun 2005 09:03:11 -0000	1.6
@@ -247,10 +247,21 @@
   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)];
 




More information about the MPlayer-cvslog mailing list