#!/bin/sh
#
# @author Markus Raab <elektra@markus-raab.org>
# @brief Reformats the whole source code
# @date 18.02.2016
# @tags reformat

SCRIPTS_DIR=$(dirname "$0")
. "${SCRIPTS_DIR}/include-common"

CLANG_FORMAT=$(which clang-format-3.8)
if [ -z "${CLANG_FORMAT}" ]; then
	CLANG_FORMAT=$(which clang-format)
fi

cd "$SOURCE"

$($CLANG_FORMAT -style=file -i `find . -name '*.[ch]' -or -name '*.[ch]pp' -or -name '*.[ch].in' | egrep -v "^(./src/tools/gen|./tests/gtest-1.7.0)"`)
