6 begin8sp_tab
=$
's/^ /\t/'
7 beginchar7sp_chartab
=$
's/^\\([^ \t]\\) /\\1\t/'
8 tab8sp_tabtab
=$
's/\t /\t\t/g'
9 begin17sptab_tab
=$
's/^ \\{1,7\\}\t/\t/'
10 tab17sptab_tabtab
=$
's/\t \\{1,7\\}\t/\t\t/g'
11 trailingws_
=$
's/[ \t]*$//'
12 # Fixes whitespace in strings:
13 # printk(KERN_WARNING "ISILoad:Card%d rejected load header:\n"...);
14 wscr_cr
=$
's/[ \t]*\\\\n/\\\\n/'
18 if test "C" = "${name/*.[ch]/C}" \
19 -o "SH" = "${name/*.sh/SH}"; then
20 echo "Formatting $name as C or sh file" >&2
22 |
sed "$begin8sp_tab" \
23 |
sed "$begin17sptab_tab" \
24 |
sed -e "$tab8sp_tabtab" -e "$tab8sp_tabtab" -e "$tab8sp_tabtab" \
25 -e "$tab8sp_tabtab" -e "$tab8sp_tabtab" -e "$tab8sp_tabtab" \
26 |
sed -e "$tab17sptab_tabtab" -e "$tab17sptab_tabtab" \
27 -e "$tab17sptab_tabtab" -e "$tab17sptab_tabtab" \
28 -e "$tab17sptab_tabtab" -e "$tab17sptab_tabtab" \
29 |
sed "$trailingws_" \
30 |
sed -e "$wscr_cr" -e "$wscr_cr" -e "$wscr_cr" -e "$wscr_cr" \
31 -e "$wscr_cr" -e "$wscr_cr" -e "$wscr_cr" -e "$wscr_cr" \
34 echo "Removing trailing spaces from $name" >&2
36 |
sed "$trailingws_" \
41 cat "$name.$temp" >"$name"