diff --git a/libemile/Makefile b/libemile/Makefile index 7b5c58e..1c2620b 100644 --- a/libemile/Makefile +++ b/libemile/Makefile @@ -36,16 +36,14 @@ SOURCES = emile_block0_write.c emile_checksum.c emile_first_get_param.c \ emile_map_set_startup.c emile_map_write.c \ emile_scsi_create_container.c emile_scsi_get_dev.c \ emile_scsi_get_rdev.c emile_second_get_configuration.c \ - emile_second_set_configuration.c emile_second_get_next_property.c \ - emile_second_get_property.c emile_second_set_property.c \ - emile_second_remove_property.c emile_second_create_mapfile.c \ + emile_second_set_configuration.c emile_second_create_mapfile.c \ emile_second_set_param.c emile_second_get_param.c \ emile_first_set_param_scsi_extents.c emile_map_get_driver_signature.c HEADERS = emile.h libemile.h partition.h bootblock.h CFLAGS = -Wall -Werror -g -CPPFLAGS = -I../libmacos -I../libcontainer -I../libstream +CPPFLAGS = -I../libmacos -I../libcontainer -I../libstream -I../libconfig all: $(LIBRARY) diff --git a/libemile/emile_second_get_next_property.c b/libemile/emile_second_get_next_property.c deleted file mode 100644 index 250a196..0000000 --- a/libemile/emile_second_get_next_property.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - * - * (c) 2005 Laurent Vivier - * - */ - -#include -#include - -#include "libemile.h" - -static char *read_line(char *s) -{ - int read = 0; - while (*s && (*s != '\n')) - { - read++; - s++; - } - if (*s == 0) - return s; - return s + 1; -} - -static char *read_word(char *line, char **next) -{ - char *word; - - while ( (*line == ' ') || (*line == '\t') || (*line == '\n') ) - line++; - - word = line; - - while ( *line && (*line != ' ') && (*line != '\t') && (*line != '\n') ) - line++; - - *next = line; - - return word; -} - -int emile_second_get_next_property(char *configuration, int index, char *name, char *property) -{ - char *next_word, *next_line; - char *current_name, *current_property; - - next_line = configuration + index; - if (*next_line == 0) - return -1; - next_word = next_line; - next_line = read_line(next_line); - - current_name = read_word(next_word, &next_word); - strncpy(name, current_name, next_word - current_name); - name[next_word - current_name] = 0; - - current_property = read_word(next_word, &next_word); - if (next_line - current_property != 0) - { - strncpy(property, current_property, next_line - current_property); - - /* remove '\n' if needed */ - - if (*(next_line - 1) == '\n') - property[next_line - current_property - 1] = 0; - else - property[next_line - current_property] = 0; - } - else - *property = 0; - - return next_line - configuration; -} diff --git a/libemile/emile_second_get_property.c b/libemile/emile_second_get_property.c deleted file mode 100644 index bef3656..0000000 --- a/libemile/emile_second_get_property.c +++ /dev/null @@ -1,25 +0,0 @@ -/* - * - * (c) 2005 Laurent Vivier - * - */ - -#include - -#include "libemile.h" - -int emile_second_get_property(char *configuration, char *name, char *property) -{ - int index = 0; - char current_name[256]; - while (1) - { - index = emile_second_get_next_property(configuration, index, current_name, property); - if (index == -1) - break; - if (strcmp(name, current_name) == 0) - return 0; - } - property[0] = 0; - return -1; -} diff --git a/libemile/emile_second_remove_property.c b/libemile/emile_second_remove_property.c deleted file mode 100644 index 7468eab..0000000 --- a/libemile/emile_second_remove_property.c +++ /dev/null @@ -1,36 +0,0 @@ -/* - * - * (c) 2005 Laurent Vivier - * - */ - -#include -#include - -#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; -} diff --git a/libemile/emile_second_set_property.c b/libemile/emile_second_set_property.c deleted file mode 100644 index a89c96c..0000000 --- a/libemile/emile_second_set_property.c +++ /dev/null @@ -1,38 +0,0 @@ -/* - * - * (c) 2005 Laurent Vivier - * - */ - -#include -#include - -#include "libemile.h" -void emile_second_set_property(char *configuration, char *name, char *property) -{ - 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'; - else - { - configuration[current++] = '\n'; - break; - } - } - } - sprintf(configuration + current, "%s %s", name, property); -}