=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/rcs/ci.c,v retrieving revision 1.24 retrieving revision 1.25 diff -c -r1.24 -r1.25 *** src/usr.bin/rcs/ci.c 2005/10/13 12:35:30 1.24 --- src/usr.bin/rcs/ci.c 2005/10/13 22:54:46 1.25 *************** *** 1,4 **** ! /* $OpenBSD: ci.c,v 1.24 2005/10/13 12:35:30 joris Exp $ */ /* * Copyright (c) 2005 Niall O'Higgins * All rights reserved. --- 1,4 ---- ! /* $OpenBSD: ci.c,v 1.25 2005/10/13 22:54:46 niallo Exp $ */ /* * Copyright (c) 2005 Niall O'Higgins * All rights reserved. *************** *** 47,52 **** --- 47,55 ---- #define LOCK_LOCK 1 #define LOCK_UNLOCK 2 + #define DATE_NOW -1 + #define DATE_MTIME -2 + static char * checkin_diff_file(RCSFILE *, RCSNUM *, const char *); static char * checkin_getlogmsg(char *, char *, RCSNUM *, RCSNUM *); *************** *** 69,75 **** { int i, ch, flags, lkmode, interactive, rflag, status; mode_t fmode; ! time_t date = -1; RCSFILE *file; RCSNUM *frev, *newrev; char fpath[MAXPATHLEN]; --- 72,78 ---- { int i, ch, flags, lkmode, interactive, rflag, status; mode_t fmode; ! time_t date = DATE_NOW; RCSFILE *file; RCSNUM *frev, *newrev; char fpath[MAXPATHLEN]; *************** *** 89,98 **** exit(1); } ! while ((ch = rcs_getopt(argc, argv, "j:l::M:N:qu::d:r::m:k:V")) != -1) { switch (ch) { case 'd': ! if ((date = cvs_date_parse(rcs_optarg)) <= 0) { cvs_log(LP_ERR, "invalide date"); exit(1); } --- 92,103 ---- exit(1); } ! while ((ch = rcs_getopt(argc, argv, "j:l::M:N:qu::d::r::m:k:V")) != -1) { switch (ch) { case 'd': ! if (rcs_optarg == NULL) ! date = DATE_MTIME; ! else if ((date = cvs_date_parse(rcs_optarg)) <= 0) { cvs_log(LP_ERR, "invalide date"); exit(1); } *************** *** 240,245 **** --- 245,263 ---- cvs_log(LP_ERR, "failed to set new rd_text for head rev"); exit (1); + } + /* + * Set the date of the revision to be the last modification time + * of the working file if -d is specified without an argument. + */ + if (date == DATE_MTIME) { + struct stat sb; + if (stat(argv[i], &sb) != 0) { + cvs_log(LP_ERRNO, "failed to stat: `%s'", argv[i]); + rcs_close(file); + continue; + } + date = (time_t)sb.st_mtimespec.tv_sec; } /* * Now add our new revision