#!/usr/local/bin/perl
#
# Puts words back together on a line
# Kees Cook 1997

$line="";

# pick either 78 as the wrap limit, or something from command line
$width=$ARGV[0] || 78;

foreach $word (<STDIN>) {
	chop($word);
        if ((length($line) + length($word) + 1) >= $width) {
                print $line, "\n";
                $line = "";
        }
        $line .= " " if ($line ne "");
	$line .= $word;
}
print $line, "\n" if ($line ne "");
