From: Glenn Morris <rgm@gnu.org>
To: 22091-done@debbugs.gnu.org
Subject: bug#22091: [PATCH 1/2] * lisp/env.el: Add (whereis-command)
Date: Fri, 04 Dec 2015 19:53:34 -0500 [thread overview]
Message-ID: <pcegf1hg1d.fsf@fencepost.gnu.org> (raw)
In-Reply-To: <1449210313-10200-1-git-send-email-lx@shellcodes.org>
Version: 25.1
Thanks for the report and the patch(es).
I installed something slightly different into emacs-25, to take care of
a few other related bits at the same time:
--- a/lisp/net/net-utils.el
+++ b/lisp/net/net-utils.el
@@ -35,15 +35,19 @@
;; * Support connections to HOST/PORT, generally for debugging and the like.
;; In other words, for doing much the same thing as "telnet HOST PORT", and
;; then typing commands.
-;;
-;; PATHS
-;;
-;; On some systems, some of these programs are not in normal user path,
-;; but rather in /sbin, /usr/sbin, and so on.
-
;;; Code:
+;; On some systems, programs like ifconfig are not in normal user
+;; path, but rather in /sbin, /usr/sbin, etc (but non-root users can
+;; still use them for queries). Actually the trend these
+;; day is for /sbin to be a symlink to /usr/sbin, but we still need to
+;; search both for older systems.
+(defun net-utils--executable-find-sbin (command)
+ "Return absolute name of COMMAND if found in an sbin directory."
+ (let ((exec-path '("/sbin" "/usr/sbin" "/usr/local/sbin")))
+ (executable-find command)))
+
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Customization Variables
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@@ -85,10 +89,13 @@ These options can be used to limit how many ICMP packets are emitted."
(define-obsolete-variable-alias 'ipconfig-program 'ifconfig-program "22.2")
(defcustom ifconfig-program
- (if (eq system-type 'windows-nt)
- "ipconfig"
- "ifconfig")
+ (cond ((eq system-type 'windows-nt) "ipconfig")
+ ((executable-find "ifconfig") "ifconfig")
+ ((net-utils--executable-find-sbin "ifconfig"))
+ ((net-utils--executable-find-sbin "ip"))
+ (t "ip"))
"Program to print network configuration information."
+ :version "25.1" ; add ip
:group 'net-utils
:type 'string)
@@ -96,10 +103,12 @@ These options can be used to limit how many ICMP packets are emitted."
'ifconfig-program-options "22.2")
(defcustom ifconfig-program-options
- (list
- (if (eq system-type 'windows-nt)
- "/all" "-a"))
+ (cond ((string-match "ipconfig\\'" ifconfig-program) '("/all"))
+ ((string-match "ifconfig\\'" ifconfig-program) '("-a"))
+ ((string-match "ip\\'" ifconfig-program) '("addr")))
"Options for the ifconfig program."
+ :version "25.1"
+ :set-after '(ifconfig-program)
:group 'net-utils
:type '(repeat string))
@@ -126,7 +135,7 @@ These options can be used to limit how many ICMP packets are emitted."
:group 'net-utils
:type '(repeat string))
-(defcustom arp-program "arp"
+(defcustom arp-program (or (net-utils--executable-find-sbin "arp") "arp")
"Program to print IP to address translation tables."
:group 'net-utils
:type 'string)
prev parent reply other threads:[~2015-12-05 0:53 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 ` bug#22091: �ظ���bug#22091: " lux
2015-12-05 0:53 ` Glenn Morris [this message]
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=pcegf1hg1d.fsf@fencepost.gnu.org \
--to=rgm@gnu.org \
--cc=22091-done@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 external index
https://git.savannah.gnu.org/cgit/emacs.git
https://git.savannah.gnu.org/cgit/emacs/org-mode.git
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.