FreeCalypso > hg > fc-pcsc-tools
comparison simtool/writecmd.c @ 141:a1aa8ee2da85
read_hex_data_file(): add maxlen argument
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Wed, 24 Feb 2021 17:25:28 +0000 |
| parents | 702c2c40e51a |
| children | 3f6f50103dd3 |
comparison
equal
deleted
inserted
replaced
| 140:13ab44761ea6 | 141:a1aa8ee2da85 |
|---|---|
| 13 offset = strtoul(argv[1], 0, 0); | 13 offset = strtoul(argv[1], 0, 0); |
| 14 if (offset > 0xFFFF) { | 14 if (offset > 0xFFFF) { |
| 15 fprintf(stderr, "error: offset argument is out of range\n"); | 15 fprintf(stderr, "error: offset argument is out of range\n"); |
| 16 return(-1); | 16 return(-1); |
| 17 } | 17 } |
| 18 rc = read_hex_data_file(argv[2], data); | 18 rc = read_hex_data_file(argv[2], data, 255); |
| 19 if (rc < 0) | 19 if (rc < 0) |
| 20 return(rc); | 20 return(rc); |
| 21 len = rc; | 21 len = rc; |
| 22 return update_bin_op(offset, data, len); | 22 return update_bin_op(offset, data, len); |
| 23 } | 23 } |
| 52 if (recno < 1 || recno > 255) { | 52 if (recno < 1 || recno > 255) { |
| 53 fprintf(stderr, | 53 fprintf(stderr, |
| 54 "error: record number argument is out of range\n"); | 54 "error: record number argument is out of range\n"); |
| 55 return(-1); | 55 return(-1); |
| 56 } | 56 } |
| 57 rc = read_hex_data_file(argv[2], data); | 57 rc = read_hex_data_file(argv[2], data, 255); |
| 58 if (rc < 0) | 58 if (rc < 0) |
| 59 return(rc); | 59 return(rc); |
| 60 if (rc != curfile_record_len) { | 60 if (rc != curfile_record_len) { |
| 61 fprintf(stderr, "error: hex data length != EF record length\n"); | 61 fprintf(stderr, "error: hex data length != EF record length\n"); |
| 62 return(-1); | 62 return(-1); |
| 68 char **argv; | 68 char **argv; |
| 69 { | 69 { |
| 70 u_char data[255]; | 70 u_char data[255]; |
| 71 int rc; | 71 int rc; |
| 72 | 72 |
| 73 rc = read_hex_data_file(argv[1], data); | 73 rc = read_hex_data_file(argv[1], data, 255); |
| 74 if (rc < 0) | 74 if (rc < 0) |
| 75 return(rc); | 75 return(rc); |
| 76 if (rc != curfile_record_len) { | 76 if (rc != curfile_record_len) { |
| 77 fprintf(stderr, "error: hex data length != EF record length\n"); | 77 fprintf(stderr, "error: hex data length != EF record length\n"); |
| 78 return(-1); | 78 return(-1); |
