X-Git-Url: https://perl5.git.perl.org/perl5.git/blobdiff_plain/225a5dca523a9706687cc7849f9ef644967ae510..2e4f8b82fc20f48732e0d55afbf2edbe89acf43b:/NetWare/nw5sck.c diff --git a/NetWare/nw5sck.c b/NetWare/nw5sck.c index 0f6c736..35dee92 100644 --- a/NetWare/nw5sck.c +++ b/NetWare/nw5sck.c @@ -1,6 +1,6 @@ /* - * Copyright © 2001 Novell, Inc. All Rights Reserved. + * Copyright © 2001 Novell, Inc. All Rights Reserved. * * You may distribute under the terms of either the GNU General Public * License or the Artistic License, as specified in the README file. @@ -8,11 +8,11 @@ */ /* - * FILENAME : nw5sck.c - * DESCRIPTION : Socket related functions. - * Author : SGP - * Date : January 2001. - * + * FILENAME : nw5sck.c + * DESCRIPTION : Socket related functions. + * Author : SGP + * Date : January 2001. + * Date Modified: June 26th 2001. */ @@ -20,19 +20,14 @@ #include "EXTERN.h" #include "perl.h" -#if defined(PERL_OBJECT) -#define NO_XSLOCKS -#include "XSUB.h" -#endif - #include "nw5iop.h" #include "nw5sck.h" #include #include -static struct servent* nw_savecopyservent(struct servent*d, - struct servent*s, - const char *proto); +// This is defined here since arpa\inet.h defines this array as an extern, +// and arpa\inet.h gets included by the inet_ntoa call. +char nwinet_scratch[18] = {'\0'}; u_long @@ -171,28 +166,14 @@ nw_getprotobynumber(int num) struct servent * nw_getservbyname(const char *name, const char *proto) { - dTHXo; - struct servent *r; - - r = getservbyname((char*)name, (char*)proto); - if (r) { - /*r = nw_savecopyservent(&nw_servent, r, proto);*/ - } - return r; + return (struct servent *)getservbyname((char*)name, (char*)proto); } struct servent * nw_getservbyport(int port, const char *proto) { - dTHXo; - struct servent *r; - - r = getservbyport(port, (char*)proto); - if (r) { - //r = nw_savecopyservent(&nw_servent, r, proto); - } - return r; + return (struct servent *)getservbyport(port, (char*)proto); } struct servent * @@ -204,31 +185,39 @@ nw_getservent(void) void nw_sethostent(int stayopen) { +#ifdef HAS_SETHOSTENT sethostent(stayopen); +#endif } void nw_setnetent(int stayopen) { +#ifdef HAS_SETNETENT setnetent(stayopen); +#endif } void nw_setprotoent(int stayopen) { +#ifdef HAS_SETPROTENT setprotoent(stayopen); +#endif } void nw_setservent(int stayopen) { +#ifdef HAS_SETSERVENT setservent(stayopen); +#endif } int nw_setsockopt(SOCKET s, int level, int optname, const char* optval, int optlen) { - return setsockopt(s, level, optname, optval, optlen); + return setsockopt(s, level, optname, (char*)optval, optlen); } int @@ -249,23 +238,10 @@ nw_inet_addr(const char *cp) return inet_addr((char*)cp); } -static struct servent* -nw_savecopyservent(struct servent*d, struct servent*s, const char *proto) +char * +nw_inet_ntoa(struct in_addr in) { - d->s_name = s->s_name; - d->s_aliases = s->s_aliases; - d->s_port = s->s_port; -#ifndef __BORLANDC__ /* Buggy on Win95 and WinNT-with-Borland-WSOCK */ - if (/*!IsWin95() && */s->s_proto && strlen(s->s_proto)) - d->s_proto = s->s_proto; - else -#endif - if (proto && strlen(proto)) - d->s_proto = (char *)proto; - else - d->s_proto = "tcp"; - - return d; + return inet_ntoa(in); } SOCKET @@ -276,7 +252,6 @@ nw_socket(int af, int type, int protocol) #ifndef USE_SOCKETS_AS_HANDLES s = socket(af, type, protocol); #else - //StartSockets(); if((s = socket(af, type, protocol)) == INVALID_SOCKET) //errno = WSAGetLastError(); else