Mercurial > emacs
changeset 72357:805ccb94d5d6
(bindat-ip-to-string): Use `format-network-address' if possible.
author | Thien-Thi Nguyen <ttn@gnuvola.org> |
---|---|
date | Fri, 11 Aug 2006 09:26:03 +0000 |
parents | 1865f719f226 |
children | eb5f2f6fbcef |
files | lisp/emacs-lisp/bindat.el |
diffstat | 1 files changed, 6 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/lisp/emacs-lisp/bindat.el Fri Aug 11 07:32:39 2006 +0000 +++ b/lisp/emacs-lisp/bindat.el Fri Aug 11 09:26:03 2006 +0000 @@ -619,9 +619,12 @@ (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)