FreeCalypso > hg > fc-pcsc-tools
changeset 80:54cebab70c19
fc-simtool restore-file: add support for cyclic files
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 17 Feb 2021 05:31:53 +0000 |
parents | b0982c0cf54d |
children | e89004a245ce |
files | simtool/restorebin.c |
diffstat | 1 files changed, 21 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/simtool/restorebin.c Wed Feb 17 05:21:34 2021 +0000 +++ b/simtool/restorebin.c Wed Feb 17 05:31:53 2021 +0000 @@ -49,6 +49,24 @@ return(0); } +static +restore_cyclic(data) + u_char *data; +{ + unsigned count; + u_char *dp; + int rc; + + dp = data + curfile_total_size; + for (count = 0; count < curfile_record_count; count++) { + dp -= curfile_record_len; + rc = update_rec_op(0, 0x03, dp, curfile_record_len); + if (rc < 0) + return(rc); + } + return(0); +} + cmd_restore_file(argc, argv) char **argv; { @@ -112,8 +130,9 @@ rc = restore_records(databuf); break; case 0x03: - fprintf(stderr, "error: cyclic files are not supported\n"); - rc = -1; + /* cyclic */ + rc = restore_cyclic(databuf); + break; } free(databuf); return(rc);