#!/bin/sh
#####
# NAME
#	insert-date-string
# USAGE
#	insert-date-string keyword
# DESCRIPTION
#  This utility replace the string which determined by the keyword
#  with date-string from standard input.
# COPYRIGHT
#  Copyright (C) 2000,2001 Steel Wheels Project.
#  This file is a apart of the papaya utilities. 
#  If you need the information of copyright of this file, see COPYING
#  file distributed with file or see http://www.asahi-net.or.jp/~em7t-hmd
#  web page.

error(){
	echo "insert-date-string [ERROR] $1" >&2 ;
	echo "usage: insert-date-string keyword" >&2 ;
	exit 1 ;
}

KEYWORD=$1 ;

if test "X${KEYWORD}" = "X" ; then
	error "keyword is not given" ;
fi

unset LANG ;
unset LC_ALL ;
unset LC_CTYPE ;
DATESTR=`date` ;

echo "insert-date-string" >&2 ;
echo " keyword : $KEYWORD" >&2 ;
echo " date    : $DATESTR" >&2 ;

sed "s!$KEYWORD!$DATESTR!g" ;

exit 0 ;

