#!/bin/ksh
#
#	CMSSET.KSH
#
#		New change  1991/1/10 S. Ono
#		New change  1999/5/19 S. Ono


export PATH=".:$PATH:${CMSPATH}/bin"

MainDir=${CMSPATH}/siten
SourceDir=${CMSPATH}/src
DiffDir=${CMSPATH}/diff
Tabfile=${CMSPATH}/diff/tabs/${TABFILE}
Version=${KEIVER}

if [ x${Tabfile} = x"" -o x${SYSNAME} = x"" -o x${KEIVER} = x"" ]
then
	errmsg "PC-CMS Environ for TABFILE SYSNAME KEIVER not found"
	exit
fi
BaseDir=`basename ${PWD}`
if [ x${BaseDir} != x${SYSNAME} ]
then
	errmsg "CMS not a dirctory"
	exit
fi
if [ ! -f ${Tabfile} ]
then
	errmsg "PC-CMS needed (source-list-table) file curent directory."
	exit
fi
if [ ! -d ${DiffDir}/lock/${SYSNAME} ]
then
	dialogmsg "mkdir2 ${DiffDir}/lock/${SYSNAME}"
	mkdir2 ${DiffDir}/lock/${SYSNAME}
fi
#for i in `grep "\/" "${TABFILE}" | sed 's/\/.*\.[a-z]$//' | sed 's/\/$//' | sort -u`
#for i in `sed 's/.*\///' ${Tabfile}|sed 's/\.[a-z]*$//'|sed 's/\/$//'|sort -u`
for i in `cat -s ${Tabfile} | sed -f ${CMSPATH}/bin/suffixes.sed | sort -u`
do
	if [ ! -f ${DiffDir}/lock/${SYSNAME}/${i}/verfile.${KEIVER} ]
	then
	#	echo "MAKE a dirctory ${DiffDir}/lock/${SYSNAME}/${i} ??\c"
	#	read resp
	#	if [ x$resp = x"y" ]
	#	then
			mkdir2 ${DiffDir}/lock/${SYSNAME}/${i}
			echo "${DiffDir}/lock/${SYSNAME}/${i}/verfile.${KEIVER}"
		echo "lock" > ${DiffDir}/lock/${SYSNAME}/${i}/lkfile${KEIVER}
		echo "${KEIVER}.00" > ${DiffDir}/lock/${SYSNAME}/${i}/verfile.${KEIVER}
	#	fi
	fi
done
