Commit cc1e0483 by Tom de Vries Committed by Tom de Vries

check_GNU_style.sh: Fix tab size in 80 characters check

2015-05-12  Tom de Vries  <tom@codesourcery.com>

	* check_GNU_style.sh (col): Fix tab size.

From-SVN: r223088
parent a22e33d0
2015-05-12 Tom de Vries <tom@codesourcery.com> 2015-05-12 Tom de Vries <tom@codesourcery.com>
* check_GNU_style.sh (col): Fix tab size.
2015-05-12 Tom de Vries <tom@codesourcery.com>
* check_GNU_style.sh: Put stdin into a temp file. * check_GNU_style.sh: Put stdin into a temp file.
2015-05-12 Tom de Vries <tom@codesourcery.com> 2015-05-12 Tom de Vries <tom@codesourcery.com>
......
...@@ -116,13 +116,37 @@ vg (){ ...@@ -116,13 +116,37 @@ vg (){
col (){ col (){
msg="$1" msg="$1"
cat $inp \ local first=true
| awk -F':\\+' '{ if (length($2) > 80) print $0}' \ local f
> $tmp for f in $files; do
if [ -s $tmp ]; then local prefix=""
printf "\n$msg\n" if [ $nfiles -ne 1 ]; then
cat $tmp prefix="$f:"
fi fi
# Don't reuse $inp, which may be generated using -H and thus contain a
# file prefix.
grep -n '^+' $f \
| grep -v ':+++' \
> $tmp
cat $tmp | while IFS= read -r line; do
local longline
# Filter out the line number prefix and the patch line modifier '+'
# to obtain the bare line, before we use expand.
longline=$(echo "$line" \
| sed 's/^[0-9]*:+//' \
| expand \
| awk '{ if (length($0) > 80) print $0}')
if [ "$longline" != "" ]; then
if $first; then
printf "\n$msg\n"
first=false
fi
echo "$prefix$line"
fi
done
done
} }
col 'Lines should not exceed 80 characters.' col 'Lines should not exceed 80 characters.'
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment