File: emile_second_remove_property.c

package info (click to toggle)
emile 0.10-1
  • links: PTS
  • area: main
  • in suites: etch, etch-m68k
  • size: 1,716 kB
  • ctags: 2,737
  • sloc: ansic: 18,908; makefile: 726; asm: 622; sh: 2
file content (36 lines) | stat: -rw-r--r-- 882 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
/*
 *
 * (c) 2005 Laurent Vivier <LaurentVivier@wanadoo.fr>
 *
 */

#include <stdio.h>
#include <string.h>

#include "libemile.h"

void emile_second_remove_property(char *configuration, char *name)
{
	int index = 0;
	int current = 0;
	char current_name[256];
	char current_property[256];

	while (configuration[index])
	{
		index = emile_second_get_next_property(configuration, index, current_name, current_property);
		if (strcmp(name, current_name) != 0)
		{
			memcpy(configuration + current, current_name, strlen(current_name));
			current += strlen(current_name);
			configuration[current++] = ' ';
			memcpy(configuration + current, current_property, strlen(current_property));
			current += strlen(current_property);
			if (configuration[index])
				configuration[current++] = '\n';
		}
	}
	if (configuration[current-1] == '\n')
		current--;
	configuration[current++] = 0;
}