From b1a6384ac1460bdd5ae2937700068e58f199badf Mon Sep 17 00:00:00 2001 From: Cory McWilliams Date: Fri, 15 Oct 2021 19:44:10 +0000 Subject: [PATCH] Don't allow unexpected arguments. git-svn-id: https://www.unprompted.com/svn/projects/tildefriends/trunk@3670 ed5197a5-7fde-0310-b194-c3ffbd925b24 --- src/main.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index 543e1373..4a83c4f8 100644 --- a/src/main.c +++ b/src/main.c @@ -139,7 +139,7 @@ static int _tf_command_test(const char* file, int argc, char* argv[]) const char** extras = NULL; int extra_count = 0; const char *err = NULL; - XOPT_PARSE(file, XOPT_CTX_KEEPFIRST, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "test [options]", "options:", NULL, 15); + XOPT_PARSE(file, XOPT_CTX_KEEPFIRST | XOPT_CTX_STRICT, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "test [options]", "options:", NULL, 15); if (extras) { free((void*)extras); @@ -184,7 +184,7 @@ static int _tf_command_import(const char* file, int argc, char* argv[]) const char** extras = NULL; int extra_count = 0; const char *err = NULL; - XOPT_PARSE(file, XOPT_CTX_KEEPFIRST | XOPT_CTX_POSIXMEHARDER, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "import [options] [paths] ...", "options:", NULL, 15); + XOPT_PARSE(file, XOPT_CTX_KEEPFIRST | XOPT_CTX_POSIXMEHARDER | XOPT_CTX_STRICT, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "import [options] [paths] ...", "options:", NULL, 15); if (err) { @@ -250,7 +250,7 @@ static int _tf_command_export(const char* file, int argc, char* argv[]) const char** extras = NULL; int extra_count = 0; const char *err = NULL; - XOPT_PARSE(file, XOPT_CTX_KEEPFIRST | XOPT_CTX_POSIXMEHARDER, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "export [options] [paths] ...", "options:", NULL, 15); + XOPT_PARSE(file, XOPT_CTX_KEEPFIRST | XOPT_CTX_POSIXMEHARDER | XOPT_CTX_STRICT, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "export [options] [paths] ...", "options:", NULL, 15); if (err) { @@ -330,7 +330,7 @@ static int _tf_command_run(const char* file, int argc, char* argv[]) const char** extras = NULL; int extra_count = 0; const char *err = NULL; - XOPT_PARSE(file, XOPT_CTX_KEEPFIRST | XOPT_CTX_POSIXMEHARDER, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "run [options] [paths] ...", "options:", NULL, 15); + XOPT_PARSE(file, XOPT_CTX_KEEPFIRST | XOPT_CTX_POSIXMEHARDER | XOPT_CTX_STRICT, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "run [options] [paths] ...", "options:", NULL, 15); if (err) { @@ -394,7 +394,7 @@ static int _tf_command_sandbox(const char* file, int argc, char* argv[]) const char** extras = NULL; int extra_count = 0; const char *err = NULL; - XOPT_PARSE(file, XOPT_CTX_KEEPFIRST | XOPT_CTX_POSIXMEHARDER, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "sandbox [options]", "options:", NULL, 15); + XOPT_PARSE(file, XOPT_CTX_KEEPFIRST | XOPT_CTX_POSIXMEHARDER | XOPT_CTX_STRICT, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "sandbox [options]", "options:", NULL, 15); if (err) { @@ -446,7 +446,7 @@ static int _tf_command_post(const char* file, int argc, char* argv[]) const char** extras = NULL; int extra_count = 0; const char *err = NULL; - XOPT_PARSE(file, XOPT_CTX_KEEPFIRST, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "post [options]", "options:", NULL, 15); + XOPT_PARSE(file, XOPT_CTX_KEEPFIRST | XOPT_CTX_STRICT, options, &args, argc, (const char**)argv, &extra_count, &extras, &err, stderr, "post [options]", "options:", NULL, 15); if (extras) { free((void*)extras);