- added erase command

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@471 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
okir 2002-04-05 15:04:35 +00:00
parent d4ee9df5ce
commit 23ff14fb06
1 changed files with 20 additions and 0 deletions

View File

@ -29,6 +29,7 @@
#include <readline/readline.h>
#include <readline/history.h>
#endif
#include "cardctl.h"
#include "util.h"
#define DIM(v) (sizeof(v)/sizeof((v)[0]))
@ -1042,7 +1043,25 @@ usage:
#endif
}
static int
do_erase(int argc, char **argv)
{
int r;
if (argc != 0)
goto usage;
r = sc_card_ctl(card, SC_CARDCTL_ERASE_CARD, NULL);
if (r) {
printf("Failed to erase card: %s\n", sc_strerror (r));
return -1;
}
return 0;
usage:
printf("Usage: erase\n");
return -1;
}
@ -1067,6 +1086,7 @@ struct command cmds[] = {
{ "mkdir", do_mkdir, "create a DF" },
{ "pksign", do_pksign, "create a public key signature" },
{ "pkdecrypt", do_pkdecrypt, "perform a public key decryption" },
{ "erase", do_erase, "erase card" },
{ "quit", do_quit, "quit this program" },
{ 0, 0, 0 }
};