about summary refs log tree commit diff
path: root/Functions/Misc
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-09-06 09:16:29 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-09-06 09:16:29 +0000
commit2031ddbfc2d109627a6a567027fef0c0c9e1126b (patch)
tree6e9398883e014ea0242805af6f4538c944e174c3 /Functions/Misc
parent026bf2d44814f4c982c33aa795b8dcca53361970 (diff)
downloadzsh-2031ddbfc2d109627a6a567027fef0c0c9e1126b.tar.gz
zsh-2031ddbfc2d109627a6a567027fef0c0c9e1126b.tar.xz
zsh-2031ddbfc2d109627a6a567027fef0c0c9e1126b.zip
manual/7652
Diffstat (limited to 'Functions/Misc')
-rw-r--r--Functions/Misc/nslookup34
1 files changed, 34 insertions, 0 deletions
diff --git a/Functions/Misc/nslookup b/Functions/Misc/nslookup
new file mode 100644
index 000000000..15afb2ff1
--- /dev/null
+++ b/Functions/Misc/nslookup
@@ -0,0 +1,34 @@
+# Simple wrapper function for `nslookup'. With completion if you are using
+# the function based completion system.
+
+setopt localoptions completealiases
+
+local char line compcontext=nslookup pid
+
+trap 'print -p exit;return' INT
+
+coproc command nslookup
+pid=$!
+
+while read -pk1 char; do
+  line="$line$char"
+  [[ "$line" = *'
+> ' ]] && break
+done
+print -nr - "$line"
+
+line=''
+while vared -p '> ' line; do
+  print -p "$line"
+  line=''
+  while read -pk1 char; do
+    line="$line$char"
+    [[ "$line" = *'
+> ' ]] && break
+  done
+  print -nr - "$line"
+  line=''
+done
+
+print -p exit
+wait $pid