jtagconsole 725 B

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