unofficial mirror of bug-gnu-emacs@gnu.org 
 help / color / mirror / code / Atom feed
From: lu4nx <lx@shellcodes.org>
To: 22091@debbugs.gnu.org
Cc: lu4nx <lx@shellcodes.org>
Subject: bug#22091: [PATCH 2/2] * lisp/net/net-utils.el: (ifconfig) function support `ip` command.
Date: Fri,  4 Dec 2015 14:25:13 +0800	[thread overview]
Message-ID: <1449210313-10200-2-git-send-email-lx@shellcodes.org> (raw)
In-Reply-To: <1449210313-10200-1-git-send-email-lx@shellcodes.org>

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..74e832a 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 (whereis-command "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 (whereis-command "ip")
+               (not (whereis-command "ifconfig"))) "addr")
+         (t "-a")))
   "Options for the ifconfig program."
   :group 'net-utils
   :type  '(repeat string))
-- 
2.5.0






  reply	other threads:[~2015-12-04  6:25 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 ` lu4nx [this message]
2015-12-04  8:03 ` Glenn Morris
2015-12-04  8:17   ` bug#22091: �ظ���bug#22091: " lux
2015-12-05  0:53     ` bug#22091: " 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=1449210313-10200-2-git-send-email-lx@shellcodes.org \
    --to=lx@shellcodes.org \
    --cc=22091@debbugs.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).