1#!/bin/sh
2
3# copy "vncviewer.sh" back over to "vncviewer" in case you delete or overwrite it
4# via build.unix. etc
5
6dir=`dirname "$0"`
7
8if [ "X$SSVNC_DYLD_LIBRARY_PATH" != "X" ]; then
9	if [ "X$DYLD_LIBRARY_PATH" = "X" ] ; then
10		DYLD_LIBRARY_PATH=$SSVNC_DYLD_LIBRARY_PATH
11	else
12		DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$SSVNC_DYLD_LIBRARY_PATH
13	fi
14	export DYLD_LIBRARY_PATH
15fi
16
17if [ "X$DISPLAY" != "X" -a "X$DARWIN_COTVNC" != "X1" ]; then
18	"$dir/vncviewer.x11" "$@"
19else
20	args=""
21	for a in "$@"
22	do
23		if echo "$a" | grep '^-' > /dev/null; then
24			args="$args $a"
25		elif echo "$a" | grep ':' > /dev/null; then
26			h=`echo "$a" | awk -F: '{print $1}'`
27			p=`echo "$a" | awk -F: '{print $2}'`
28			if [ "X$p" != "X" ]; then
29				if [ $p -lt 5900 ]; then
30					p=`expr $p + 5900`
31				fi
32			fi
33			args="$args $h:$p"
34		else
35			args="$args $a"
36		fi
37	done
38	"$dir/../../MacOSX/Chicken of the VNC.app/Contents/MacOS/Chicken of the VNC" $args
39fi
40