2 * Deal with duplicated lines in a file
19 void pline(char *buf);
20 int equal(char *b1, char *b2);
24 main(int argc, char *argv[])
34 if(isdigit(argv[1][1]))
35 fields = atoi(&argv[1][1]);
43 letters = atoi(&argv[1][1]);
50 sysfatal("cannot open %s", argv[1]);
54 sysfatal("unexpected argument %s", argv[2]);
55 Binit(&fin, f, OREAD);
56 Binit(&fout, 1, OWRITE);
75 } while(equal(b2, b1));
88 p = Brdline(&fin, '\n');
93 sysfatal("line too long");
117 Bprint(&fout, "%4d ", linec);
120 Bprint(&fout, "%s\n", buf);
124 equal(char *b1, char *b2)
128 if(fields || letters) {
135 if(c == 0 && mode == 's')
152 while(nf++ < fields) {
153 while(*s == ' ' || *s == '\t')
155 while(!(*s == ' ' || *s == '\t' || *s == 0) )
158 while(nl++ < letters && *s != 0)