zsh-users
 help / color / mirror / code / Atom feed
From: Sebastian Stark <seb@todesplanet.de>
To: zsh-users@sunsite.dk
Subject: DNS completion
Date: Fri, 6 Jul 2001 00:01:30 +0200	[thread overview]
Message-ID: <20010706000130.A7749@devel.todesplanet.de> (raw)

[-- 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

                 reply	other threads:[~2001-07-05 22:01 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20010706000130.A7749@devel.todesplanet.de \
    --to=seb@todesplanet.de \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).