Revert "Replaced rsc with a bash version without remote dependencies."
[utils.git] / rdp
1 #!/bin/bash
2
3 usage() {
4     echo "usage: rdp [-hf] HOST [PORT|INSTANCE]"
5 }
6
7 args=(-K -r sound)
8 fs=
9 while [ "${1:0:1}" = - ]; do
10     a="$1"
11     shift
12     case "$a" in
13         -h)
14             usage
15             exit 0
16             ;;
17         -f)
18             fs=y
19             ;;
20     esac
21 done
22 if [ "$fs" = y ]; then args=("${args[@]}" -f); else args=("${args[@]}" -g 1280x960); fi
23
24 if [ $# -lt 1 ]; then
25     usage >&2
26     exit 1
27 fi
28
29 port=3389
30 if [ $# -ge 2 ]; then
31     port="$2"
32     if [ "$port" -lt 100 ]; then
33         port=$((port + 3389))
34     fi
35 fi
36
37 exec rdesktop "${args[@]}" "$1:$port"