Update from upstream
This commit is contained in:
parent
68a3d912ca
commit
dd01fa56fc
|
@ -1,6 +1,6 @@
|
|||
#!/bin/sh
|
||||
#$Id$
|
||||
#Copyright (c) 2017 Pierre Pronchery <khorben@defora.org>
|
||||
#Copyright (c) 2017-2019 Pierre Pronchery <khorben@defora.org>
|
||||
#
|
||||
#Redistribution and use in source and binary forms, with or without
|
||||
#modification, are permitted provided that the following conditions are met:
|
||||
|
@ -32,6 +32,7 @@ DATE="date"
|
|||
DEBUG="_debug"
|
||||
FIND="find"
|
||||
GREP="grep"
|
||||
MKDIR="mkdir -p"
|
||||
SORT="sort -n"
|
||||
TR="tr"
|
||||
|
||||
|
@ -59,19 +60,25 @@ _fixme()
|
|||
[ -d "../$subdir" ] || continue
|
||||
for filename in $($FIND "../$subdir" -type f | $SORT); do
|
||||
callback=
|
||||
case "$filename" in
|
||||
*.asm|*.S)
|
||||
ext=${filename##*/}
|
||||
ext=${ext%.in}
|
||||
ext=${ext##*.}
|
||||
case "$ext" in
|
||||
asm|S)
|
||||
callback="_fixme_asm"
|
||||
;;
|
||||
*.c|*.h|*.js)
|
||||
c|cc|cpp|cxx|h|js)
|
||||
callback="_fixme_c"
|
||||
;;
|
||||
*.conf|*.sh)
|
||||
conf|sh)
|
||||
callback="_fixme_sh"
|
||||
;;
|
||||
htm|html|xml)
|
||||
callback="_fixme_xml"
|
||||
;;
|
||||
esac
|
||||
[ -n "$callback" ] || continue
|
||||
$callback "$filename" 2>&1
|
||||
($callback "$filename") 2>&1
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "$PROGNAME: $filename: FAIL" 1>&2
|
||||
ret=2
|
||||
|
@ -83,31 +90,31 @@ _fixme()
|
|||
|
||||
_fixme_asm()
|
||||
{
|
||||
retc=0
|
||||
ret=0
|
||||
filename="$1"
|
||||
|
||||
#warnings
|
||||
$GREP -nH '/\*.*\(TODO\|XXX\)' "$filename"
|
||||
#failures
|
||||
$GREP -nH '/\*.*FIXME' "$filename" && retc=2
|
||||
return $retc
|
||||
$GREP -nH '/\*.*FIXME' "$filename" && ret=2
|
||||
return $ret
|
||||
}
|
||||
|
||||
_fixme_c()
|
||||
{
|
||||
retc=0
|
||||
ret=0
|
||||
filename="$1"
|
||||
|
||||
#warnings
|
||||
$GREP -nH '/\(/\|\*\).*\(TODO\|XXX\)' "$filename"
|
||||
#failures
|
||||
$GREP -nH '/\(/\|\*\).*FIXME' "$filename" && retc=2
|
||||
return $retc
|
||||
$GREP -nH '/\(/\|\*\).*FIXME' "$filename" && ret=2
|
||||
return $ret
|
||||
}
|
||||
|
||||
_fixme_sh()
|
||||
{
|
||||
retsh=0
|
||||
ret=0
|
||||
filename="$1"
|
||||
#XXX avoid matching the regexp
|
||||
comment="#"
|
||||
|
@ -115,8 +122,21 @@ _fixme_sh()
|
|||
#warnings
|
||||
$GREP -nH "$comment.*\\(TODO\\|XXX\\)" "$filename"
|
||||
#failures
|
||||
$GREP -nH "$comment.*FIXME" "$filename" && retsh=2
|
||||
return $retsh
|
||||
$GREP -nH "$comment.*FIXME" "$filename" && ret=2
|
||||
return $ret
|
||||
}
|
||||
|
||||
_fixme_xml()
|
||||
{
|
||||
ret=0
|
||||
filename="$1"
|
||||
|
||||
#XXX limited to a single line
|
||||
#warnings
|
||||
$GREP -nH '<!--.*\(TODO\|XXX\)' "$filename"
|
||||
#failures
|
||||
$GREP -nH '<!--.*FIXME' "$filename" && ret=2
|
||||
return $ret
|
||||
}
|
||||
|
||||
|
||||
|
@ -169,12 +189,15 @@ fi
|
|||
[ $clean -ne 0 ] && exit 0
|
||||
|
||||
exec 3>&1
|
||||
ret=0
|
||||
while [ $# -gt 0 ]; do
|
||||
target="$1"
|
||||
dirname="${target%/*}"
|
||||
shift
|
||||
|
||||
_fixme > "$target" || ret=$?
|
||||
if [ -n "$dirname" -a "$dirname" != "$target" ]; then
|
||||
$MKDIR -- "$dirname" || ret=$?
|
||||
fi
|
||||
_fixme > "$target" || exit 2
|
||||
done
|
||||
#XXX ignore errors
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue
Block a user