#!/bin/sh _printhelp() { cat</dev/null; then echo "Please install 'indent'." exit fi CMD="indent -i4 -ppi4 -bli0 -cli4 -nut" _formatc_dir() { ## Note that '+' does not work together with {} concatenation. Don't know ## why... find "$1" -type f \ -name "*.[ch]" \ -print \ -exec $CMD {} \; \ -exec rm {}"~" \; } for i ; do [ ! -e "$i" ] && continue if [ -d "$i" ]; then _formatc_dir "$i" else $CMD "$i" rm -f "$i~" fi done