Better abstractions for target struct manipulation in host.
[sbcl.git] / tools-for-build / canonicalize-whitespace-1
blob431c1cbbf7c3f7899f446513a907cb9d4b641514
1 #!/bin/sh
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)
8 scratchfilename=/tmp/canonicalize-whitespace-1.$$.tmp
10 echo '/in canonicalize-whitespace-1'
11 echo '/$*'=$*
12 echo '/$scratchfilename='$scratchfilename
14 for f in $*; do
15 if egrep '( |[ ]+$)' $f >/dev/null
16 then
17 echo '/$f'=$f
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
25 sed 's/[ ]*$//' < $scratchfilename > $f
28 done
30 rm -f $scratchfilename