FreeCalypso > hg > freecalypso-hwlab
comparison simtool/pberase.c @ 112:87d459d9797a
fc-simtool: pb-erase command implemented
| author | Mychaela Falconia <falcon@freecalypso.org> |
|---|---|
| date | Tue, 26 Jan 2021 03:32:20 +0000 |
| parents | |
| children | 0dcd666292e4 |
comparison
equal
deleted
inserted
replaced
| 111:5bfb5a7262c1 | 112:87d459d9797a |
|---|---|
| 1 /* | |
| 2 * This module implements the pb-erase command. | |
| 3 */ | |
| 4 | |
| 5 #include <sys/types.h> | |
| 6 #include <string.h> | |
| 7 #include <strings.h> | |
| 8 #include <stdio.h> | |
| 9 #include <stdlib.h> | |
| 10 #include <pcsclite.h> | |
| 11 #include <winscard.h> | |
| 12 #include "globals.h" | |
| 13 | |
| 14 cmd_pb_erase(argc, argv) | |
| 15 char **argv; | |
| 16 { | |
| 17 int rc; | |
| 18 unsigned recno; | |
| 19 u_char record[255]; | |
| 20 | |
| 21 rc = phonebook_op_common(argv[1]); | |
| 22 if (rc < 0) | |
| 23 return(rc); | |
| 24 memset(record, 0xFF, curfile_record_len); | |
| 25 for (recno = 1; recno <= curfile_record_count; recno++) { | |
| 26 rc = update_rec_op(recno, 0x04, record, curfile_record_len); | |
| 27 if (rc < 0) | |
| 28 return(rc); | |
| 29 } | |
| 30 return(0); | |
| 31 } |
