diff options
author | Harald Welte <laforge@gnumonks.org> | 2010-08-16 13:09:04 +0800 |
---|---|---|
committer | Harald Welte <laforge@gnumonks.org> | 2010-08-16 13:09:04 +0800 |
commit | d3c282f9179de48d66b850444ea688bfd02c40d7 (patch) | |
tree | 4208221717a1b7de69a7be1d8fbfec6887fbd4da /easytool | |
parent | cd534f500edd5c04fc8e68e72eae3264dfef34fd (diff) |
actually call functions to modify the dump file
Diffstat (limited to 'easytool')
-rw-r--r-- | easytool/easytool.c | 33 |
1 files changed, 19 insertions, 14 deletions
diff --git a/easytool/easytool.c b/easytool/easytool.c index 75cec83..2e7ada3 100644 --- a/easytool/easytool.c +++ b/easytool/easytool.c @@ -42,16 +42,24 @@ /* Easycard specific includes */ #include "easycard.h" -#define VERSION "0.03" +#define VERSION "0.04" #define COPYRIGHT \ "EasyTool "VERSION" (C) 2010 by Harald Welte <laforge@gnumonks.org>\n" \ "This is FREE SOFTWARE with ABSOLUTELY NO WARRANTY\n\n" \ "Use of this software is authorized for RESEARCH PURPOSE ONLY!\n\n" +enum mode { + MODE_DUMP_MFACC, + MODE_DUMP, + MODE_RECHARGE, + MODE_PURCHASE, +}; + struct { int fd; unsigned long size; mifare_tag *mft; + enum mode mode; } global; static void dump_acc_bits(const struct acc_bits_parsed *abp) @@ -126,19 +134,14 @@ static void print_help(void) { } -enum mode { - MODE_DUMP_MFACC, - MODE_DUMP, - MODE_RECHARGE, - MODE_PURCHASE, -}; - int main(int argc, char **argv) { - enum mode mode = MODE_DUMP; + struct stat st; int delta = 0; int option_index = 0; - struct stat st; + int rc; + + global.mode = MODE_DUMP; printf(COPYRIGHT); @@ -159,14 +162,14 @@ int main(int argc, char **argv) switch (c) { case 'a': - mode = MODE_DUMP_MFACC; + global.mode = MODE_DUMP_MFACC; break; case 'r': - mode = MODE_RECHARGE; + global.mode = MODE_RECHARGE; delta = atoi(optarg); break; case 'p': - mode = MODE_PURCHASE; + global.mode = MODE_PURCHASE; delta = atoi(optarg); break; case 'h': @@ -200,7 +203,7 @@ int main(int argc, char **argv) exit(1); } - switch (mode) { + switch (global.mode) { case MODE_DUMP_MFACC: dump_mfcl(global.mft); break; @@ -208,8 +211,10 @@ int main(int argc, char **argv) dump_easycard(global.mft); break; case MODE_RECHARGE: + rc = easy_alter_last_recharge(global.mft, delta); break; case MODE_PURCHASE: + rc = easy_alter_last_purchase(global.mft, delta); break; } |