summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJean Delvare <jdelvare@suse.de>2017-02-22 18:40:20 -0500
committerLinus Torvalds <torvalds@linux-foundation.org>2017-02-22 19:41:26 -0500
commit78c5250296c94c0d6bd9e92814e6601ff6c0b18b (patch)
tree31ae67f25b3fee70f9feb0dc13a346f30cafc720
parent10f24f75b304f6874eacf765d09827a28caea28d (diff)
scripts/Lindent: clean up and optimize
* Add a few blank lines to improve readability. * Don't call cut 3 times when once is enough. * Drop a useless semicolon. Link: http://lkml.kernel.org/r/20170104140356.162abab2@endymion Signed-off-by: Jean Delvare <jdelvare@suse.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
-rwxr-xr-xscripts/Lindent14
1 files changed, 9 insertions, 5 deletions
diff --git a/scripts/Lindent b/scripts/Lindent
index 6d889de4e70b..57b564c24d61 100755
--- a/scripts/Lindent
+++ b/scripts/Lindent
@@ -1,21 +1,25 @@
1#!/bin/sh 1#!/bin/sh
2
2PARAM="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1" 3PARAM="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1"
3RES=`indent --version` 4
5RES=`indent --version | cut -d' ' -f3`
4if [ "$RES" = "" ]; then 6if [ "$RES" = "" ]; then
5 exit 1 7 exit 1
6fi 8fi
7V1=`echo $RES | cut -d' ' -f3 | cut -d'.' -f1` 9V1=`echo $RES | cut -d'.' -f1`
8V2=`echo $RES | cut -d' ' -f3 | cut -d'.' -f2` 10V2=`echo $RES | cut -d'.' -f2`
9V3=`echo $RES | cut -d' ' -f3 | cut -d'.' -f3` 11V3=`echo $RES | cut -d'.' -f3`
12
10if [ $V1 -gt 2 ]; then 13if [ $V1 -gt 2 ]; then
11 PARAM="$PARAM -il0" 14 PARAM="$PARAM -il0"
12elif [ $V1 -eq 2 ]; then 15elif [ $V1 -eq 2 ]; then
13 if [ $V2 -gt 2 ]; then 16 if [ $V2 -gt 2 ]; then
14 PARAM="$PARAM -il0"; 17 PARAM="$PARAM -il0"
15 elif [ $V2 -eq 2 ]; then 18 elif [ $V2 -eq 2 ]; then
16 if [ $V3 -ge 10 ]; then 19 if [ $V3 -ge 10 ]; then
17 PARAM="$PARAM -il0" 20 PARAM="$PARAM -il0"
18 fi 21 fi
19 fi 22 fi
20fi 23fi
24
21indent $PARAM "$@" 25indent $PARAM "$@"