/* hostname.c -- prints hostname */ /* $Id$ */ /* Carlos Duarte , 980728 */ #include #include #include #include int main() { char s[100]; if (gethostname(s, 100) == -1) { printf("error gethostname\n"); exit(1); } printf("local hostname: %s\n", s); if (gethostbyname(s)==0) { printf("error gethostbyname\n"); exit(1); } return(0); }