[Mplayer-cvslog] CVS: main cfgparser.c,1.9,1.10

Szabolcs Berecz szabii at users.sourceforge.net
Mon Mar 19 22:58:22 CET 2001


Update of /cvsroot/mplayer/main
In directory usw-pr-cvs1:/tmp/cvs-serv17588

Modified Files:
	cfgparser.c 
Log Message:
parameter can be in quotes in config file

Index: cfgparser.c
===================================================================
RCS file: /cvsroot/mplayer/main/cfgparser.c,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -r1.9 -r1.10
*** cfgparser.c	2001/03/19 21:06:56	1.9
--- cfgparser.c	2001/03/19 21:58:20	1.10
***************
*** 231,234 ****
--- 231,235 ----
  	char opt[MAX_OPT_LEN];
  	char param[MAX_PARAM_LEN];
+ 	char c;		/* for the "" and '' check */
  	int tmp;
  	int line_num = 0;
***************
*** 317,328 ****
  
  		/* read the parameter */
! 		for (param_pos = 0; isprint(line[line_pos]) && !isspace(line[line_pos])
! 				&& line[line_pos] != '#'; /* NOTHING */) {
! 			param[param_pos++] = line[line_pos++];
! 			if (param_pos >= MAX_PARAM_LEN) {
! 				PRINT_LINENUM;
! 				printf("too long parameter\n");
! 				ret = -1;
! 				continue;
  			}
  		}
--- 318,344 ----
  
  		/* read the parameter */
! 		if (line[line_pos] == '"' || line[line_pos] == '\'') {
! 			c = line[line_pos];
! 			++line_pos;
! 			for (param_pos = 0; line[line_pos] != c; /* NOTHING */) {
! 				param[param_pos++] = line[line_pos++];
! 				if (param_pos >= MAX_PARAM_LEN) {
! 					PRINT_LINENUM;
! 					printf("too long parameter\n");
! 					ret = -1;
! 					continue;
! 				}
! 			}
! 			line_pos++;	/* skip the closing " or ' */
! 		} else {
! 			for (param_pos = 0; isprint(line[line_pos]) && !isspace(line[line_pos])
! 					&& line[line_pos] != '#'; /* NOTHING */) {
! 				param[param_pos++] = line[line_pos++];
! 				if (param_pos >= MAX_PARAM_LEN) {
! 					PRINT_LINENUM;
! 					printf("too long parameter\n");
! 					ret = -1;
! 					continue;
! 				}
  			}
  		}


_______________________________________________
Mplayer-cvslog mailing list
Mplayer-cvslog at lists.sourceforge.net
http://lists.sourceforge.net/lists/listinfo/mplayer-cvslog



More information about the MPlayer-cvslog mailing list