From 5fcbdc9525ae127996366023c517e58a863fa0ae Mon Sep 17 00:00:00 2001 From: Ian Moffett Date: Mon, 9 Feb 2026 16:20:04 -0500 Subject: [PATCH] core: Add initial command line options Signed-off-by: Ian Moffett --- src/main.c | 42 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 41 insertions(+), 1 deletion(-) diff --git a/src/main.c b/src/main.c index a0ccfeb..41b2be7 100644 --- a/src/main.c +++ b/src/main.c @@ -1,7 +1,47 @@ #include +#include +#include + +#define CAV_VERSION "0.0.1" + +static void +help(void) +{ + printf( + "Consume and vomit - blugh!\n" + "--------------------------\n" + "[-h] Display this help menu\n" + "[-v] Display the version\n" + ); +} + +static void +version(void) +{ + printf( + "Consume and vomit - blugh!\n" + "--------------------------\n" + "Copyright (c) 2026, Ian Moffett\n" + "Version %s\n", + CAV_VERSION + ); +} int -main(void) +main(int argc, char **argv) { + int opt; + + while ((opt = getopt(argc, argv, "hv")) != -1) { + switch (opt) { + case 'h': + help(); + return -1; + case 'v': + version(); + return -1; + } + } + return 0; }