#!/bin/bash

#This script opens a Telnet connection with HP 700 terminal emulation using
#QCTerm. The URL is specified as telnet_hp700://<host>:<port>

if [ ! "$1" ]
then
	echo "no URL provided" >&2
	exit 1
fi

if ! echo "$1" | grep -q '^telnet_hp700://'
then
	echo "URL does not start with telnet_hp700://" >&2
	exit 1
fi

telnet_args="`echo $1 | sed 's,telnet_hp700://,,'`"

exec qcterm $telnet_args
