/* Ed. note, written by tref, subbmitted by ruGG, * Claimed useful for BSD systems in which gethostbyaddr() calls caused * extreme hanging/blocking of the talker. * Note, popen is a blocking call however ************************************************************************/ /* in ip.h */ char* resolve(char*); /* in ip.c */ /***********************************************************************/ /* Resolves a host name */ /***********************************************************************/ char* resolve(char* host) { FILE* han; static char str[256]; char *txt,*t; sprintf(str,"/usr/bin/host %s",host); han=popen(str,"r"); *str=0; fgets(str,255,han); pclose(han); txt=strchr(str,':'); if (txt) { txt++; while (isspace(*txt)) txt++; t=txt; while (*t && *t!='\n') t++; *t=0; return(txt); } return(host); } /* in socket.c to replace the gethostbyaddr...*/ out_pack_current++; return; } p = create_player(); current_player = p; p->fd = new_socket; strncpy(p->num_addr, inet_ntoa(incoming.sin_addr), MAX_INET_ADDR - 2); numerical_address = (char*)resolve(p->num_addr); /*in proto.h */ extern char *resolve(char*);