-
Notifications
You must be signed in to change notification settings - Fork 0
/
mon_tail.c~
63 lines (38 loc) · 808 Bytes
/
mon_tail.c~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "mon_tail.h"
#ifdef TAIL_SIMPLE
int tail(char *path, int nline)
{
int count_lines1, count_lines2, fd, i ;
char *buffer ;
cpt_lines1 = (cpt_lines2 = 0) ;
fd = open(path, O_RDONLY) ;
buffer=(char*)malloc(STRINGSIZE*sizeof(char)) ;
assert(fd != -1) ;
assert(buffer != NULL) ;
while(read(fd, buffer, STREAMSIZE) != 0) ;
while (*(buffer+i) != '
}
#endif
#ifdef TAIL_RELATIVE
int index_tail_buffer(const char *buffer, int bufsize, int ntail, int *nlines)
{
int index ;
index = (-1) ;
while (index <= bufsize)
{
++index ;
}
*nlines = index + 1 ;
return index ;
}
int tail_before_pos(int fd, unsigned int pos, int ntail)
{
}
#endif
#ifdef TAIL_EFFICACE
int tail(const char *path, int ntail)
{
}
#endif
#ifdef TAIL_UTILE
#endif