# ifdef HAS_GETPWENT
#ifndef getpwent
struct passwd *getpwent (void);
+#elif defined (VMS) && defined (my_getpwent)
+ struct passwd *Perl_my_getpwent (void);
#endif
# endif
#endif
#ifdef HAS_SOCKET
if (PL_op->op_type == OP_RECV) {
char namebuf[MAXPATHLEN];
-#if (defined(VMS_DO_SOCKETS) && defined(DECCRTL_SOCKETS)) || defined(MPE)
+#if (defined(VMS_DO_SOCKETS) && defined(DECCRTL_SOCKETS)) || defined(MPE) || defined(__QNXNTO__)
bufsize = sizeof (struct sockaddr_in);
#else
bufsize = sizeof namebuf;
STRLEN n_a;
EXTEND(SP, 10);
- if (which == OP_GHBYNAME)
+ if (which == OP_GHBYNAME) {
#ifdef HAS_GETHOSTBYNAME
- hent = PerlSock_gethostbyname(POPpbytex);
+ char* name = POPpbytex;
+ hent = PerlSock_gethostbyname(name);
#else
DIE(aTHX_ PL_no_sock_func, "gethostbyname");
#endif
+ }
else if (which == OP_GHBYADDR) {
#ifdef HAS_GETHOSTBYADDR
int addrtype = POPi;
struct netent *nent;
STRLEN n_a;
- if (which == OP_GNBYNAME)
+ if (which == OP_GNBYNAME){
#ifdef HAS_GETNETBYNAME
- nent = PerlSock_getnetbyname(POPpbytex);
+ char *name = POPpbytex;
+ nent = PerlSock_getnetbyname(name);
#else
DIE(aTHX_ PL_no_sock_func, "getnetbyname");
#endif
+ }
else if (which == OP_GNBYADDR) {
#ifdef HAS_GETNETBYADDR
int addrtype = POPi;
struct protoent *pent;
STRLEN n_a;
- if (which == OP_GPBYNAME)
+ if (which == OP_GPBYNAME) {
#ifdef HAS_GETPROTOBYNAME
- pent = PerlSock_getprotobyname(POPpbytex);
+ char* name = POPpbytex;
+ pent = PerlSock_getprotobyname(name);
#else
DIE(aTHX_ PL_no_sock_func, "getprotobyname");
#endif
- else if (which == OP_GPBYNUMBER)
+ }
+ else if (which == OP_GPBYNUMBER) {
#ifdef HAS_GETPROTOBYNUMBER
- pent = PerlSock_getprotobynumber(POPi);
+ int number = POPi;
+ pent = PerlSock_getprotobynumber(number);
#else
- DIE(aTHX_ PL_no_sock_func, "getprotobynumber");
+ DIE(aTHX_ PL_no_sock_func, "getprotobynumber");
#endif
+ }
else
#ifdef HAS_GETPROTOENT
pent = PerlSock_getprotoent();
switch (which) {
case OP_GPWNAM:
- pwent = getpwnam(POPpbytex);
- break;
+ {
+ char* name = POPpbytex;
+ pwent = getpwnam(name);
+ }
+ break;
case OP_GPWUID:
- pwent = getpwuid((Uid_t)POPi);
+ {
+ Uid_t uid = POPi;
+ pwent = getpwuid(uid);
+ }
break;
case OP_GPWENT:
# ifdef HAS_GETPWENT
struct group *grent;
STRLEN n_a;
- if (which == OP_GGRNAM)
- grent = (struct group *)getgrnam(POPpbytex);
- else if (which == OP_GGRGID)
- grent = (struct group *)getgrgid(POPi);
+ if (which == OP_GGRNAM) {
+ char* name = POPpbytex;
+ grent = (struct group *)getgrnam(name);
+ }
+ else if (which == OP_GGRGID) {
+ Gid_t gid = POPi;
+ grent = (struct group *)getgrgid(gid);
+ }
else
#ifdef HAS_GETGRENT
grent = (struct group *)getgrent();
PUSHs(sv = sv_mortalcopy(&PL_sv_no));
sv_setiv(sv, (IV)grent->gr_gid);
+#if !(defined(_CRAYMPP) && defined(USE_REENTRANT_API))
PUSHs(sv = sv_mortalcopy(&PL_sv_no));
+ /* In UNICOS/mk (_CRAYMPP) the multithreading
+ * versions (getgrnam_r, getgrgid_r)
+ * seem to return an illegal pointer
+ * as the group members list, gr_mem.
+ * getgrent() doesn't even have a _r version
+ * but the gr_mem is poisonous anyway.
+ * So yes, you cannot get the list of group
+ * members if building multithreaded in UNICOS/mk. */
for (elem = grent->gr_mem; elem && *elem; elem++) {
sv_catpv(sv, *elem);
if (elem[1])
sv_catpvn(sv, " ", 1);
}
+#endif
}
RETURN;