/* Wrap a stream of characters into even lines. * Ignore newlines in the input. */ /* Copyright (c) 1999 Blossom Associates West */ /* All rights reserved. */ #include enum { DFLTN = 50 /* default output line length */ }; int main( int argc, char* argv[] ) { int c; int p = 0; int n = DFLTN; int start_nocount = '<'; /* To count everything set this to -1. */ int end_nocount = '>'; int counting = 1; while ( EOF != ( c = getchar() ) ) { if ( isprint( c ) ) { putchar( c ); if ( start_nocount == c ) { counting = 0; } if ( counting ) { p++; } p %= n; if ( 0 == p && counting ) { putchar( '\n' ); } if ( end_nocount == c ) { counting = 1; } } } if ( 0 != p ) putchar( '\n' ); }