blob: d404fac5e802a2182974ff354f2dd3846797f743 [file] [log] [blame]
Mike Frysingerc11ff772009-06-01 19:08:33 -04001#!/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
Mike Frysingerf5ff2032010-07-23 11:27:51 -040034trap "stty icanon echo opost intr ^C" 0 2 3 5 10 13 15
Mike Frysingerc11ff772009-06-01 19:08:33 -040035echo "NOTE: the interrupt signal (normally ^C) has been remapped to ^T"
36
Mike Frysingerf5ff2032010-07-23 11:27:51 -040037stty -icanon -echo -opost intr ^T
Mike Frysingerc11ff772009-06-01 19:08:33 -040038nc ${ip} ${port}
39exit 0