diff parser-cfg.c @ 17471:63909962d3fc

Profiles support.
author albeu
date Tue, 24 Jan 2006 11:16:13 +0000
parents e632b43f0598
children 1a14fde7680d
line wrap: on
line diff
--- a/parser-cfg.c	Tue Jan 24 11:14:13 2006 +0000
+++ b/parser-cfg.c	Tue Jan 24 11:16:13 2006 +0000
@@ -37,6 +37,7 @@
 	int ret = 1;
 	int errors = 0;
 	int prev_mode = config->mode;
+	m_profile_t* profile = NULL;
 
 #ifdef MP_DEBUG
 	assert(config != NULL);
@@ -105,6 +106,16 @@
 			continue;
 		}
 		opt[opt_pos] = '\0';
+		
+		/* Profile declaration */
+		if(opt_pos > 2 && opt[0] == '[' && opt[opt_pos-1] == ']') {
+			opt[opt_pos-1] = '\0';
+			if(strcmp(opt+1,"default"))
+				profile = m_config_add_profile(config,opt+1);
+			else
+				profile = NULL;
+			continue;
+		}
 
 #ifdef MP_DEBUG
 		PRINT_LINENUM;
@@ -184,7 +195,14 @@
 			ret = -1;
 		}
 
-		tmp = m_config_set_option(config, opt, param);
+		if(profile) {
+			if(!strcmp(opt,"profile-desc"))
+				m_profile_set_desc(profile,param), tmp = 1;
+			else
+				tmp = m_config_set_profile_option(config,profile,
+								  opt,param);
+		} else
+			tmp = m_config_set_option(config, opt, param);
 		if (tmp < 0) {
 			PRINT_LINENUM;
 			if(tmp == M_OPT_UNKNOWN) {