4 This program reads an article from standard input and checks if it
5 is a uuencoded binary. If it is, exits with exit code 0, otherwise
8 GNU Copyright applies. ichudov@algebra.com
15 #define MAX_BINARY_LINES 10
19 int main( int argc, char *argv[] )
21 int nBinLines = 0, maxNBinLines = 0;
24 while( fgets( buf, MAX_BUF, stdin ) )
25 if( strlen( buf ) <= 1 ) break;
27 while( fgets( buf, MAX_BUF, stdin ) ) {
28 if( strlen( buf ) > 45 /* buf long enough */
29 && (!(strchr( buf, ' ' ) || strchr( buf, '\t' )) /* no spaces */
30 || (buf[0] == 'M') ) /* some uuencoded stuff begins with 'M' */
31 ) { /* likely a uuencoded line */
33 maxNBinLines = (nBinLines > maxNBinLines) ? nBinLines : maxNBinLines;
37 /* more than 10 consecutive 45 char lines with no blank - likely binary */
38 return( maxNBinLines < MAX_BINARY_LINES );