Craig you wrote:

> $ cc/prefix=all/define=MULTINET_SOCKETS gethostbyaddr_problem

Unfortunately, when I run that command using DEC C V6.0-001 on VMS 7.3,
or with Compaq C V6.5-001 (also on VMS V7.3) I see an informational:

$ cc/prefix=all/define=MULTINET_SOCKETS gethostbyaddr_problem

    myaddr.s_addr = inet_addr("127.0.0.1");
.....................^
%CC-I-IMPLICITFUNC, In this statement, the identifier "multinet_inet_addr"
is im
plicitly declared as a function.

indicating that inet_addr() is not prototyped by the time main() tries
to compile it.  A work around consists of altering the #include order.
Taking a queue from the #include order in Perl's sockadapt.h I came
up with this version of try.c.  Does this compile cleanly for you with

  $ cc/define=MULTINET_SOCKETS try.c

(that is even without the /prefix=all qualifier)?
Here is try.c as _might_ go into configure.com:

#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.sys]socket.h"
# include "multinet_root:[multinet.include.netinet]in.h"
# include "multinet_root:[multinet.include.arpa]inet.h"
# include "multinet_root:[multinet.include]netdb.h"
#else                   /* the DEC/Compaq/HP C headers (UCX/TCPIP) */
# include <socket.h>
# include <inet.h>
# include <in.h>
# include <netdb.h>
#endif
#include <stdio.h>
int main() {            /* expected output: "LOCALHOST 4\n" */
    struct hostent *h;
    struct in_addr myaddr;
    myaddr.s_addr = inet_addr("127.0.0.1");
    h = gethostbyaddr( (char*) &myaddr, 4, AF_INET );
    if ( h != NULL ) {
        printf( "%s %d\n", h->h_name, h->h_length );
    }
    else {
        printf( "(null)\n" );
    }
    return(0);
}

Reply via email to