Import the latest version upstream
This commit is contained in:
parent
ad717b181e
commit
06173a8dbc
|
@ -1,6 +1,6 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#$Id$
|
#$Id$
|
||||||
#Copyright (c) 2016-2017 Pierre Pronchery <khorben@defora.org>
|
#Copyright (c) 2016-2018 Pierre Pronchery <khorben@defora.org>
|
||||||
#
|
#
|
||||||
#Redistribution and use in source and binary forms, with or without
|
#Redistribution and use in source and binary forms, with or without
|
||||||
#modification, are permitted provided that the following conditions are met:
|
#modification, are permitted provided that the following conditions are met:
|
||||||
|
@ -33,6 +33,7 @@ PROJECTCONF="../project.conf"
|
||||||
DATE="date"
|
DATE="date"
|
||||||
DEBUG="_debug"
|
DEBUG="_debug"
|
||||||
FIND="find"
|
FIND="find"
|
||||||
|
GREP="grep"
|
||||||
LINT="lint -g"
|
LINT="lint -g"
|
||||||
SORT="sort -n"
|
SORT="sort -n"
|
||||||
TR="tr"
|
TR="tr"
|
||||||
|
@ -59,11 +60,17 @@ _clint()
|
||||||
done < "$PROJECTCONF"
|
done < "$PROJECTCONF"
|
||||||
for subdir in $subdirs; do
|
for subdir in $subdirs; do
|
||||||
[ -d "../$subdir" ] || continue
|
[ -d "../$subdir" ] || continue
|
||||||
for filename in $($FIND "../$subdir" -name '*.c' | $SORT); do
|
for filename in $($FIND "../$subdir" -type f | $SORT); do
|
||||||
_clint_file "$filename"
|
case "$filename" in
|
||||||
if [ $? -eq 0 ]; then
|
*.c)
|
||||||
echo "$filename:"
|
(_clint_lint "$filename" ||
|
||||||
else
|
_clint_rtrim "$filename")
|
||||||
|
;;
|
||||||
|
*.h)
|
||||||
|
(_clint_rtrim "$filename")
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
echo "$PROGNAME: $filename: FAIL" 1>&2
|
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||||
ret=2
|
ret=2
|
||||||
fi
|
fi
|
||||||
|
@ -72,10 +79,35 @@ _clint()
|
||||||
return $ret
|
return $ret
|
||||||
}
|
}
|
||||||
|
|
||||||
_clint_file()
|
_clint_lint()
|
||||||
{
|
{
|
||||||
|
filename="$1"
|
||||||
|
|
||||||
echo
|
echo
|
||||||
$DEBUG $LINT $CPPFLAGS $CFLAGS "$filename" 2>&1
|
$DEBUG $LINT $CPPFLAGS $CFLAGS "$filename" 2>&1
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -eq 0 ]; then
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "FAIL"
|
||||||
|
fi
|
||||||
|
return $ret
|
||||||
|
}
|
||||||
|
|
||||||
|
_clint_rtrim()
|
||||||
|
{
|
||||||
|
filename="$1"
|
||||||
|
regex="[ ]\\+\$"
|
||||||
|
|
||||||
|
echo
|
||||||
|
$DEBUG $GREP -vq "$regex" "$filename" 2>&1
|
||||||
|
ret=$?
|
||||||
|
if [ $ret -eq 0 ]; then
|
||||||
|
echo "OK"
|
||||||
|
else
|
||||||
|
echo "FAIL"
|
||||||
|
fi
|
||||||
|
return $ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -94,7 +126,7 @@ _debug()
|
||||||
#usage
|
#usage
|
||||||
_usage()
|
_usage()
|
||||||
{
|
{
|
||||||
echo "Usage: $PROGNAME [-c] target" 1>&2
|
echo "Usage: $PROGNAME [-c] target..." 1>&2
|
||||||
return 1
|
return 1
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,7 +150,7 @@ while getopts "cO:P:" name; do
|
||||||
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
export "${OPTARG%%=*}"="${OPTARG#*=}"
|
||||||
;;
|
;;
|
||||||
P)
|
P)
|
||||||
#XXX ignored for compatibility
|
CPPFLAGS="$CPPFLAGS -I$OPTARG/include"
|
||||||
;;
|
;;
|
||||||
?)
|
?)
|
||||||
_usage
|
_usage
|
||||||
|
@ -127,14 +159,18 @@ while getopts "cO:P:" name; do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
shift $((OPTIND - 1))
|
shift $((OPTIND - 1))
|
||||||
if [ $# -ne 1 ]; then
|
if [ $# -lt 1 ]; then
|
||||||
_usage
|
_usage
|
||||||
exit $?
|
exit $?
|
||||||
fi
|
fi
|
||||||
target="$1"
|
|
||||||
|
|
||||||
#clean
|
#clean
|
||||||
[ $clean -ne 0 ] && exit 0
|
[ $clean -ne 0 ] && exit 0
|
||||||
|
|
||||||
exec 3>&1
|
exec 3>&1
|
||||||
_clint > "$target"
|
while [ $# -gt 0 ]; do
|
||||||
|
target="$1"
|
||||||
|
shift
|
||||||
|
|
||||||
|
_clint > "$target" || exit 2
|
||||||
|
done
|
||||||
|
|
Loading…
Reference in New Issue
Block a user