From 78f975696bffc58366b55dd0b8d5bc9f9065a13a Mon Sep 17 00:00:00 2001 From: Xavier Santolaria Date: Fri, 25 Nov 2005 14:16:45 +0000 Subject: add `-T' support for rcsclean(1) and rcs(1); --- usr.bin/rcs/rcsprog.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'usr.bin/rcs/rcsprog.c') diff --git a/usr.bin/rcs/rcsprog.c b/usr.bin/rcs/rcsprog.c index df48069172b..dedc939d850 100644 --- a/usr.bin/rcs/rcsprog.c +++ b/usr.bin/rcs/rcsprog.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsprog.c,v 1.47 2005/11/25 13:50:01 xsa Exp $ */ +/* $OpenBSD: rcsprog.c,v 1.48 2005/11/25 14:16:44 xsa Exp $ */ /* * Copyright (c) 2005 Jean-Francois Brousseau * All rights reserved. @@ -376,6 +376,7 @@ rcs_main(int argc, char **argv) RCSFILE *file, *oldfile; RCSNUM *logrev; struct rcs_access *acp; + time_t rcs_mtime = -1; kflag = lkmode = -1; fmode = 0; @@ -465,10 +466,13 @@ rcs_main(int argc, char **argv) if (verbose == 1) printf("RCS file: %s\n", fpath); - file = rcs_open(fpath, flags, fmode); - if (file == NULL) + + if ((file = rcs_open(fpath, flags, fmode)) == NULL); continue; + if (flags & PRESERVETIME) + rcs_mtime = rcs_get_mtime(file->rf_path); + if (logstr != NULL) { if ((logmsg = strchr(logstr, ':')) == NULL) { cvs_log(LP_ERR, "missing log message"); @@ -478,7 +482,8 @@ rcs_main(int argc, char **argv) *logmsg++ = '\0'; if ((logrev = rcsnum_parse(logstr)) == NULL) { - cvs_log(LP_ERR, "'%s' bad revision number", logstr); + cvs_log(LP_ERR, + "'%s' bad revision number", logstr); rcs_close(file); continue; } @@ -532,6 +537,9 @@ rcs_main(int argc, char **argv) rcs_close(file); + if (flags & PRESERVETIME) + rcs_set_mtime(fpath, rcs_mtime); + if (verbose == 1) printf("done\n"); } -- cgit v1.2.3