1#!/bin/sh
2
3usage() {
4	(
5	echo "Usage: $0 [board IP] [board port]"
6	echo ""
7	echo "If IP is not specified, 'localhost' will be used"
8	echo "If port is not specified, '2001' will be used"
9	[ -z "$*" ] && exit 0
10	echo ""
11	echo "ERROR: $*"
12	exit 1
13	) 1>&2
14	exit $?
15}
16
17while [ -n "$1" ] ; do
18	case $1 in
19		-h|--help) usage;;
20		--)        break;;
21		-*)        usage "Invalid option $1";;
22		*)         break;;
23	esac
24	shift
25done
26
27ip=${1:-localhost}
28port=${2:-2001}
29
30if [ -z "${ip}" ] || [ -n "$3" ] ; then
31	usage "Invalid number of arguments"
32fi
33
34trap "stty icanon echo opost intr ^C" 0 2 3 5 10 13 15
35echo "NOTE: the interrupt signal (normally ^C) has been remapped to ^T"
36
37stty -icanon -echo -opost intr ^T
38nc ${ip} ${port}
39exit 0
40