This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] missing in_addr_t type


Hi all,

while compiling kde with cygwin I recgonized a missing 'in_addr_t' type in
arpa/inet.h, which seems to belong to this file like
http://www.opengroup.org/onlinepubs/007908799/xns/netinetin.h.html says.

Additional this type should be uses as return type for the following functions

in_addr_t      inet_addr(const char *cp);
in_addr_t      inet_lnaof(struct in_addr in);
in_addr_t      inet_netof(struct in_addr in);
in_addr_t      inet_network(const char *cp);

which are currently

unsigned long	 inet_addr (const char *);
unsigned long	 inet_lnaof (struct in_addr);
unsigned int	 inet_netof (struct in_addr);
unsigned int	 inet_network (const char *);

see http://www.opengroup.org/onlinepubs/007908799/xns/arpainet.h.html for
further details.


The following patch fixes this:


Index: include/cygwin/in.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/cygwin/in.h,v
retrieving revision 1.4
diff -u -3 -p -B -u -b -B -p -r1.4 in.h
--- include/cygwin/in.h 28 Oct 2000 05:41:43 -0000      1.4
+++ include/cygwin/in.h 10 Feb 2003 12:52:59 -0000
@@ -76,10 +76,11 @@ enum
     IPPORT_USERRESERVED = 5000
   };

+typedef unsigned int in_addr_t;

 /* Internet address. */
 struct in_addr {
-       unsigned int    s_addr;
+  in_addr_t s_addr;
 };

 /* Request struct for multicast socket ops */

Index: include/arpa/inet.h
===================================================================
RCS file: /cvs/src/src/winsup/cygwin/include/arpa/inet.h,v
retrieving revision 1.2
diff -u -3 -p -B -u -b -B -p -r1.2 inet.h
--- include/arpa/inet.h 5 Mar 2001 21:29:21 -0000       1.2
+++ include/arpa/inet.h 10 Feb 2003 12:55:32 -0000
@@ -19,12 +19,12 @@ extern "C"
 #endif

 #ifndef __INSIDE_CYGWIN_NET__
-unsigned long   inet_addr (const char *);
+in_addr_t inet_addr (const char *);
 int             inet_aton (const char *, struct in_addr *);
-unsigned long   inet_lnaof (struct in_addr);
+in_addr_t inet_lnaof (struct in_addr);
 struct in_addr  inet_makeaddr (unsigned long , unsigned long);
-unsigned int    inet_netof (struct in_addr);
-unsigned int    inet_network (const char *);
+in_addr_t inet_netof (struct in_addr);
+in_addr_t inet_network (const char *);
 char           *inet_ntoa (struct in_addr);
 #endif

ChangeLog
--------------------------------------------------------------------
2003-02-10  Ralf Habacker <ralf.habacker@freenet.de>

	* include/cygwin/in.h (in_attr_t): new type.
	* include/arpa/inet.h (inet_addr): changed
	return type into in_addr_t.
	(inet_lnaof): ditto.
	(inet_netof): ditto.
	(inet_network): ditto.


BTW: I have tried to indent this files at first with indent tool and second with
astyle --gnu, but this results into a completly different style. It seems that
this files are NOT coded with the gnu style.

Regards
Ralf


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]