#!/bin/bash
#                                               -*- Shell-script -*-
#
#  (C) Copyright 2005-2010 EDF-EADS-Phimeca
#
#  This library is free software; you can redistribute it and/or
#  modify it under the terms of the GNU Lesser General Public
#  License as published by the Free Software Foundation; either
#  version 2.1 of the License.
#
#  This library is distributed in the hope that it will be useful
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
#  Lesser General Public License for more details.
#
#  You should have received a copy of the GNU Lesser General Public
#  License along with this library; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
#
#  @author: $LastChangedBy: dutka $
#  @date:   $LastChangedDate: 2007-10-05 12:49:51 +0200 (ven, 05 oct 2007) $
#  Id:      $Id: bootstrap 555 2007-10-05 10:49:51Z dutka $
#
#  This file customizes the file tree to the user's needs
#  Call it before the bootstrap script
#


case $# in
  1)
    newname=$1
    oldname="wcode"

    filelist="configure.ac Makefile.am test.py ${oldname}.xml wrapper.c"

    for file in $filelist
    do
     if [[ -f $file ]]
     then
       sed -e "s/${oldname}/${newname}/g" < $file > $file.mod && mv $file.mod $file
     else
       echo "$file not found"
     fi
    done

    mv ${oldname}.xml ${newname}.xml
    ;;

  2)
    newname=$1
    oldname="wcode"

    file=$2
    if [[ -f $file ]]
    then
      sed -e "s/${oldname}/${newname}/g" < $file > $file.mod && mv $file.mod $file
    else
      echo "$file not found"
      exit 1
    fi
    ;;

  *)
    echo "usage: $0 <new_wrapper_name> [ <file> ]"
    exit 1
esac

