_interface_address   xtlang


Defined in:  https://github.com/digego/extempore/tree/v0.8.9/libs/external/libc.xtm

Implementation

(bind-func _interface_address
  (lambda (name:i8* ifs:ifaddrs*)
    (let ((address (cast (tref ifs 3) sockaddr_in*))
          (ipv:i8* (cast (tref-ptr address 0) i8*)))
      (if (and (= (pref ipv 1) (i16toi8 AF_INET))
               (= (strcmp name (tref ifs 1)) 0))
          (inet_ntoa (tref (tref-ptr address 2) 0))
          (if (null? (tref ifs 0))
              ""
              (_interface_address name (tref ifs 0)))))))


Back to Index

Similar Entries