diff options
| author | Philipp Klaus <philipp.klaus@gmail.com> | 2011-06-21 17:12:21 +0200 |
|---|---|---|
| committer | Philipp Klaus <philipp.klaus@gmail.com> | 2011-06-21 17:12:21 +0200 |
| commit | 4535ac486ce87b6a7257a7959426138405b7ecf8 (patch) | |
| tree | 2b397f1430e62032aa696dd8fe0b91fd8b6a3269 /wordwrap.pl | |
| download | pwgen-4535ac486ce87b6a7257a7959426138405b7ecf8.zip | |
automatic commit for pwgen-2.0
Diffstat (limited to 'wordwrap.pl')
| -rwxr-xr-x | wordwrap.pl | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/wordwrap.pl b/wordwrap.pl new file mode 100755 index 0000000..646bbc3 --- /dev/null +++ b/wordwrap.pl @@ -0,0 +1,29 @@ +#!/usr/bin/perl +# +# wordwrap.pl --- does word wrap +# +while (<>) { + if (/^#/) { # don't word wrap comments + print; + next; + } + next if (/^$/); # skip blank lines + $linelen = 0; + split; + while (defined($word = shift @_)) { + $word =~ s#\$\(srcdir\)/\.\./version.h#\$\(top_srcdir\)/version.h#; + $word =~ s#\$\(srcdir\)/.\.\/\.\./version.h#\$\(top_srcdir\)/version.h#; + $word =~ s#\$\(srcdir\)/.\.\/et/com_err.h#\$\(top_srcdir\)/lib/et/com_err.h#; + if ($linelen > 0) { + printf(" "); + } + $len = length($word) + 1; + $linelen += $len; + if ($linelen > 78) { + printf("\\\n "); + $linelen = 1+$len; + } + printf("%s", $word); + } + printf("\n"); +} |