Ver Fonte

correction des warnings

Pi3rrot há 9 anos atrás
pai
commit
a0985c3d7f
2 ficheiros alterados com 24 adições e 4 exclusões
  1. 19 0
      couper.c
  2. 5 4
      poolset.c

+ 19 - 0
couper.c

@@ -0,0 +1,19 @@
+#include <stdio.h>
+#include <string.h>
+ 
+int main ()
+{
+  char str[] ="05/08/87";
+  char *token;
+ 
+  printf ("%s : ", str);
+ 
+  token = strtok (str,"/");
+  
+  while (token != NULL)
+  {
+    printf ("%s ", token);
+    token = strtok (NULL, "/");
+
+  }
+}

+ 5 - 4
poolset.c

@@ -1,5 +1,6 @@
 #include <stdlib.h>
 #include <string.h>
+#include <unistd.h>
 
 #include <nfc/nfc.h>
 #include <freefare.h>
@@ -15,7 +16,7 @@ void show_menu(){
 	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_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");
 
-				if(coins != NULL && buy_date != NULL && expire_date != NULL) {
+				if(coins != 0 && buy_date != NULL && expire_date != NULL) {
 
 					char *token;
 					token = strtok (buy_date,"/");
@@ -124,9 +125,9 @@ int main(int argc, const char **argv) {
 		show_menu();
 	//else coins = atoi(argv[1]);
 	if (strcmp(argv[1], "--read") == 0)
-		read_tag(NULL, NULL, NULL);
+		rw_tag(NULL, NULL, NULL);
 	
 	if (strcmp(argv[1], "--write") == 0)
-		read_tag(atoi(argv[2]), argv[3], argv[4]);
+		rw_tag(atoi(argv[2]), argv[3], argv[4]);
 
 }