]> git.proxmox.com Git - mirror_edk2.git/blobdiff - StdLib/LibC/Locale/aliasname.c
edk2: Remove AppPkg, StdLib, StdLibPrivateInternalFiles
[mirror_edk2.git] / StdLib / LibC / Locale / aliasname.c
diff --git a/StdLib/LibC/Locale/aliasname.c b/StdLib/LibC/Locale/aliasname.c
deleted file mode 100644 (file)
index 56303e9..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/* $NetBSD: aliasname.c,v 1.2 2005/02/09 21:35:46 kleink Exp $ */\r
-\r
-/*-\r
- * Copyright (c)2002 YAMAMOTO Takashi,\r
- * All rights reserved.\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 AUTHOR AND 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 AUTHOR 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
-#include  <LibConfig.h>\r
-#include  <sys/EfiCdefs.h>\r
-#if defined(LIBC_SCCS) && !defined(lint)\r
-__RCSID("$NetBSD: aliasname.c,v 1.2 2005/02/09 21:35:46 kleink Exp $");\r
-#endif /* LIBC_SCCS and not lint */\r
-\r
-#include "namespace.h"\r
-#include <assert.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-\r
-#include "aliasname_local.h"\r
-\r
-__inline int __is_ws(char);\r
-\r
-__inline int __is_ws(char ch)\r
-{\r
-\r
-  return (ch == ' ' || ch == '\t');\r
-}\r
-\r
-const char *\r
-__unaliasname(const char *dbname, const char *alias, void *buf, size_t bufsize)\r
-{\r
-  FILE *fp = NULL;\r
-  const char *result = alias;\r
-  size_t resultlen;\r
-  size_t aliaslen;\r
-  const char *p;\r
-  size_t len;\r
-\r
-  _DIAGASSERT(dbname != NULL);\r
-  _DIAGASSERT(alias != NULL);\r
-  _DIAGASSERT(buf != NULL);\r
-\r
-  fp = fopen(dbname, "r");\r
-  if (fp == NULL)\r
-    goto quit;\r
-\r
-  aliaslen = strlen(alias);\r
-\r
-  while (/*CONSTCOND*/ 1) {\r
-    p = fgetln(fp, &len);\r
-    if (p == NULL)\r
-      goto quit; /* eof or error */\r
-\r
-    _DIAGASSERT(len != 0);\r
-\r
-    /* ignore terminating NL */\r
-    if (p[len - 1] == '\n')\r
-      len--;\r
-\r
-    /* ignore null line and comment */\r
-    if (len == 0 || p[0] == '#')\r
-      continue;\r
-\r
-    if (aliaslen > len)\r
-      continue;\r
-\r
-    if (memcmp(alias, p, aliaslen))\r
-      continue;\r
-\r
-    p += aliaslen;\r
-    len -= aliaslen;\r
-\r
-    if (len == 0 || !__is_ws(*p))\r
-      continue;\r
-\r
-    /* entry was found here */\r
-    break;\r
-\r
-    /* NOTREACHED */\r
-  }\r
-\r
-  /* skip white spaces */\r
-  do {\r
-    p++;\r
-    len--;\r
-  } while (len != 0 && __is_ws(*p));\r
-\r
-  if (len == 0)\r
-    goto quit;\r
-\r
-  /* count length of result */\r
-  resultlen = 0;\r
-  while (resultlen < len && !__is_ws(*p))\r
-    resultlen++;\r
-\r
-  /* check if space is enough */\r
-  if (bufsize < resultlen + 1)\r
-    goto quit;\r
-\r
-  memcpy(buf, p, resultlen);\r
-  ((char *)buf)[resultlen] = 0;\r
-  result = buf;\r
-\r
-quit:\r
-  if (fp)\r
-    fclose(fp);\r
-\r
-  return result;\r
-}\r