|
|
1.1 root 1: #include "ctype.h"
2: #include "output.h"
3: #include "input.h"
4: #define eqstr(a,b) (cf(a,b)==0)
5: #define cpstr(x) movstr(w,x)
6: #define MAXW 128
7:
8: char w[MAXW];
9: char word();
10: int width=120;
11:
12: main(argc,argv)
13: int argc;
14: char *argv[];
15: {
16: char f1[MAXW], f2[MAXW];
17: FILEBLK f;
18: char first;
19:
20: /* args ? */
21: if(argc>1) {
22: width=atoi(argv[1]);
23: }
24:
25: initf(0);
26: f1[0]=0; f2[0]=0;
27:
28: while(eof==0) {
29: word();
30:
31: if(w[0]!=first) {
32: first=w[0];
33: newline();
34: }
35:
36: if(eqstr(w,f1)) {
37: word();
38: if(!eqstr(w,f2)) {
39: print("\n%16t%s", w);
40: ensure(32);
41: cpstr(f2);
42: }
43: }else{ cpstr(f1);
44: print("\n%s", f1);
45: ensure(16);
46: word(); cpstr(f2);
47: print("%s", f2);
48: ensure(32);
49: }
50:
51: word();
52: if(charpos()>=width) {
53: print("\n%32t");
54: }
55: print("%s %4t", w);
56: }
57: exit(0);
58: }
59:
60: ensure(n)
61: int n;
62: {
63: if(charpos()<n-1)
64: print("%T",n);
65: else print("\n%T",n);
66: }
67:
68: char word()
69: {
70: register char *p=w;
71: register char c;
72:
73: while((c=readc())!=':' && c!='\n' && c!=EOF) {
74: if(p<&w[MAXW]) {
75: *p++ = c;
76: }
77: }
78: *p++ = 0;
79: return(c&0377);
80: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.