diff -ruN logtool-1.2.6~/src/includes.h logtool-1.2.6/src/includes.h --- logtool-1.2.6~/src/includes.h 2003-05-02 18:34:59.000000000 +0200 +++ logtool-1.2.6/src/includes.h 2004-04-13 15:07:47.000000000 +0200 @@ -40,6 +40,12 @@ extern int h_errno; struct hostent *h; +/* For stat(), opendir(), and friends */ +#include +#include +#include +#include + /* in here we work with the event-centric modules */ #include "mods.h" /* declare this before logtool.h */ /* we use some structs from this in logtool.h (yeah, I know, lousy organization :) */ diff -ruN logtool-1.2.6~/src/regex.c logtool-1.2.6/src/regex.c --- logtool-1.2.6~/src/regex.c 2003-10-07 23:08:23.000000000 +0200 +++ logtool-1.2.6/src/regex.c 2004-04-13 16:32:49.000000000 +0200 @@ -66,6 +66,38 @@ char count = 1; FILE *fileptr; short int retval; + DIR *dir; + struct stat *stbuf; + char *fname; + struct dirent *de; + + stbuf=malloc(sizeof(struct stat)); + if(stat(file, stbuf)<0) { + /* Could not stat, so, back out */ + if(cf.debug) fprintf(stderr, "Could not stat %s\n", file); + return FALSE; + } + + if(S_ISDIR(stbuf->st_mode)) { + dir=opendir(file); + if( ! dir ) { + if(cf.debug) fprintf(stderr, "Could not opendir %s\n", file); + return FALSE; + } + while((de=readdir(dir))) { + if(!strncmp(de->d_name, ".", 1)) continue; + fname=malloc(strlen(file)+strlen(de->d_name)+2); + sprintf(fname, "%s/%s", file, de->d_name); + if(!lt_load_regex(fname, dest, re)) { + if(cf.debug) fprintf(stderr, + "error occured, bailing out\n"); + free(fname); + return FALSE; + } + free(fname); + } + return TRUE; + } fileptr = fopen(file, "r"); if( ! fileptr ) {