Files
paparazzi/fix_code_style.sh
Michal Podhradsky 606cd4eea2 Crypto updates (#2245)
* Cleaned up GEC code

* Added airborne support for pprzlink 1.0

* Update hacl-c

* Add proper indexing for pprz messages

* Updated airframe config for secure link

* Code style changes and updated code style script

* Bump rustlink

* Compilation fixes
2018-03-17 19:25:23 -07:00

54 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
if ! type "astyle" > /dev/null; then
echo "You need to install astyle to use this script!"
exit 1
fi
if [ $# -eq 0 ]; then
echo "Please provide one or multiple files as arguments!"
exit 1
fi
ASTYLE_VERSION=`astyle --version 2>&1| awk '{print $4}'`
ASTYLE_VERSION=${ASTYLE_VERSION:0:4}
echo "Using astyle version $ASTYLE_VERSION"
set -f
if [ $(bc <<< "$ASTYLE_VERSION >= 2.03") -eq 1 ]; then
astyle --style=kr \
--indent=spaces=2 \
--convert-tabs \
--indent-switches \
--indent-preprocessor \
--pad-oper \
--pad-header \
--unpad-paren \
--keep-one-line-blocks \
--keep-one-line-statements \
--align-pointer=name \
--suffix=none \
--lineend=linux \
--add-brackets \
--ignore-exclude-errors-x \
--max-code-length=120 \
$*
else
astyle --style=kr \
--indent=spaces=2 \
--convert-tabs \
--indent-switches \
--indent-preprocessor \
--pad-oper \
--pad-header \
--unpad-paren \
--keep-one-line-blocks \
--keep-one-line-statements \
--align-pointer=name \
--suffix=none \
--lineend=linux \
--add-brackets \
$*
fi