about summary refs log tree commit diff
path: root/Functions/Misc/nslookup
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-02-11 19:46:32 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-02-11 19:46:32 +0000
commit779b36d8442997a42de3fb5c032fbb984498182a (patch)
tree4bb72d633aaadd4028ed24502dd1724a4d3cedf6 /Functions/Misc/nslookup
parenta008690d67199d689b54972fa27a3398c1c74a7e (diff)
downloadzsh-779b36d8442997a42de3fb5c032fbb984498182a.tar.gz
zsh-779b36d8442997a42de3fb5c032fbb984498182a.tar.xz
zsh-779b36d8442997a42de3fb5c032fbb984498182a.zip
zsh-3.1.6-dev-18 zsh-3.1.6-dev-18
Diffstat (limited to 'Functions/Misc/nslookup')
-rw-r--r--Functions/Misc/nslookup49
1 files changed, 24 insertions, 25 deletions
diff --git a/Functions/Misc/nslookup b/Functions/Misc/nslookup
index d59a5e66c..2103a839b 100644
--- a/Functions/Misc/nslookup
+++ b/Functions/Misc/nslookup
@@ -1,34 +1,33 @@
 # Simple wrapper function for `nslookup'. With completion if you are using
 # the function based completion system.
 
-setopt localoptions completealiases
+setopt localoptions localtraps completealiases
 
-local char line compcontext=nslookup pid
+local tmp line compcontext=nslookup curcontext='nslookup:::' pmpt
 
-trap 'print -p exit;return' INT
+zmodload -e zsh/zpty || zmodload -i zsh/zpty
 
-coproc command nslookup
-pid=$!
+trap 'return 130' INT
+trap 'zpty -d nslookup' EXIT
 
-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=''
+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 '*> ' || break
+  print -nr "$line"
 done
 
-print -p exit
-wait $pid
+zpty -w nslookup 'exit'