:
#	@(#) mktables.src 23.4 91/11/19 
#
#	Copyright (C) 1987-1991 The Santa Cruz Operation, Inc.
#		All Rights Reserved.
#	The information in this file is provided for the exclusive use of
#	the licensees of The Santa Cruz Operation, Inc.  Such users have the
#	right to use, modify, and incorporate this code into other products
#	for purposes authorized by the license agreement provided they include
#	this notice and the associated copyright notice with any such product.
#	The information in this file is provided "AS IS" without warranty.
#

#
# If INTL_SUPP is set or /etc/perms/sup.os exists
# we build all the International Supplement files.
#
[ -f /etc/perms/sup.os ] && INTL_SUPP=true

#
# Where to build the language files
#
LLIB=${LLIB:-/usr/lib/lang}

#
# Makes sure the given directory tree exists and is clean of tables
#
cleantree ()
{
	mkdir -p $1 >/dev/null 2>&1
	rm -f $1/collate $1/ctype $1/currency >/dev/null 2>&1
	rm -f $1/messages $1/numeric $1/time >/dev/null 2>&1
}

cleantree $LLIB/english/uk/8859
cleantree $LLIB/english/uk/ascii
cleantree $LLIB/english/us/8859
cleantree $LLIB/english/us/ascii
cleantree $LLIB/french/france/8859
cleantree $LLIB/french/france/ascii
cleantree $LLIB/german/germany/8859
cleantree $LLIB/german/germany/ascii
if [ $INTL_SUPP ]; then
	cleantree $LLIB/english/uk/8859m
	cleantree $LLIB/english/us/8859m
	cleantree $LLIB/french/france/8859m
	cleantree $LLIB/german/germany/8859m
	cleantree $LLIB/portuguese/brazil/8859
	cleantree $LLIB/portuguese/brazil/8859m
	cleantree $LLIB/portuguese/brazil/ascii
	cleantree $LLIB/spanish/spain/8859
	cleantree $LLIB/spanish/spain/8859m
	cleantree $LLIB/spanish/spain/ascii
	cleantree $LLIB/spanish/america/8859
	cleantree $LLIB/spanish/america/8859m
	cleantree $LLIB/spanish/america/ascii
fi

if [ -f chr.C.src ]; then
	cleantree $LLIB/C/C/C

	chrtbl chr.C.src
	mv ctype $LLIB/C/C/C/ctype
fi

chrtbl chr.8859.src
ln ctype $LLIB/english/us/8859/ctype
ln ctype $LLIB/english/uk/8859/ctype
ln ctype $LLIB/french/france/8859/ctype
ln ctype $LLIB/german/germany/8859/ctype
if [ $INTL_SUPP ]; then
	ln ctype $LLIB/portuguese/brazil/8859/ctype
	ln ctype $LLIB/spanish/spain/8859/ctype
	ln ctype $LLIB/spanish/america/8859/ctype
	ln ctype $LLIB/english/us/8859m/ctype
	ln ctype $LLIB/english/uk/8859m/ctype
	ln ctype $LLIB/french/france/8859m/ctype
	ln ctype $LLIB/german/germany/8859m/ctype
	ln ctype $LLIB/portuguese/brazil/8859m/ctype
	ln ctype $LLIB/spanish/spain/8859m/ctype
	ln ctype $LLIB/spanish/america/8859m/ctype
fi
rm ctype

chrtbl chr.asci.src
ln ctype $LLIB/english/us/ascii/ctype
ln ctype $LLIB/english/uk/ascii/ctype
ln ctype $LLIB/french/france/ascii/ctype
ln ctype $LLIB/german/germany/ascii/ctype
if [ $INTL_SUPP ]; then
	ln ctype $LLIB/portuguese/brazil/ascii/ctype
	ln ctype $LLIB/spanish/spain/ascii/ctype
	ln ctype $LLIB/spanish/america/ascii/ctype
fi
rm ctype

if [ -f tim.C.src ]; then
	timtbl tim.C.src
	mv time $LLIB/C/C/C/time
fi

timtbl tim.us.src
ln time $LLIB/english/us/8859/time
ln time $LLIB/english/us/ascii/time
if [ $INTL_SUPP ]; then
	ln time $LLIB/english/us/8859m/time
fi
rm time

