diff options
Diffstat (limited to 'src/options.c')
-rw-r--r-- | src/options.c | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/src/options.c b/src/options.c new file mode 100644 index 0000000..b3836a7 --- /dev/null +++ b/src/options.c @@ -0,0 +1,35 @@ +#include <stdio.h> +#include <unistd.h> + +#include "options.h" + +static void print_usage(const char *progname) +{ + printf("Usage: %s [-c config_file] [-o output_directory]\n", + progname); +} + +int parse_options(struct argent_options *opts, int argc, char **argv) +{ + opts->conf_filename = "argent.lua"; + opts->output_dir = "build"; + + int opt; + while ((opt = getopt(argc, argv, "c:o:")) != -1) { + switch (opt) { + case 'c': + opts->conf_filename = optarg; + break; + + case 'o': + opts->output_dir = optarg; + break; + + default: + print_usage(argv[0]); + return 1; + } + } + + return 0; +} |