Check whether avahi-daemon is started

This commit is contained in:
David Paleino 2009-06-20 09:14:08 +02:00
parent ab36c8d29d
commit 1e532f0f2b

View File

@ -1193,10 +1193,13 @@ _known_hosts_real()
fi
# Add hosts reported by avahi, if it's available
# and if the daemon is started.
if type avahi-browse >&/dev/null; then
COMPREPLY=( "${COMPREPLY[@]}" $(
compgen -W "$( avahi-browse -kcpr _workstation._tcp | \
grep ^= | cut -d\; -f7 | sort -u )" -- $cur ) )
if [ -z "$(pidof avahi-daemon)" ]; then
COMPREPLY=( "${COMPREPLY[@]}" $(
compgen -W "$( avahi-browse -kcpr _workstation._tcp | \
grep ^= | cut -d\; -f7 | sort -u )" -- $cur ) )
fi
fi
# Now add results of normal hostname completion