diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 2000-01-23 22:34:02 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 2000-01-23 22:34:02 +0000 |
commit | 08f335e4851dd626c0a9c4f5e3b0fe661909e6f4 (patch) | |
tree | bc507250d496944fee22fd1bd7c51560e8216411 /Functions/Misc/nslookup | |
parent | 5b0c4cae62f351a24260cb35a3a51c94ff556aa1 (diff) | |
download | zsh-08f335e4851dd626c0a9c4f5e3b0fe661909e6f4.tar.gz zsh-08f335e4851dd626c0a9c4f5e3b0fe661909e6f4.tar.xz zsh-08f335e4851dd626c0a9c4f5e3b0fe661909e6f4.zip |
zsh-3.1.6-dev-16 zsh-3.1.6-dev-16
Diffstat (limited to 'Functions/Misc/nslookup')
-rw-r--r-- | Functions/Misc/nslookup | 47 |
1 files changed, 25 insertions, 22 deletions
diff --git a/Functions/Misc/nslookup b/Functions/Misc/nslookup index 499cabf5a..d59a5e66c 100644 --- a/Functions/Misc/nslookup +++ b/Functions/Misc/nslookup @@ -1,31 +1,34 @@ # Simple wrapper function for `nslookup'. With completion if you are using # the function based completion system. -setopt localoptions localtraps completealiases +setopt localoptions completealiases -local tmp line compcontext=nslookup curcontext=':nslookup' pmpt +local char line compcontext=nslookup pid -trap 'return 130' INT -trap 'zpty -d nslookup' EXIT +trap 'print -p exit;return' INT -pmpt=() -zstyle -s ':nslookup' prompt tmp && pmpt=(-p "$tmp") -zstyle -s ':nslookup' rprompt tmp && pmpt=("$pmpt[@]" -r "$tmp") -(( $#pmpt )) || pmpt=(-p '> ') +coproc command nslookup +pid=$! -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 '*> ' || break - print -nr "$line" +while read -pk 1 char; do + line="$line$char" + [[ "$line" = *' +> ' ]] && break +done +print -nr - "$line" + +line='' +while vared -p '> ' line; do + print -p "$line" + line='' + while read -pk 1 char; do + line="$line$char" + [[ "$line" = *' +> ' ]] && break + done + print -nr - "$line" + line='' done -zpty -w nslookup 'exit' +print -p exit +wait $pid |