New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
utime undef, undef, @files #712
Comments
From andrew@pimlott.ne.mediaone.netOn Solaris, and presumably most systems, the utime(2) system call applies Andrew Perl Info
|
From @rspierI've implemented this, cause it sounds like a good idea. (There are Patch below. The documentation for 'utime(2)' on all the systems I could get my -R Inline Patch--- doio.c.org Sat May 26 18:37:55 2001
+++ doio.c Sat May 26 19:00:48 2001
@@ -1667,20 +1667,31 @@
} 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--;
}
}
--- pod/perlfunc.pod.original Sat May 26 10:17:09 2001
+++ pod/perlfunc.pod Sat May 26 19:39:33 2001
@@ -5622,6 +5622,13 @@
$now = time;
utime $now, $now, @ARGV;
+If the fisrt two two elements of the list are C<undef>, then the
+system (C Library) utime will be called with a null second argument.
+On most machines, this will set the files access and modification time
+to the current time. (i.e. equivalent to the example above.)
+
+ utime undef, undef, @ARGV;
+
=item values HASH
Returns a list consisting of all the values of the named hash. (In a |
From [Unknown Contact. See original ticket]Thanks! Can I suggest:
Replace "On most ..." with something like This will set the file's access and modification time to the I think if some system were found to do something else with a null (Even if you don't take my suggestion, take my apostrophe, O Andrew |
From @rspier
The ownership rules vary from system to system, but are generaly the
New doc patch follows: -R Inline Patch--- perlfunc.pod.original Sat May 26 10:17:09 2001
+++ perlfunc.pod Sun May 27 00:16:59 2001
@@ -5622,6 +5622,13 @@
$now = time;
utime $now, $now, @ARGV;
+If the first two elements of the list are C<undef>, then the utime(2)
+function in the C library will be called with a null second argument.
+On most systems, this will set the file's access and modification
+times to the current time. (i.e. equivalent to the example above.)
+
+ utime undef, undef, @ARGV;
+
=item values HASH
Returns a list consisting of all the values of the named hash. (In a |
From @rspierI thought about that, and it was starting to look real ugly. the The patch shouldn't change the common case functionality. -R |
From @jhiI believe "rat's nest" is the technical term :-)
True. I'm just afraid that in some far-away platform utime(2) will
|
Migrated from rt.perl.org#1614 (status was 'resolved')
Searchable as RT1614$
The text was updated successfully, but these errors were encountered: