about summary refs log tree commit diff
path: root/Functions/Misc/nslookup
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-01-20 18:44:51 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-01-20 18:44:51 +0000
commite7de8c77d47868854a162c2332f36817ba9b5bba (patch)
treeef5febff04efab471e4f1aa884081751cc580654 /Functions/Misc/nslookup
parent74be4d9a377c6dd7fe5a29c1b053f59db1049762 (diff)
downloadzsh-e7de8c77d47868854a162c2332f36817ba9b5bba.tar.gz
zsh-e7de8c77d47868854a162c2332f36817ba9b5bba.tar.xz
zsh-e7de8c77d47868854a162c2332f36817ba9b5bba.zip
zsh-workers/9390
Diffstat (limited to 'Functions/Misc/nslookup')
-rw-r--r--Functions/Misc/nslookup43
1 files changed, 18 insertions, 25 deletions
diff --git a/Functions/Misc/nslookup b/Functions/Misc/nslookup
index d59a5e66c..8cbbdce6b 100644
--- a/Functions/Misc/nslookup
+++ b/Functions/Misc/nslookup
@@ -1,34 +1,27 @@
 # 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
+trap 'return 130' INT
+trap 'zpty -d nslookup' EXIT
 
-coproc command nslookup
-pid=$!
+zstyle -s ':nslookup' prompt pmpt || pmpt='> '
 
-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=''
+zpty nslookup nslookup
+
+zpty -r nslookup line '*> '
+print -nr "$line"
+
+while line=''; vared -p "$pmpt" line; do
+  [[ "$line" = exit ]] && break
+
+  zpty -w nslookup "$line"
+
+  zpty -r nslookup line '*> '
+  print -nr "$line"
 done
 
-print -p exit
-wait $pid
+zpty -w nslookup 'exit'