NULL character support

This commit is contained in:
hooper114 2009-01-02 21:09:16 +00:00
parent 1015a11b5a
commit d6df698918
20 changed files with 2286 additions and 1849 deletions

View file

@ -82,6 +82,7 @@ void usage(void)
" --secure=NUMBER (PDF417 and QR Code) Error correction level.\n"
" --primary=STRING (Maxicode and Composite) Structured primary message.\n"
" --mode=NUMBER (Maxicode and Composite) Set encoding mode.\n"
" --null=NUMBER Character to represent NULL.\n"
, ZINT_VERSION);
}
@ -153,6 +154,7 @@ int main(int argc, char **argv)
{"mode=", 1, 0, 0},
{"primary=", 1, 0, 0},
{"scale=", 1, 0, 0},
{"null=", 1, 0, 0},
{0, 0, 0, 0}
};
c = getopt_long(argc, argv, "htb:w:d:o:i:rcmp", long_options, &option_index);
@ -200,6 +202,18 @@ int main(int argc, char **argv)
fprintf(stderr, "Border width out of range\n");
}
}
if(!strcmp(long_options[option_index].name, "null=")) {
error_number = validator(NESET, optarg);
if(error_number == ERROR_INVALID_DATA) {
fprintf(stderr, "Invalid NULL replacement\n");
exit(1);
}
if((atoi(optarg) >= 1) && (atoi(optarg) <= 128)) {
my_symbol->nullchar = atoi(optarg);
} else {
fprintf(stderr, "Invalid NULL replacement\n");
}
}
if(!strcmp(long_options[option_index].name, "height=")) {
error_number = validator(NESET, optarg);
if(error_number == ERROR_INVALID_DATA) {