comp_include _dequote _filedir _get_cword _known_hosts


_ssh()
{
    local cur optconfigfile prev
    local -a config

    COMPREPLY=()
    cur=`_get_cword`
    prev=${COMP_WORDS[COMP_CWORD-1]}

    case "$prev" in
    -F)
	_filedir
	;;
    -*c)
        COMPREPLY=( $( compgen -W 'blowfish 3des 3des-cbc blowfish-cbc \
            arcfour cast128-cbc' -- $cur ) )
        ;;
    -*i)
        _filedir
        ;;
    -*l)
        COMPREPLY=( $( compgen -u -- $cur ) )
        ;;
    *)
	# Search COMP_WORDS for '-F[ ]configfile' argument
	set -- "${COMP_WORDS[@]}"
	while [ $# -gt 0 ]; do
	    if [ "${1:0:2}" = -F ]; then
		if [ ${#1} -gt 2 ]; then
		    optconfigfile="$(_dequote "$1")"
		else
		    shift
		    [ "$1" ] && optconfigfile="$(_dequote "-F$1")"
		fi
		break
	    fi
	    shift
	done

        _known_hosts -a "$optconfigfile"

        [ $COMP_CWORD -eq 1 -o -n "$optconfigfile" ] || \
	    COMPREPLY=( "${COMPREPLY[@]}" $( compgen -c -- $cur ) )
    esac

    return 0
}
