+++ /dev/null
-/*\r
- * Copyright (c) 1996 by Internet Software Consortium.\r
- *\r
- * Permission to use, copy, modify, and distribute this software for any\r
- * purpose with or without fee is hereby granted, provided that the above\r
- * copyright notice and this permission notice appear in all copies.\r
- *\r
- * THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS\r
- * ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES\r
- * OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE\r
- * CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL\r
- * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR\r
- * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS\r
- * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS\r
- * SOFTWARE.\r
- */\r
-\r
-/*\r
- * Portions copyright (c) 1999, 2000\r
- * Intel Corporation.\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
- * \r
- * 1. Redistributions of source code must retain the above copyright\r
- * notice, this list of conditions and the following disclaimer.\r
- * \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
- * 3. All advertising materials mentioning features or use of this software\r
- * must display the following acknowledgement:\r
- * \r
- * This product includes software developed by Intel Corporation and\r
- * its contributors.\r
- * \r
- * 4. Neither the name of Intel Corporation or its contributors may be\r
- * used to endorse or promote products derived from this software\r
- * without specific prior written permission.\r
- * \r
- * THIS SOFTWARE IS PROVIDED BY INTEL CORPORATION AND CONTRIBUTORS ``AS IS''\r
- * AND 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 INTEL CORPORATION OR CONTRIBUTORS BE\r
- * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r
- * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r
- * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r
- * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r
- * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r
- * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF\r
- * THE POSSIBILITY OF SUCH DAMAGE.\r
- * \r
- */\r
-\r
-#if defined(LIBC_SCCS) && !defined(lint)\r
-static const char orig_rcsid[] = "From Id: inet_neta.c,v 8.2 1996/08/08 06:54:44 vixie Exp";\r
-static const char rcsid[] = "$Id: inet_neta.c,v 1.1.1.1 2003/11/19 01:51:29 kyu3 Exp $";\r
-#endif\r
-\r
-#include <sys/types.h>\r
-#include <sys/socket.h>\r
-#include <netinet/in.h>\r
-#include <arpa/inet.h>\r
-\r
-#include <errno.h>\r
-#include <stdio.h>\r
-#include <string.h>\r
-\r
-#ifdef SPRINTF_CHAR\r
-# define SPRINTF(x) strlen(sprintf/**/x)\r
-#else\r
-# define SPRINTF(x) ((size_t)sprintf x)\r
-#endif\r
-\r
-/*\r
- * char *\r
- * inet_neta(src, dst, size)\r
- * format a u_long network number into presentation format.\r
- * return:\r
- * pointer to dst, or NULL if an error occurred (check errno).\r
- * note:\r
- * format of ``src'' is as for inet_network().\r
- * author:\r
- * Paul Vixie (ISC), July 1996\r
- */\r
-char *\r
-inet_neta(\r
- u_long src,\r
- char *dst,\r
- size_t size\r
- )\r
-{\r
- char *odst = dst;\r
- char *tp;\r
-\r
- while (src & 0xffffffff) {\r
- u_char b = (u_char)((src & 0xff000000) >> 24);\r
-\r
- src <<= 8;\r
- if (b) {\r
- if (size < sizeof "255.")\r
- goto emsgsize;\r
- tp = dst;\r
- dst += SPRINTF((dst, "%u", b));\r
- if (src != 0L) {\r
- *dst++ = '.';\r
- *dst = '\0';\r
- }\r
- size -= (size_t)(dst - tp);\r
- }\r
- }\r
- if (dst == odst) {\r
- if (size < sizeof "0.0.0.0")\r
- goto emsgsize;\r
- strcpy(dst, "0.0.0.0");\r
- }\r
- return (odst);\r
-\r
- emsgsize:\r
- errno = EMSGSIZE;\r
- return (NULL);\r
-}\r