((name :initarg :name :accessor host-ent-name)
(aliases :initarg :aliases :accessor host-ent-aliases)
(address-type :initarg :type :accessor host-ent-address-type)
((name :initarg :name :accessor host-ent-name)
(aliases :initarg :aliases :accessor host-ent-aliases)
(address-type :initarg :type :accessor host-ent-address-type)
(addresses :initarg :addresses :accessor host-ent-addresses))
;; FIXME: Our Texinfo documentation extracter need at least his to spit
;; out the signature. Real documentation would be better...
(addresses :initarg :addresses :accessor host-ent-addresses))
;; FIXME: Our Texinfo documentation extracter need at least his to spit
;; out the signature. Real documentation would be better...
(car (host-ent-addresses host-ent)))
;(define-condition host-not-found-error (socket-error)) ; host unknown
(car (host-ent-addresses host-ent)))
;(define-condition host-not-found-error (socket-error)) ; host unknown
(defun make-host-ent (h)
(if (sb-grovel::foreign-nullp h) (name-service-error "gethostbyname"))
(let* ((length (sockint::hostent-length h))
(defun make-host-ent (h)
(if (sb-grovel::foreign-nullp h) (name-service-error "gethostbyname"))
(let* ((length (sockint::hostent-length h))
- (aliases (loop for i = 0 then (1+ i)
- for al = (sb-alien:deref (sockint::hostent-aliases h) i)
- while al
- collect al))
- (addresses
- (loop for i = 0 then (1+ i)
- for ad = (sb-alien:deref (sockint::hostent-addresses h) i)
- until (sb-alien:null-alien ad)
- collect (ecase (sockint::hostent-type h)
- (#.sockint::af-inet
- (assert (= length 4))
- (let ((addr (make-array 4 :element-type '(unsigned-byte 8))))
- (loop for i from 0 below length
- do (setf (elt addr i) (sb-alien:deref ad i)))
- addr))
- (#.sockint::af-local
- (sb-alien:cast ad sb-alien:c-string))))))
+ (aliases (loop for i = 0 then (1+ i)
+ for al = (sb-alien:deref (sockint::hostent-aliases h) i)
+ while al
+ collect al))
+ (addresses
+ (loop for i = 0 then (1+ i)
+ for ad = (sb-alien:deref (sockint::hostent-addresses h) i)
+ until (sb-alien:null-alien ad)
+ collect (ecase (sockint::hostent-type h)
+ (#.sockint::af-inet
+ (assert (= length 4))
+ (let ((addr (make-array 4 :element-type '(unsigned-byte 8))))
+ (loop for i from 0 below length
+ do (setf (elt addr i) (sb-alien:deref ad i)))
+ addr))
+ (#.sockint::af-local
+ (sb-alien:cast ad sb-alien:c-string))))))
(sockint::with-in-addr packed-addr ()
(let ((addr-vector (coerce address 'vector)))
(loop for i from 0 below (length addr-vector)
(sockint::with-in-addr packed-addr ()
(let ((addr-vector (coerce address 'vector)))
(loop for i from 0 below (length addr-vector)
(error condition :errno *name-service-errno* :syscall where))))
(define-condition name-service-error (condition)
((errno :initform nil
(error condition :errno *name-service-errno* :syscall where))))
(define-condition name-service-error (condition)
((errno :initform nil
(symbol :initform nil :initarg :symbol :reader name-service-error-symbol)
(syscall :initform "an unknown location" :initarg :syscall :reader name-service-error-syscall))
(:report (lambda (c s)
(symbol :initform nil :initarg :symbol :reader name-service-error-symbol)
(syscall :initform "an unknown location" :initarg :syscall :reader name-service-error-syscall))
(:report (lambda (c s)
- (let ((num (name-service-error-errno c)))
- (format s "Name service error in \"~A\": ~A (~A)"
- (name-service-error-syscall c)
- (or (name-service-error-symbol c)
- (name-service-error-errno c))
- (get-name-service-error-message num))))))
+ (let ((num (name-service-error-errno c)))
+ (format s "Name service error in \"~A\": ~A (~A)"
+ (name-service-error-syscall c)
+ (or (name-service-error-symbol c)
+ (name-service-error-errno c))
+ (get-name-service-error-message num))))))