]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
SourceFormat: report broken file and continue after errors.
authorAmos Jeffries <amosjeffries@squid-cache.org>
Thu, 3 Sep 2009 12:05:05 +0000 (06:05 -0600)
committerAmos Jeffries <amosjeffries@squid-cache.org>
Thu, 3 Sep 2009 12:05:05 +0000 (06:05 -0600)
scripts/formater.pl
scripts/srcformat.sh

index af929fc0ad97d882e3da697100b9b1675783f6d6..2f6216edfd99d19d0512220b79acc1c44a1cb1b7 100755 (executable)
@@ -25,13 +25,12 @@ use IPC::Open2;
 #
 # NP: The Squid code requires astyle version 1.22 or later
 #
-$ASTYLE_BIN="/usr/bin/astyle";
-
+$ASTYLE_BIN="/usr/local/bin/astyle";
+#$ASTYLE_BIN="/usr/bin/astyle";
 #$ASTYLE_BIN="/usr/local/src/astyle-1.22/bin/astyle";
-$ASTYLE_ARGS ="--mode=c -s4 -O -l";
 
+$ASTYLE_ARGS ="--mode=c -s4 -O -l";
 #$ASTYLE_ARGS="--mode=c -s4 -O --break-blocks -l";
-#$ASTYLE_BIN="/usr/local/src/astyle-1.22/bin/astyle";
 
 
 if(! -e $ASTYLE_BIN){
@@ -82,8 +81,7 @@ while($out){
        print "An error while open2\n";
        exit -1;
     }
-    
-    
+
     if($pid=fork()){
        #do parrent staf
        close(FROM_ASTYLE);
@@ -110,7 +108,7 @@ while($out){
     else{
        # child staf
        close(TO_ASTYLE);
-       
+
        if(!open(OUT,">$out")){
            print "Can't open output file: $out\n";
            exit -1;
@@ -141,7 +139,7 @@ sub input_filter{
 
     if($$line =~/\s+int\s+.*/s || $$line=~ /\s+unsigned\s+.*/s ||
        $$line =~/^int\s+.*/s || $$line=~ /^unsigned\s+.*/s
-       ){ 
+       ){
        if( $$line =~ /(\(|,|\)|\#|typedef)/s ){
            #excluding int/unsigned appeared inside function prototypes,typedefs etc....
            return 1;
@@ -158,12 +156,12 @@ sub input_filter{
             $prx =~ s/\s*$//g;
            $$line= $prx." int ".$name."__FORASTYLE__".$val.";".$extra;
 #          print "----->".$$line."\n";
-       }       
+       }
        elsif($$line =~ /\s*unsigned\s+([^:]*):\s*(\w+)\s*\;(.*)/s){
             local($name,$val,$extra)=($1,$2,$3);
             $prx =~ s/\s*$//g;
            $$line= "unsigned ".$name."__FORASTYLE__".$val.";".$extra;
-       }       
+       }
        return 1;
     }
 
index ffe5efe9c62f69e9ce964092c197029641c5110e..659c8a4c5dbb8df9d452b27ca3ccbedbc9caadcd 100755 (executable)
@@ -30,12 +30,12 @@ for FILENAME in `ls -1`; do
                md52=`cat  $FILENAME.astylebak| tr -d "\n \t\r" | $MD5`;
 
                if test "$md51" != "$md52" ; then
-                       echo "File $PWD/$FILENAME not converted well";
+                       echo "ERROR: File $PWD/$FILENAME not formating well";
                        mv $FILENAME $FILENAME.astylebad
                        mv $FILENAME.astylebak $FILENAME
-                       exit 1;
+               else
+                       rm $FILENAME.astylebak
                fi
-               rm $FILENAME.astylebak
                continue;
         fi
     esac