#include #include #include #include int main(int argc, char** argv) { int i; char hostname[80]; if(gethostname(hostname, sizeof(hostname))) { perror("gethostname"); return(1); } printf("Ich bin %s.\n", hostname); for (i=1; ih_name); for(pa = phostent->h_aliases; pa && *pa; pa++) { printf (" %s", *pa); } printf("\nAddress(%d):", phostent->h_length); for(pa = phostent->h_addr_list; pa && *pa; pa++) { int j; printf (" "); for(j=0;;j++) { printf("%u", (unsigned char)(*pa)[j]); if(j+1 >= phostent->h_length) break; printf("."); } } printf("\n"); } return 0; }