Fix make-array transforms.
[sbcl.git] / tools-for-build / canonicalize-whitespace-1
1 #!/bin/sh
2
3 # in-place "canonicalize-whitespace" conversion for files in $*:
4 #   * Convert tabs to spaces.
5 #   * Delete trailing whitespace.
6 # (on $*, in place, overwriting the old file)
7
8 scratchfilename=/tmp/canonicalize-whitespace-1.$$.tmp
9
10 echo '/in canonicalize-whitespace-1'
11 echo '/$*'=$*
12 echo '/$scratchfilename='$scratchfilename
13
14 for f in $*; do
15   if egrep '(   |[       ]+$)' $f >/dev/null
16   then
17     echo '/$f'=$f
18
19     # We reuse the "expand" GNU utility to remove tabs, but if it turns out
20     # not to be available everywhere (or someone has defined "expand" to 
21     # mean something else on some other class of system!) we could probably
22     # hand-code a replacement in a few lines.
23     expand $f > $scratchfilename
24
25     sed 's/[    ]*$//' < $scratchfilename > $f
26   fi
27
28 done
29
30 rm -f $scratchfilename