#!/bin/sh

if [ $# -lt 1 ]; then
	echo "Usage: $(basename $0) ip-address-or-fqdn-of-rdp-server"
	exit 1
fi

if ! [ -x "$(which readlink)" -a -x "$(which dirname)" -a -x "$(which realpath)" ]; then
	echo "This utility needs \"readlink\", \"dirname\" and \"realpath\" programs."
	exit 1
fi

me=$(readlink $0)
[ "x${me}" = "x" ] && me=$0

my_dir=$(dirname $(realpath $me))

export LD_LIBRARY_PATH=${my_dir}

${my_dir}/xfreerdp \
	/gdi:hw \
	-grab-keyboard \
	+clipboard \
	-offscreen-cache \
	-glyph-cache \
	/f \
	/sec:rdp \
	/v:$1
