#!/bin/sh
# @(#) $Id: arduino-version.sh 47 2017-11-29 03:55:32Z leres $ (XSE)
#
# The ARDUINO version.txt should really:
#
#    (a) be in an include file and
#    (b) should (at a minimum) be cpp friendly
#
# Meanwhile this helper script tries return something usable.
#

if [ $# -ne 1 ]; then
	echo "usage: $0 version.txt" 1>&2
	exit 1
fi

version="`cat $1`" || exit 1

case "${version}" in

0*)
	echo "${version}"
	;;

*.*.*)
	echo "${version}" | /usr/bin/sed -e 's/\.//g'
	;;

*.*)
	echo "${version}" | /usr/bin/awk '{ print 100 * $0 }'
	;;

*)
	echo "${version}"
	;;
esac
