summaryrefslogtreecommitdiff
path: root/src/options.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/options.c')
-rw-r--r--src/options.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/options.c b/src/options.c
index cab8079..fa6b999 100644
--- a/src/options.c
+++ b/src/options.c
@@ -6,10 +6,11 @@
static void print_usage(const char *progname)
{
- printf("Usage: %s [-c config_file] [-v[v[v]]] [-q[q[q]]] [-h]\n"
+ printf("Usage: %s [-c config_file] [-v[v[v]]] [-q[q[q]]] [-h] [-s script]\n"
" -v Increase output verbosity (-vvv displays every log message)\n"
" -q Decrease output verbosity (-qqq suppresses even fatal errors)\n"
" -c Specify configuration file to read (default 'config.lua')\n"
+ " -s Override the built-in Lua script\n"
" -h Print this help message and exit\n",
progname);
}
@@ -18,9 +19,10 @@ int parse_options(struct argent_options *opts, int argc, char **argv)
{
opts->log_level = WARN;
opts->conf_filename = "config.lua";
+ opts->script_filename = NULL;
int opt;
- while ((opt = getopt(argc, argv, "hqvc:")) != -1) {
+ while ((opt = getopt(argc, argv, "hqvc:s:")) != -1) {
switch (opt) {
case 'q':
opts->log_level -= 1;
@@ -34,6 +36,10 @@ int parse_options(struct argent_options *opts, int argc, char **argv)
opts->conf_filename = optarg;
break;
+ case 's':
+ opts->script_filename = optarg;
+ break;
+
case 'h':
print_usage(argv[0]);
return 2;