added list support
[my-code/hdw-sniff.git] / list.c
diff --git a/list.c b/list.c
new file mode 100644 (file)
index 0000000..03fec7c
--- /dev/null
+++ b/list.c
@@ -0,0 +1,33 @@
+/* manage sniffed stuff in linked lists
+ *
+ * author: hackbard@hackdaworld.dyndns.org
+ *
+ */
+
+#include "list.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+char sys_call[20];
+
+int add_ssid_2_list(char *ssid, struct list *my_list) {
+
+       struct list *new_entry;
+
+       if(my_list->next==NULL) {
+               // printf("debug: new ssid found!\n");
+               sprintf(sys_call,"flite \"new ssid. %s\"",ssid);
+               system(sys_call);
+               new_entry=(struct list *)malloc(sizeof(struct list));
+               my_list->next=new_entry;
+               strcpy(my_list->ssid,ssid);
+               new_entry->next=NULL;
+       } else if(!strcmp(my_list->ssid,ssid)) {
+       /* do nothing! */
+       } else {
+               add_ssid_2_list(ssid,my_list->next);
+       }
+       return 1;
+}