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

Martin Kletzander mkletzan at redhat.com
Mon Jul 11 15:40:56 UTC 2016


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 at redhat.com
>https://www.redhat.com/mailman/listinfo/libvir-list
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: Digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20160711/06863b06/attachment-0001.sig>


More information about the libvir-list mailing list