The following commit has been merged in the master branch:
commit 1c62e1f704bb6bb9519fc6e3648df939bfcdb9f1
Author: Raphael Geissert <[email protected]>
Date:   Wed May 12 15:51:21 2010 -0500

    checkbashisms: handle line continuations
    
    Closes: #531327
    
    Signed-off-by: Raphael Geissert <[email protected]>
    Signed-off-by: James Vega <[email protected]>

diff --git a/scripts/checkbashisms.pl b/scripts/checkbashisms.pl
index 1117a9c..5b5a34c 100755
--- a/scripts/checkbashisms.pl
+++ b/scripts/checkbashisms.pl
@@ -105,6 +105,7 @@ foreach my $filename (@ARGV) {
     my $last_continued = 0;
     my $continued = 0;
     my $found_rules = 0;
+    my $buffered_line = "";
 
     while (<C>) {
        next unless ($check_lines_count == -1 or $. <= $check_lines_count);
@@ -170,6 +171,18 @@ foreach my $filename (@ARGV) {
            $_ = $orig_line;
        }
 
+       # Handle line continuation
+       if (!$makefile && $cat_string eq '' && m/\\$/) {
+           chop;
+           $buffered_line .= $_;
+           next;
+       }
+
+       if ($buffered_line ne '') {
+           $_ = $buffered_line . $_;
+           $buffered_line ='';
+       }
+
        if ($makefile) {
            $last_continued = $continued;
            if (/[^\\]\\$/) {

-- 
Git repository for devscripts


-- 
To unsubscribe, send mail to [email protected].

Reply via email to