From: John E. Malmberg Date: Mon, 20 Mar 2006 08:12:19 +0000 (-0500) Subject: [patch@27538] utime patch for VMS X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=704c2eb32539845568269483e091b89ae0793748;p=p5sagit%2Fp5-mst-13.2.git [patch@27538] utime patch for VMS From: "John E. Malmberg" Message-ID: <441EAA33.6010603@qsl.net> p4raw-id: //depot/perl@27561 --- diff --git a/configure.com b/configure.com index 41103db..6933eaa 100644 --- a/configure.com +++ b/configure.com @@ -3512,6 +3512,13 @@ $ tmp = "unistd.h" $ GOSUB inhdr $ i_unistd = tmp $! +$! Check to see if we've got utime.h (which we should use if we have) +$! +$ i_netdb = "undef" +$ tmp = "utime.h" +$ GOSUB inhdr +$ i_utime = tmp +$! $! do we have getppid()? $! $ IF i_unistd .EQS. "define" @@ -6113,7 +6120,7 @@ $ WC "i_termios='undef'" $ WC "i_time='define'" $ WC "i_unistd='" + i_unistd + "'" $ WC "i_ustat='undef'" -$ WC "i_utime='undef'" +$ WC "i_utime='" + i_utime + "'" $ WC "i_values='undef'" $ WC "i_varargs='undef'" $ WC "i_vfork='undef'" diff --git a/vms/vms.c b/vms/vms.c index ea25085..05b4ce9 100644 --- a/vms/vms.c +++ b/vms/vms.c @@ -9740,12 +9740,31 @@ int Perl_my_utime(pTHX_ const char *file, const struct utimbuf *utimes) devdsc = {0,DSC$K_DTYPE_T, DSC$K_CLASS_S,0}, fnmdsc = {0,DSC$K_DTYPE_T, DSC$K_CLASS_S,0}; + if (decc_efs_charset != 0) { + struct utimbuf utc_utimes; + + utc_utimes.actime = utimes->actime; + utc_utimes.modtime = utimes->modtime; +# ifdef VMSISH_TIME + /* If input was local; convert to UTC for sys svc */ + if (VMSISH_TIME) { + utc_utimes.actime = _toutc(utimes->actime); + utc_utimes.modtime = _toutc(utimes->modtime); + } +# endif + sts = utime(file, &utc_utimes); + return sts; + } + if (file == NULL || *file == '\0') { set_errno(ENOENT); set_vaxc_errno(LIB$_INVARG); return -1; } - if (do_tovmsspec(file,vmsspec,0) == NULL) return -1; + + /* Convert to VMS format ensuring that it will fit in 255 characters */ + if (do_rmsexpand(file, vmsspec, 0, NULL, PERL_RMSEXPAND_M_VMS) == NULL) + return -1; if (utimes != NULL) { /* Convert Unix time (seconds since 01-JAN-1970 00:00:00.00) diff --git a/vms/vmsish.h b/vms/vmsish.h index 2c8bace..6dc97a4 100644 --- a/vms/vmsish.h +++ b/vms/vmsish.h @@ -464,12 +464,18 @@ struct interp_intern { # include #define ABORT() abort() +#ifdef I_UTIME +#include +#else /* Used with our my_utime() routine in vms.c */ struct utimbuf { time_t actime; time_t modtime; }; +#endif +#ifndef DONT_MASK_RTL_CALLS #define utime my_utime +#endif /* This is what times() returns, but calls it tbuffer_t on VMS * prior to v7.0. We check the DECC manifest to see whether it's already