"Tom G. Christensen" <t...@jupiterrise.com> writes: > It assumes that only win32 lacks HOST_NAME_MAX which is not > true.
:-( > The daily gnulib snapshot from Simon fails thusly on > sparc-sun-solaris2.6: > test-gethostname.c: In function 'main': > test-gethostname.c:34: error: 'HOST_NAME_MAX' undeclared (first use in this > function) > test-gethostname.c:34: error: (Each undeclared identifier is reported only > once > test-gethostname.c:34: error: for each function it appears in.) > > After googling a bit and checking some of the hosts I have access to it > seems atleast IRIX, Solaris, OS X 10.5 and FreeBSD does not define > HOST_NAME_MAX directly. > > On Solaris 10 the value is available from getconf: > $ getconf HOST_NAME_MAX > 255 > > On Solaris < 10 there is MAXHOSTNAMELEN in <netdb.h> that could perhaps > be used to define HOST_NAME_MAX. > IRIX also defines MAXHOSTNAMELEN but in <sys/param.h>. Right, it seems clear that gnulib should define HOST_NAME_MAX on more systems. I note that a Solaris 10 I have access to defines _POSIX_HOST_NAME_MAX: /usr/include/limits.h:#define _POSIX_HOST_NAME_MAX 255 But I can't find HOST_NAME_MAX. Indeed MAXHOSTNAMELEN exists: /usr/include/netdb.h:#define MAXHOSTNAMELEN 256 According to the POSIX spec, 255 is the safe minimum value. /Simon