diff options
Diffstat (limited to 'vms')
-rw-r--r-- | vms/vms.c | 22 | ||||
-rw-r--r-- | vms/vmsish.h | 8 |
2 files changed, 16 insertions, 14 deletions
@@ -207,7 +207,7 @@ int my_trnlnm(const char *lnm, char *eqv, unsigned long int idx) * Note: Uses Perl temp to store result so char * can be returned to * caller; this pointer will be invalidated at next Perl statement * transition. - * We define this as a function rather than a macro in terms of my_getenv_sv() + * We define this as a function rather than a macro in terms of my_getenv_len() * so that it'll work when PL_curinterp is undefined (and we therefore can't * allocate SVs). */ @@ -256,17 +256,18 @@ my_getenv(const char *lnm, bool sys) /*}}}*/ -/*{{{ SV *my_getenv_sv(const char *lnm, bool sys)*/ -SV * -my_getenv_sv(const char *lnm, bool sys) +/*{{{ SV *my_getenv_len(const char *lnm, bool sys)*/ +char * +my_getenv_len(const char *lnm, unsigned long *len, bool sys) { char buf[LNM$C_NAMLENGTH+1], *cp1, *cp2; - unsigned long int len, idx = 0; + unsigned long idx = 0; for (cp1 = (char *)lnm, cp2 = buf; *cp1; cp1++,cp2++) *cp2 = _toupper(*cp1); if (cp1 - lnm == 7 && !strncmp(buf,"DEFAULT",7)) { getcwd(buf,LNM$C_NAMLENGTH); - return newSVpv(buf,0); + *len = strlen(buf); + return buf; } else { if ((cp2 = strchr(lnm,';')) != NULL) { @@ -275,18 +276,19 @@ my_getenv_sv(const char *lnm, bool sys) idx = strtoul(cp2+1,NULL,0); lnm = buf; } - if ((len = vmstrnenv(lnm,buf,idx, + if ((*len = vmstrnenv(lnm,buf,idx, sys ? fildev : NULL, #ifdef SECURE_INTERNAL_GETENV sys ? PERL__TRNENV_SECURE : 0 #else 0 #endif - ))) return newSVpv(buf,len); - else return &PL_sv_undef; + ))) + return buf; + else return Nullch; } -} /* end of my_getenv_sv() */ +} /* end of my_getenv_len() */ /*}}}*/ static void create_mbx(unsigned short int *, struct dsc$descriptor_s *); diff --git a/vms/vmsish.h b/vms/vmsish.h index 4b45cf4968..5398bcccb0 100644 --- a/vms/vmsish.h +++ b/vms/vmsish.h @@ -74,7 +74,7 @@ /* getenv used for regular logical names */ # define getenv(v) my_getenv(v,TRUE) #endif -#define getenv_sv(v) my_getenv_sv(v,TRUE) +#define getenv_len(v,l) my_getenv_len(v,l,TRUE) /* DECC introduces this routine in the RTL as of VMS 7.0; for now, * we'll use ours, since it gives us the full VMS exit status. */ @@ -90,7 +90,7 @@ #define vmstrnenv Perl_vmstrnenv #define my_trnlnm Perl_my_trnlnm #define my_getenv Perl_my_getenv -#define my_getenv_sv Perl_my_getenv_sv +#define my_getenv_len Perl_my_getenv_len #define prime_env_iter Perl_prime_env_iter #define vmssetenv Perl_vmssetenv #define my_setenv Perl_my_setenv @@ -413,7 +413,7 @@ struct utimbuf { #define ENV_HV_NAME "%EnV%VmS%" /* Special getenv function for retrieving %ENV elements. */ #define ENVgetenv(v) my_getenv(v,FALSE) -#define ENVgetenv_sv(v) my_getenv_sv(v,FALSE) +#define ENVgetenv_len(v,l) my_getenv_len(v,l,FALSE) /* Thin jacket around cuserid() tomatch Unix' calling sequence */ @@ -581,7 +581,7 @@ typedef char __VMS_PROTOTYPES__; int vmstrnenv _((const char *, char *, unsigned long int, struct dsc$descriptor_s **, unsigned long int)); int my_trnlnm _((const char *, char *, unsigned long int)); char * my_getenv _((const char *, bool)); -SV * my_getenv_sv _((const char *, bool)); +char * my_getenv_len _((const char *, unsigned long *, bool)); int vmssetenv _((char *, char *, struct dsc$descriptor_s **)); char * my_crypt _((const char *, const char *)); Pid_t my_waitpid _((Pid_t, int *, int)); |