Skip to content
Snippets Groups Projects
Commit 13b1b98f authored by Andrew Cooks's avatar Andrew Cooks
Browse files

rework the cleanup.sh script

- move it to the cleanup directory
- let it build the bundled ccmtcnvt utility
- organise related steps into sections
parent d2764684
No related branches found
No related tags found
No related merge requests found
......@@ -2,31 +2,28 @@
set -e
if [ -z "$LINDENT" -o ! -x "$LINDENT" ] ; then
echo " You need to set the LINDENT environment variable to specify where the Lindent script is (Hint: in the kernel sources at scripts/Lindent)"
exit 1
fi
if ! which ccmtcnvt >/dev/null ; then
echo "You need 'ccmtcnvt' in the path. It is provided by the liwc package. Your distro may have it, or get it from https://github.com/ajkaijanaho/liwc"
exit 1
fi
# Trim trailing whitespace:
# Trim trailing whitespace
sed -i 's|\s*$||g' *.c *.h
# Convert C++ comments into C comments.
# Unfortunately this doesn't fix C++ comments inside C comments
for f in *.c *.h
do mv $f $f~
ccmtcnvt $f~ > $f
# build 'ccmtcnvt' for converting C++ comments into C comments.
# (unfortunately it doesn't fix C++ comments inside C comments)
make -C cleanup
for f in *.c *.h ; do
mv $f $f~
cleanup/ccmtcnvt $f~ > $f
done
# Run a twice, because the operation is unfortunately not idempotent
# Use the kernel's scripts/Lindent utility
if [ -z "$LINDENT" -o ! -x "$LINDENT" ] ; then
echo " You need to set the LINDENT environment variable to specify where the Lindent script is (Hint: in the kernel sources at scripts/Lindent)"
exit 1
fi
# Run Lindent twice, because the operation is unfortunately not idempotent
# after only a single run (but is after two runs).
${LINDENT} *.c *.h ; ${LINDENT} *.c *.h
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment