unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: "lux" <lx@shellcodes.org>
To: "Glenn Morris" <rgm@gnu.org>
Cc: 22091 <22091@debbugs.gnu.org>
Subject: bug#22091: ���bug#22091: [PATCH 1/2] * lisp/env.el: Add (whereis-command)
Date: Fri, 4 Dec 2015 16:17:57 +0800	[thread overview]
Message-ID: <tencent_142FDD1D59FF212C06D4F3FD@qq.com> (raw)
In-Reply-To: <jzoae6wshx.fsf@fencepost.gnu.org>


[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1.1: Type: text/plain; charset="gb18030", Size: 1835 bytes --]

I'm sorry, his is new patch, thank you Glenn Morris:


diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index c6d40b6..0a4693f 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -87,7 +87,9 @@ These options can be used to limit how many ICMP packets are emitted."
 (defcustom ifconfig-program
   (if (eq system-type 'windows-nt)
       "ipconfig"
-    "ifconfig")
+    (if (executable-find "ifconfig")
+        "ifconfig"
+      "ip"))
   "Program to print network configuration information."
   :group 'net-utils
   :type  'string)
@@ -97,8 +99,10 @@ These options can be used to limit how many ICMP packets are emitted."
 
 (defcustom ifconfig-program-options
   (list
-   (if (eq system-type 'windows-nt)
-       "/all" "-a"))
+   (cond ((eq system-type 'windows-nt) "/all")
+         ((and (executable-find "ip")
+               (not (executable-find "ifconfig"))) "addr")
+         (t "-a")))
   "Options for the ifconfig program."
   :group 'net-utils
   :type  '(repeat string))
-- 
2.5.0







------------------ ԭʼÓʼþ ------------------
·¢¼þÈË: "Glenn Morris";<rgm@gnu.org>;
·¢ËÍʱ¼ä: 2015Äê12ÔÂ4ÈÕ(ÐÇÆÚÎå) ÏÂÎç4:03
ÊÕ¼þÈË: "lux"<lx@shellcodes.org>; 
³­ËÍ: "22091"<22091@debbugs.gnu.org>; 
Ö÷Ìâ: bug#22091: [PATCH 1/2] * lisp/env.el: Add (whereis-command)



lu4nx wrote:

> +(defun whereis-command (command)
> +  (let ((paths (split-string (getenv "PATH") ":")))
> +    (remove-if-not
> +     (lambda (path)
> +       (file-exists-p (format "%s/%s" path command)))
> +     paths)))

You use a CL function without requiring CL.
But 'executable-find' already exists anyway, so this isn't needed.

Also, you sent 4 or 5 identical copies of each of your mails in rapid
succession (filtered out by list moderation). Please fix your mailer.

[-- Attachment #1.2: Type: text/html, Size: 3017 bytes --]

[-- Attachment #2: 0001-lisp-net-net-utils.el-ifconfig-function-support-ip.patch --]
[-- Type: application/octet-stream, Size: 1437 bytes --]

From 27b9af13c9662abad4a252b0e28bb5d40ef4e9ea Mon Sep 17 00:00:00 2001
From: lu4nx <lx@shellcodes.org>
Date: Fri, 4 Dec 2015 16:13:31 +0800
Subject: [PATCH] * lisp/net/net-utils.el: (ifconfig) function support `ip`

In some Linux distribution default not found `ifconfig` command, such as CentOS7.

- `ifconfig-program` and `ifconfig-program-options` add support `ip` command.
---
 lisp/net/net-utils.el | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/lisp/net/net-utils.el b/lisp/net/net-utils.el
index c6d40b6..0a4693f 100644
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -87,7 +87,9 @@ These options can be used to limit how many ICMP packets are emitted."
 (defcustom ifconfig-program
   (if (eq system-type 'windows-nt)
       "ipconfig"
-    "ifconfig")
+    (if (executable-find "ifconfig")
+        "ifconfig"
+      "ip"))
   "Program to print network configuration information."
   :group 'net-utils
   :type  'string)
@@ -97,8 +99,10 @@ These options can be used to limit how many ICMP packets are emitted."
 
 (defcustom ifconfig-program-options
   (list
-   (if (eq system-type 'windows-nt)
-       "/all" "-a"))
+   (cond ((eq system-type 'windows-nt) "/all")
+         ((and (executable-find "ip")
+               (not (executable-find "ifconfig"))) "addr")
+         (t "-a")))
   "Options for the ifconfig program."
   :group 'net-utils
   :type  '(repeat string))
-- 
2.5.0


  reply	other threads:[~2015-12-04  8:17 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-12-04  6:25 bug#22091: [PATCH 1/2] * lisp/env.el: Add (whereis-command) lu4nx
2015-12-04  6:25 ` bug#22091: [PATCH 2/2] * lisp/net/net-utils.el: (ifconfig) function support `ip` command lu4nx
2015-12-04  8:03 ` bug#22091: [PATCH 1/2] * lisp/env.el: Add (whereis-command) Glenn Morris
2015-12-04  8:17   ` lux [this message]
2015-12-05  0:53     ` Glenn Morris

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=tencent_142FDD1D59FF212C06D4F3FD@qq.com \
    --to=lx@shellcodes.org \
    --cc=22091@debbugs.gnu.org \
    --cc=rgm@gnu.org \
    /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.savannah.gnu.org/cgit/emacs.git

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 read-only IMAP folder(s) and NNTP newsgroup(s).