]> xenbits.xensource.com Git - libvirt.git/commitdiff
test-wrap-argv: return a string in rewrap_arg
authorJán Tomko <jtomko@redhat.com>
Mon, 30 May 2016 15:58:27 +0000 (17:58 +0200)
committerJán Tomko <jtomko@redhat.com>
Tue, 21 Jun 2016 16:13:07 +0000 (18:13 +0200)
Do not print anything, let the caller take care of it.

tests/test-wrap-argv.pl

index 72a3e32b7f86e9389755b6ddf4643a705d2d1fa4..693bed558cf20e1f85b201662f23e1015b5e8039 100755 (executable)
@@ -104,7 +104,7 @@ sub rewrap_line {
     print join(" \\\n", @env, $cmd), " \\\n";
     # We might have to split line argument values...
     for (my $i = 0; $i <= $#args; $i++) {
-        &rewrap_arg($args[$i]);
+        print &rewrap_arg($args[$i]);
 
         if ($i != $#args) {
             print " \\\n";
@@ -116,6 +116,7 @@ sub rewrap_line {
 
 sub rewrap_arg {
     my $arg = shift;
+    my @ret;
 
     while (length($arg) > 80) {
         my $split = rindex $arg, ",", 80;
@@ -131,10 +132,9 @@ sub rewrap_arg {
         }
         $split++;
 
-        my $head = substr $arg, 0, $split;
+        push @ret, substr $arg, 0, $split;
         $arg = substr $arg, $split;
-
-        print $head, "\\\n";
     }
-    print $arg;
+    push @ret, $arg;
+    return join("\\\n", @ret);
 }