This code takes an IP address from the user and verifies that it is well formed. It then looks up the hostname and copies it into a buffer.
(bad code)
void host_lookup(char *user_supplied_addr){
struct hostent *hp;