zsh-workers
 help / color / mirror / code / Atom feed
From: Baptiste Daroussin <baptiste.daroussin@gmail.com>
To: zsh-workers@sunsite.dk
Subject: [Patch] remove awk dependency from zfanon
Date: Sat, 12 Sep 2009 15:02:28 +0200	[thread overview]
Message-ID: <ed7b1c610909120602tb9420bam693f1da51b386424@mail.gmail.com> (raw)

[-- Attachment #1: Type: text/plain, Size: 149 bytes --]

Hi

Here is a patch that replace awk with zsh equivalent in zfanon

now only zfinit uses awk I'll have a look at this in the next days
regards,
Bapt

[-- Attachment #2: zfanon-noawk.patch --]
[-- Type: application/octet-stream, Size: 885 bytes --]

diff --git a/Functions/Zftp/zfanon b/Functions/Zftp/zfanon
index 5dc2261..336609b 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...

                 reply	other threads:[~2009-09-12 13:02 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ed7b1c610909120602tb9420bam693f1da51b386424@mail.gmail.com \
    --to=baptiste.daroussin@gmail.com \
    --cc=zsh-workers@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).