timtbl tim.uk.src
ln time $LLIB/english/uk/8859/time
ln time $LLIB/english/uk/ascii/time
if [ $INTL_SUPP ]; then
	ln time $LLIB/english/uk/8859m/time
fi
rm time

timtbl tim.fra7.src
mv time $LLIB/french/france/ascii/time

timtbl tim.fra8.src
ln time $LLIB/french/france/8859/time
if [ $INTL_SUPP ]; then
	ln time $LLIB/french/france/8859m/time
fi
rm time

timtbl tim.ger7.src
mv time $LLIB/german/germany/ascii/time

timtbl tim.ger8.src
ln time $LLIB/german/germany/8859/time
if [ $INTL_SUPP ]; then
	ln time $LLIB/german/germany/8859m/time
fi
rm time

if [ $INTL_SUPP ]; then
	timtbl tim.bra7.src
	mv time $LLIB/portuguese/brazil/ascii/time

	timtbl tim.bra8.src
	ln time $LLIB/portuguese/brazil/8859m/time
	ln time $LLIB/portuguese/brazil/8859/time
	rm time

	timtbl tim.spa7.src
	ln time $LLIB/spanish/america/ascii/time
	ln time $LLIB/spanish/spain/ascii/time
	rm time

	timtbl tim.spa8.src
	ln time $LLIB/spanish/spain/8859/time
	ln time $LLIB/spanish/spain/8859m/time
	ln time $LLIB/spanish/america/8859/time
	ln time $LLIB/spanish/america/8859m/time
	rm time
fi

if [ -f num.C.src ]; then
	numtbl num.C.src
	mv numeric $LLIB/C/C/C/numeric
fi

numtbl num.engl.src
ln numeric $LLIB/english/us/8859/numeric
ln numeric $LLIB/english/us/ascii/numeric
ln numeric $LLIB/english/uk/8859/numeric
ln numeric $LLIB/english/uk/ascii/numeric
if [ $INTL_SUPP ]; then
	ln numeric $LLIB/english/us/8859m/numeric
	ln numeric $LLIB/english/uk/8859m/numeric
fi
rm numeric

numtbl num.euro.src
ln numeric $LLIB/french/france/8859/numeric
ln numeric $LLIB/french/france/ascii/numeric
ln numeric $LLIB/german/germany/8859/numeric
ln numeric $LLIB/german/germany/ascii/numeric
if [ $INTL_SUPP ]; then
	ln numeric $LLIB/french/france/8859m/numeric
	ln numeric $LLIB/german/germany/8859m/numeric
	ln numeric $LLIB/portuguese/brazil/8859m/numeric
	ln numeric $LLIB/portuguese/brazil/8859/numeric
	ln numeric $LLIB/portuguese/brazil/ascii/numeric
	ln numeric $LLIB/spanish/spain/8859m/numeric
	ln numeric $LLIB/spanish/spain/8859/numeric
	ln numeric $LLIB/spanish/spain/ascii/numeric
	ln numeric $LLIB/spanish/america/8859m/numeric
	ln numeric $LLIB/spanish/america/8859/numeric
	ln numeric $LLIB/spanish/america/ascii/numeric
fi
rm numeric

if [ -f col.C.src ]; then
	coltbl col.C.src
	mv collate $LLIB/C/C/C/collate
fi

coltbl col.8859.src
ln collate $LLIB/english/us/8859/collate
ln collate $LLIB/english/uk/8859/collate
ln collate $LLIB/french/france/8859/collate
ln collate $LLIB/german/germany/8859/collate
if [ $INTL_SUPP ]; then
	ln collate $LLIB/portuguese/brazil/8859/collate
fi
rm collate

if [ $INTL_SUPP ]; then
	coltbl col.885m.src
	ln collate $LLIB/english/us/8859m/collate
	ln collate $LLIB/english/uk/8859m/collate
	ln collate $LLIB/french/france/8859m/collate
	ln collate $LLIB/german/germany/8859m/collate
	ln collate $LLIB/portuguese/brazil/8859m/collate
	ln collate $LLIB/spanish/spain/8859m/collate
	ln collate $LLIB/spanish/america/8859m/collate
	rm collate
fi

