Subject: Re: problems with arpa/inet.h
To: SamMaEl <rimsky@teleport.com>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
List: current-users
Date: 06/08/1998 08:14:40
> I'm trying to compile a program that uses the arpa/inet.h header
> file, and for some reason gcc is complaining about it.

> In file included from loop.c:17:
> /usr/include/arpa/inet.h:76: warning: `struct in_addr' declared inside parameter list
> /usr/include/arpa/inet.h:76: warning: its scope is only this definition or declaration,
> /usr/include/arpa/inet.h:76: warning: which is probably not what you want.
> /usr/include/arpa/inet.h:77: warning: `struct in_addr' declared inside parameter list
> /usr/include/arpa/inet.h:77: warning: parameter has incomplete type
> /usr/include/arpa/inet.h:80: warning: parameter has incomplete type
> /usr/include/arpa/inet.h:84: warning: parameter has incomplete type

NetBSD's <arpa/inet.h> is buggy; it depends on <netinet/in.h> having
been included, but doesn't include it itself.

The short-term cure is just to #include <netinet/in.h> yourself, before
you include <arpa/inet.h>.  (The long-term fix, of course, is to fix
the bug in the NetBSD tree.  Someday I'm going to do a sweep for
include exhibiting this sort of misbehavior.  You may want to "fix" the
code anyway, because such bugs are relatively common on other OSes
too.)  If you want to maintain a local patch to NetBSD, here's what
I've done to my <arpa/inet.h> (as of inet.h 1.8) to fix this:

--- OLD/include/arpa/inet.h	Thu Jan  1 00:00:00 1970
+++ NEW/include/arpa/inet.h	Thu Jan  1 00:00:00 1970
@@ -70,6 +70,7 @@
 # include <sys/types.h>
 #endif
 #include <sys/cdefs.h>
+#include <netinet/in.h>
 
 __BEGIN_DECLS
 unsigned long	 inet_addr __P((const char *));

					der Mouse

			       mouse@rodents.montreal.qc.ca
		     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B