From: hackbard Date: Fri, 24 Sep 2004 11:14:18 +0000 (+0000) Subject: there is a new event api ... X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=493a62c2130d491c3cb417ab00723d662f3eb391;p=sound-tools%2Fhdrec.git there is a new event api ... --- diff --git a/event.c b/event.c deleted file mode 100644 index 316f0d6..0000000 --- a/event.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - * event.c -- simple event api - * - * author: hackbard@hackdaworld.dyndns.org - * - */ - -#include -#include - -typedef struct __fd_list { - int fd; - unsigned char mode; - fd_list *next; -} fd_list; - -#define READ 1 -#define WRITE 2 - -int add_fd(int fd,unsigned char mode,fd_list *fd_list) { - fd_list *new; - if(fd_list->next==NULL) { - if((new=(fd_list *)(malloc(sizeof(fd_list))))==NULL) { - puts("failed allocating fd_list memory"); - return -1; - } - new->fd=fd; - new->mode=mode; - fd_list->next=new; - fd_list->next->next=NULL; - return fd; - } - else add_fd(fd,mode,tv,fd_list->next); -} - -int del_fd(int fd,fd_list *fd_list) { - fd_list *tmp; - if(fd_list->next->fd==fd) { - tmp=fd_list->next; - fd_list->next=fd_list->next->next; - free(tmp); - return fd; - } - else { - if(fd_list->next==NULL) { - puts("didnt find this fd in list!); - return -1; - } - del_fd(fd,fd_list->next); - } - return 1; -} - -get_max_fd(fd_list *fd_list) { - int test=-1; - if(fd_list->next=NULL) return test; - else { - if(fd_list->fd>test) test=fd_list->fd; - get_max_fd(fd_list->next); - } -} - -int loop(fd_list *fd_list,timeval tv) { -