summaryrefslogtreecommitdiffstats
path: root/wordwrap.pl
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:49:25 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 15:49:25 +0000
commit464df1d5e5ab1322e2dd0a7796939fff1aeefa9a (patch)
tree6a403684e0978f0287d7f0ec0e5aab1fd31a59e1 /wordwrap.pl
parentInitial commit. (diff)
downloade2fsprogs-464df1d5e5ab1322e2dd0a7796939fff1aeefa9a.tar.xz
e2fsprogs-464df1d5e5ab1322e2dd0a7796939fff1aeefa9a.zip
Adding upstream version 1.47.0.upstream/1.47.0upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'wordwrap.pl')
-rw-r--r--wordwrap.pl29
1 files changed, 29 insertions, 0 deletions
diff --git a/wordwrap.pl b/wordwrap.pl
new file mode 100644
index 0000000..807c628
--- /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;
+ @words = split;
+ while (defined($word = shift @words)) {
+ $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");
+}