4 (defun init-username ()
5 (format t
"~&Please input your Name:")(force-output)
8 (defun init-user-ip-interface ()
9 (format t
"~&You have the following network cards. ")
10 (let ((ip-interfaces (reverse (get-ip-interfaces))))
11 (loop for i from
1 to
(length ip-interfaces
)
12 do
(format t
"~& ~a: ~a~%" i
(ip-interface-address
13 (nth (1- i
) ip-interfaces
))))
15 (format t
"~&Choose one[Enter for first]:")(force-output)
16 (let ((curchoice (read-line *standard-input
* nil
"")))
17 (if (string= curchoice
"")
18 (return (first ip-interfaces
))
19 (let ((curindex (parse-integer curchoice
:junk-allowed t
)))
20 (when (and (integerp curindex
)
22 (<= curindex
(length ip-interfaces
)))
23 (return (nth (1- curindex
) ip-interfaces
)))))))))
25 (defun format-ip (vector)
26 (format nil
"~{~a~^.~}" (coerce vector
'list
)))
28 (defclass ipmsg-protocol-selfinfo
()
29 ((username :accessor user-name
:allocation
:class
:initform nil
)
30 (hostname :accessor host-name
:allocation
:class
:initform nil
)
31 (groupname :accessor group-name
:allocation
:class
)