|
@@ -1,5 +1,6 @@
|
|
#include <stdlib.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include <string.h>
|
|
|
|
+#include <unistd.h>
|
|
|
|
|
|
#include <nfc/nfc.h>
|
|
#include <nfc/nfc.h>
|
|
#include <freefare.h>
|
|
#include <freefare.h>
|
|
@@ -15,7 +16,7 @@ void show_menu(){
|
|
exit(0);
|
|
exit(0);
|
|
}
|
|
}
|
|
|
|
|
|
-void read_tag(int coins, const char *buy_date, const char *expire_date) {
|
|
|
|
|
|
+void rw_tag(int coins, char *buy_date, char *expire_date) {
|
|
|
|
|
|
nfc_context *context; //init libnfc
|
|
nfc_context *context; //init libnfc
|
|
nfc_device *pnd; //trouver un lecteur
|
|
nfc_device *pnd; //trouver un lecteur
|
|
@@ -58,7 +59,7 @@ void read_tag(int coins, const char *buy_date, const char *expire_date) {
|
|
}
|
|
}
|
|
else printf("Non ca chie dans la colle mais grave, check ta clé\n");
|
|
else printf("Non ca chie dans la colle mais grave, check ta clé\n");
|
|
|
|
|
|
- if(coins != NULL && buy_date != NULL && expire_date != NULL) {
|
|
|
|
|
|
+ if(coins != 0 && buy_date != NULL && expire_date != NULL) {
|
|
|
|
|
|
char *token;
|
|
char *token;
|
|
token = strtok (buy_date,"/");
|
|
token = strtok (buy_date,"/");
|
|
@@ -124,9 +125,9 @@ int main(int argc, const char **argv) {
|
|
show_menu();
|
|
show_menu();
|
|
//else coins = atoi(argv[1]);
|
|
//else coins = atoi(argv[1]);
|
|
if (strcmp(argv[1], "--read") == 0)
|
|
if (strcmp(argv[1], "--read") == 0)
|
|
- read_tag(NULL, NULL, NULL);
|
|
|
|
|
|
+ rw_tag(NULL, NULL, NULL);
|
|
|
|
|
|
if (strcmp(argv[1], "--write") == 0)
|
|
if (strcmp(argv[1], "--write") == 0)
|
|
- read_tag(atoi(argv[2]), argv[3], argv[4]);
|
|
|
|
|
|
+ rw_tag(atoi(argv[2]), argv[3], argv[4]);
|
|
|
|
|
|
}
|
|
}
|