Ville Skyttä 7ef492
diff --git a/contrib/vncviewer b/contrib/vncviewer
Ville Skyttä 7ef492
index 1e6e3eb..d3e5c59 100644
Ville Skyttä 7ef492
--- a/contrib/vncviewer
Ville Skyttä 7ef492
+++ b/contrib/vncviewer
Ville Skyttä 7ef492
@@ -1,22 +1,27 @@
Ville Skyttä 7ef492
 # bash completion for vncviewer
Ville Skyttä 7ef492
 
Ville Skyttä 7ef492
 have vncviewer &&
Ville Skyttä 7ef492
-_vncviewer_bootstrap() {
Ville Skyttä 7ef492
+_vncviewer_bootstrap()
Ville Skyttä 7ef492
+{
Ville Skyttä 7ef492
     local fname
Ville Skyttä 7ef492
     case "$(_realcommand vncviewer)" in
Ville Skyttä 7ef492
-        # If `vncviewer' not installed, default file-dir completion
Ville Skyttä 7ef492
-        '') _filedir `_get_cword` ;;
Ville Skyttä 7ef492
         *xvnc4viewer)      fname=_xvnc4viewer    ;;
Ville Skyttä 7ef492
-        *tightvncviewer|*) fname=_tightvncviewer ;;
Ville Skyttä 7ef492
+        *tightvncviewer)   fname=_tightvncviewer ;;
Ville Skyttä 7ef492
+        *)                 fname=_vncviewer      ;;
Ville Skyttä 7ef492
     esac
Ville Skyttä 7ef492
-    if [ $fname ]; then
Ville Skyttä 7ef492
-        # Install real completion for subsequent completions
Ville Skyttä 7ef492
-        complete -F $fname vncviewer
Ville Skyttä 7ef492
-        $fname  # Generate completions once for now
Ville Skyttä 7ef492
-        unset -f _vncviewer_bootstrap
Ville Skyttä 7ef492
-    fi
Ville Skyttä 7ef492
+
Ville Skyttä 7ef492
+    # Install real completion for subsequent completions
Ville Skyttä 7ef492
+    complete -F $fname vncviewer
Ville Skyttä 7ef492
+    $fname  # Generate completions once for now
Ville Skyttä 7ef492
+    unset -f _vncviewer_bootstrap
Ville Skyttä 7ef492
 } &&
Ville Skyttä 7ef492
-complete -F _vncviewer_bootstrap vncviewer
Ville Skyttä 7ef492
+complete -F _vncviewer_bootstrap vncviewer &&
Ville Skyttä 7ef492
+_vncviewer()
Ville Skyttä 7ef492
+{
Ville Skyttä 7ef492
+    COMPREPLY=()
Ville Skyttä 7ef492
+    local cur=`_get_cword`
Ville Skyttä 7ef492
+    _known_hosts_real "$cur"
Ville Skyttä 7ef492
+}
Ville Skyttä 7ef492
 
Ville Skyttä 7ef492
 have tightvncviewer &&
Ville Skyttä 7ef492
 _tightvncviewer()