diff options
-rw-r--r-- | .gitignore | 1 | ||||
-rwxr-xr-x | scripts/buildmk.sh | 2 | ||||
-rw-r--r-- | test/Makefile | 6 | ||||
-rw-r--r-- | test/main.c | 22 |
4 files changed, 30 insertions, 1 deletions
@@ -7,3 +7,4 @@ y.* *-parser.* *.a *.so +test/test diff --git a/scripts/buildmk.sh b/scripts/buildmk.sh index 5edff96..5139ee3 100755 --- a/scripts/buildmk.sh +++ b/scripts/buildmk.sh @@ -8,7 +8,7 @@ gen_obj() done } -SRC="$(find * -name '*.c') properties-parser.c properties-lexer.c" +SRC="utils/string.c properties-parser.c properties-lexer.c" OBJA=$(gen_obj build/static/) OBJSO=$(gen_obj build/shared/) diff --git a/test/Makefile b/test/Makefile new file mode 100644 index 0000000..8215134 --- /dev/null +++ b/test/Makefile @@ -0,0 +1,6 @@ +test: + cc -c main.c -o main.o + cc main.o -L.. -l:libproperties.a -o $@ + +clean: + rm -rf test diff --git a/test/main.c b/test/main.c new file mode 100644 index 0000000..479c5fa --- /dev/null +++ b/test/main.c @@ -0,0 +1,22 @@ +#include <stdio.h> +#include <stdlib.h> +#include <string.h> + +void properties_load(FILE *file); + +int +main(int argc, char **argv) +{ + FILE *file; + + for (int i = 1; i < argc; i++) { + if (strcmp(argv[i], "-f") == 0 && (i + 1) < argc) { + file = fopen(argv[i + 1], "r"); + break; + } + } + + properties_load(file); + + return EXIT_SUCCESS; +} |