summaryrefslogtreecommitdiff
path: root/mcon/U/sh.U
blob: f0b9965c6e7bd284262f571be618aee7470e7313 (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
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1997, Chip Salzenberg
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic Licence,
?RCS: as specified in the README file that comes with the distribution.
?RCS: You may reuse parts of this distribution only within the terms of
?RCS: that same Artistic Licence; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS: 
?RCS: $Log: sh.U,v $
?RCS: Revision 3.0.1.1  1997/02/28  16:20:13  ram
?RCS: patch61: created
?RCS:
?MAKE:sh: Head
?MAKE:	-pick wipe $@ %<
?S:sh:
?S:	This variable contains the full pathname of the shell used
?S:	on this system to execute Bourne shell scripts.  Usually, this will be
?S:	/bin/sh, though it's possible that some systems will have /bin/ksh,
?S:	/bin/pdksh, /bin/ash, /bin/bash, or even something such as
?S:	D:/bin/sh.exe.
?S:	This unit comes before Options.U, so you can't set sh with a -D
?S:	option, though you can override this (and startsh)
?S:	with -O -Dsh=/bin/whatever -Dstartsh=whatever
?S:.
?C:SH_PATH:
?C:	This symbol contains the full pathname to the shell used on this
?C:	on this system to execute Bourne shell scripts.  Usually, this will be
?C:	/bin/sh, though it's possible that some systems will have /bin/ksh,
?C:	/bin/pdksh, /bin/ash, /bin/bash, or even something such as
?C:	D:/bin/sh.exe.
?C:.
?H:#define SH_PATH "$sh"  /**/
?H:.
?T:xxx try pth p SYSTYPE
?LINT:extern maintloc maintname
?X:
?X: Be quiet unless something unusual happens because this gets
?X: loaded up even before options are processed.
?X:	Can't use ./loc because that depends on startsh, which, in turn
?X:	depends on this unit.
?X:
: Find the basic shell for Bourne shell scripts
case "$sh" in
'')
?X: SYSTYPE is for some older MIPS systems. 
?X: I do not know if it is still needed.
	case "$SYSTYPE" in
	*bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
	*) xxx='/bin/sh';;
	esac
	if test -f "$xxx"; then
		sh="$xxx"
	else
		: Build up a list and do a single loop so we can 'break' out.
		pth=`echo $PATH | sed -e "s/$p_/ /g"`
		for xxx in sh bash ksh pdksh ash; do
			for p in $pth; do
				try="$try ${p}/${xxx}"
			done
		done
		for xxx in $try; do
			if test -f "$xxx"; then
				sh="$xxx"
				break
			elif test -f "$xxx$_exe"; then
				sh="$xxx"
				break
			elif test -f "$xxx.exe"; then
				sh="$xxx"
				break
			fi
		done
	fi
	;;
esac

?X: fd 4 isn't open yet...
case "$sh" in
'')	cat >&2 <<EOM
$me:  Fatal Error:  I can't find a Bourne Shell anywhere.  

Usually it's in /bin/sh.  How did you even get this far?
Please contact me (<$maintname>) at <$maintloc> and 
we'll try to straighten this all out.
EOM
	exit 1
	;;
esac