summaryrefslogtreecommitdiff
path: root/obsolete/fonts/utilities/safemtpk/append_db
blob: 3d54351b7c81b2fc023493a68a79882f96ead6fd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/bin/sh

# append_db
# Written by Thomas Esser <te@informatik.uni-hannover.de>, Nov., 1994

TOOLS="/usr/local/tex/kpsetools-0.2/bin"
KPSEXPAND="$TOOLS/kpsexpand"
SED="/usr/bin/sed"
CAT="/bin/cat"
EDT="/bin/ed"
CHM="/bin/chmod 666"


progname=`basename $0`
db_file=`$KPSEXPAND '$TEXMF'`/ls-R
control_string='% This is file ls-R. Maintained by texhash and append_db.'

case $# in
2)	;;
*)	echo "Usage: append_db dir file"
	exit
	;;
esac

test -f $db_file || (echo "$control_string" > $db_file; $CHM $db_file)

if [ ! -w "$db_file" ] ; then
	echo "$progname: error: cannot write to file $db_file."
	exit
fi >&2

$EDT -s $db_file >& /dev/null <<-eof
	/`echo $1 | $SED 's@/@\\\\/@g'`/a
	$2
	.
	wq
eof

if [ $? != 0 ]; then
	$CAT >> $db_file <<-eof
		$1:
		$2
	eof
fi