#define MAXSYMLINKS 8
#endif
+#ifndef VMS
/*
* char *realpath(const char *path, char resolved[MAXPATHLEN]);
*
char *
bsd_realpath(const char *path, char resolved[MAXPATHLEN])
{
-#ifdef VMS
- dTHX;
- return Perl_rmsexpand(aTHX_ (char*)path, resolved, NULL, 0);
-#else
char *p, *q, *s;
size_t left_len, resolved_len;
unsigned symlinks;
if (resolved_len > 1 && resolved[resolved_len - 1] == '/')
resolved[resolved_len - 1] = '\0';
return (resolved);
-#endif
}
+#endif
#ifndef SV_CWD_RETURN_UNDEF
#define SV_CWD_RETURN_UNDEF \
PPCODE:
{
dXSTARG;
- char *path;
+ char *const path = pathsv ? SvPV_nolen(pathsv) : (char *)".";
char buf[MAXPATHLEN];
- path = pathsv ? SvPV_nolen(pathsv) : (char *)".";
-
- if (bsd_realpath(path, buf)) {
- sv_setpvn(TARG, buf, strlen(buf));
+ if (
+#ifdef VMS
+ Perl_rmsexpand(aTHX_ path, buf, NULL, 0)
+#else
+ bsd_realpath(path, buf)
+#endif
+ ) {
+ sv_setpv_mg(TARG, buf);
SvPOK_only(TARG);
SvTAINTED_on(TARG);
}
else
sv_setsv(TARG, &PL_sv_undef);
- XSprePUSH; PUSHTARG;
+ XSprePUSH; PUSHs(TARG);
#ifndef INCOMPLETE_TAINTS
SvTAINTED_on(TARG);
#endif
New(0,dir,MAXPATHLEN,char);
if (_getdcwd(drive, dir, MAXPATHLEN)) {
- sv_setpvn(TARG, dir, strlen(dir));
+ sv_setpv_mg(TARG, dir);
SvPOK_only(TARG);
}
else
Safefree(dir);
- XSprePUSH; PUSHTARG;
+ XSprePUSH; PUSHs(TARG);
#ifndef INCOMPLETE_TAINTS
SvTAINTED_on(TARG);
#endif