diff options
author | Xavier Santolaria <xsa@cvs.openbsd.org> | 2005-11-25 14:16:45 +0000 |
---|---|---|
committer | Xavier Santolaria <xsa@cvs.openbsd.org> | 2005-11-25 14:16:45 +0000 |
commit | 78f975696bffc58366b55dd0b8d5bc9f9065a13a (patch) | |
tree | 72e5cda1ebee4a599a2a3029bcf611d0c690440c /usr.bin | |
parent | 6fd1543ce51a7e96037a6dc1e8f444869c7d22fa (diff) |
add `-T' support for rcsclean(1) and rcs(1);
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/rcs/rcsclean.c | 14 | ||||
-rw-r--r-- | usr.bin/rcs/rcsprog.c | 16 |
2 files changed, 23 insertions, 7 deletions
diff --git a/usr.bin/rcs/rcsclean.c b/usr.bin/rcs/rcsclean.c index 9fae89016cb..fb6669622d9 100644 --- a/usr.bin/rcs/rcsclean.c +++ b/usr.bin/rcs/rcsclean.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsclean.c,v 1.16 2005/11/23 09:39:20 xsa Exp $ */ +/* $OpenBSD: rcsclean.c,v 1.17 2005/11/25 14:16:44 xsa Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -42,16 +42,16 @@ static int rcsclean_file(char *, RCSNUM *); static int nflag = 0; static int kflag = RCS_KWEXP_ERR; static int uflag = 0; +static int flags = 0; int rcsclean_main(int argc, char **argv) { - int i, ch, flags; + int i, ch; RCSNUM *rev; DIR *dirp; struct dirent *dp; - flags = 0; rev = RCS_HEAD_REV; while ((ch = rcs_getopt(argc, argv, "k:n::q::r:Tu::Vx:")) != -1) { @@ -137,6 +137,7 @@ rcsclean_file(char *fname, RCSNUM *rev) BUF *b1, *b2; char *s1, *s2, *c1, *c2; struct stat st; + time_t rcs_mtime = -1; match = 1; @@ -149,6 +150,9 @@ rcsclean_file(char *fname, RCSNUM *rev) if ((file = rcs_open(fpath, RCS_RDWR)) == NULL) return (-1); + if (flags & PRESERVETIME) + rcs_mtime = rcs_get_mtime(file->rf_path); + if (!RCS_KWEXP_INVAL(kflag)) rcs_kwexp_set(file, kflag); @@ -205,5 +209,9 @@ rcsclean_file(char *fname, RCSNUM *rev) } rcs_close(file); + + if (flags & PRESERVETIME) + rcs_set_mtime(fpath, rcs_mtime); + return (0); } 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 <jfb@openbsd.org> * 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"); } |