From aab7700e2bba9216a8343e8e4e0cd0096026ba1a Mon Sep 17 00:00:00 2001 From: pommicket Date: Thu, 11 Sep 2025 19:17:23 -0400 Subject: Reading lines --- examples/Makefile | 5 +++-- examples/conf.pom | 7 +++++++ examples/read_conf.c | 4 ++-- 3 files changed, 12 insertions(+), 4 deletions(-) create mode 100644 examples/conf.pom (limited to 'examples') diff --git a/examples/Makefile b/examples/Makefile index f49e1ae..18bb7a5 100644 --- a/examples/Makefile +++ b/examples/Makefile @@ -1,3 +1,4 @@ -build/read_conf: read_conf.c ../release/libpom.a +PROFILE?=release +build/read_conf: read_conf.c ../$(PROFILE)/libpom.a @mkdir -p build - $(CC) -I.. -Wall -o $@ read_conf.c ../release/libpom.a + $(CC) -I.. -Wall -o $@ read_conf.c ../$(PROFILE)/libpom.a diff --git a/examples/conf.pom b/examples/conf.pom new file mode 100644 index 0000000..efff968 --- /dev/null +++ b/examples/conf.pom @@ -0,0 +1,7 @@ +[0oo] + bar = 10 +# testing + + + + # here's another comment diff --git a/examples/read_conf.c b/examples/read_conf.c index da23534..b18be3a 100644 --- a/examples/read_conf.c +++ b/examples/read_conf.c @@ -2,9 +2,9 @@ #include "pom.h" -int main(void) { +int main(int argc, char **argv) { pom_error *error; - pom_conf *conf = pom_load_path("foo", &error); + pom_conf *conf = pom_load_path(argc >= 2 ? argv[1] : "conf.pom", &error); if (!conf) { pom_error_print(error); free(error); -- cgit v1.2.3