mirror of
https://git.code.sf.net/p/zint/code
synced 2026-08-09 06:48:53 +00:00
CLI: warn if "--primary" given but not MaxiCode or Composite
This commit is contained in:
@@ -411,6 +411,12 @@ static void to_lower(char source[]) {
|
||||
}
|
||||
}
|
||||
|
||||
/* Whether `symbology` can have composite 2D component data (copy of `z_is_composite()` from "common.c") */
|
||||
static int is_composite(const int symbology) {
|
||||
return (symbology >= BARCODE_EANX_CC && symbology <= BARCODE_DBAR_EXPSTK_CC)
|
||||
|| symbology == BARCODE_EAN8_CC || symbology == BARCODE_EAN13_CC;
|
||||
}
|
||||
|
||||
/* Return symbology id if `barcode_name` a barcode name */
|
||||
#ifdef ZINT_TEST
|
||||
static int get_barcode_name(const char *const barcode_name, const int test) {
|
||||
@@ -2344,6 +2350,12 @@ int main(int argc, char **argv) {
|
||||
fflush(stderr);
|
||||
warn_number = ZINT_WARN_INVALID_OPTION;
|
||||
}
|
||||
if (my_symbol->primary[0] && symbology != BARCODE_MAXICODE && !is_composite(symbology)) {
|
||||
fprintf(stderr, "Warning 162: Primary '%s' given but not MaxiCode or GS1 Composite, **IGNORED**\n",
|
||||
my_symbol->primary);
|
||||
fflush(stderr);
|
||||
warn_number = ZINT_WARN_INVALID_OPTION;
|
||||
}
|
||||
if (batch_mode) {
|
||||
/* Take each line of text as a separate data set */
|
||||
if (data_arg_num > 1) {
|
||||
|
||||
Reference in New Issue
Block a user