#!/bin/bash

#   FILE: %(FILE) -- 
# AUTHOR: %(FULLNAME) <%(EMAIL)>
#   DATE: %(DAY) %(MONTH) %(YEAR)
#
# Copyright (C) %(YEAR) %(FULLNAME) <%(EMAIL)>
# All rights reserved.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program 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 General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

IN=/dev/stdin
OUT=/dev/stdout
LOG=/dev/null

USAGE="[OPTION]...

  -h, -?   print this message
  -l path  set the log path     [ $LOG ]
  -i path  set the input path   [ $IN ]
  -o path  set the output path  [ $OUT ]"

while :;
	do case "$1" in
		-h | "-?" )	
			echo -e usage: ${0##*/} "$USAGE" >&2
			exit 1 ;;
		-i )
			IN=$2
			shift ;;
		-o )
			OUT=$2
			shift ;;
		-l )
			LOG=$2
			shift ;;
		-?* )
			echo "${0##*/}: unrecognised option: $1" >&2
			exit 1 ;;
		* )
			break ;;
	esac
	shift
done

if [ ! -f $IN ]; then
        echo "${0##*/}: $IN does not exist" >&2
	exit 1
fi

cat $IN > $OUT
echo $IN > $LOG
