At 4:30 PM -0700 5/16/02, Alan Winston - SSRL Central Computing wrote:
>[much snippage]
>
> > but if I use the Multinet headers and routines I get the correct length of 4:
>I have to advise extreme caution here. Here's a response from Hunter Goatley
>of Process Software about the Multinet-provided C headers files (in the context
>of compiling lynx 2.8.2):
>
>===============================================================
>
>> Some years ago, when TGV still existed and developed MultiNet, I was told
>> by them to ignore MultiNet's '#include' files and just use the "standard"
>> ones (i.e. TCP/IP Services libraries) which are now shipped with VMS. The
>> MultiNet definition files hadn't been updated to keep them suitable for
>> modern compilers.
>
>Primarily because trying to keep up with all the changes in each
>release of DEC C for the past 8 or so years would require a full-time
>person---and they'd be insane by now. 8-)
>
>As Jeremy says, build it as if for UCX and all should be fine (though
>you may have to modify one module to point to MultiNet's copy of
>UCX$INETDEF.H).
>====================================================================
>
>So the vendors of Multinet aren't actually encouraging you to use those
>header files and don't guarantee they will even compile with modern versions
>of DECC.
Thanks, Alan. The problem is that the DEC C headers don't work in
the particular case of gethostbyaddr, at least as far as its
returning the correct address length. And that's true for any
combination of _SOCKADDR_LEN and _XOPEN_SOURCE_EXTENDED that I've
tried, and I think I've tried them all. There is no UCX$INETDEF.H in
my Multinet 4.3 distribution, which I suppose just proves Hunter's
point that they have given up maintaining the headers.
If they recommend using the DEC C headers and those headers don't
work, I say we just leave it and let people know it's a Multinet bug,
possibly fixed in Multinet 4.4 which has a new BSD-4.4 gethostbyaddr.
If anyone has Multinet 4.4 and wants to try this and/or report it to
Process Software, here's the test reduced as much as I can get it:
$ cc/prefix=all gethostbyaddr_problem
$ link gethostbyaddr_problem
$ run gethostbyaddr_problem
localhost
2
58
$ cc/prefix=all/define=MULTINET_SOCKETS gethostbyaddr_problem
$ link gethostbyaddr_problem, sys$input:/opt
MULTINET:MULTINET_SOCKET_LIBRARY.EXE/SHARE
^Z
$ run gethostbyaddr_problem
localhost
2
4
$ type gethostbyaddr_problem.c
#ifdef MULTINET_SOCKETS
/* must link against MULTINET:MULTINET_SOCKET_LIBRARY.EXE/SHARE */
# include "multinet_root:[multinet.include.sys]types.h"
# include "multinet_root:[multinet.include.netinet]in.h"
# include "multinet_root:[multinet.include.arpa]inet.h"
# include "multinet_root:[multinet.include.sys]socket.h"
# include "multinet_root:[multinet.include]netdb.h"
#else
# include <errno.h>
# include <in.h>
# include <inet.h>
# include <netdb.h>
#endif
#include <socket.h>
#include <stdio.h>
int main() {
struct hostent *h;
struct in_addr myaddr;
myaddr.s_addr = inet_addr("127.0.0.1");
h = gethostbyaddr( (char*) &myaddr, sizeof(struct in_addr), AF_INET );
if ( h != NULL ) {
printf( "%s\n", h->h_name );
printf( "%d\n", h->h_addrtype );
printf( "%d\n", h->h_length );
}
else {
printf( "h is null\n" );
herror( "h " );
}
return(0);
}
$
--
____________________________________________
Craig A. Berry
mailto:[EMAIL PROTECTED]
"Literary critics usually know what they're
talking about. Even if they're wrong."
-- Perl creator Larry Wall