added tcp support
[my-code/hdw-sniff.git] / list.c
1 /* manage sniffed stuff in linked lists
2  *
3  * author: hackbard@hackdaworld.dyndns.org
4  *
5  */
6
7 #include "list.h"
8 #include <stdio.h>
9 #include <stdlib.h>
10 #include <string.h>
11
12
13 char sys_call[20];
14
15 int add_ssid_2_list(char *ssid, struct list *my_list) {
16
17         struct list *new_entry;
18
19         if(my_list->next==NULL) {
20                 // printf("debug: new ssid found!\n");
21                 sprintf(sys_call,"flite \"new ssid. %s\"",ssid);
22                 system(sys_call);
23                 new_entry=(struct list *)malloc(sizeof(struct list));
24                 my_list->next=new_entry;
25                 strcpy(my_list->ssid,ssid);
26                 new_entry->next=NULL;
27         } else if(!strcmp(my_list->ssid,ssid)) {
28         /* do nothing! */
29         } else {
30                 add_ssid_2_list(ssid,my_list->next);
31         }
32         return 1;
33 }