remove a debugging printf that snuck in
[xombrero.git] / version.sh
blob91ca2fd0cc8f362dbb0993b8bca3ed67158d384a
1 #!/bin/sh
3 # Get version from header.
5 HEADER=version.h
6 SCRIPT=version.sh
7 if [ ! -f "$HEADER" ]; then
8 echo "$SCRIPT: error: $HEADER does not exist" 1>&2
9 exit 1
11 PAT_PREFIX='^#define[[:space:]]+XOMBRERO_'
12 PAT_SUFFIX='[[:space:]]+[0-9]+$'
13 MAJOR=$(egrep "${PAT_PREFIX}MAJOR${PAT_SUFFIX}" $HEADER | awk '{print $3}')
14 MINOR=$(egrep "${PAT_PREFIX}MINOR${PAT_SUFFIX}" $HEADER | awk '{print $3}')
15 PATCH=$(egrep "${PAT_PREFIX}PATCH${PAT_SUFFIX}" $HEADER | awk '{print $3}')
16 if [ -z "$MAJOR" -o -z "$MINOR" -o -z "$PATCH" ]; then
17 echo "$SCRIPT: error: unable to get version from $HEADER" 1>&2
18 exit 1
20 echo $MAJOR.$MINOR.$PATCH | tr -d '\n'