9 #define MAX_LOGFILES 10
12 static char buff[1024] ;
13 static struct stat statb ;
16 #warning "PROJDIR not defined! Assuming /RTS"
17 #define PROJDIR "/RTS"
20 static char logfiles[MAX_LOGFILES][128] = {
21 PROJDIR
"/log/rts.log",
22 PROJDIR
"/log/trigger.log",
23 PROJDIR
"/log/evp.log",
24 PROJDIR
"/log/det.log",
25 PROJDIR
"/log/daq.log",
28 static FILE *files[MAX_LOGFILES] ;
30 static int oldsizes[MAX_LOGFILES] ;
35 int main(
int argc,
char *argv[])
44 for(i=0;i<MAX_LOGFILES;i++) {
45 printf(
"%3d: %d %c -%s-\n",i,logfiles[i][0],logfiles[i][0],logfiles[i]) ;
52 while(logfiles[i][0] != 0) {
54 files[i] = fopen(logfiles[i],
"r") ;
56 if(files[i] == NULL) {
67 u_int last_delta = time(NULL) - last_flush ;
70 for(i=0;i<MAX_LOGFILES;i++) {
72 if(logfiles[i][0]==0) continue ;
77 fret = fgets(buff,
sizeof(buff),files[i]) ;
80 last_flush = time(NULL) ;
91 ret = stat(logfiles[i],&statb) ;
98 if(statb.st_size < oldsizes[i]) {
100 files[i] = fopen(logfiles[i],
"r") ;
105 oldsizes[i] = statb.st_size ;
111 if(((strstr(buff,
"OPERATOR") != NULL) ||
112 (strstr(buff,
"CRITICAL") != NULL) ||
113 (strstr(buff,
"SHIFTLOG") != NULL))) {
120 if(!data_in) sleep(1) ;