summaryrefslogtreecommitdiff
path: root/mcon/U/issymlink.U
blob: 460564ea3828c7ef196efd26c2a09c4d93acec8f (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
?RCS: $Id$
?RCS:
?RCS: Copyright (c) 1991-1997, 2004-2006, Raphael Manfredi
?RCS: 
?RCS: You may redistribute only under the terms of the Artistic License,
?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 License; a copy of which may be found at the root
?RCS: of the source tree for dist 4.0.
?RCS: 
?RCS: Original Author: Andy Dougherty <doughera@lafcol.lafayette.edu>
?RCS:
?RCS: $Log: lns.U,v $
?RCS: Revision 3.0.1.1  1994/06/20  07:05:52  ram
?RCS: patch30: created by ADO
?RCS:
?MAKE:issymlink: lns test rm
?MAKE:	-pick add $@ %<
?S:issymlink:
?S:	This variable holds the test command to test for a symbolic link
?S:	(if they are supported).  Typical values include 'test -h' and
?S:	'test -L'.
?S:.
?T:pth p
?LINT:change PATH test
: determine whether symbolic links are supported
echo " "
case "$lns" in
*"ln"*" -s")
	echo "Checking how to test for symbolic links..." >&4
	$lns blurfl sym
	if $test "X$issymlink" = X; then
?X:
?X: In some AIX 4 versions the (ksh) builtin test (-h) is broken.
?X:
		case "$newsh" in
		'') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
		*)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
		esac
		if test $? = 0; then
			issymlink="test -h"
		else
			echo "Your builtin 'test -h' may be broken." >&4
			case "$test" in
			/*)	;;
			*)	pth=`echo $PATH | sed -e "s/$p_/ /g"`
				for p in $pth
				do
					if test -f "$p/$test"; then
						test="$p/$test"
						break
					fi
				done
				;;
			esac
			case "$test" in
			/*)
				echo "Trying external '$test -h'." >&4
				issymlink="$test -h"
				if $test ! -h sym >/dev/null 2>&1; then
					echo "External '$test -h' is broken, too." >&4
					issymlink=''
				fi
				;;
			*)	issymlink='' ;;
			esac
		fi		
	fi
	if $test "X$issymlink" = X; then
		if $test -L sym 2>/dev/null; then
			issymlink="$test -L"
			echo "The builtin '$test -L' worked." >&4
		fi
	fi
	if $test "X$issymlink" != X; then
		echo "You can test for symbolic links with '$issymlink'." >&4
	else
		echo "I do not know how you can test for symbolic links." >&4
	fi
	$rm -f blurfl sym
	;;
*)	echo "No symbolic links, so not testing for their testing..." >&4
	;;
esac