FreeCalypso > hg > freecalypso-hwlab
diff simtool/writecmd.c @ 101:454ff8bd0b83
fc-simtool: update-bin command implemented
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Mon, 25 Jan 2021 01:54:43 +0000 |
parents | |
children | 29cc5612797a |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/simtool/writecmd.c Mon Jan 25 01:54:43 2021 +0000 @@ -0,0 +1,25 @@ +#include <sys/types.h> +#include <stdio.h> +#include <stdlib.h> +#include <pcsclite.h> +#include <winscard.h> +#include "globals.h" + +cmd_update_bin(argc, argv) + char **argv; +{ + unsigned offset, len; + u_char data[255]; + int rc; + + offset = strtoul(argv[1], 0, 0); + if (offset > 0xFFFF) { + fprintf(stderr, "error: offset argument is out of range\n"); + return(-1); + } + rc = read_hex_data_file(argv[2], data); + if (rc < 0) + return(rc); + len = rc; + return update_bin_op(offset, data, len); +}