#!/bin/sh

## Builds a release.c containing the release number as a string.
## If tagged as r_a_b_c_d, rel_a_b_c_d, release_a_b_c_d, etc, use that
## release number; else drop to today's date (if not).

num="$1"
#set -- `echo "$num" | tr _ ' '`
if echo "$num" | grep _ >/dev/null; then
	# we have a symbol
	rel="release"
	num=`echo $num | sed -e 's/^[^_]*_//' | tr _ .`
else
	rel="version"
	num=`date +'0.%Y.%m.%d'`
fi

echo 'static char release_string[] = "'$rel $num'";'
echo "char *release(void) {return release_string;}"

exit
	if echo '$(RELEASE)'
		set -- `echo $$3 $$4 $$5 $$6 0 0 0 0`; \
	else \
		set -- `date +'0.%Y.%m.%d'`; \
	fi; \
	echo "#define REL_NUM \"$$1.$$2.$$3.$$4

