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/rcs/rcsclean.c | |
parent | 6fd1543ce51a7e96037a6dc1e8f444869c7d22fa (diff) |
add `-T' support for rcsclean(1) and rcs(1);
Diffstat (limited to 'usr.bin/rcs/rcsclean.c')
-rw-r--r-- | usr.bin/rcs/rcsclean.c | 14 |
1 files changed, 11 insertions, 3 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); } |