restructured workdir
This commit is contained in:
parent
4d6c51e37b
commit
5fa25a03da
2
Makefile
2
Makefile
@ -3,7 +3,7 @@ BINDIR=out
|
||||
|
||||
DEBUG_FLAGS=-Wall -Werror
|
||||
|
||||
CFLAGS=$(DEBUG_FLAGS) -ggdb $(shell pkg-config libxml-2.0 --cflags) -ansi -I ./headers
|
||||
CFLAGS=$(DEBUG_FLAGS) -ggdb $(shell pkg-config libxml-2.0 --cflags) -ansi
|
||||
LDFLAGS=$(shell pkg-config libxml-2.0 --libs)
|
||||
|
||||
BINARY=generarxml
|
||||
|
8
main.c
8
main.c
@ -31,12 +31,20 @@ int main(int argc, char **argv) {
|
||||
}
|
||||
else {
|
||||
/* Incorrect usage */
|
||||
if (config_file != NULL) {
|
||||
free(config_file);
|
||||
}
|
||||
printusage(1);
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
config = (CONFIG *) malloc(sizeof(CONFIG));
|
||||
config->file = NULL;
|
||||
config->bible = NULL;
|
||||
config->book = NULL;
|
||||
config->chapter = NULL;
|
||||
config->chapter_numbers = NULL;
|
||||
|
||||
int status = readconfig(config_file, config);
|
||||
free(config_file);
|
||||
|
@ -41,6 +41,12 @@ int readconfig(char *config_file, CONFIG *config) {
|
||||
|
||||
root = xmlDocGetRootElement(config_xml);
|
||||
|
||||
if (root == NULL) {
|
||||
fprintf(stderr,"El archivo %s no contiene xml\n", config_file);
|
||||
xmlFreeDoc(config_xml);
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* Run through the nodes to find the config information. */
|
||||
node = root->xmlChildrenNode;
|
||||
while (node != NULL) {
|
||||
|
Loading…
Reference in New Issue
Block a user