+ /*
+ * All-numeric, no dot at the end.
+ * Fake up a hostent as if we'd actually
+ * done a lookup. What if someone types
+ * 255.255.255.255? The test below will
+ * succeed spuriously... ???
+ */
+ if ((host_addr.s_addr = inet_addr(name)) == -1) {
+ h_errno = HOST_NOT_FOUND;
+ return((struct hostent *) NULL);
+ }
+ host.h_name = name;
+ host.h_aliases = host_aliases;
+ host_aliases[0] = NULL;
+ host.h_addrtype = AF_INET;
+ host.h_length = sizeof(u_long);
+ h_addr_ptrs[0] = (char *)&host_addr;
+ h_addr_ptrs[1] = (char *)0;
+#if BSD >= 43 || defined(h_addr) /* new-style hostent structure */
+ host.h_addr_list = h_addr_ptrs;
+#else
+ host.h_addr = h_addr_ptrs[0];
+#endif
+ return (&host);