diff options
author | rillig <rillig@pkgsrc.org> | 2005-09-02 11:43:52 +0000 |
---|---|---|
committer | rillig <rillig@pkgsrc.org> | 2005-09-02 11:43:52 +0000 |
commit | 3b87a700545da3484edaf227171c3fdfc2478b12 (patch) | |
tree | e492e11896d7742606023a439bb0f683ab38d460 /pkgtools | |
parent | 40b74e8b4e6eafa89d8e5479c0e361359e017936 (diff) | |
download | pkgsrc-3b87a700545da3484edaf227171c3fdfc2478b12.tar.gz |
In logical lines from Makefiles, white-space surrounding the
continuation is stripped from the string to make the output shorter.
Diffstat (limited to 'pkgtools')
-rw-r--r-- | pkgtools/pkglint/files/pkglint.pl | 21 |
1 files changed, 13 insertions, 8 deletions
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; |