source: mainline/tools/ccheck.sh@ 77578e8

Last change on this file since 77578e8 was e49d0ac, checked in by Jiří Zárevúcky <zarevucky.jiri@…>, 3 years ago

Update files with /bin/sh shebang

  • Property mode set to 100755
File size: 904 bytes
Line 
1#!/bin/sh
2#
3# SPDX-FileCopyrightText: 2018 Jiri Svoboda
4#
5# SPDX-License-Identifier: BSD-3-Clause
6#
7
8ccheck=tools/sycek/ccheck
9if [ ."$CCHECK" != . ]; then
10 ccheck="$CCHECK"
11fi
12
13if [ ."$1" = .--fix ]; then
14 opt=--fix
15else
16 opt=
17fi
18
19srepcnt=0
20snorepcnt=0
21fcnt=0
22
23find abi kernel boot uspace -type f -regex '^.*\.[ch]$' \
24 | grep -v -e '^uspace/lib/pcut/' \
25 | (
26while read fname; do
27 outfile="$(mktemp)"
28 "$ccheck" $opt $fname >"$outfile" 2>&1
29 if [ $? -eq 0 ]; then
30 if [ -s "$outfile" ] ; then
31 srepcnt=$((srepcnt + 1))
32 cat "$outfile"
33 else
34 snorepcnt=$((snorepcnt + 1))
35 fi
36 else
37 fcnt=$((fcnt + 1))
38 cat "$outfile"
39 fi
40
41 rm -f "$outfile"
42done
43
44if [ $srepcnt -eq 0 ] && [ $fcnt -eq 0 ]; then
45 echo "Ccheck passed."
46else
47 echo "Ccheck failed."
48 echo "Checked files with issues: $srepcnt"
49 echo "Checked files without issues: $snorepcnt"
50 echo "Files with parse errors: $fcnt"
51 exit 1
52fi
53)
Note: See TracBrowser for help on using the repository browser.