#!/bin/sh
PTT_HOST=$1
PTT_PORT=$2
PTT_DEST=$3
PTT_SIDE=-L

if [ $# -lt 3 ] ; then
	echo "`basename $0` (c)2008-2016 PaulTT"
	echo "Usage: "
	echo "  `basename $0` <ssh_server> <mapped_local_port> <dest_host:port> [-L|-R]"
	echo "  . if not specified, the tunnel is opened locally, using -L"
	exit
fi
if [ $# -eq 4 ] ; then
	if [ $4 = "-L" -o $4 = "-R" ] ; then
		PTT_SIDE=$4
	fi
fi

#if [ "`cut -d":" -f 1` $PTT_DEST" == "x" ] ; then
#	$PTT_DEST = localhost:`cut -d":" -f 2 $PTT_DEST`
#fi


#ssh -oTCPKeepAlive=yes -N -L $PTT_PORT:$PTT_DEST $PTT_HOST
ssh -oTCPKeepAlive=yes -N $PTT_SIDE $PTT_PORT:$PTT_DEST $PTT_HOST

