Skip to content

Commit

Permalink
Update to latest Lindent script from kernel tree.
Browse files Browse the repository at this point in the history
Signed-off-by: Stephen Smalley <sds@tycho.nsa.gov>
  • Loading branch information
stephensmalley committed Oct 30, 2013
1 parent 6abcb4f commit c525be3
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions scripts/Lindent
@@ -1,8 +1,18 @@
#!/bin/sh

perl -e 'undef $/;' -pi \
-e 's|#ifdef __cplusplus\n(.*?)\n#endif|//__CPP \1|g' "$@"

indent -npro -kr -i8 -ts8 -sob -l80 -ss -ncs "$@"

perl -pi -e 's|^//__CPP (.*)$|#ifdef __cplusplus\n\1\n#endif|' "$@"
PARAM="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1"
RES=`indent --version`
V1=`echo $RES | cut -d' ' -f3 | cut -d'.' -f1`
V2=`echo $RES | cut -d' ' -f3 | cut -d'.' -f2`
V3=`echo $RES | cut -d' ' -f3 | cut -d'.' -f3`
if [ $V1 -gt 2 ]; then
PARAM="$PARAM -il0"
elif [ $V1 -eq 2 ]; then
if [ $V2 -gt 2 ]; then
PARAM="$PARAM -il0";
elif [ $V2 -eq 2 ]; then
if [ $V3 -ge 10 ]; then
PARAM="$PARAM -il0"
fi
fi
fi
indent $PARAM "$@"

0 comments on commit c525be3

Please sign in to comment.