#!/bin/sh 
#--------------------------- Shell MegaWave2 Macro --------------------------#
_sccsid="%Z%MegaWave2 %R%, %M% %I%, %G%";
_Prog="`basename $0`"
_Vers="1.01"
_Date="1999-2003"
_Func="Return the incremented last field of the MegaWave2 version number"
_Auth="Jacques Froment";
_Usage="mw2dir"
#----------------------------------------------------------------------------#
# This file is part of the MegaWave2 system macros. 
# MegaWave2 is a "soft-publication" for the scientific community. It has
# been developed for research purposes and it comes without any warranty.
# The last version is available at http://www.cmla.ens-cachan.fr/Cmla/Megawave
# CMLA, Ecole Normale Superieure de Cachan, 61 av. du President Wilson,
#       94235 Cachan cedex, France. Email: megawave@cmla.ens-cachan.fr 
#-----------------------------------------------------------------------------

# Usage
if [ $# -ne 1 ]; then
  . .mw2_help_lg_com
fi

MWSRC=$1

if [ ! -d $MWSRC ]; then
  echo "Cannot found MegaWave2 directory $MWSRC !"
  exit 1
fi

V=$MWSRC/VERS
if [ ! -r $V ]; then
  echo "Cannot read version number in $V !"
  exit 1
fi

major=`cat $V | cut -f 1 -d "."`
minor=`cat $V | cut -f 2 -d "."`
variant=`cat $V | cut -f 3 -d "."`
if [ "$variant" = "" ]; then
  variant=0
fi
variant=`expr $variant + 1`

echo "${major}.${minor}.${variant}"

exit 0

