X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=pp_sys.c;h=aa8fb77acc0afce198330b0f81b6377711069706;hb=f05bbc4047b4e519eb0edbaf2fce2004f4838d1a;hp=47602103cda77947497904512a405ffdf709fb53;hpb=edd309b7facc349294ca0ee12a41c07bb525e567;p=p5sagit%2Fp5-mst-13.2.git diff --git a/pp_sys.c b/pp_sys.c index 4760210..aa8fb77 100644 --- a/pp_sys.c +++ b/pp_sys.c @@ -82,6 +82,8 @@ extern int h_errno; # ifdef HAS_GETPWENT #ifndef getpwent struct passwd *getpwent (void); +#elif defined (VMS) && defined (my_getpwent) + struct passwd *Perl_my_getpwent (void); #endif # endif #endif @@ -1582,7 +1584,7 @@ PP(pp_sysread) #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; @@ -3745,17 +3747,39 @@ PP(pp_open_dir) dSP; STRLEN n_a; char *dirname = POPpx; - GV *gv = (GV*)POPs; - register IO *io = GvIOn(gv); + char *dscp = NULL; + GV *gv; + register IO *io; + bool want_utf8 = FALSE; + + if (MAXARG == 3) + dscp = POPpx; + + gv = (GV*)POPs; + io = GvIOn(gv); if (!io) goto nope; + if (dscp) { + if (*dscp == ':') { + if (strnEQ(dscp + 1, "utf8", 4)) + want_utf8 = TRUE; + else + Perl_croak(aTHX_ "Unknown discipline '%s'", dscp); + } + else + Perl_croak(aTHX_ "Unknown discipline '%s'", dscp); + } + if (IoDIRP(io)) PerlDir_close(IoDIRP(io)); if (!(IoDIRP(io) = PerlDir_open(dirname))) goto nope; + if (want_utf8) + IoFLAGS(io) |= IOf_DIR_UTF8; + RETPUSHYES; nope: if (!errno) @@ -3793,6 +3817,8 @@ PP(pp_readdir) if (!(IoFLAGS(io) & IOf_UNTAINT)) SvTAINTED_on(sv); #endif + if (IoFLAGS(io) & IOf_DIR_UTF8 && !IN_BYTES) + SvUTF8_on(sv); XPUSHs(sv_2mortal(sv)); } } @@ -3808,6 +3834,8 @@ PP(pp_readdir) if (!(IoFLAGS(io) & IOf_UNTAINT)) SvTAINTED_on(sv); #endif + if (IoFLAGS(io) & IOf_DIR_UTF8) + sv_utf8_upgrade(sv); XPUSHs(sv_2mortal(sv)); } RETURN; @@ -5428,12 +5456,22 @@ PP(pp_ggrent) 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;