Mercurial > public > ostc4
comparison ostc4pack/src/OSTC4pack_V4.cpp @ 162:ad98da7e74f8 linux-build
OSTC4pack_V4: do not hard code output filename for fonts
... and be a bit more polite. When called without parameters, the
packer simply crashed. Now, print a trivial usage line.
But the real change is, not hard coding the fonts output file name.
This is simply not flexible and inconvenient.
Signed-off-by: Jan Mulder <jlmulder@xs4all.nl>
author | Jan Mulder <jlmulder@xs4all.nl> |
---|---|
date | Thu, 21 Feb 2019 10:29:26 +0100 |
parents | 1e707b34667e |
children | 01f40cb1057e |
comparison
equal
deleted
inserted
replaced
161:b70fae5023b4 | 162:ad98da7e74f8 |
---|---|
409 #include <stdio.h> | 409 #include <stdio.h> |
410 #include <string.h> | 410 #include <string.h> |
411 int main(int argc, char** argv) { | 411 int main(int argc, char** argv) { |
412 | 412 |
413 | 413 |
414 if (argc != 3) { | |
415 fprintf(stderr, "Usage: OSTC4pack_V4 <type> <bin file>\n"); | |
416 return(-1); | |
417 } | |
418 | |
414 FILE *fp, * fpout; | 419 FILE *fp, * fpout; |
415 size_t len; | 420 size_t len; |
416 unsigned char buf[1050000]; | 421 unsigned char buf[1050000]; |
417 char *file = argv[2]; | 422 char *file = argv[2]; |
418 int type = atoi(argv[1]); | 423 int type = atoi(argv[1]); |
438 fclose(fp); | 443 fclose(fp); |
439 if(type == 0) | 444 if(type == 0) |
440 sprintf(filenameout,"%s_upload.bin",filename); | 445 sprintf(filenameout,"%s_upload.bin",filename); |
441 else | 446 else |
442 if(type == 2) | 447 if(type == 2) |
443 sprintf(filenameout,"OSTC4_FONT_upload.bin",filename); | 448 sprintf(filenameout,"%s_upload.bin",filename); |
444 else | 449 else |
445 sprintf(filenameout,"%s_upload.bin",filename); | 450 sprintf(filenameout,"%s_upload.bin",filename); |
446 | 451 |
447 unsigned char buf2[4]; | 452 unsigned char buf2[4]; |
448 | 453 |
511 buf2[3] = 0xFF & checksum; | 516 buf2[3] = 0xFF & checksum; |
512 | 517 |
513 fwrite(buf2,sizeof(char),4,fp); | 518 fwrite(buf2,sizeof(char),4,fp); |
514 | 519 |
515 } | 520 } |
516 | |
517 | |
518 | |
519 | |
520 |