1*0Sstevel@tonic-gate #include "ipf.h" 2*0Sstevel@tonic-gate 3*0Sstevel@tonic-gate int gethost(name, hostp) 4*0Sstevel@tonic-gate char *name; 5*0Sstevel@tonic-gate u_32_t *hostp; 6*0Sstevel@tonic-gate { 7*0Sstevel@tonic-gate struct hostent *h; 8*0Sstevel@tonic-gate u_32_t addr; 9*0Sstevel@tonic-gate 10*0Sstevel@tonic-gate if (!strcmp(name, "<thishost>")) 11*0Sstevel@tonic-gate name = thishost; 12*0Sstevel@tonic-gate 13*0Sstevel@tonic-gate h = gethostbyname(name); 14*0Sstevel@tonic-gate if (h != NULL) { 15*0Sstevel@tonic-gate if ((h->h_addr != NULL) && (h->h_length == sizeof(addr))) { 16*0Sstevel@tonic-gate bcopy(h->h_addr, (char *)&addr, sizeof(addr)); 17*0Sstevel@tonic-gate *hostp = addr; 18*0Sstevel@tonic-gate return 0; 19*0Sstevel@tonic-gate } 20*0Sstevel@tonic-gate } 21*0Sstevel@tonic-gate return -1; 22*0Sstevel@tonic-gate } 23