FreeCalypso > hg > fc-pcsc-tools
diff simtool/restorebin.c @ 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 | a6ca422323b9 |
children | bd19dc7591ec |
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);