Filters
This commit is contained in:
parent
b1a271edce
commit
372b11ba1f
2 changed files with 17 additions and 10 deletions
|
@ -1,15 +1,15 @@
|
||||||
# cnd Makefile
|
# cnd Makefile
|
||||||
# (C)2005, Dan Ponte
|
# (C)2005, Dan Ponte
|
||||||
# $Amigan: phoned/phoned/Makefile,v 1.8 2005/06/02 20:49:26 dcp1990 Exp $
|
# $Amigan: phoned/phoned/Makefile,v 1.9 2005/06/12 15:22:56 dcp1990 Exp $
|
||||||
include ../global.mk
|
include ../global.mk
|
||||||
# basic stuff. we append for a reason.
|
# basic stuff. we append for a reason.
|
||||||
CPPFLAGS=-I../include -DDEBUG -DYY_NO_UNPUT
|
CPPFLAGS+=-I../include -DDEBUG -DYY_NO_UNPUT
|
||||||
CFLAGS+=-g -Wall -W -ansi ${CPPFLAGS} -pthread
|
CFLAGS+=-g -Wall -W -ansi ${CPPFLAGS} -pthread
|
||||||
LDFLAGS=-lutil
|
LDFLAGS+=-lutil -lpcre
|
||||||
# keep these up to date.
|
# keep these up to date.
|
||||||
MAINBIN=phoned
|
MAINBIN=phoned
|
||||||
SRCS=main.c init.c log.c cfg.c socket.c y.tab.c lex.yy.c signals.c cid.c modem.c notify.c
|
SRCS=main.c init.c log.c cfg.c socket.c y.tab.c lex.yy.c signals.c cid.c modem.c notify.c filters.c
|
||||||
OBJS=main.o init.o log.o cfg.o socket.o y.tab.o lex.yy.o signals.o cid.o modem.o notify.o
|
OBJS=main.o init.o log.o cfg.o socket.o y.tab.o lex.yy.o signals.o cid.o modem.o notify.o filters.o
|
||||||
OHDRS=y.tab.h
|
OHDRS=y.tab.h
|
||||||
CLEANFILES=y.tab.c y.tab.h lex.yy.c
|
CLEANFILES=y.tab.c y.tab.h lex.yy.c
|
||||||
LEX=lex
|
LEX=lex
|
||||||
|
|
|
@ -27,11 +27,12 @@
|
||||||
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
||||||
* SUCH DAMAGE.
|
* SUCH DAMAGE.
|
||||||
*/
|
*/
|
||||||
/* $Amigan: phoned/phoned/filters.c,v 1.1 2005/06/10 00:21:49 dcp1990 Exp $ */
|
/* $Amigan: phoned/phoned/filters.c,v 1.2 2005/06/12 15:22:56 dcp1990 Exp $ */
|
||||||
#include <strings.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <pthread.h>
|
#include <pthread.h>
|
||||||
|
#include <stdio.h>
|
||||||
#include <phoned.h>
|
#include <phoned.h>
|
||||||
|
|
||||||
cond_t* topcond = 0x0;
|
cond_t* topcond = 0x0;
|
||||||
|
@ -43,10 +44,10 @@ cond_t* add_condition(nameregex, numregex, action)
|
||||||
char* numregex;
|
char* numregex;
|
||||||
int action;
|
int action;
|
||||||
{
|
{
|
||||||
cont_t *c, *nc;
|
cond_t *c, *nc;
|
||||||
nc = malloc(sizeof(cond_t));
|
nc = malloc(sizeof(cond_t));
|
||||||
memset(nc, 0, sizeof(cond_t));
|
memset(nc, 0, sizeof(cond_t));
|
||||||
pthread_mutex_lock(condmx); /* ALWAYS do this if dealing with next, last or topcond!! */
|
pthread_mutex_lock(&condmx); /* ALWAYS do this if dealing with next, last or topcond!! */
|
||||||
if(topcond == 0x0)
|
if(topcond == 0x0)
|
||||||
topcond = nc;
|
topcond = nc;
|
||||||
else {
|
else {
|
||||||
|
@ -54,7 +55,13 @@ cond_t* add_condition(nameregex, numregex, action)
|
||||||
nc->last = c;
|
nc->last = c;
|
||||||
c->next = nc;
|
c->next = nc;
|
||||||
}
|
}
|
||||||
pthread_mutex_unlock(condmc); /* done */
|
pthread_mutex_unlock(&condmx); /* done */
|
||||||
nc->name = strdup(nameregex);
|
nc->name = strdup(nameregex);
|
||||||
|
nc->number = strdup(numregex);
|
||||||
|
nc->namerx.prex = pcre_compile(nc->name, 0x0, &nc->namerx.error,
|
||||||
|
&nc->namerx.erroroffset, NULL);
|
||||||
|
nc->numbrx.prex = pcre_compile(nc->number, 0x0, &nc->numbrx.error,
|
||||||
|
&nc->numbrx.erroroffset, NULL);
|
||||||
|
nc->action = action;
|
||||||
return nc;
|
return nc;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue