]> code.delx.au - gnu-emacs/commitdiff
(bindat-ip-to-string): Use `format-network-address' if possible.
authorThien-Thi Nguyen <ttn@gnuvola.org>
Fri, 11 Aug 2006 09:28:44 +0000 (09:28 +0000)
committerThien-Thi Nguyen <ttn@gnuvola.org>
Fri, 11 Aug 2006 09:28:44 +0000 (09:28 +0000)
lisp/ChangeLog
lisp/emacs-lisp/bindat.el

index ada27d2c275f6c2ce7cd9db2dbf83bbe55ce9fd5..a6ee985c659f8e6ed9e67fec08cfd32af96fe51a 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-11  Thien-Thi Nguyen  <ttn@gnu.org>
+
+       * emacs-lisp/bindat.el (bindat-ip-to-string):
+       Use `format-network-address' if possible.
+
 2006-08-11  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
 
        * x-dnd.el (x-dnd-init-frame): Call x-register-dnd-atom.
 2006-08-11  Jan Dj\e,Ad\e(Brv  <jan.h.d@swipnet.se>
 
        * x-dnd.el (x-dnd-init-frame): Call x-register-dnd-atom.
index d05eed2c4a284d27a12754bebb844ed4b16cfbdd..1b37f3f772f2dbc6232d5cf0cff379936d6447dd 100644 (file)
@@ -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)
   (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)
 
 
 (provide 'bindat)