1
0
mirror of https://git.code.sf.net/p/zint/code synced 2026-07-31 10:29:52 +00:00

CLI: differentiate between unknown & ambiguous options using new

`is_ambiguous_opt()` func, which necessitated moving `options`
  enum & `long_options[]` to file scope, & sorting `long_options[]`
This commit is contained in:
gitlost
2026-07-26 02:49:26 +01:00
parent 3a76ce7a77
commit d6a4bdfe90
2 changed files with 184 additions and 115 deletions
+3
View File
@@ -1381,6 +1381,9 @@ static void test_bad_args(const testCtx *const p_ctx) {
/* 0*/ { BARCODE_CODE128, NULL, -1, NULL, NULL, "Error 109: Option '-d' requires an argument" },
/* 1*/ { BARCODE_CODE128, "1", -1, " -o", NULL, "Error 109: Option '-o' requires an argument" },
/* 2*/ { BARCODE_CODE128, "1", -1, " --fast=", "1", "Error 126: Option '--fast' does not take an argument" },
/* 3*/ { BARCODE_CODE128, "1", -1, " -x", NULL, "Error 101: Unknown option '-x'" },
/* 4*/ { BARCODE_CODE128, "1", -1, " --x", NULL, "Error 101: Unknown option '--x'" },
/* 5*/ { BARCODE_CODE128, "1", -1, " --dm", NULL, "Error 187: Ambiguous option '--dm'" },
};
int data_size = ARRAY_SIZE(data);
int i;