3 # Automated Testing Framework (atf)
5 # Copyright (c) 2007 The NetBSD Foundation, Inc.
8 # Redistribution and use in source and binary forms, with or without
9 # modification, are permitted provided that the following conditions
11 # 1. Redistributions of source code must retain the above copyright
12 # notice, this list of conditions and the following disclaimer.
13 # 2. Redistributions in binary form must reproduce the above copyright
14 # notice, this list of conditions and the following disclaimer in the
15 # documentation and/or other materials provided with the distribution.
17 # THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND
18 # CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
19 # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 # MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
21 # IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY
22 # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
23 # DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
24 # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
25 # INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
26 # IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
27 # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
28 # IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 # A utility to sanity check the coding style of all source files in the
42 echo "${Prog_Name}: ${@}" 1>&2
50 echo "${Prog_Name}: ${@}" 1>&2
56 # Locates the project's top directory and prints its path. The caller
57 # must verify if the result is correct or not.
62 while [ ${topdir} != / ]; do
63 if [ -f .
/atf-c.h
]; then
77 # Locates all source files within the project, relative to the current
78 # directory, and prints their paths.
81 find . \
( -name "AUTHORS" -o \
83 -name "ChangeLog" -o \
99 \
! -path "*/atf-[0-9]*" -a \
100 \
! -path "*autom4te*" -a \
102 \
! -name "aclocal.m4" \
103 \
! -name "bconfig.h" \
105 \
! -name "libtool.m4" \
106 \
! -name "ltoptions.m4" \
107 \
! -name "ltsugar.m4" \
108 \
! -name "lt~obsolete.m4" \
116 # Guesses the formats applicable to the given file and prints the resulting
144 # Checks the validity of the given file.
148 for format
in $
(guess_formats
${1}); do
149 awk -f ${topdir}/admin/check-style-${format}.awk ${1} || err
=1
161 topdir
=$
(guess_topdir
)
162 if [ ! -f ${topdir}/atf-c.h
]; then
163 err
"Could not locate the project's top directory"
166 if [ ${#} -gt 0 ]; then
170 sources
=$
(find_sources
)
174 for file in ${sources}; do
175 file=$
(echo ${file} |
sed -e "s,\\./,,")
177 if [ ! -f ${file} ]; then
178 err
"Could not open ${file}"
180 check_file
${file} || ok
=1
189 # vim: syntax=sh:expandtab:shiftwidth=4:softtabstop=4