core: Add initial command line options
Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
42
src/main.c
42
src/main.c
@@ -1,7 +1,47 @@
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user