[syslinux:master] inet: Adding inet_ntoa()

syslinux-bot for Erwan Velu erwanaliasr1 at gmail.com
Mon Apr 25 15:28:12 PDT 2011


Commit-ID:  10e31def736e29719392ddfadc849b3a475d99d7
Gitweb:     http://syslinux.zytor.com/commit/10e31def736e29719392ddfadc849b3a475d99d7
Author:     Erwan Velu <erwanaliasr1 at gmail.com>
AuthorDate: Tue, 22 Mar 2011 22:13:10 +0100
Committer:  Erwan Velu <erwanaliasr1 at gmail.com>
CommitDate: Tue, 22 Mar 2011 22:13:10 +0100

inet: Adding inet_ntoa()

Adding inet_ntoa() as it could be useful to print pxe_boot_t structure


---
 com32/include/netinet/in.h          |    1 +
 com32/lib/Makefile                  |    1 +
 com32/{hdt/hdt-ata.c => lib/inet.c} |   19 +++++++++----------
 3 files changed, 11 insertions(+), 10 deletions(-)

diff --git a/com32/include/netinet/in.h b/com32/include/netinet/in.h
index ccf0475..eae1162 100644
--- a/com32/include/netinet/in.h
+++ b/com32/include/netinet/in.h
@@ -53,4 +53,5 @@ struct in_addr {
     in_addr_t s_addr;
 };
 
+char * inet_ntoa (in_addr_t addr);
 #endif /* _NETINET_IN_H */
diff --git a/com32/lib/Makefile b/com32/lib/Makefile
index 0614cf3..bf0da99 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/hdt/hdt-ata.c b/com32/lib/inet.c
similarity index 82%
copy from com32/hdt/hdt-ata.c
copy to com32/lib/inet.c
index 9ba17ba..18891e8 100644
--- a/com32/hdt/hdt-ata.c
+++ b/com32/lib/inet.c
@@ -1,6 +1,6 @@
 /* ----------------------------------------------------------------------- *
  *
- *   Copyright 2009 Erwan Velu - All Rights Reserved
+ *   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
@@ -26,13 +26,12 @@
  * -----------------------------------------------------------------------
  */
 
-#include <string.h>
 #include <stdio.h>
-#include <stdlib.h>
-#include <console.h>
-#include <disk/geom.h>
-#include <disk/util.h>
-
-#include "com32io.h"
-#include "hdt-common.h"
-#include "hdt-ata.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;
+}



More information about the Syslinux-commits mailing list