home *** CD-ROM | disk | FTP | other *** search
/ ARM Club 3 / TheARMClub_PDCD3.iso / hensa / unix / unixlib_1 / !UnixLib37_netlib_netlib_c_inet_ntoa < prev    next >
Encoding:
Text File  |  1996-07-28  |  658 b   |  34 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 <stdio.h>
  15.  
  16. #include <arpa/inet.h>
  17. #include <netinet/in.h>
  18.  
  19. /*
  20.  * Format an internet address in string form
  21.  */
  22. char *
  23. inet_ntoa (struct in_addr in)
  24. {
  25.   static char string[16];
  26.  
  27.   /* Print the string into the buffer */
  28.   sprintf (string, "%ld.%ld.%ld.%ld", in.s_addr & 0xff,
  29.        (in.s_addr >> 8) & 0xff, (in.s_addr >> 16) & 0xff,
  30.        (in.s_addr >> 24) & 0xff);
  31.  
  32.   return string;
  33. }
  34.