diff options
author | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2004-08-13 12:47:55 +0000 |
---|---|---|
committer | Jean-Francois Brousseau <jfb@cvs.openbsd.org> | 2004-08-13 12:47:55 +0000 |
commit | 1005ac4d4afab2b8fea1c137024bafb4a1c5e6f9 (patch) | |
tree | 3314abfb2206a31211551256dfca0c5b00ff69a3 /usr.bin/cvs | |
parent | b97b96819946de923c0f3bcc7985696750636ff6 (diff) |
Ditch the 'ce_timestamp' field in favor of 'ce_mtime', which keeps
the timestamp in time_t instead of a string
Diffstat (limited to 'usr.bin/cvs')
-rw-r--r-- | usr.bin/cvs/cvs.h | 12 | ||||
-rw-r--r-- | usr.bin/cvs/entries.c | 13 |
2 files changed, 17 insertions, 8 deletions
diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h index f4ea936ccdd..79cf5c0f435 100644 --- a/usr.bin/cvs/cvs.h +++ b/usr.bin/cvs/cvs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.h,v 1.27 2004/08/13 02:56:37 jfb Exp $ */ +/* $OpenBSD: cvs.h,v 1.28 2004/08/13 12:47:54 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -163,7 +163,8 @@ struct cvsroot { #define CVS_HIST_TAG 'T' -#define CVS_ENT_DUMMYTIME "dummy timestamp" +#define CVS_DATE_DUMMY "dummy timestamp" +#define CVS_DATE_DMSEC (time_t)-1 #define CVS_ENT_NONE 0 #define CVS_ENT_FILE 1 @@ -180,7 +181,6 @@ struct cvs_ent { u_int ce_type; char *ce_name; RCSNUM *ce_rev; - char *ce_timestamp; time_t ce_mtime; char *ce_opts; char *ce_tag; @@ -281,8 +281,12 @@ int cvs_hist_append (CVSHIST *, struct cvs_hent *); /* from util.c */ + +#define CVS_DATE_CTIME 0 +#define CVS_DATE_RFC822 1 + int cvs_readrepo (const char *, char *, size_t); -time_t cvs_datesec (const char *); +time_t cvs_datesec (const char *, int, int); int cvs_modetostr (mode_t, char *, size_t); int cvs_strtomode (const char *, mode_t *); int cvs_splitpath (const char *, char *, size_t, char **); diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c index e9c0ebdd4d9..3a65db2a662 100644 --- a/usr.bin/cvs/entries.c +++ b/usr.bin/cvs/entries.c @@ -1,4 +1,4 @@ -/* $OpenBSD: entries.c,v 1.12 2004/08/12 18:33:47 jfb Exp $ */ +/* $OpenBSD: entries.c,v 1.13 2004/08/13 12:47:54 jfb Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -366,7 +366,7 @@ cvs_ent_parse(const char *entry) if (entp->ce_type == CVS_ENT_FILE) { rcsnum_aton(fields[2], NULL, entp->ce_rev); - entp->ce_timestamp = fields[3]; + entp->ce_mtime = cvs_datesec(fields[3], CVS_DATE_CTIME, 0); entp->ce_opts = fields[4]; entp->ce_tag = fields[5]; } @@ -436,7 +436,8 @@ cvs_ent_getent(const char *path) int cvs_ent_write(CVSENTRIES *ef) { - char revbuf[64]; + size_t len; + char revbuf[64], timebuf[32]; struct cvs_ent *ent; if (ef->cef_file == NULL) @@ -452,8 +453,12 @@ cvs_ent_write(CVSENTRIES *ef) putc('D', ef->cef_file); rcsnum_tostr(ent->ce_rev, revbuf, sizeof(revbuf)); + ctime_r(&(ent->ce_mtime), timebuf); + len = strlen(timebuf); + if ((len > 0) && (timebuf[len - 1] == '\n')) + timebuf[--len] = '\0'; fprintf(ef->cef_file, "/%s/%s/%s/%s/%s\n", ent->ce_name, - revbuf, ent->ce_timestamp, "", ""); + revbuf, timebuf, "", ""); } /* terminating line */ |