1e3336946d7c85f08ea10a222964a8d532d23eaf
[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
16   echo '/$f'=$f
17
18   # We reuse the "expand" GNU utility to remove tabs, but if it turns out
19   # not to be available everywhere (or someone has defined "expand" to 
20   # mean something else on some other class of system!) we could probably
21   # hand-code a replacement in a few lines.
22   expand $f > $scratchfilename
23
24   sed 's/[      ]*$//' < $scratchfilename > $f
25
26 done
27
28 rm $scratchfilename