(bindat-ip-to-string): Use `format-network-address' if possible.

This commit is contained in:
Thien-Thi Nguyen 2006-08-11 09:28:44 +00:00
parent 2f2f340fb5
commit bad03cfc80
2 changed files with 11 additions and 3 deletions

View 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)
"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)