grass_indent.sh 628 B

1234567891011121314151617181920
  1. #!/bin/sh
  2. # Indent source code according to GRASS SUBMITTING rules
  3. if [ $# -lt 1 ] ; then
  4. echo "No files specified (give file name(s) as parameter)"
  5. exit 1
  6. else
  7. indent -npro -bad -bap -bbb -br -bli0 -bls -cli0 -ncs -fc1 -hnl -i4 \
  8. -nbbo -nbc -nbfda -nbfde -ncdb -ncdw -nce -nfca -npcs -nprs \
  9. -npsl -nsc -nsob -saf -sai -saw -sbi0 -ss -ts8 -ut "$@"
  10. # fix broken gettext macros:
  11. grep -l '\<_$' "$@" | \
  12. while read file ; do sed -i -e '/[( \t]_$/{;N;s/\n[ \t]*//;}' $file ; done
  13. # restore original file with timestamp if indent did not change anything
  14. cmp "$@"~ "$@" > /dev/null && mv -f "$@"~ "$@"
  15. fi