1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-25 05:31:19 +02:00
zsh/Functions/Misc/nslookup
2000-03-10 01:01:03 +00:00

35 lines
765 B
Text

# Simple wrapper function for `nslookup'. With completion if you are using
# the function based completion system.
setopt localoptions localtraps completealiases
local tmp line compcontext=nslookup curcontext='nslookup:::' pmpt
zmodload -e zsh/zpty || zmodload -i zsh/zpty
trap 'return 130' INT
trap 'zpty -d nslookup' EXIT
pmpt=()
zstyle -s ':nslookup' prompt tmp && pmpt=(-p "$tmp")
zstyle -s ':nslookup' rprompt tmp && pmpt=("$pmpt[@]" -r "$tmp")
(( $#pmpt )) || pmpt=(-p '> ')
zpty nslookup nslookup
zpty -r nslookup line '*
> '
print -nr "$line"
while line=''; vared -he "$pmpt[@]" line; do
print -s "$line"
[[ "$line" = exit ]] && break
zpty -w nslookup "$line"
zpty -r nslookup line '*
> '
print -nr "$line"
done
zpty -w nslookup 'exit'