FreeCalypso > hg > freecalypso-hwlab
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/simtool/pberase.c Tue Jan 26 03:32:20 2021 +0000 @@ -0,0 +1,31 @@ +/* + * This module implements the pb-erase command. + */ + +#include <sys/types.h> +#include <string.h> +#include <strings.h> +#include <stdio.h> +#include <stdlib.h> +#include <pcsclite.h> +#include <winscard.h> +#include "globals.h" + +cmd_pb_erase(argc, argv) + char **argv; +{ + int rc; + unsigned recno; + u_char record[255]; + + rc = phonebook_op_common(argv[1]); + if (rc < 0) + return(rc); + memset(record, 0xFF, curfile_record_len); + for (recno = 1; recno <= curfile_record_count; recno++) { + rc = update_rec_op(recno, 0x04, record, curfile_record_len); + if (rc < 0) + return(rc); + } + return(0); +}