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

[PATCH 1/3] Create valid dctrl-like output



From: Joachim Breitner <mail@joachim-breitner.de>

Instead of adding the dots for empty lines when reading the input, and
adding the extra space when outputting, save the data as is and create
the correct format when outputting. This makes sure that multi-line-data
passed to -m is also represented correctly.
---
 bin/wanna-build |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/bin/wanna-build b/bin/wanna-build
index 4f3690c..c093a7f 100755
--- a/bin/wanna-build
+++ b/bin/wanna-build
@@ -274,7 +274,6 @@ if (!$fail_reason) {
 		while(!eof(STDIN)) {
 			$line = <STDIN>;
 			last if $line eq ".\n";
-			$line = ".\n" if $line eq "\n";
 			$fail_reason .= $line;
 		}
 		chomp( $fail_reason );
@@ -2187,8 +2186,8 @@ sub write_db {
 				if (!defined($ui->{'User'}));
 			    foreach $key (keys %{$ui}) {
 				my $val = $ui->{$key};
-				chomp($val);
-				$val =~ s/\n/\n /g;
+				$val =~ s/^/ /mg;
+				$val =~ s/^ $/ ./mg;
 				print F "$key: $val\n";
 			    }
 			    print F "\n";
@@ -2198,7 +2197,8 @@ sub write_db {
 			foreach $key (keys %{$pkg}) {
 				my $val = $pkg->{$key};
 				chomp( $val );
-				$val =~ s/\n/\n /g;
+				$val =~ s/^/ /mg;
+				$val =~ s/^ $/ ./mg;
 				print F "$key: $val\n";
 			}
 		    	print F "\n";
-- 
1.6.3.3


Reply to: