FreeCalypso > hg > freecalypso-hwlab
diff 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 |
line wrap: on
line diff
--- a/uicc/readcmd.c Thu Feb 04 05:12:24 2021 +0000 +++ b/uicc/readcmd.c Sat Feb 06 02:03:11 2021 +0000 @@ -40,10 +40,20 @@ "error: record number argument is out of range\n"); return(-1); } - len = strtoul(argv[2], 0, 0); - if (len < 1 || len > 255) { - fprintf(stderr, "error: length argument is out of range\n"); - return(-1); + if (argv[2]) { + len = strtoul(argv[2], 0, 0); + if (len < 1 || len > 255) { + fprintf(stderr, + "error: length argument is out of range\n"); + return(-1); + } + } else { + if (!last_sel_file_record_len) { + fprintf(stderr, + "error: no current file record length is available\n"); + return(-1); + } + len = last_sel_file_record_len; } rc = readrec_op(recno, 0x04, len); if (rc < 0)