comparison 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
comparison
equal deleted inserted replaced
100:fa7005185b84 101:454ff8bd0b83
1 #include <sys/types.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4 #include <pcsclite.h>
5 #include <winscard.h>
6 #include "globals.h"
7
8 cmd_update_bin(argc, argv)
9 char **argv;
10 {
11 unsigned offset, len;
12 u_char data[255];
13 int rc;
14
15 offset = strtoul(argv[1], 0, 0);
16 if (offset > 0xFFFF) {
17 fprintf(stderr, "error: offset argument is out of range\n");
18 return(-1);
19 }
20 rc = read_hex_data_file(argv[2], data);
21 if (rc < 0)
22 return(rc);
23 len = rc;
24 return update_bin_op(offset, data, len);
25 }