comparison uicc/readcmd.c @ 144:429a8f80426e

fc-uicc-tool: catch record length from manual select
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 06 Feb 2021 02:03:11 +0000
parents f3bdefbeae38
children 19b96c52348f
comparison
equal deleted inserted replaced
143:431194b772e1 144:429a8f80426e
38 if (recno < 1 || recno > 255) { 38 if (recno < 1 || recno > 255) {
39 fprintf(stderr, 39 fprintf(stderr,
40 "error: record number argument is out of range\n"); 40 "error: record number argument is out of range\n");
41 return(-1); 41 return(-1);
42 } 42 }
43 len = strtoul(argv[2], 0, 0); 43 if (argv[2]) {
44 if (len < 1 || len > 255) { 44 len = strtoul(argv[2], 0, 0);
45 fprintf(stderr, "error: length argument is out of range\n"); 45 if (len < 1 || len > 255) {
46 return(-1); 46 fprintf(stderr,
47 "error: length argument is out of range\n");
48 return(-1);
49 }
50 } else {
51 if (!last_sel_file_record_len) {
52 fprintf(stderr,
53 "error: no current file record length is available\n");
54 return(-1);
55 }
56 len = last_sel_file_record_len;
47 } 57 }
48 rc = readrec_op(recno, 0x04, len); 58 rc = readrec_op(recno, 0x04, len);
49 if (rc < 0) 59 if (rc < 0)
50 return(rc); 60 return(rc);
51 display_sim_resp_in_hex(); 61 display_sim_resp_in_hex();