Here is a little fix for that little problem.

Vitaly

----- Original Message ----- 
From: Stefan Bodewig <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, July 06, 2000 12:26 AM
Subject: Re: enhancements?


> >>>>> "MA" == Michael B. Allen <[EMAIL PROTECTED]> writes:
> 
>  MA> 1) Permissions are not preserved when generating a tar. How can
>  MA> you ensure binarys will be marked executible when untarred?
> 
> Java doesn't know the Unix concept of permissions, so there is no easy
> way to determine the permissions while building the tar file. One
> could spawn a stat(1) for each file on Unix systems but this sounds
> cumbersome to me.
> 
>  MA> 2) Copydir will not copy an empty subdirectory.
> 
> Use Mkdir instead? Seriously, this could be done.
> 
>  MA> 3) Will there be an Unjar task, or are we supposed to use exec?
> 
> JAR is the same as ZIP with an added META-INF/MANIFEST.MF file. Unzip
> should be fine.
> 
>  MA> 4) FixCRLF task converts tabs to 8 spaces. Can I specify 4?
> 
> This could easily become a religious question - TABs *are* 8 spaces
> wide you know? OK, let's avoid a flame war, send a patch to make that
> an attribute and I'll commit it.
> 
> Stefan
Index: FixCRLF.java
===================================================================
RCS file: 
/home/cvspublic/jakarta-ant/src/main/org/apache/tools/ant/taskdefs/FixCRLF.java,v
retrieving revision 1.5
diff -u -r1.5 FixCRLF.java
--- FixCRLF.java        2000/02/27 01:47:46     1.5
+++ FixCRLF.java        2000/07/06 18:45:06
@@ -94,6 +94,7 @@
     private int addcr;      // cr:  -1 => remove, 0 => asis, +1 => add
     private int addtab;     // tab: -1 => remove, 0 => asis, +1 => add
     private int ctrlz;      // eof: -1 => remove, 0 => asis, +1 => add
+    private int tablenght = 8;  // length of tab in spaces
 
     private File srcDir;
     private File destDir = null;
@@ -177,6 +178,15 @@
     }
 
     /**
+     * Specify tab length in characters
+     *
+     * @param tabLength specify the length of tab in spaces, has to be a power 
of 2
+     */
+    public void setTabLenght(String tlenght) {
+        tablenght = Integer.parseInt(tlenght);
+    }
+
+    /**
      * Specify how DOS EOF (control-z) charaters are to be handled
      *
      * @param option valid values:
@@ -226,7 +236,8 @@
         project.log("options:" +
             " cr=" + (addcr==-1 ? "add" : addcr==0 ? "asis" : "remove") +
             " tab=" + (addtab==-1 ? "add" : addtab==0 ? "asis" : "remove") +
-            " eof=" + (ctrlz==-1 ? "add" : ctrlz==0 ? "asis" : "remove"),
+            " eof=" + (ctrlz==-1 ? "add" : ctrlz==0 ? "asis" : "remove") +
+            " tablenght=" + tablenght,
             "fixcrlf", project.MSG_VERBOSE);
 
         DirectoryScanner ds = super.getDirectoryScanner(srcDir);
@@ -270,7 +281,7 @@
             int outsize = count;
             if (addcr  !=  0) outsize-=cr;
             if (addcr  == +1) outsize+=lf;
-            if (addtab == -1) outsize+=tab*7;
+            if (addtab == -1) outsize+=tab*tablenght;
             if (ctrlz  == +1) outsize+=1;
 
             // copy the data
@@ -294,7 +305,7 @@
                             col++;
                         } else {
                             // advance column to next tab stop
-                            col = (col|7)+1;
+                            col = (col|(tablenght-1))+1;
                         }
                         break;
 
@@ -322,9 +333,9 @@
 
                             // add tabs until this column would be passed
                             // note: the start of line is adjusted to match
-                            while ((diff|7)<col) {
+                            while ((diff|(tablenght-1))<col) {
                                 outdata[o++]=(byte)'\t';
-                                line-=7-(diff&7);
+                                line-=(tablenght-1)-(diff&(tablenght-1));
                                 diff=o-line;
                             };
                         };

Attachment: FixCRLF.java
Description: Binary data

Reply via email to