-
Notifications
You must be signed in to change notification settings - Fork 296
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
formatted astyle.sh + removed shellcheck warnings
- Loading branch information
Showing
1 changed file
with
32 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,50 +1,51 @@ | ||
#! /usr/bin/env bash | ||
|
||
#formatted with shfmt v3.6.0 | ||
DIRS=$1 | ||
|
||
# keep only dirname | ||
DIRS=${DIRS##*/} | ||
echo "$DIRS" | ||
|
||
# shellcheck disable=SC2125 | ||
test -z "$DIRS" && DIRS=* | ||
|
||
for dir in $DIRS | ||
do | ||
test -d "$dir" || continue | ||
|
||
test "$dir" = lapack && continue | ||
test "$dir" = blas && continue | ||
test "$dir" = molfile && continue | ||
test "$dir" = lepton && continue | ||
test "$dir" = asmjit && continue | ||
test "$dir" = xdrfile && continue | ||
for dir in $DIRS; do | ||
test -d "$dir" || continue | ||
|
||
cd $dir | ||
test "$dir" = lapack && continue | ||
test "$dir" = blas && continue | ||
test "$dir" = molfile && continue | ||
test "$dir" = lepton && continue | ||
test "$dir" = asmjit && continue | ||
test "$dir" = xdrfile && continue | ||
|
||
cd "$dir" || { | ||
echo "Problem with 'cd $dir'" | ||
exit 1 | ||
} | ||
|
||
for file in *.c *.cpp *.h *.inc.in | ||
do | ||
for file in *.c *.cpp *.h *.inc.in; do | ||
|
||
test -f "$file" || continue | ||
test -f "$file" || continue | ||
|
||
echo -n "astyle $file" | ||
echo -n "astyle $file" | ||
|
||
../../astyle/astyle --options=../../.astyle.options < $file > $file.tmp && { | ||
if cmp -s $file $file.tmp ; then | ||
echo | ||
else | ||
cp $file.tmp $file | ||
echo " +++ PATCHED" | ||
git add $file | ||
fi | ||
} | ||
../../astyle/astyle --options=../../.astyle.options <"$file" >"$file.tmp" && { | ||
if cmp -s "$file" "$file.tmp"; then | ||
echo | ||
else | ||
cp "$file.tmp" "$file" | ||
echo " +++ PATCHED" | ||
git add "$file" | ||
fi | ||
} | ||
|
||
rm $file.tmp | ||
rm "$file.tmp" | ||
|
||
done | ||
done | ||
|
||
cd - | ||
cd - || { | ||
echo "Problem with 'cd -' from '$dir'" | ||
exit 1 | ||
} | ||
|
||
done | ||
|
||
|