mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Make CLI errors more consistent
Should now output errors and warnings in a consistent and predictable fashion. This is not a neat solution, but functional for now.
This commit is contained in:
parent
ae57d413bf
commit
d2161ffb20
@ -1062,6 +1062,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||||||
for (i = 0; i < in_length; i++) {
|
for (i = 0; i < in_length; i++) {
|
||||||
if (source[i] == '\0') {
|
if (source[i] == '\0') {
|
||||||
strcpy(symbol->errtxt, "219: NULL characters not permitted in GS1 mode");
|
strcpy(symbol->errtxt, "219: NULL characters not permitted in GS1 mode");
|
||||||
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_DATA);
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1073,6 +1074,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||||||
in_length =(int)ustrlen(local_source);
|
in_length =(int)ustrlen(local_source);
|
||||||
} else {
|
} else {
|
||||||
strcpy(symbol->errtxt, "220: Selected symbology does not support GS1 mode");
|
strcpy(symbol->errtxt, "220: Selected symbology does not support GS1 mode");
|
||||||
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1083,6 +1085,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||||||
if (symbol->input_mode & ESCAPE_MODE) {
|
if (symbol->input_mode & ESCAPE_MODE) {
|
||||||
error_number = escape_char_process(symbol, local_source, &in_length);
|
error_number = escape_char_process(symbol, local_source, &in_length);
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
|
error_tag(symbol->errtxt, error_number);
|
||||||
return error_number;
|
return error_number;
|
||||||
}
|
}
|
||||||
symbol->input_mode -= ESCAPE_MODE;
|
symbol->input_mode -= ESCAPE_MODE;
|
||||||
@ -1102,6 +1105,7 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||||||
|
|
||||||
if ((symbol->dot_size < 0.01) || (symbol->dot_size > 20.0)) {
|
if ((symbol->dot_size < 0.01) || (symbol->dot_size > 20.0)) {
|
||||||
strcpy(symbol->errtxt, "221: Invalid dot size");
|
strcpy(symbol->errtxt, "221: Invalid dot size");
|
||||||
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1123,10 +1127,6 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||||||
/* Try another ECI mode */
|
/* Try another ECI mode */
|
||||||
symbol->eci = get_best_eci(local_source, in_length);
|
symbol->eci = get_best_eci(local_source, in_length);
|
||||||
|
|
||||||
error_number = ZINT_WARN_USES_ECI;
|
|
||||||
strcpy(symbol->errtxt, "222: Encoded data includes ECI codes");
|
|
||||||
//printf("Data will encode with ECI %d\n", symbol->eci);
|
|
||||||
|
|
||||||
switch (symbol->symbology) {
|
switch (symbol->symbology) {
|
||||||
case BARCODE_QRCODE:
|
case BARCODE_QRCODE:
|
||||||
case BARCODE_MICROQR:
|
case BARCODE_MICROQR:
|
||||||
@ -1139,7 +1139,12 @@ int ZBarcode_Encode(struct zint_symbol *symbol, const unsigned char *source, int
|
|||||||
error_number = reduced_charset(symbol, local_source, in_length);
|
error_number = reduced_charset(symbol, local_source, in_length);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (error_number == 0) {
|
||||||
|
error_number = ZINT_WARN_USES_ECI;
|
||||||
|
strcpy(symbol->errtxt, "222: Encoded data includes ECI");
|
||||||
|
if (symbol->debug) printf("Data ECI %d\n", symbol->eci);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (error_number == 0) {
|
if (error_number == 0) {
|
||||||
@ -1174,12 +1179,14 @@ int ZBarcode_Print(struct zint_symbol *symbol, int rotate_angle) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(symbol->errtxt, "223: Invalid rotation angle");
|
strcpy(symbol->errtxt, "223: Invalid rotation angle");
|
||||||
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (symbol->output_options & BARCODE_DOTTY_MODE) {
|
if (symbol->output_options & BARCODE_DOTTY_MODE) {
|
||||||
if (!(is_matrix(symbol->symbology))) {
|
if (!(is_matrix(symbol->symbology))) {
|
||||||
strcpy(symbol->errtxt, "224: Selected symbology cannot be rendered as dots");
|
strcpy(symbol->errtxt, "224: Selected symbology cannot be rendered as dots");
|
||||||
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1264,6 +1271,7 @@ int ZBarcode_Buffer(struct zint_symbol *symbol, int rotate_angle) {
|
|||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
strcpy(symbol->errtxt, "228: Invalid rotation angle");
|
strcpy(symbol->errtxt, "228: Invalid rotation angle");
|
||||||
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
||||||
return ZINT_ERROR_INVALID_OPTION;
|
return ZINT_ERROR_INVALID_OPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1310,6 +1318,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename) {
|
|||||||
file = fopen(filename, "rb");
|
file = fopen(filename, "rb");
|
||||||
if (!file) {
|
if (!file) {
|
||||||
strcpy(symbol->errtxt, "229: Unable to read input file");
|
strcpy(symbol->errtxt, "229: Unable to read input file");
|
||||||
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_OPTION);
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1321,6 +1330,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename) {
|
|||||||
if (fileLen > 7100) {
|
if (fileLen > 7100) {
|
||||||
/* The largest amount of data that can be encoded is 7089 numeric digits in QR Code */
|
/* The largest amount of data that can be encoded is 7089 numeric digits in QR Code */
|
||||||
strcpy(symbol->errtxt, "230: Input file too long");
|
strcpy(symbol->errtxt, "230: Input file too long");
|
||||||
|
error_tag(symbol->errtxt, ZINT_ERROR_INVALID_DATA);
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return ZINT_ERROR_INVALID_DATA;
|
return ZINT_ERROR_INVALID_DATA;
|
||||||
}
|
}
|
||||||
@ -1330,6 +1340,7 @@ int ZBarcode_Encode_File(struct zint_symbol *symbol, char *filename) {
|
|||||||
buffer = (unsigned char *) malloc(fileLen * sizeof (unsigned char));
|
buffer = (unsigned char *) malloc(fileLen * sizeof (unsigned char));
|
||||||
if (!buffer) {
|
if (!buffer) {
|
||||||
strcpy(symbol->errtxt, "231: Internal memory error");
|
strcpy(symbol->errtxt, "231: Internal memory error");
|
||||||
|
error_tag(symbol->errtxt, ZINT_ERROR_MEMORY);
|
||||||
if (strcmp(filename, "-"))
|
if (strcmp(filename, "-"))
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return ZINT_ERROR_MEMORY;
|
return ZINT_ERROR_MEMORY;
|
||||||
|
@ -344,7 +344,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c
|
|||||||
posn++;
|
posn++;
|
||||||
}
|
}
|
||||||
if (posn > 7090) {
|
if (posn > 7090) {
|
||||||
fprintf(stderr, "103 on line %d: Input data too long\n", line_count);
|
fprintf(stderr, "On line %d: Error 103: Input data too long\n", line_count);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
do {
|
do {
|
||||||
character = fgetc(file);
|
character = fgetc(file);
|
||||||
@ -353,7 +353,7 @@ int batch_process(struct zint_symbol *symbol, char *filename, int mirror_mode, c
|
|||||||
} while ((!feof(file)) && (line_count < 2000000000));
|
} while ((!feof(file)) && (line_count < 2000000000));
|
||||||
|
|
||||||
if (character != '\n') {
|
if (character != '\n') {
|
||||||
fprintf(stderr, "warning 104: No newline at end of file\n");
|
fprintf(stderr, "Warning 104: No newline at end of file\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,7 +503,7 @@ int main(int argc, char **argv) {
|
|||||||
my_symbol->scale = (float) (atof(optarg));
|
my_symbol->scale = (float) (atof(optarg));
|
||||||
if (my_symbol->scale < 0.01) {
|
if (my_symbol->scale < 0.01) {
|
||||||
/* Zero and negative values are not permitted */
|
/* Zero and negative values are not permitted */
|
||||||
fprintf(stderr, "105: Invalid scale value\n");
|
fprintf(stderr, "Warning 105: Invalid scale value\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
my_symbol->scale = 1.0;
|
my_symbol->scale = 1.0;
|
||||||
}
|
}
|
||||||
@ -512,7 +512,7 @@ int main(int argc, char **argv) {
|
|||||||
my_symbol->dot_size = (float) (atof(optarg));
|
my_symbol->dot_size = (float) (atof(optarg));
|
||||||
if (my_symbol->dot_size < 0.01) {
|
if (my_symbol->dot_size < 0.01) {
|
||||||
/* Zero and negative values are not permitted */
|
/* Zero and negative values are not permitted */
|
||||||
fprintf(stderr, "106: Invalid dot radius value\n");
|
fprintf(stderr, "Warning 106: Invalid dot radius value\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
my_symbol->dot_size = 4.0F / 5.0F;
|
my_symbol->dot_size = 4.0F / 5.0F;
|
||||||
}
|
}
|
||||||
@ -520,26 +520,26 @@ int main(int argc, char **argv) {
|
|||||||
if (!strcmp(long_options[option_index].name, "border")) {
|
if (!strcmp(long_options[option_index].name, "border")) {
|
||||||
error_number = validator(NESET, optarg);
|
error_number = validator(NESET, optarg);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
fprintf(stderr, "107: Invalid border width\n");
|
fprintf(stderr, "Error 107: Invalid border width\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) {
|
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) {
|
||||||
my_symbol->border_width = atoi(optarg);
|
my_symbol->border_width = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "108: Border width out of range\n");
|
fprintf(stderr, "Warning 108: Border width out of range\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!strcmp(long_options[option_index].name, "height")) {
|
if (!strcmp(long_options[option_index].name, "height")) {
|
||||||
error_number = validator(NESET, optarg);
|
error_number = validator(NESET, optarg);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
fprintf(stderr, "109: Invalid symbol height\n");
|
fprintf(stderr, "Error 109: Invalid symbol height\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 1000)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 1000)) {
|
||||||
my_symbol->height = atoi(optarg);
|
my_symbol->height = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "110: Symbol height out of range\n");
|
fprintf(stderr, "Warning 110: Symbol height out of range\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -548,7 +548,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 66)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 66)) {
|
||||||
my_symbol->option_2 = atoi(optarg);
|
my_symbol->option_2 = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "111: Number of columns out of range\n");
|
fprintf(stderr, "Warning 111: Number of columns out of range\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -556,7 +556,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 44)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 44)) {
|
||||||
my_symbol->option_1 = atoi(optarg);
|
my_symbol->option_1 = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "112: Number of rows out of range\n");
|
fprintf(stderr, "Warning 112: Number of rows out of range\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -564,7 +564,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 84)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 84)) {
|
||||||
my_symbol->option_2 = atoi(optarg);
|
my_symbol->option_2 = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "113: Invalid Version\n");
|
fprintf(stderr, "Warning 113: Invalid Version\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -572,7 +572,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 8)) {
|
if ((atoi(optarg) >= 1) && (atoi(optarg) <= 8)) {
|
||||||
my_symbol->option_1 = atoi(optarg);
|
my_symbol->option_1 = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "114: ECC level out of range\n");
|
fprintf(stderr, "Warning 114: ECC level out of range\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -580,7 +580,7 @@ int main(int argc, char **argv) {
|
|||||||
if (strlen(optarg) <= 90) {
|
if (strlen(optarg) <= 90) {
|
||||||
strcpy(my_symbol->primary, optarg);
|
strcpy(my_symbol->primary, optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "115: Primary data string too long");
|
fprintf(stderr, "Error 115: Primary data string too long");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -588,7 +588,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((optarg[0] >= '0') && (optarg[0] <= '6')) {
|
if ((optarg[0] >= '0') && (optarg[0] <= '6')) {
|
||||||
my_symbol->option_1 = optarg[0] - '0';
|
my_symbol->option_1 = optarg[0] - '0';
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "116: Invalid mode\n");
|
fprintf(stderr, "Warning 116: Invalid mode\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -596,7 +596,7 @@ int main(int argc, char **argv) {
|
|||||||
/* Only certain inputs allowed */
|
/* Only certain inputs allowed */
|
||||||
error_number = validator(NESET, optarg);
|
error_number = validator(NESET, optarg);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
fprintf(stderr, "117: Invalid rotation parameter\n");
|
fprintf(stderr, "Error 117: Invalid rotation parameter\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
switch (atoi(optarg)) {
|
switch (atoi(optarg)) {
|
||||||
@ -626,7 +626,7 @@ int main(int argc, char **argv) {
|
|||||||
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 999999)) {
|
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 999999)) {
|
||||||
my_symbol->eci = atoi(optarg);
|
my_symbol->eci = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "118: Invalid ECI code\n");
|
fprintf(stderr, "Warning 118: Invalid ECI code\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -655,7 +655,7 @@ int main(int argc, char **argv) {
|
|||||||
case 'b':
|
case 'b':
|
||||||
error_number = validator(NESET, optarg);
|
error_number = validator(NESET, optarg);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
fprintf(stderr, "119: Invalid barcode type\n");
|
fprintf(stderr, "Error 119: Invalid barcode type\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
my_symbol->symbology = atoi(optarg);
|
my_symbol->symbology = atoi(optarg);
|
||||||
@ -664,13 +664,13 @@ int main(int argc, char **argv) {
|
|||||||
case 'w':
|
case 'w':
|
||||||
error_number = validator(NESET, optarg);
|
error_number = validator(NESET, optarg);
|
||||||
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
if (error_number == ZINT_ERROR_INVALID_DATA) {
|
||||||
fprintf(stderr, "120: Invalid whitespace value\n");
|
fprintf(stderr, "Error 120: Invalid whitespace value\n");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) {
|
if ((atoi(optarg) >= 0) && (atoi(optarg) <= 1000)) {
|
||||||
my_symbol->whitespace_width = atoi(optarg);
|
my_symbol->whitespace_width = atoi(optarg);
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "121: Whitespace value out of range");
|
fprintf(stderr, "Warning 121: Whitespace value out of range");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -682,22 +682,23 @@ int main(int argc, char **argv) {
|
|||||||
strcat(my_symbol->outfile, filetype);
|
strcat(my_symbol->outfile, filetype);
|
||||||
}
|
}
|
||||||
error_number = ZBarcode_Encode(my_symbol, (unsigned char*) optarg, strlen(optarg));
|
error_number = ZBarcode_Encode(my_symbol, (unsigned char*) optarg, strlen(optarg));
|
||||||
if (error_number < 5) {
|
generated = 1;
|
||||||
|
if (error_number != 0) {
|
||||||
|
fprintf(stderr, "%s\n", my_symbol->errtxt);
|
||||||
|
fflush(stderr);
|
||||||
|
}
|
||||||
|
if (error_number < 5) {
|
||||||
|
error_number = ZBarcode_Print(my_symbol, rotate_angle);
|
||||||
|
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
fprintf(stderr, "%s\n", my_symbol->errtxt);
|
fprintf(stderr, "%s\n", my_symbol->errtxt);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
|
ZBarcode_Delete(my_symbol);
|
||||||
|
return 1;
|
||||||
}
|
}
|
||||||
error_number = ZBarcode_Print(my_symbol, rotate_angle);
|
|
||||||
}
|
|
||||||
generated = 1;
|
|
||||||
if (error_number != 0) {
|
|
||||||
fprintf(stderr, "%s\n", my_symbol->errtxt);
|
|
||||||
fflush(stderr);
|
|
||||||
ZBarcode_Delete(my_symbol);
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
fprintf(stderr, "122: Cannot define data in batch mode");
|
fprintf(stderr, "Warning 122: Can't define data in batch mode");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
@ -705,19 +706,19 @@ int main(int argc, char **argv) {
|
|||||||
case 'i': /* Take data from file */
|
case 'i': /* Take data from file */
|
||||||
if (batch_mode == 0) {
|
if (batch_mode == 0) {
|
||||||
error_number = ZBarcode_Encode_File(my_symbol, optarg);
|
error_number = ZBarcode_Encode_File(my_symbol, optarg);
|
||||||
if (error_number < 5) {
|
|
||||||
if (error_number != 0) {
|
|
||||||
fprintf(stderr, "%s\n", my_symbol->errtxt);
|
|
||||||
fflush(stderr);
|
|
||||||
}
|
|
||||||
error_number = ZBarcode_Print(my_symbol, rotate_angle);
|
|
||||||
}
|
|
||||||
generated = 1;
|
generated = 1;
|
||||||
if (error_number != 0) {
|
if (error_number != 0) {
|
||||||
fprintf(stderr, "%s\n", my_symbol->errtxt);
|
fprintf(stderr, "%s\n", my_symbol->errtxt);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
ZBarcode_Delete(my_symbol);
|
}
|
||||||
return 1;
|
if (error_number < 5) {
|
||||||
|
error_number = ZBarcode_Print(my_symbol, rotate_angle);
|
||||||
|
if (error_number != 0) {
|
||||||
|
fprintf(stderr, "%s\n", my_symbol->errtxt);
|
||||||
|
fflush(stderr);
|
||||||
|
ZBarcode_Delete(my_symbol);
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* Take each line of text as a separate data set */
|
/* Take each line of text as a separate data set */
|
||||||
@ -748,13 +749,13 @@ int main(int argc, char **argv) {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "123: ?? getopt error 0%o\n", c);
|
fprintf(stderr, "Error 123: ?? getopt error 0%o\n", c);
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (optind < argc) {
|
if (optind < argc) {
|
||||||
fprintf(stderr, "125: Invalid option\n");
|
fprintf(stderr, "Error 125: Invalid option\n");
|
||||||
while (optind < argc)
|
while (optind < argc)
|
||||||
fprintf(stderr, "%s", argv[optind++]);
|
fprintf(stderr, "%s", argv[optind++]);
|
||||||
fprintf(stderr, "\n");
|
fprintf(stderr, "\n");
|
||||||
@ -762,7 +763,7 @@ int main(int argc, char **argv) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (generated == 0) {
|
if (generated == 0) {
|
||||||
fprintf(stderr, "124: No data received, no symbol generated\n");
|
fprintf(stderr, "Warning 124: No data received, no symbol generated\n");
|
||||||
fflush(stderr);
|
fflush(stderr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user