File: typist

package info (click to toggle)
typist 2.2b-4
  • links: PTS
  • area: main
  • in suites: potato
  • size: 1,456 kB
  • ctags: 209
  • sloc: ansic: 1,594; awk: 329; makefile: 148; sh: 42
file content (75 lines) | stat: -rw-r--r-- 2,519 bytes parent folder | download
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
#!/bin/sh
#
# Typist v2.2 - improved typing tutor program for UNIX systems
# Copyright (C) 1998  Simon Baldwin (simonb@sco.com)
#
# 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.
#

# some constants
TYPIST_LIBRARY="/usr/share/typist"
TERMINFO_1="/usr/share/terminfo"
TERMINFO_2="/usr/lib/terminfo"
ME="`basename $0`"
MYDIR="`dirname $0`"
REAL_TYPIST="typist_bin"

# if TYPIST_PATH is not set then set it as a courtesy
if [ -z "$TYPIST_PATH" ]; then

	# ensure that the library directory exists
	if [ -d $TYPIST_LIBRARY ]; then
		TYPIST_PATH="$TYPIST_LIBRARY"
		export TYPIST_PATH
	else
		echo "$ME: WARNING: TYPIST_PATH not set, and $TYPIST_LIBRARY not found" >&2
echo "  If TYPIST_PATH is not set, and cannot be set for you automatically," >&2
echo "  you will need to give the full path to each script file you run." >&2
echo "  Try 'man typist' for more." >&2
echo "  To fix this, set a value for the TYPIST_PATH environment variable." >&2
		sleep 3
	fi
fi

# try to set a suitable value for TERMINFO, since it can live in different
# places on different platforms
if [ -z "$TERMINFO" ]; then

	if [ -d $TERMINFO_1 ]; then
		TERMINFO=$TERMINFO_1
		export TERMINFO
	else
		if [ -d $TERMINFO_2 ]; then
			TERMINFO=$TERMINFO_2
			export TERMINFO
		else
			echo "$ME: WARNING: couldn't find a TERMINFO directory" >&2
echo "  Neither $TERMINFO_1 nor $TERMINFO_2 exist, and these are" >&2
echo "  the two primary locations for the terminfo database.  Typist may" >&2
echo "  fail if it can't find this database.  Try 'man terminfo' for more." >&2
echo "  To fix this, set a value for the TERMINFO environment variable." >&2
			sleep 3
		fi
	fi
fi

# run the binary from within our directory
if [ -x $MYDIR/$REAL_TYPIST ]; then
	exec $MYDIR/$REAL_TYPIST $*
fi

# if we get to here something is badly wrong
echo "$ME: ERROR: can't find the $REAL_TYPIST binary" >&2
exit 1