Tank's everybody..... i compile with gcc p.c -o p -lsocket..... :-) On Wed, 13 Jun 2001, Mario Henley Becerril Geldis wrote: > > > > I have next code: > > > #include <stdio.h> > #include <sys/types.h> > #include <netdb.h> > #include <sys/socket.h> > #include <netinet/in.h> > #include <arpa/inet.h> > > main (argc, argv) > int argc; > char *argv; > { > register char *ptr; > char *host_err_str(); > register struct hostent *hostptr; > > while (--argc > 0) > { > ptr= *++argv; > if ( (hostptr = gethostbyname(ptr)) == NULL) > { > err_ret("gethostbyname error for host: %s %s", ptr, host_err_str()); > continue; > } > printf ("official host name: %s\n", hostptr->h_name); > /* go through the list of aliases*/ > while ( (ptr = *(hostptr->h_aliases)) != NULL) > { > printf("alias:%s\n", ptr); > hostptr->h_aliases++; > } > printf(" addr type= %d, addr length = %d\n", hostptr->h_addrtype, > hostptr->h_length); > switch ( hostptr->h_addrtype ) > { > case AF_INET: pr_inet(hostptr->h_addr_list, hostptr->h_length); > break; > default: err_ret("unknown address type"); > break; > } > } > } > > pr_inet(listptr, length) > char **listptr; > int length; > { > struct in_addr *ptr; > while ( (ptr = struct in_addr *) *listptr++) != NULL) */ > { > printf (" Internet address: %s\n", inet_ntoa(*ptr)); > } > } > > > > But send next errors, when i compile > > > gcc p.c -o p > > > In function `main': > 18: warning: assignment makes pointer from integer without a cast > In function `pr_inet': > 49: warning: assignment from incompatible pointer type > Undefined first referenced > symbol in file > gethostbyname /var/tmp/ccIkvU0H.o > inet_ntoa /var/tmp/ccIkvU0H.o > host_err_str /var/tmp/ccIkvU0H.o > err_ret /var/tmp/ccIkvU0H.o > ld: fatal: Symbol referencing errors. No output written to p > collect2: ld returned 1 exit status > > > any ideas..????? > > :-( > > > > > > > > > >Received on Thu Jun 14 04:18:29 2001
This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:24:57 EDT