From a611c6cbf61a21148875a18bd52784a972fd33bd Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Sat, 21 Dec 1996 22:16:03 +0000 Subject: (wrap): New function. Use it. --- tests/cut/mk-script.pl | 30 ++++++++++++++++++++++++++---- 1 file changed, 26 insertions(+), 4 deletions(-) (limited to 'tests/cut/mk-script.pl') diff --git a/tests/cut/mk-script.pl b/tests/cut/mk-script.pl index 5f9c9af6a..a7b396b17 100644 --- a/tests/cut/mk-script.pl +++ b/tests/cut/mk-script.pl @@ -109,6 +109,28 @@ sub spec_to_list ($$$) return \%h; } +sub wrap +{ + my ($preferred_line_len, @tok) = @_; + assert ($preferred_line_len > 0); + my @lines; + my $line = ''; + my $word; + foreach $word (@tok) + { + if ($line && length ($line) + 1 + length ($word) > $preferred_line_len) + { + push (@lines, $line); + $line = $word; + next; + } + my $sp = ($line ? ' ' : ''); + $line .= "$sp$word"; + } + push (@lines, $line); + return @lines; +} + # ~~~~~~~ main ~~~~~~~~ { $| = 1; @@ -120,7 +142,6 @@ sub spec_to_list ($$$) if ($xx eq '--list') { validate (); - # FIXME !!!!!!!!!!!!!!!!!!!!!!!!!!!! # Output three lists of files: # EXPLICIT -- file names specified in Test.pm # MAINT_GEN -- maintainer-generated files @@ -145,9 +166,10 @@ sub spec_to_list ($$$) push (@maint, @{$e->{MAINT_GEN}}); } - print 'explicit: ', join (' ', @exp), "\n"; - print 'maint-gen: ', join (' ', @maint), "\n"; - print 'run-gen: ', join (' ', @run), "\n"; + my $len = 78; + print join (" \\\n", wrap ($len, 'explicit =', @exp)), "\n"; + print join (" \\\n", wrap ($len, 'maint-gen =', @maint)), "\n"; + print join (" \\\n", wrap ($len, 'run-gen =', @run)), "\n"; exit 0; } -- cgit v1.2.3-70-g09d2