~ubuntu-branches/debian/sid/pwgen/sid

« back to all changes in this revision

Viewing changes to wordwrap.pl

  • Committer: Bazaar Package Importer
  • Author(s): Vincent Renardias
  • Date: 2001-12-06 17:38:58 UTC
  • Revision ID: james.westby@ubuntu.com-20011206173858-jf0wwxjtrm7e68hg
Tags: upstream-2.01
ImportĀ upstreamĀ versionĀ 2.01

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
#
 
3
# wordwrap.pl --- does word wrap
 
4
#
 
5
while (<>) {
 
6
    if (/^#/) {         # don't word wrap comments
 
7
        print;
 
8
        next;
 
9
    }
 
10
    next if (/^$/);     # skip blank lines
 
11
    $linelen = 0;
 
12
    split;
 
13
    while (defined($word = shift @_)) {
 
14
        $word =~ s#\$\(srcdir\)/\.\./version.h#\$\(top_srcdir\)/version.h#;
 
15
        $word =~ s#\$\(srcdir\)/.\.\/\.\./version.h#\$\(top_srcdir\)/version.h#;
 
16
        $word =~ s#\$\(srcdir\)/.\.\/et/com_err.h#\$\(top_srcdir\)/lib/et/com_err.h#;
 
17
        if ($linelen > 0) {
 
18
            printf(" ");
 
19
        }
 
20
        $len = length($word) + 1;
 
21
        $linelen += $len;
 
22
        if ($linelen > 78) {
 
23
            printf("\\\n ");
 
24
            $linelen = 1+$len;
 
25
        }
 
26
        printf("%s", $word);
 
27
    }
 
28
    printf("\n");
 
29
}