You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

31 lines
736 B

  1. #!/bin/sh
  2. # Run the beautifier "Uncrustify" on a single file.
  3. # Because the file "uncrustify.cfg" only exists in the top level of the project
  4. # you should run this script from there so this script can find your uncrustify.cfg file.
  5. UNCRUSTIFYTMP=/tmp/uncrustify.tmp
  6. if [ ! -f uncrustify.cfg ]; then
  7. echo "unable to find uncrustify.cfg, aborting"
  8. exit 1
  9. fi
  10. UNCRUSTIFYBIN=`which uncrustify`
  11. if [ "$UNCRUSTIFYBIN" = "" ]; then
  12. echo "you must specify uncrustify in your PATH, I cannot find it"
  13. exit 2
  14. fi
  15. if [ $# -lt 1 ]; then
  16. echo "Usage $0 <filename .c or .h>"
  17. exit 3
  18. fi
  19. uncrustify -c uncrustify.cfg <$1 >$UNCRUSTIFYTMP
  20. # you can comment this out while tuning the uncrustify.cfg file:
  21. mv $UNCRUSTIFYTMP $1