mirror of
https://github.com/zint/zint
synced 2024-11-16 20:57:25 +13:00
Add --notext option.
This commit is contained in:
parent
40ca0fe17c
commit
190360ea6a
@ -94,6 +94,7 @@ void usage(void)
|
|||||||
" --mode=NUMBER (Maxicode and Composite) Set encoding mode.\n"
|
" --mode=NUMBER (Maxicode and Composite) Set encoding mode.\n"
|
||||||
" --gs1 Treat input as GS1 data\n"
|
" --gs1 Treat input as GS1 data\n"
|
||||||
" --binary Treat input as Binary data\n"
|
" --binary Treat input as Binary data\n"
|
||||||
|
" --notext Remove human readable text\n"
|
||||||
, ZINT_VERSION);
|
, ZINT_VERSION);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,12 +120,14 @@ int main(int argc, char **argv)
|
|||||||
int error_number;
|
int error_number;
|
||||||
int rotate_angle;
|
int rotate_angle;
|
||||||
int generated;
|
int generated;
|
||||||
|
int suppress_human_readable;
|
||||||
|
|
||||||
error_number = 0;
|
error_number = 0;
|
||||||
rotate_angle = 0;
|
rotate_angle = 0;
|
||||||
generated = 0;
|
generated = 0;
|
||||||
my_symbol = ZBarcode_Create();
|
my_symbol = ZBarcode_Create();
|
||||||
my_symbol->input_mode = UNICODE_MODE;
|
my_symbol->input_mode = UNICODE_MODE;
|
||||||
|
suppress_human_readable = 0;
|
||||||
|
|
||||||
if(argc == 1) {
|
if(argc == 1) {
|
||||||
usage();
|
usage();
|
||||||
@ -162,6 +165,7 @@ int main(int argc, char **argv)
|
|||||||
{"kanji", 0, 0, 0},
|
{"kanji", 0, 0, 0},
|
||||||
{"sjis", 0, 0, 0},
|
{"sjis", 0, 0, 0},
|
||||||
{"binary", 0, 0, 0},
|
{"binary", 0, 0, 0},
|
||||||
|
{"notext", 0, 0, 0},
|
||||||
{0, 0, 0, 0}
|
{0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
c = getopt_long(argc, argv, "htb:w:d:o:i:rcmp", long_options, &option_index);
|
c = getopt_long(argc, argv, "htb:w:d:o:i:rcmp", long_options, &option_index);
|
||||||
@ -205,6 +209,9 @@ int main(int argc, char **argv)
|
|||||||
if(!strcmp(long_options[option_index].name, "bg")) {
|
if(!strcmp(long_options[option_index].name, "bg")) {
|
||||||
strncpy(my_symbol->bgcolour, optarg, 7);
|
strncpy(my_symbol->bgcolour, optarg, 7);
|
||||||
}
|
}
|
||||||
|
if(!strcmp(long_options[option_index].name, "notext")) {
|
||||||
|
suppress_human_readable = 1;
|
||||||
|
}
|
||||||
if(!strcmp(long_options[option_index].name, "scale")) {
|
if(!strcmp(long_options[option_index].name, "scale")) {
|
||||||
my_symbol->scale = (float)(atof(optarg));
|
my_symbol->scale = (float)(atof(optarg));
|
||||||
if(my_symbol->scale < 0.01) {
|
if(my_symbol->scale < 0.01) {
|
||||||
@ -322,7 +329,13 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd': /* we have some data! */
|
case 'd': /* we have some data! */
|
||||||
error_number = ZBarcode_Encode_and_Print(my_symbol, (unsigned char*)optarg, strlen(optarg), rotate_angle);
|
error_number = ZBarcode_Encode(my_symbol, (unsigned char*)optarg, strlen(optarg));
|
||||||
|
if(error_number == 0) {
|
||||||
|
if(suppress_human_readable) {
|
||||||
|
my_symbol->text[0] = (unsigned char)'\0';
|
||||||
|
}
|
||||||
|
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);
|
||||||
@ -332,7 +345,13 @@ int main(int argc, char **argv)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case 'i': /* Take data from file */
|
case 'i': /* Take data from file */
|
||||||
error_number = ZBarcode_Encode_File_and_Print(my_symbol, optarg, rotate_angle);
|
error_number = ZBarcode_Encode_File(my_symbol, optarg);
|
||||||
|
if(error_number == 0) {
|
||||||
|
if(suppress_human_readable) {
|
||||||
|
my_symbol->text[0] = (unsigned char)'\0';
|
||||||
|
}
|
||||||
|
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);
|
||||||
|
Loading…
Reference in New Issue
Block a user