home *** CD-ROM | disk | FTP | other *** search
/ InfoMagic Source Code 1993 July / THE_SOURCE_CODE_CD_ROM.iso / bsd_srcs / contrib / usr.x25 / lib / getx25hostbyaddr.c < prev    next >
Encoding:
C/C++ Source or Header  |  1990-09-03  |  464 b   |  26 lines

  1. /*
  2.  * Fetch netdb entry from /etc/x25hosts for a
  3.  * host given its X.121 address.
  4.  *
  5.  * Copyright 1985 Frank Pronk
  6.  */
  7.  
  8. #include <sys/types.h>
  9. #include <netccitt/x25.h>
  10. #include <netdb.h>
  11.  
  12. struct hostent *
  13. getx25hostbyaddr (addr)
  14. char *addr;
  15. {
  16.     register struct hostent *p;
  17.     struct hostent *getx25hostent ();
  18.  
  19.     setx25hostent(0);
  20.     while ((p = getx25hostent ()) &&
  21.         strcmp (((struct sockaddr_x25 *)p->h_addr)->x25_addr, addr))
  22.             ;
  23.     endx25hostent ();
  24.     return (p);
  25. }
  26.