Browse Source

restructured workdir

master
Chris Cromer 3 years ago
parent
commit
5fa25a03da
5 changed files with 15 additions and 1 deletions
  1. +1
    -1
      Makefile
  2. +8
    -0
      main.c
  3. +0
    -0
      main.h
  4. +6
    -0
      readconfig.c
  5. +0
    -0
      readconfig.h

+ 1
- 1
Makefile View File

@@ -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
- 0
main.c View File

@@ -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);

headers/main.h → main.h View File


+ 6
- 0
readconfig.c View 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) {

headers/readconfig.h → readconfig.h View File


Loading…
Cancel
Save