about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2009-09-13 18:26:21 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2009-09-13 18:26:21 +0000
commit1f6225fd7827c4cb151db759836c65399f7689f9 (patch)
tree40d8b3dc9924c366b26ed68607f3ce63102f082b
parentd980a79a43e5c44acfd884a248c313cb9dad7269 (diff)
downloadzsh-1f6225fd7827c4cb151db759836c65399f7689f9.tar.gz
zsh-1f6225fd7827c4cb151db759836c65399f7689f9.tar.xz
zsh-1f6225fd7827c4cb151db759836c65399f7689f9.zip
Baptiste Daroussin: 27271: remove awk dependence
-rw-r--r--ChangeLog5
-rw-r--r--Functions/Zftp/zfanon7
2 files changed, 7 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index e3e57f669..2688e919c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2009-09-13  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
+	* Baptiste Daroussin: 27271: Functions/Zftp/zfanon: remove awk
+	dependence.
+
 	* Baptiste Daroussin: 27270: Functions/Zftp/zfcd_match: remove
 	awk dependence.
 
@@ -12160,5 +12163,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.4776 $
+* $Revision: 1.4777 $
 *****************************************************
diff --git a/Functions/Zftp/zfanon b/Functions/Zftp/zfanon
index 5dc22617c..336609bd0 100644
--- a/Functions/Zftp/zfanon
+++ b/Functions/Zftp/zfanon
@@ -23,12 +23,11 @@ if [[ -z $EMAIL_ADDR ]]; then
     host=$HOST
   elif [[ -f /etc/resolv.conf ]]; then
     # Next, maybe we've got resolv.conf.
-    domain=$(awk '/domain/ { print $2 }' /etc/resolv.conf)
+    domain=${${=${(M)${(f)"$(</etc/resolv.conf)"}:#domain*}}[2]}
     [[ -n $domain ]] && host=$HOST.$domain
   fi
-  # Next, maybe we've got nlsookup.  May not work on LINUX.
-  [[ -z $host ]] && host=$(nslookup $HOST 2>/dev/null |
-    awk '/Name:/ { print $2 }')
+  # Next, maybe we've got nslookup.  May not work on LINUX.
+  [[ -z $host ]] && host=${${=${(M)${(f)"$(nslookup $HOST 2>/dev/null)"}:#Name:*}}[2]}
   if [[ -z $host ]]; then
     # we're running out of ideas, but this should work.
     # after all, i wrote it...