#!/bin/sh -
: ${USER=${LOGNAME-root}}
REVISION=`cat revision 2>/dev/null || (echo 0 | tee revision)`
HOSTNAME=`(/bin/hostname || /bin/uname -n) 2>/dev/null`
case "$REVISION" in
[0-9]|[0-9][0-9]|[0-9][0-9][0-9])
	REVISION=`expr $REVISION + 1` ;;
*)	REVISION=0 ;;
esac
case "${PATCHLEVEL}" in
0)	VERSION="${MAJORVERSION}.${MINORVERSION}" ;;
*)	VERSION="${MAJORVERSION}.${MINORVERSION}.${PATCHLEVEL}" ;;
esac
echo $REVISION > revision
exec > version.c
cat > version.c <<EOF
char *Version = "${VERSION} #${REVISION}: `date`";
char *CC_user = "${USER}@${HOSTNAME}";
char *CC_pwd = "`pwd`";
EOF
