#!/bin/sh

path="${0%/*}"

cmd=
case "$#" in
0)	;;
*)	cmd="$1"
	shift
	test -x "$path/gwmodem-files/gwmodem-$cmd" && exec "$path/gwmodem-files/gwmodem-$cmd" "$@"
	case "$cmd" in
		at*|aT*|AT*|At*) test -x "$path/gwmodem-files/gwmodem-at" && exec "$path/gwmodem-files/gwmodem-at" "$cmd"
		;;
		help)
			cat "$path/gwmodem-files/gwmodem-help"
			exit
		;;
	esac
;;
esac

echo "Usage: gwmodem COMMAND [OPTIONS] [TARGET]"
if [ -n "$cmd" ]; then
    echo "gwmodem command '$cmd' not found."
fi
echo "gwmodem commands are:"
echo "    at chat edit help info reset resethw select sendsms stat"

