httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dgau...@hotwired.com (Dean Gaudet)
Subject Re: cvs commit: apache/src util.c
Date Mon, 18 Nov 1996 04:01:50 GMT
Hey, what if INADDR_NONE is an enumerated type?  :)

Count me for +1 if my piddly contributions amount to voting status yet.

Dean

In article <hot.mailing-lists.new-httpd-9611171745.aa04548@paris.ics.uci.edu>,
Roy T. Fielding <new-httpd@hyperreal.com> wrote:
>Dean said:
>> As I mentioned, inet_addr/inet_network return -1 on Solaris, and return
>> INADDR_NONE on Linux and IRIX.  -1 is wrong, ~0ul is wrong, and INADDR_NONE
>> is wrong too -- unless we use autoconf or stick something else in conf.h.
>> So either we choose one of those wrongnesses and live with it, or we
>> switch to inet_aton, or we use autoconf.  I know how much some people
>> like that last option (for reasons I can't fathom at all).
>
>I believe the follwing patch will settle the question.  If there are further
>platform-specific problems, we can modify the platform-specific definition
>of INADDR_NONE in the platform-specific section of conf.h.
>
>.....Roy
>
>Index: conf.h
>===================================================================
>RCS file: /export/home/cvs/apache/src/conf.h,v
>retrieving revision 1.43
>diff -c -r1.43 conf.h
>*** conf.h	1996/11/14 07:24:41	1.43
>--- conf.h	1996/11/18 01:34:52
>***************
>*** 457,462 ****
>--- 457,466 ----
>  #define S_ISLNK(m) (((m) & S_IFMT) == S_IFLNK)
>  #endif
>  
>+ #ifndef INADDR_NONE
>+ #define INADDR_NONE ((unsigned long) -1)
>+ #endif
>+ 
>  /* Finding offsets of elements within structures.
>   * Taken from the X code... they've sweated portability of this stuff
>   * so we don't have to.  Sigh...
>Index: util.c
>===================================================================
>RCS file: /export/home/cvs/apache/src/util.c,v
>retrieving revision 1.31
>diff -c -r1.31 util.c
>*** util.c	1996/11/14 07:24:44	1.31
>--- util.c	1996/11/18 01:34:53
>***************
>*** 1170,1176 ****
>  #else
>      my_addr = inet_addr(w);
>  #endif
>!     if (my_addr != (~0ul))
>      {
>  	if (p != NULL) *p = ':';
>  	return my_addr;
>--- 1170,1176 ----
>  #else
>      my_addr = inet_addr(w);
>  #endif
>!     if (my_addr != INADDR_NONE)
>      {
>  	if (p != NULL) *p = ':';
>  	return my_addr;



Mime
View raw message