From 75553e7df9ca8697e6dc26aaf313453c963ba921 Mon Sep 17 00:00:00 2001 From: rillig Date: Fri, 2 Sep 2005 11:43:52 +0000 Subject: In logical lines from Makefiles, white-space surrounding the continuation is stripped from the string to make the output shorter. --- pkgtools/pkglint/files/pkglint.pl | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) (limited to 'pkgtools') diff --git a/pkgtools/pkglint/files/pkglint.pl b/pkgtools/pkglint/files/pkglint.pl index 9b9276a09f1..d3f74b011de 100644 --- a/pkgtools/pkglint/files/pkglint.pl +++ b/pkgtools/pkglint/files/pkglint.pl @@ -11,7 +11,7 @@ # Freely redistributable. Absolutely no warranty. # # From Id: portlint.pl,v 1.64 1998/02/28 02:34:05 itojun Exp -# $NetBSD: pkglint.pl,v 1.267 2005/09/02 10:42:18 rillig Exp $ +# $NetBSD: pkglint.pl,v 1.268 2005/09/02 11:43:52 rillig Exp $ # # This version contains lots of changes necessary for NetBSD packages # done by: @@ -506,16 +506,21 @@ sub parse_command_line() { sub get_logical_line($$) { my ($lines, $ref_lineno) = @_; - my ($value, $lineno); + my ($value, $lineno, $first); $value = ""; + $first = true; for ($lineno = ${$ref_lineno}; $lineno <= $#{$lines}; $lineno++) { - my $text = $lines->[$lineno]->text; - if ($text =~ qr"^(.*)\\$") { - $value .= $1; - } else { - $value .= $text; - last; + if ($lines->[$lineno]->text =~ qr"^(\s*)(.*?)\s*(\\?)$") { + my ($indent, $text, $cont) = ($1, $2, $3); + + $value .= $first ? "$indent$text" : $text; + if ($cont eq "\\") { + $value .= " "; + } else { + last; + } + $first = false; } } ${$ref_lineno} = $lineno + 1; -- cgit v1.2.3