From 41793193f5703820cd7763d57814b7accad5a293 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 12 Aug 2013 15:18:11 +0000 Subject: [PATCH] checkdefs.sh: check first and second args, handle definelevelname. git-svn-id: https://svn.eduke32.com/eduke32@4009 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/util/checkdefs.sh | 22 +++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) 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)