diff options
author | Jean Delvare <jdelvare@suse.de> | 2017-02-22 18:40:20 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2017-02-22 19:41:26 -0500 |
commit | 78c5250296c94c0d6bd9e92814e6601ff6c0b18b (patch) | |
tree | 31ae67f25b3fee70f9feb0dc13a346f30cafc720 | |
parent | 10f24f75b304f6874eacf765d09827a28caea28d (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-x | scripts/Lindent | 14 |
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 | |||
2 | PARAM="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1" | 3 | PARAM="-npro -kr -i8 -ts8 -sob -l80 -ss -ncs -cp1" |
3 | RES=`indent --version` | 4 | |
5 | RES=`indent --version | cut -d' ' -f3` | ||
4 | if [ "$RES" = "" ]; then | 6 | if [ "$RES" = "" ]; then |
5 | exit 1 | 7 | exit 1 |
6 | fi | 8 | fi |
7 | V1=`echo $RES | cut -d' ' -f3 | cut -d'.' -f1` | 9 | V1=`echo $RES | cut -d'.' -f1` |
8 | V2=`echo $RES | cut -d' ' -f3 | cut -d'.' -f2` | 10 | V2=`echo $RES | cut -d'.' -f2` |
9 | V3=`echo $RES | cut -d' ' -f3 | cut -d'.' -f3` | 11 | V3=`echo $RES | cut -d'.' -f3` |
12 | |||
10 | if [ $V1 -gt 2 ]; then | 13 | if [ $V1 -gt 2 ]; then |
11 | PARAM="$PARAM -il0" | 14 | PARAM="$PARAM -il0" |
12 | elif [ $V1 -eq 2 ]; then | 15 | elif [ $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 |
20 | fi | 23 | fi |
24 | |||
21 | indent $PARAM "$@" | 25 | indent $PARAM "$@" |