Re: [PATCH 5/5] test-wrap-argv: set cutoff at 78 characters

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Mon, Jul 11, 2016 at 04:40:28PM +0200, Ján Tomko wrote:
For every but the last argument, we also need space for a space
and a backslash.

Rewrap everything longer than 78 characters.
---

[...]

diff --git a/tests/test-wrap-argv.pl b/tests/test-wrap-argv.pl
index 6adaef9..3d94df6 100755
--- a/tests/test-wrap-argv.pl
+++ b/tests/test-wrap-argv.pl
@@ -150,18 +150,19 @@ sub rewrap_line {
sub rewrap_arg {
    my $arg = shift;
    my @ret;
+    my $max_len = 78;

-    while (length($arg) > 80) {
-        my $split = rindex $arg, ",", 80;
+    while (length($arg) > $max_len) {
+        my $split = rindex $arg, ",", $max_len;
        if ($split == -1) {
-            $split = rindex $arg, ":", 80;
+            $split = rindex $arg, ":", $max_len;
        }
        if ($split == -1) {
-            $split = rindex $arg, " ", 80;
+            $split = rindex $arg, " ", $max_len;
        }
        if ($split == -1) {
            warn "cannot find nice place to split '$arg' below 80 chars\n";
-            $split = 79;
+            $split = $max_len;

Shouldn't this be $split = $max_len - 1?

        }
        $split++;

--
2.7.3

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

Attachment: signature.asc
Description: Digital signature

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]