You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

fixcrlf.html 6.7 KiB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. <html>
  2. <head>
  3. <meta http-equiv="Content-Language" content="en-us">
  4. <title>Ant User Manual</title>
  5. </head>
  6. <body>
  7. <h2><a name="fixcrlf">FixCRLF</a></h2>
  8. <h3>Description</h3>
  9. <p>Adjusts a text file to local.</p>
  10. <p>It is possible to refine the set of files that are being adjusted. This can be
  11. done with the <i>includes</i>, <i>includesfile</i>, <i>excludes</i>, <i>excludesfile</i> and <i>defaultexcludes</i>
  12. attributes. With the <i>includes</i> or <i>includesfile</i> attribute you specify the files you want to
  13. have included by using patterns. The <i>exclude</i> or <i>excludesfile</i> attribute is used to specify
  14. the files you want to have excluded. This is also done with patterns. And
  15. finally with the <i>defaultexcludes</i> attribute, you can specify whether you
  16. want to use default exclusions or not. See the section on <a
  17. href="../dirtasks.html#directorybasedtasks">directory based tasks</a>, on how the
  18. inclusion/exclusion of files works, and how to write patterns.</p>
  19. <p>This task forms an implicit <a href="../CoreTypes/fileset.html">FileSet</a> and
  20. supports all attributes of <code>&lt;fileset&gt;</code>
  21. (<code>dir</code> becomes <code>srcdir</code>) as well as the nested
  22. <code>&lt;include&gt;</code>, <code>&lt;exclude&gt;</code> and
  23. <code>&lt;patternset&gt;</code> elements.</p>
  24. <h3>Parameters</h3>
  25. <table border="1" cellpadding="2" cellspacing="0">
  26. <tr>
  27. <td valign="top"><b>Attribute</b></td>
  28. <td valign="top"><b>Description</b></td>
  29. <td align="center" valign="top"><b>Required</b></td>
  30. </tr>
  31. <tr>
  32. <td valign="top">srcDir</td>
  33. <td valign="top">Where to find the files to be fixed up.</td>
  34. <td valign="top" align="center">Yes</td>
  35. </tr>
  36. <tr>
  37. <td valign="top">destDir</td>
  38. <td valign="top">Where to place the corrected files. Defaults to
  39. srcDir (replacing the original file)</td>
  40. <td valign="top" align="center">No</td>
  41. </tr>
  42. <tr>
  43. <td valign="top">includes</td>
  44. <td valign="top">comma separated list of patterns of files that must be
  45. included. All files are included when omitted.</td>
  46. <td valign="top" align="center">No</td>
  47. </tr>
  48. <tr>
  49. <td valign="top">includesfile</td>
  50. <td valign="top">the name of a file. Each line of this file is
  51. taken to be an include pattern</td>
  52. <td valign="top" align="center">No</td>
  53. </tr>
  54. <tr>
  55. <td valign="top">excludes</td>
  56. <td valign="top">comma separated list of patterns of files that must be
  57. excluded. No files (except default excludes) are excluded when omitted.</td>
  58. <td valign="top" align="center">No</td>
  59. </tr>
  60. <tr>
  61. <td valign="top">excludesfile</td>
  62. <td valign="top">the name of a file. Each line of this file is
  63. taken to be an exclude pattern</td>
  64. <td valign="top" align="center">No</td>
  65. </tr>
  66. <tr>
  67. <td valign="top">defaultexcludes</td>
  68. <td valign="top">indicates whether default excludes should be used or not
  69. (&quot;yes&quot;/&quot;no&quot;). Default excludes are used when omitted.</td>
  70. <td valign="top" align="center">No</td>
  71. </tr>
  72. <tr>
  73. <td valign="top">cr</td>
  74. <td valign="top">Specifies how carriage return (CR) characters are to
  75. be handled. Valid values for this property are:
  76. <ul>
  77. <li>add: ensure that there is a CR before every LF</li>
  78. <li>asis: leave CR characters alone</li>
  79. <li>remove: remove all CR characters</li>
  80. </ul>
  81. Default is based on the platform on which you are running this task.
  82. For Unix platforms, the default is remove. For DOS based systems
  83. (including Windows), the default is add.
  84. <p>
  85. Note: Unless this property is specified as &quot;asis&quot;, extra CR characters
  86. which do not precede a LF will be removed.</p>
  87. </td>
  88. <td valign="top" align="center">No</td>
  89. </tr>
  90. <tr>
  91. <td valign="top">tab</td>
  92. <td valign="top">Specifies how tab characters are to be handled. Valid
  93. values for this property are:
  94. <ul>
  95. <li>add: convert sequences of spaces which span a tab stop to tabs</li>
  96. <li>asis: leave tab and space characters alone</li>
  97. <li>remove: convert tabs to spaces</li>
  98. </ul>
  99. Default for this parameter is &quot;asis&quot;.
  100. <p>
  101. Note: Unless this property is specified as &quot;asis&quot;, extra spaces and
  102. tabs after the last non-whitespace character on the line will be removed.</p>
  103. </td>
  104. <td valign="top" align="center">No</td>
  105. </tr>
  106. <tr>
  107. <td valign="top">tablength</td>
  108. <td valign="top">The number of characters a TAB stop corresponds to.
  109. Must be a positive power of 2, default for this parameter is 8.</td>
  110. <td valign="top" align="center">No</td>
  111. </tr>
  112. <tr>
  113. <td valign="top">eof</td>
  114. <td valign="top">Specifies how DOS end of file (control-Z) characters are
  115. to be handled. Valid values for this property are:
  116. <ul>
  117. <li>add: ensure that there is an EOF character at the end of the file</li>
  118. <li>asis: leave EOF characters alone</li>
  119. <li>remove: remove any EOF character found at the end</li>
  120. </ul>
  121. Default is based on the platform on which you are running this task.
  122. For Unix platforms, the default is remove. For DOS based systems
  123. (including Windows), the default is asis.
  124. </td>
  125. <td valign="top" align="center">No</td>
  126. </tr>
  127. </table>
  128. <h3>Examples</h3>
  129. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  130. cr=&quot;remove&quot; eof=&quot;remove&quot;
  131. includes=&quot;**/*.sh&quot;
  132. /&gt;</pre>
  133. <p>Removes carriage return and eof characters from the shell scripts. Tabs and
  134. spaces are left as is.</p>
  135. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  136. cr=&quot;add&quot;
  137. includes=&quot;**/*.bat&quot;
  138. /&gt;</pre>
  139. <p>Ensures that there are carriage return characters prior to evey line feed.
  140. Tabs and spaces are left as is.
  141. EOF characters are left alone if run on
  142. DOS systems, and are removed if run on Unix systems.</p>
  143. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  144. tabs=&quot;add&quot;
  145. includes=&quot;**/Makefile&quot;
  146. /&gt;</pre>
  147. <p>Adds or removes CR characters to match local OS conventions, and
  148. converts spaces to tabs when appropriate. EOF characters are left alone if
  149. run on DOS systems, and are removed if run on Unix systems.
  150. Many versions of make require tabs prior to commands.</p>
  151. <pre> &lt;fixcrlf srcdir=&quot;${src}&quot;
  152. tabs=&quot;remove&quot;
  153. includes=&quot;**/README*&quot;
  154. /&gt;</pre>
  155. <p>Adds or removes CR characters to match local OS conventions, and
  156. converts all tabs to spaces. EOF characters are left alone if run on
  157. DOS systems, and are removed if run on Unix systems.
  158. You never know what editor a user will use to browse README's.</p>
  159. <hr>
  160. <p align="center">Copyright &copy; 2000,2001 Apache Software Foundation. All rights
  161. Reserved.</p>
  162. </body>
  163. </html>