aboutsummaryrefslogtreecommitdiff
path: root/wordwrap.pl
diff options
context:
space:
mode:
authorTheodore Ts'o <tytso@mit.edu>1999-07-03 20:25:58 +0000
committerTheodore Ts'o <tytso@mit.edu>1999-07-03 20:25:58 +0000
commit9d564f73f594282d87209313ea59e4ca08727ab3 (patch)
tree09c14c39d89cfa127f36b5d7b44cadc8f74ef13a /wordwrap.pl
parentc54b3c3c99a5d3011f6f60934e90dae7f60b3b00 (diff)
downloade2fsprogs-9d564f73f594282d87209313ea59e4ca08727ab3.tar.gz
ChangeLog, Makefile.in, configure.in, MCONFIG.in, configure, wordwrap.pl:
Makefile.in (depend): Make "make depend" at the top-level automatically recurse through all subdirectories. configure.in: Test for perl since it's needed by wordwrap.pl MCONFIG.in (depend): Fix make-depend so that it the dependencies are automatically word-wrapped. Added the makefile macro $(PERL). wordwrap.pl: New file which does the word wrapping.
Diffstat (limited to 'wordwrap.pl')
-rw-r--r--wordwrap.pl26
1 files changed, 26 insertions, 0 deletions
diff --git a/wordwrap.pl b/wordwrap.pl
new file mode 100644
index 00000000..f8d6019d
--- /dev/null
+++ b/wordwrap.pl
@@ -0,0 +1,26 @@
+#!/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 @_)) {
+ if ($linelen > 0) {
+ printf(" ");
+ }
+ $len = length($word) + 1;
+ $linelen += $len;
+ if ($linelen > 78) {
+ printf("\\\n ");
+ $linelen = 1+$len;
+ }
+ printf("%s", $word);
+ }
+ printf("\n");
+}