pkgconfig.req: paranoid pkg-config output validation

This commit is contained in:
Alexey Tourbin 2007-10-07 16:42:06 +04:00
parent 566bc6ace5
commit 4a8997aa6f

View File

@ -36,10 +36,30 @@ PkgconfigReqProv()
echo "$out" |while read -r line; do
set -- $line
case $# in
1) echo "pkgconfig($1)" ;;
3) echo "pkgconfig($1) $2 $3" ;;
*) Fatal "$f: invalid pkg-config output: $line"
1 | 3 ) ;;
*) Fatal "$f: invalid pkg-config output: $line" ;;
esac
case "$1" in
*[!A-Za-z0-9_.+-]*)
Fatal "$f: invalid pkg-config output: $line" ;;
[A-Za-z0-9_]*) ;;
*) Fatal "$f: invalid pkg-config output: $line" ;;
esac
if [ $# = 1 ]; then
echo "pkgconfig($1)"
continue
fi
case "$2" in
[\<\>=] | [\<\>]= ) ;;
*) Fatal "$f: invalid pkg-config output: $line" ;;
esac
case "$3" in
*[!A-Za-z0-9_.+-]*)
Fatal "$f: invalid pkg-config output: $line" ;;
[0-9]*) ;;
*) Fatal "$f: invalid pkg-config output: $line" ;;
esac
echo "pkgconfig($1) $2 $3"
done
}