tail.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int addtailsource (char *filename)
int taildata (char **filename, char *buf, size_t bufsz)
void tailsleep (unsigned long sleep)


Function Documentation

int addtailsource char *  filename  ) 
 

addtailsource opens and seeks to EOF the specified file. The file descriptor and position offset is saved. If an error occurs errno is set and addtailsource returns -1 otherwise it returns 0.

Definition at line 36 of file tail.c.

References _tail(), tails, tcnt, and tp.

Referenced by main().

00036                                   {
00037      int tp;
00038      tail_t _t = {"",-1,-1}, *t = &_t, *a;
00039      strcpy(t->filename,filename);
00040      if(_tail(t,NULL,-1)) 
00041           return -1;
00042      tp = tcnt ++;
00043      if((tails = realloc(tails,(sizeof(tail_t)*(tcnt)))) == NULL) {
00044           close(t->fd);
00045           return -1;
00046      }
00047      tails[tp] = *t;
00048      return 0;
00049 }

Here is the call graph for this function:

int taildata char **  filename,
char *  buf,
size_t  bufsz
 

taildata returns the next available line from a tail-file. The filename read from is stored in filename. buf will contain the data read upto bufsz bytes.

Definition at line 54 of file tail.c.

References _tail(), _tail::filename, tails, tcnt, and tp.

Referenced by secwatch().

00054                                                        {
00055      int cnt;
00056      tail_t * t = &tails[tp++]; 
00057      if(tp >= tcnt)
00058           tp = 0;
00059      cnt = _tail(t,buf,bufsz);
00060      *filename = &t->filename[0];
00061      return cnt;
00062 }

Here is the call graph for this function:

void tailsleep unsigned long  sleep  ) 
 

tailsleep suspends execution for sleep number of milliseconds.

Definition at line 96 of file tail.c.

Referenced by secwatch().

00096                                     {
00097      struct timespec ts = {0,(sleep*1000000)};
00098      nanosleep(&ts,NULL);
00099 }


Generated on Tue Oct 31 10:17:41 2006 for secwatch by  doxygen 1.4.6