1 #include <stdio.h>
2 #include <fcntl.h>
3 #include <sys/types.h>
4 #include <unistd.h>
5 
6 #define TAIL 56
7 
main(int argc,char ** argv)8 void main(int argc, char** argv)
9 {
10     int i, j;
11     signed char buff[TAIL];
12 
13     for(i = 1; i < argc; i++)
14     {
15 	char* f;
16 	int fd;
17 
18 	f = argv[i];
19 	if((fd = open(f, O_RDWR)) < 0)
20 	{
21 	    perror(f);
22 	    continue;
23 	}
24 
25 	lseek(fd, -TAIL, SEEK_END);
26 	read(fd, buff, TAIL);
27 	printf("%s: ", f);
28 	for(j = 0; j < TAIL; j++)
29 	    if(buff[j] < ' ')
30 		putchar('.');
31 	    else
32 		putchar(buff[j]);
33 	putchar('\n');
34 	close(fd);
35     }
36 }
37 
38 
39