#!/bin/bash

#This script opens a TN3270 connection in x3270. The URL is in the format
#tn3270://<host>[:<port>]

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

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

x3270_args="`echo $1 | sed 's_tn3270://__'`"

exec x3270 -model 5 -once $x3270_args
