diff --git a/polymer/eduke32/build/src/util/checkdefs.sh b/polymer/eduke32/build/src/util/checkdefs.sh index fb2630fa0..7a701e831 100755 --- a/polymer/eduke32/build/src/util/checkdefs.sh +++ b/polymer/eduke32/build/src/util/checkdefs.sh @@ -1,17 +1,32 @@ #!/bin/bash -if [ -z "$1" ]; then +function usage () +{ echo 'Usage: checkdefs.sh [[] {-patch,-con,-conpatch}]' exit 1 +} + +if [ -z "$1" ]; then + usage fi deffn="$1" +if [ ! -f "$deffn" ]; then + echo "Error: First argument must be a name of an existing DEF or CON file." + usage +fi + if [ -z "$2" ]; then thedir=. else thedir="$2" fi +if [ ! -d "$thedir" ]; then + echo "Error: Second argument must be a name of an existing directory." + usage +fi + dopatch="" docon="" if [ -n "$3" ]; then @@ -34,7 +49,10 @@ if [ -z $docon ]; then files=$(grep -E "\".*\..*\"" "$deffn" | sed 's/.*"\(.*\..*\)".*/\1/g') else # con... this is awful - files=$(grep -E -i '(include *.*\.con)|(definesound.*(voc|wav|ogg))' "$deffn" | sed -r 's/.*include[ \t]+([^ \t]+\.[cC][oO][nN]).*/\1/g; s/.*[ \t]([^ \t].+\.([wW][aA][vV]|[vV][oO][cC]|[oO][gG][gG])).*/\1/g') + files=$(grep -E -i '(include *.*\.con)|(definesound.*(voc|wav|ogg))|(definelevelname.*\.map)' "$deffn" | + sed -r 's/.*include[ \t]+([^ \t]+\.[cC][oO][nN]).*/\1/g; + s/.*[ \t]([^ \t].+\.([wW][aA][vV]|[vV][oO][cC]|[oO][gG][gG])).*/\1/g; + s/.*[ \t]([^ \t].+\.([mM][aA][pP])).*/\1/g;') fi exfiles=$(find "$thedir" -type f)