2 * Deal with duplicated lines in a file
22 void pline(char *buf);
23 int equal(char *b1, char *b2);
27 main(int argc, char *argv[])
38 if(isdigit(argv[1][1]))
39 fields = atoi(&argv[1][1]);
47 letters = atoi(&argv[1][1]);
54 sysfatal("cannot open %s", argv[1]);
58 sysfatal("unexpected argument %s", argv[2]);
59 Binit(&fin, f, OREAD);
60 Binit(&fout, 1, OWRITE);
79 } while(equal(b2, b1));
92 p = Brdline(&fin, '\n');
97 sysfatal("line too long");
121 Bprint(&fout, "%4d ", linec);
124 Bprint(&fout, "%s\n", buf);
128 equal(char *b1, char *b2)
132 if(fields || letters) {
139 if(c == 0 && mode == 's')
156 while(nf++ < fields) {
157 while(*s == ' ' || *s == '\t')
159 while(!(*s == ' ' || *s == '\t' || *s == 0) )
162 while(nl++ < letters && *s != 0)