summaryrefslogtreecommitdiff
path: root/doio.c
diff options
context:
space:
mode:
authorRobert Spier <rspier@pobox.com>2001-05-26 16:05:23 -0400
committerJarkko Hietaniemi <jhi@iki.fi>2001-05-27 17:57:18 +0000
commitc6f7b413036791fab1bc70a20478e35308cb125e (patch)
tree016bb19d8fdf7969fe0d4c04860f43065a3c0c54 /doio.c
parent772ff3b9a0f0c2a13c6c07025abd657f0b9691c9 (diff)
downloadperl-c6f7b413036791fab1bc70a20478e35308cb125e.tar.gz
[PATCH] [ID 19991013.005] utime undef, undef, @files
Date: Sat, 26 May 2001 20:05:23 -0400 Message-ID: <15120.17603.148648.12430@rls.cx> Subject: Re: [PATCH] [ID 19991013.005] utime undef, undef, @files From: rspier@pobox.com (Robert Spier) Date: Sun, 27 May 2001 00:23:12 -0400 Message-ID: <15120.33072.511966.767230@rls.cx> p4raw-id: //depot/perl@10232
Diffstat (limited to 'doio.c')
-rw-r--r--doio.c21
1 files changed, 16 insertions, 5 deletions
diff --git a/doio.c b/doio.c
index dd840f6757..e86862f108 100644
--- a/doio.c
+++ b/doio.c
@@ -1667,20 +1667,31 @@ nothing in the core.
} utbuf;
#endif
+ SV* accessed = *++mark;
+ SV* modified = *++mark;
+ void * utbufp = &utbuf;
+
+ /* be like C, and if both times are undefined, let the C
+ library figure out what to do. This usually means
+ "current time" */
+
+ if ( accessed == &PL_sv_undef && modified == &PL_sv_undef )
+ utbufp = NULL;
+
Zero(&utbuf, sizeof utbuf, char);
#ifdef BIG_TIME
- utbuf.actime = (Time_t)SvNVx(*++mark); /* time accessed */
- utbuf.modtime = (Time_t)SvNVx(*++mark); /* time modified */
+ utbuf.actime = (Time_t)SvNVx(accessed); /* time accessed */
+ utbuf.modtime = (Time_t)SvNVx(modified); /* time modified */
#else
- utbuf.actime = (Time_t)SvIVx(*++mark); /* time accessed */
- utbuf.modtime = (Time_t)SvIVx(*++mark); /* time modified */
+ utbuf.actime = (Time_t)SvIVx(accessed); /* time accessed */
+ utbuf.modtime = (Time_t)SvIVx(modified); /* time modified */
#endif
APPLY_TAINT_PROPER();
tot = sp - mark;
while (++mark <= sp) {
char *name = SvPVx(*mark, n_a);
APPLY_TAINT_PROPER();
- if (PerlLIO_utime(name, &utbuf))
+ if (PerlLIO_utime(name, utbufp))
tot--;
}
}