home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / unix / unixlib_1 / !UnixLib37_netlib_netlib_c_inet_netwo < prev    next >
Encoding:
Text File  |  1996-07-28  |  577 b   |  31 lines

  1. /****************************************************************************
  2.  *
  3.  * $Source$
  4.  * $Date$
  5.  * $Revision$
  6.  * $State$
  7.  * $Author$
  8.  *
  9.  * $Log$
  10.  ***************************************************************************/
  11.  
  12. static const char rcs_id[] = "$Id$";
  13.  
  14. #include <arpa/inet.h>
  15. #include <netinet/in.h>
  16. #include <sys/byteorder.h>
  17.  
  18. /*
  19.  * Extract a network number in host byte order from a string
  20.  */
  21. u_long
  22. inet_network (const char *cp)
  23. {
  24.   struct in_addr net;
  25.  
  26.   /* Decode the address string */
  27.   net.s_addr = inet_addr (cp);
  28.  
  29.   return ntohl (inet_netof (net));
  30. }
  31.