settings.c
changeset 3600 b2f245c26617
parent 3599 c09257ed88f8
child 3606 743a2cd312a9
equal deleted inserted replaced
3599:c09257ed88f8 3600:b2f245c26617
   231 			if (comment_size) {
   231 			if (comment_size) {
   232 				item->comment = pool_strdup(&ini->pool, comment, comment_size);
   232 				item->comment = pool_strdup(&ini->pool, comment, comment_size);
   233 				comment_size = 0;
   233 				comment_size = 0;
   234 			}
   234 			}
   235 
   235 
   236 			// for list items, the name and value are the same:
       
   237 			if (group->type == IGT_LIST) {
       
   238 				item->value = item->name;
       
   239 				continue;
       
   240 			}
       
   241 
       
   242 			// find start of parameter
   236 			// find start of parameter
   243 			while (*t == '=' || *t == ' ' || *t == '\t') t++;
   237 			while (*t == '=' || *t == ' ' || *t == '\t') t++;
   244 
   238 
   245 
   239 
   246 			// remove starting quotation marks
   240 			// remove starting quotation marks
   313 
   307 
   314 	for (group = ini->group; group != NULL; group = group->next) {
   308 	for (group = ini->group; group != NULL; group = group->next) {
   315 		if (group->comment) fputs(group->comment, f);
   309 		if (group->comment) fputs(group->comment, f);
   316 		fprintf(f, "[%s]\n", group->name);
   310 		fprintf(f, "[%s]\n", group->name);
   317 		for (item = group->item; item != NULL; item = item->next) {
   311 		for (item = group->item; item != NULL; item = item->next) {
   318 			if (item->comment) fputs(item->comment, f);
   312 			assert(item->value != NULL);
   319 			if (group->type == IGT_LIST)
   313 			if (item->comment != NULL) fputs(item->comment, f);
   320 				fprintf(f, "%s\n", item->value ? item->value : "");
   314 
   321 			else
   315 			//*Don't give an equal sign to list items that don't have a parameter */
   322 				fprintf(f, "%s = %s\n", item->name, item->value ? item->value : "");
   316 			if (group->type == IGT_LIST && *item->value == '\0') {
       
   317 				fprintf(f, "%s\n", item->name);
       
   318 			} else
       
   319 				fprintf(f, "%s = %s\n", item->name, item->value);
   323 		}
   320 		}
   324 	}
   321 	}
   325 	if (ini->comment) fputs(ini->comment, f);
   322 	if (ini->comment) fputs(ini->comment, f);
   326 
   323 
   327 	fclose(f);
   324 	fclose(f);