Doxygen Source Code Documentation
        
Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search   
xxx_name_to_inet.c
Go to the documentation of this file.00001 #include <sys/types.h>
00002 #include <sys/socket.h>
00003 #include <netinet/in.h>
00004 #include <netdb.h>
00005 #include <stdio.h>
00006 #include <arpa/inet.h>
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 char * xxx_name_to_inet( char * host )
00015 {
00016    struct hostent * hostp ;
00017    char * iname = NULL , * str ;
00018    int ll ;
00019 
00020    if( host == NULL || host[0] == '\0' ) return NULL ;
00021 
00022    hostp = gethostbyname(host) ; if( hostp == NULL ) return NULL :
00023 
00024    str = inet_ntoa(*((struct in_addr *)(hostp->h_addr))) ;
00025    if( str == NULL || str[0] == '\0' ) return NULL ;
00026 
00027    ll = strlen(str) ; iname = AFMALL(char, ll+1) ; strcpy(iname,str) ;
00028    return iname ;
00029 }