1: /* Copyright (c) 1979 Regents of the University of California */
2: #include <stdio.h>
3: char ibuf[BUFSIZ];
4:
5: main(argc, argv)
6: int argc;
7: char *argv[];
8: {
9: register char *linp;
10: FILE *f;
11: register int c;
12: char line[1000];
13:
14: setbuf(stdout, ibuf);
15: argc--;
16: argv++;
17: f = stdin;
18: do {
19: if (argc > 0) {
20: close(0);
21: if ((f=fopen(argv[0], "r")) < 0) {
22: perror(argv[0]);
23: exit(1);
24: }
25: argc--, argv++;
26: }
27: for (;;) {
28: linp = line;
29: for (;;) {
30: c = getc(f);
31: if (c == '\n' || c == -1)
32: break;
33: *linp++ = c;
34: }
35: if (linp == line) {
36: if (c == '\n')
37: printf("\n");
38: } else {
39: *linp = 0;
40: printf("%s\r%s\n", line, line);
41: }
42: if (c == -1)
43: break;
44: }
45: } while (argc > 0);
46: fflush(stdout);
47: exit(0);
48: }
Defined functions
main
defined in line
5;
never used
Defined variables
ibuf
defined in line
3; used 1 times