5 main(int argc, char *argv[])
12 int i, lines=0, prefixes[256];
14 /* initialize array of # of prefixes (for each ascii char) */
15 for(i=0; i<256; prefixes[i]=0, i++);
17 /* set values for quote ratio and max #lines */
18 Qratio = argc>1 ? atof(argv[1]) : .75 ;
19 MaxLines = argc>2 ? atoi(argv[2]) : 20 ;
21 /* open input file or stdin */
22 if(argc<=3 || ! ( fp = fopen(argv[3], "r") ) )
26 while( fgets(buf, 99, fp) )
30 /* get to the first non-white char in line */
31 for(i=0; buf[i] < 33 && buf[i] > 0; i++);
33 /* string is non-empty */
36 /* increment prefix counter for this prefix */
37 prefixes[ (int) buf[i] ]++;
39 /* increment line counter */
44 if( lines > MaxLines )
45 for( i=0; i<256; i++ )
47 /* overquote with char i */
48 if( prefixes[i] > Qratio*lines )
51 /* everytjing seems ok */