summaryrefslogtreecommitdiff
path: root/com32/lib
diff options
context:
space:
mode:
authorErwan Velu <erwanaliasr1@gmail.com>2011-03-22 22:13:10 +0100
committerErwan Velu <erwanaliasr1@gmail.com>2011-03-22 22:13:10 +0100
commit10e31def736e29719392ddfadc849b3a475d99d7 (patch)
treea33a11dff8e5cf6e01102b6182d84f12c4645cbf /com32/lib
parentbd97eeacd2e533a7c1c36d62f863930816d9df6b (diff)
downloadsyslinux-10e31def736e29719392ddfadc849b3a475d99d7.tar.gz
inet: Adding inet_ntoa()
Adding inet_ntoa() as it could be useful to print pxe_boot_t structure
Diffstat (limited to 'com32/lib')
-rw-r--r--com32/lib/Makefile1
-rw-r--r--com32/lib/inet.c37
2 files changed, 38 insertions, 0 deletions
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 0614cf3c..bf0da998 100644
--- a/com32/lib/Makefile
+++ b/com32/lib/Makefile
@@ -30,6 +30,7 @@ LIBOBJS = \
skipspace.o \
chrreplace.o \
bufprintf.o \
+ inet.o \
\
lmalloc.o lstrdup.o \
\
diff --git a/com32/lib/inet.c b/com32/lib/inet.c
new file mode 100644
index 00000000..18891e88
--- /dev/null
+++ b/com32/lib/inet.c
@@ -0,0 +1,37 @@
+/* ----------------------------------------------------------------------- *
+ *
+ * Copyright 2011 Erwan Velu - All Rights Reserved
+ *
+ * Permission is hereby granted, free of charge, to any person
+ * obtaining a copy of this software and associated documentation
+ * files (the "Software"), to deal in the Software without
+ * restriction, including without limitation the rights to use,
+ * copy, modify, merge, publish, distribute, sublicense, and/or
+ * sell copies of the Software, and to permit persons to whom
+ * the Software is furnished to do so, subject to the following
+ * conditions:
+ *
+ * The above copyright notice and this permission notice shall
+ * be included in all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+ * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
+ * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ * OTHER DEALINGS IN THE SOFTWARE.
+ *
+ * -----------------------------------------------------------------------
+ */
+
+#include <stdio.h>
+#include <netinet/in.h>
+char * inet_ntoa ( in_addr_t addr ) {
+ static char buf[16] = {0};
+ uint8_t *bytes = ( uint8_t * ) &addr;
+
+ sprintf ( buf, "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3] );
+ return buf;
+}