summaryrefslogtreecommitdiff
path: root/lisp/emacs-lisp/bindat.el
diff options
context:
space:
mode:
authorThien-Thi Nguyen <ttn@gnuvola.org>2006-08-11 09:28:44 +0000
committerThien-Thi Nguyen <ttn@gnuvola.org>2006-08-11 09:28:44 +0000
commitbad03cfc8030793473927dff7f8c87bc45fc4bbe (patch)
treee81e9d7bd00f7dae914777fc4008e3fa2fa81e27 /lisp/emacs-lisp/bindat.el
parent2f2f340fb561971fef6a846ff4621c69dab0a969 (diff)
downloademacs-bad03cfc8030793473927dff7f8c87bc45fc4bbe.tar.gz
emacs-bad03cfc8030793473927dff7f8c87bc45fc4bbe.tar.bz2
emacs-bad03cfc8030793473927dff7f8c87bc45fc4bbe.zip
(bindat-ip-to-string): Use `format-network-address' if possible.
Diffstat (limited to 'lisp/emacs-lisp/bindat.el')
-rw-r--r--lisp/emacs-lisp/bindat.el9
1 files changed, 6 insertions, 3 deletions
diff --git a/lisp/emacs-lisp/bindat.el b/lisp/emacs-lisp/bindat.el
index d05eed2c4a2..1b37f3f772f 100644
--- a/lisp/emacs-lisp/bindat.el
+++ b/lisp/emacs-lisp/bindat.el
@@ -619,9 +619,12 @@ If optional second arg SEP is a string, use that as separator."
(bindat-format-vector vect "%02x" (if (stringp sep) sep ":")))
(defun bindat-ip-to-string (ip)
- "Format vector IP as an ip address in dotted notation."
- (format "%d.%d.%d.%d"
- (aref ip 0) (aref ip 1) (aref ip 2) (aref ip 3)))
+ "Format vector IP as an ip address in dotted notation.
+The port (if any) is omitted. IP can be a string, as well."
+ (if (vectorp ip)
+ (format-network-address ip t)
+ (format "%d.%d.%d.%d"
+ (aref ip 0) (aref ip 1) (aref ip 2) (aref ip 3))))
(provide 'bindat)