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'
12 echo '/$scratchfilename='$scratchfilename
15 if egrep '( |[ ]+$)' $f >/dev
/null
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
30 rm -f $scratchfilename