| 1 | #! /bin/shscip-shell filesystem . . `/bin/sh`. |
| 2 | |
| 3 | #================================================================ |
| 4 | # tabcheck |
| 5 | # Find files including dispensable tab and space characters |
| 6 | #================================================================ |
| 7 | |
| 8 | |
| 9 | # set variables |
| 10 | regex='(\.h|\.c|\.cc|\.cpp|\.cxx|\.java|\.pl|\.pm|\.pod|\.rb|\.rd)$' |
| 11 | tabcode=`printfscip-shell system . . printf. '\t'` |
| 12 | |
| 13 | |
| 14 | # find tab |
| 15 | findscip-shell system . . find. . -type f | egrepscip-shell system . . egrep. $regex | |
| 16 | while read file |
| 17 | do |
| 18 | printfscip-shell system . . printf. 'Checking %s ... ' $file |
| 19 | err=0 |
| 20 | if grepscip-shell system . . grep. "$tabcode" $file > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 21 | then |
| 22 | printfscip-shell system . . printf. '### !!! TAB FOUND !!! ###' |
| 23 | err=1 |
| 24 | fi |
| 25 | if grepscip-shell system . . grep. ' $' $file > /dev/nullscip-shell filesystem . . `/dev/null`. |
| 26 | then |
| 27 | printfscip-shell system . . printf. '### !!! TAILING SPACE FOUND !!! ###' |
| 28 | err=1 |
| 29 | fi |
| 30 | [scip-shell system . . `[`. "$err" = 0 ] && printfscip-shell system . . printf. 'ok' |
| 31 | printfscip-shell system . . printf. '\n' |
| 32 | done |
| 33 | |
| 34 | |
| 35 | # exit normally |
| 36 | exit 0 |
| 37 | |
| 38 | |
| 39 | |
| 40 | # END OF FILE |