Author: rjung
Date: Thu Sep 20 09:34:18 2018
New Revision: 1841452

URL: http://svn.apache.org/viewvc?rev=1841452&view=rev
Log:
Add a new switch to allow ignoring file conversion
based on a regexp pattern for the full file path name.

Will be used to not convert PCRE testdata (which
is binary).

Modified:
    tomcat/jk/trunk/tools/lineends.pl

Modified: tomcat/jk/trunk/tools/lineends.pl
URL: 
http://svn.apache.org/viewvc/tomcat/jk/trunk/tools/lineends.pl?rev=1841452&r1=1841451&r2=1841452&view=diff
==============================================================================
--- tomcat/jk/trunk/tools/lineends.pl (original)
+++ tomcat/jk/trunk/tools/lineends.pl Thu Sep 20 09:34:18 2018
@@ -55,6 +55,8 @@ $ignore .= "class-so-dll-exe-obj-a-o-lo-
 # Some build env files
 $ignore .= "mcp-xdc-ncb-opt-pdb-ilk-sbr-";
 
+my $ignorepat = '';
+
 my $preservedate = 1;
 
 my $forceending = 0;
@@ -79,17 +81,22 @@ while (defined $ARGV[0]) {
     elsif ($ARGV[0] eq '--FORCE') {
         $forceending = 2;
     }
+    elsif ($ARGV[0] eq '--ignore' && $#ARGV >= 1) {
+        shift;
+        $ignorepat = $ARGV[0];
+    }
     elsif ($ARGV[0] =~ m/^-/) {
         die "What is " . $ARGV[0] . " supposed to mean?\n\n" 
          . "Syntax:\t$0 [option()s] [path(s)]\n\n" . <<'OUTCH'
 Where: paths specifies the top level directory to convert (default of '.')
        options are;
 
-         --cr     keep/add one ^M
-         --nocr   remove ^M's
-         --touch  the datestamp (default: keeps date/attribs)
-         --force  mismatched corrections (unbalanced ^M's)
-         --FORCE  all files regardless of file name!
+         --cr          keep/add one ^M
+         --nocr        remove ^M's
+         --touch       the datestamp (default: keeps date/attribs)
+         --force       mismatched corrections (unbalanced ^M's)
+         --FORCE       all files regardless of file name!
+         --ignore PAT  Do not convert files with full name matching regexp PAT
 
 OUTCH
     }
@@ -114,6 +121,9 @@ sub totxt {
         }
         my @exts = split /\./;
         if ($forceending < 2) {
+            if ($ignorepat ne '' && $File::Find::name =~ /$ignorepat/o) {
+                return;
+            }
             my $ext;
             while ($#exts && ($ext = pop(@exts))) {
                 if ($ignore =~ m|-$ext-|i) {



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to