Added rdp.
authorFredrik Tolf <fredrik@dolda2000.com>
Sun, 1 Aug 2010 03:52:47 +0000 (05:52 +0200)
committerFredrik Tolf <fredrik@dolda2000.com>
Sun, 1 Aug 2010 03:52:47 +0000 (05:52 +0200)
rdp [new file with mode: 0755]

diff --git a/rdp b/rdp
new file mode 100755 (executable)
index 0000000..85956cc
--- /dev/null
+++ b/rdp
@@ -0,0 +1,37 @@
+#!/bin/bash
+
+usage() {
+    echo "usage: rdp [-hf] HOST [PORT|INSTANCE]"
+}
+
+args=(-K -r sound)
+fs=
+while [ "${1:0:1}" = - ]; do
+    a="$1"
+    shift
+    case "$a" in
+       -h)
+           usage
+           exit 0
+           ;;
+       -f)
+           fs=y
+           ;;
+    esac
+done
+if [ "$fs" = y ]; then args=("${args[@]}" -f); else args=("${args[@]}" -g 1280x960); fi
+
+if [ $# -lt 1 ]; then
+    usage >&2
+    exit 1
+fi
+
+port=3389
+if [ $# -ge 2 ]; then
+    port="$2"
+    if [ "$port" -lt 100 ]; then
+       port=$((port + 3389))
+    fi
+fi
+
+exec rdesktop "${args[@]}" "$1:$port"