root/trunk/fcx.c

Revision 389, 1.8 kB (checked in by heitor.barbieri, 3 weeks ago)

essage first commit

Line 
1#include <stdio.h>
2#include <string.h>
3#include <conio.h>
4#include <fcntl.h>
5void main(int argc, char *argv[])
6{
7        char line[BUFSIZ],*p;
8        FILE *fp;
9        int xch,xmorx,xmore=24;
10       
11        if (argc >= 3) if (sscanf(argv[2],"%d",&xmore) != 1) xmore=24;
12
13#define xprint(x)                       \
14printf("%s",x); xmorx++;                \
15if (xmorx % xmore == 0) {               \
16    xch=getch();                        \
17    if (xch == 'q')  break;             \
18    if (xch == 'x')  break;             \
19    if (xch == 0x03) break;             \
20    if (xch == 0x04) break;             \
21    xmorx=0;                            \
22}                                       \
23/* end xprint */
24
25        for (fp=fopen(argv[1],"r"); fp != NULL; ) {
26                clrscr(); xmorx=0;
27                p=fgets(line,sizeof(line),fp);
28                if (strncmp(line,"Comparing files ",16) == 0) {
29                        xprint(line);
30                        p=fgets(line,sizeof(line),fp);
31                }
32                xprint(line);
33                while ((p=fgets(line,sizeof(line),fp)) != NULL) {
34                        if (strncmp(line, "*****", 5) == 0) break;
35                        xprint(line); 
36                }
37                xprint(" \n");
38                xprint(line);
39                while ((p=fgets(line,sizeof(line),fp)) != NULL) {
40                        if (strncmp(line, "*****", 5) == 0) break;
41                        xprint(line);
42                }
43                p=fgets(line,sizeof(line),fp);
44                /* xprint(line); */
45
46                if (p == NULL) break;
47
48                xch=getch();
49                if (xch == 'q')  break;
50                if (xch == 'x')  break;
51                if (xch == 0x03) break;
52                if (xch == 0x04) break;
53        }
54        getch();
55}
Note: See TracBrowser for help on using the browser.