home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / tolkit45.zip / os2tk45 / samples / tcpiptk / sampdll / sampdll.c < prev    next >
Text File  |  1999-05-11  |  3KB  |  61 lines

  1. /********************************************************copyrite.xic********/
  2. /*                                                                          */
  3. /*   Licensed Materials - Property of IBM                                   */
  4. /*   IBM TCP/IP for OS/2                                                    */
  5. /*   (C) Copyright IBM Corporation. 1990,1996.                              */
  6. /*                                                                          */
  7. /*   All rights reserved.                                                   */
  8. /*                                                                          */
  9. /*   US Government Users Restricted Rights -                                */
  10. /*   Use, duplication or disclosure restricted by GSA ADP Schedule          */
  11. /*   Contract with IBM Corp.                                                */
  12. /*                                                                          */
  13. /*--------------------------------------------------------------------------*/
  14. /*                                                                          */
  15. /*  DISCLAIMER OF WARRANTIES.  The following [enclosed] code is             */
  16. /*  sample code created by IBM Corporation. This sample code is not         */
  17. /*  part of any standard or IBM product and is provided to you solely       */
  18. /*  for  the purpose of assisting you in the development of your            */
  19. /*  applications.  The code is provided "AS IS", without                    */
  20. /*  warranty of any kind.  IBM shall not be liable for any damages          */
  21. /*  arising out of your use of the sample code, even if they have been      */
  22. /*  advised of the possibility of such damages.                             */
  23. /*--------------------------------------------------------------------------*/
  24. /* Modification History:
  25. **  Date:    By:  Tag:    Reason:
  26. **  9/23/96  DRC  DRC01   Rearranged include files to preserve defs
  27. **  9/30/96  DRC  DRC02   removed unreferenced variable
  28. */
  29.  
  30. /*
  31.  * Include Files.
  32.  */
  33. #include <netdb.h>            /* DRC01 - rearranged order of included files*/
  34. #include <stdio.h>            /* DRC01 - rearranged order of included files*/
  35. #include <stdlib.h>           /* DRC01 - rearranged order of included files*/
  36. #include <types.h>
  37. #include <netinet\in.h>
  38. #include <sys\socket.h>
  39. #include <string.h>
  40. #include <arpa\inet.h>
  41.  
  42. char * s_gethostbyname(char * name)
  43. {
  44.     struct hostent *hp;    /* server host name information             */
  45.     struct in_addr in;
  46.  
  47.     /*
  48.      */
  49.     hp = gethostbyname(name);
  50.     if (hp) {
  51.              memcpy(&in.s_addr, hp->h_addr, hp->h_length);
  52.     } else {
  53.              /* return appropriate error code to calling application */
  54.              exit(1);
  55.     }
  56.  
  57.     return(inet_ntoa(in));
  58.  
  59. }
  60.  
  61.