* DNS completion
@ 2001-07-05 22:01 Sebastian Stark
0 siblings, 0 replies; only message in thread
From: Sebastian Stark @ 2001-07-05 22:01 UTC (permalink / raw)
To: zsh-users
[-- Attachment #1: Type: text/plain, Size: 686 bytes --]
I wrote some code to support DNS zonetransfers in host completion.
It's a simple replacement for _hosts and it is not quite perfect yet.
You have to put a "search domain.com" line into /etc/resolv.conf and
need to have the "host" utility installed on your system.
Please let me know, what you think about it.
Also, I have two questions: How can I make libc calls directly from the
shell? You guess it: gethostbyname(2). Would it be possible to
substitute the awk usage with zsh parameter expansion?
please use reply-to, I'm not on the list.
--
1024D/DC805C44 2000-07-06 http://cran.ath.cx/~seb/publicpgpkey.asc
key fingerprint A079 88E9 3617 838D ED65 A7D1 277D D529 DC80 5C44
[-- Attachment #2: _hosts --]
[-- Type: text/plain, Size: 475 bytes --]
#compdef ftp ping rwho rup xping traceroute host
local expl hosts
if ! zstyle -a ":completion:${curcontext}:hosts" hosts hosts; then
(( $+_cache_hosts )) ||
: ${(A)_cache_hosts:=${(s: :)${(ps:\t:)${${(f)~~"$(host -l $(awk '/search/ { print $2 }' < /etc/resolv.conf) 2>/dev/null | awk '{ print $3, $1}')"}%%\#*}##[:blank:]#[^[:blank:]]#}}}
hosts=( "$_cache_hosts[@]" )
fi
_wanted hosts expl host \
compadd -M 'm:{a-zA-Z}={A-Za-z} r:|.=* r:|=*' "$@" -a hosts
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2001-07-05 22:01 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2001-07-05 22:01 DNS completion Sebastian Stark
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).