coltbl col.asci.src
ln collate $LLIB/english/us/ascii/collate
ln collate $LLIB/english/uk/ascii/collate
ln collate $LLIB/french/france/ascii/collate
ln collate $LLIB/german/germany/ascii/collate
if [ $INTL_SUPP ]; then
	ln collate $LLIB/portuguese/brazil/ascii/collate
	ln collate $LLIB/spanish/spain/ascii/collate
	ln collate $LLIB/spanish/america/ascii/collate
fi
rm collate

if [ $INTL_SUPP ]; then
	coltbl col.spa8.src
	ln collate $LLIB/spanish/spain/8859/collate
	ln collate $LLIB/spanish/america/8859/collate
	rm collate
fi

if [ -f cur.C.src ]; then
	montbl cur.C.src
	mv currency $LLIB/C/C/C/currency
fi

montbl cur.us.src
ln currency $LLIB/english/us/8859/currency
ln currency $LLIB/english/us/ascii/currency
if [ $INTL_SUPP ]; then
	ln currency $LLIB/english/us/8859m/currency
fi
rm currency

montbl cur.uk7.src
mv currency $LLIB/english/uk/ascii/currency

montbl cur.uk8.src
ln currency $LLIB/english/uk/8859/currency
if [ $INTL_SUPP ]; then
	ln currency $LLIB/english/uk/8859m/currency
fi
rm currency

montbl cur.fra.src
ln currency $LLIB/french/france/8859/currency
ln currency $LLIB/french/france/ascii/currency
if [ $INTL_SUPP ]; then
	ln currency $LLIB/french/france/8859m/currency
fi
rm currency

montbl cur.ger.src
ln currency $LLIB/german/germany/8859/currency
ln currency $LLIB/german/germany/ascii/currency
if [ $INTL_SUPP ]; then
	ln currency $LLIB/german/germany/8859m/currency
fi
rm currency

if [ $INTL_SUPP ]; then
	montbl cur.bra.src
	ln currency $LLIB/portuguese/brazil/8859m/currency
	ln currency $LLIB/portuguese/brazil/8859/currency
	ln currency $LLIB/portuguese/brazil/ascii/currency
	rm currency

	montbl cur.spa.src
	ln currency $LLIB/spanish/spain/8859m/currency
	ln currency $LLIB/spanish/spain/8859/currency
	ln currency $LLIB/spanish/spain/ascii/currency
	ln currency $LLIB/spanish/america/8859m/currency
	ln currency $LLIB/spanish/america/8859/currency
	ln currency $LLIB/spanish/america/ascii/currency
	rm currency
fi

if [ -f mes.C.src ]; then
	mestbl mes.C.src
	mv messages $LLIB/C/C/C/messages
fi

mestbl mes.engl.src
ln messages $LLIB/english/us/8859/messages
ln messages $LLIB/english/us/ascii/messages
ln messages $LLIB/english/uk/8859/messages
ln messages $LLIB/english/uk/ascii/messages
if [ $INTL_SUPP ]; then
	ln messages $LLIB/english/us/8859m/messages
	ln messages $LLIB/english/uk/8859m/messages
fi
rm messages

mestbl mes.fra.src
ln messages $LLIB/french/france/8859/messages
ln messages $LLIB/french/france/ascii/messages
if [ $INTL_SUPP ]; then
	ln messages $LLIB/french/france/8859m/messages
fi
rm messages

mestbl mes.ger.src
ln messages $LLIB/german/germany/8859/messages
ln messages $LLIB/german/germany/ascii/messages
if [ $INTL_SUPP ]; then
	ln messages $LLIB/german/germany/8859m/messages
fi
rm messages

if [ $INTL_SUPP ]; then
	mestbl mes.bra8.src
	ln messages $LLIB/portuguese/brazil/8859m/messages
	ln messages $LLIB/portuguese/brazil/8859/messages
	rm messages

	mestbl mes.bra7.src
	mv messages $LLIB/portuguese/brazil/ascii/messages

	mestbl mes.spa8.src
	ln messages $LLIB/spanish/spain/8859m/messages
	ln messages $LLIB/spanish/spain/8859/messages
	ln messages $LLIB/spanish/america/8859m/messages
	ln messages $LLIB/spanish/america/8859/messages
	rm messages

	mestbl mes.spa7.src
	ln messages $LLIB/spanish/spain/ascii/messages
	ln messages $LLIB/spanish/america/ascii/messages
	rm messages
fi
