]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/BsdSocketLib/gethostbynis.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / StdLib / BsdSocketLib / gethostbynis.c
diff --git a/StdLib/BsdSocketLib/gethostbynis.c b/StdLib/BsdSocketLib/gethostbynis.c
deleted file mode 100644 (file)
index 72081dc..0000000
+++ /dev/null
@@ -1,134 +0,0 @@
-/*-\r
- * Copyright (c) 1994, Garrett Wollman\r
- *\r
- * Redistribution and use in source and binary forms, with or without\r
- * modification, are permitted provided that the following conditions\r
- * are met:\r
- * 1. Redistributions of source code must retain the above copyright\r
- *    notice, this list of conditions and the following disclaimer.\r
- * 2. Redistributions in binary form must reproduce the above copyright\r
- *    notice, this list of conditions and the following disclaimer in the\r
- *    documentation and/or other materials provided with the distribution.\r
- *\r
- * THIS SOFTWARE IS PROVIDED BY THE CONTRIBUTORS ``AS IS'' AND\r
- * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r
- * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE\r
- * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\r
- * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS\r
- * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\r
- * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\r
- * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY\r
- * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF\r
- * SUCH DAMAGE.\r
- */\r
-\r
-#if defined(LIBC_SCCS) && !defined(lint)\r
-static char sccsid[] = "@(#)$Id: gethostbynis.c,v 1.1.1.1 2003/11/19 01:51:27 kyu3 Exp $";\r
-static char rcsid[] = "$Id: gethostbynis.c,v 1.1.1.1 2003/11/19 01:51:27 kyu3 Exp $";\r
-#endif /* LIBC_SCCS and not lint */\r
-\r
-#include <sys/param.h>\r
-#include <sys/socket.h>\r
-#include <netinet/in.h>\r
-#include <arpa/inet.h>\r
-#include <netdb.h>\r
-#include <stdio.h>\r
-#include <stdlib.h>\r
-#include <ctype.h>\r
-#include <errno.h>\r
-#include <string.h>\r
-#ifdef YP\r
-#include <rpc/rpc.h>\r
-#include <rpcsvc/yp_prot.h>\r
-#include <rpcsvc/ypclnt.h>\r
-#endif\r
-\r
-#define        MAXALIASES      35\r
-#define        MAXADDRS        35\r
-\r
-#ifdef YP\r
-static char *host_aliases[MAXALIASES];\r
-static char hostaddr[MAXADDRS];\r
-static char *host_addrs[2];\r
-#endif /* YP */\r
-\r
-static struct hostent *\r
-_gethostbynis(const char *name, char *map, int af)\r
-{\r
-#ifdef YP\r
-       register char *cp, **q;\r
-       char *result;\r
-       int resultlen;\r
-       static struct hostent h;\r
-       static char *domain = (char *)NULL;\r
-       static char ypbuf[YPMAXRECORD + 2];\r
-\r
-       switch(af) {\r
-       case AF_INET:\r
-               break;\r
-       default:\r
-       case AF_INET6:\r
-               errno = EAFNOSUPPORT;\r
-               return NULL;\r
-       }\r
-\r
-       if (domain == (char *)NULL)\r
-               if (yp_get_default_domain (&domain))\r
-                       return ((struct hostent *)NULL);\r
-\r
-       if (yp_match(domain, map, name, strlen(name), &result, &resultlen))\r
-               return ((struct hostent *)NULL);\r
-\r
-       /* avoid potential memory leak */\r
-       bcopy((char *)result, (char *)&ypbuf, resultlen);\r
-       ypbuf[resultlen] = '\0';\r
-       free(result);\r
-       result = (char *)&ypbuf;\r
-\r
-       if ((cp = index(result, '\n')))\r
-               *cp = '\0';\r
-\r
-       cp = strpbrk(result, " \t");\r
-       *cp++ = '\0';\r
-       h.h_addr_list = host_addrs;\r
-       h.h_addr = hostaddr;\r
-       *((u_long *)h.h_addr) = inet_addr(result);\r
-       h.h_length = sizeof(u_long);\r
-       h.h_addrtype = AF_INET;\r
-       while (*cp == ' ' || *cp == '\t')\r
-               cp++;\r
-       h.h_name = cp;\r
-       q = h.h_aliases = host_aliases;\r
-       cp = strpbrk(cp, " \t");\r
-       if (cp != NULL)\r
-               *cp++ = '\0';\r
-       while (cp && *cp) {\r
-               if (*cp == ' ' || *cp == '\t') {\r
-                       cp++;\r
-                       continue;\r
-               }\r
-               if (q < &host_aliases[MAXALIASES - 1])\r
-                       *q++ = cp;\r
-               cp = strpbrk(cp, " \t");\r
-               if (cp != NULL)\r
-                       *cp++ = '\0';\r
-       }\r
-       *q = NULL;\r
-       return (&h);\r
-#else\r
-       return (NULL);\r
-#endif /* YP */\r
-}\r
-\r
-struct hostent *\r
-_gethostbynisname(const char *name, int af)\r
-{\r
-       return _gethostbynis(name, "hosts.byname", af);\r
-}\r
-\r
-struct hostent *\r
-_gethostbynisaddr(const char *addr, int len, int af)\r
-{\r
-       return _gethostbynis(inet_ntoa(*(struct in_addr *)addr),"hosts.byaddr", af);\r
-}\r