#!/bin/bash

CONFIG="tmp/wip/config.h"

    # This script changes all definitions of elements in $CONFIG in the
    # file passed as arg 1, generating arg 2. 
    # The default path to the macro files in $CONFIG can be overrules
    # by a 3rd argument. 

case $# in
    (3)
        YODL_BIN=`grep YODL_BIN $CONFIG | cut -d\" -f2`
        VERSION=`grep VERSION $CONFIG | cut -d\" -f2`
        STD_INCLUDE=$3
    ;;

    (*)
        echo "Usage: $0 xxx.in xxx.yo path-to-macro-files"
        exit 1
    ;;
esac

    # Create the destination file, changing @... into the required
    # values
    #
sed '
s,@STD_INCLUDE@,'$STD_INCLUDE',g
s,@YODL_BIN@,'$YODL_BIN',g
s,@VERSION@,'$VERSION',g
' $1 > $2



