summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoris Vink <joris@cvs.openbsd.org>2008-02-10 10:21:43 +0000
committerJoris Vink <joris@cvs.openbsd.org>2008-02-10 10:21:43 +0000
commit1bfb3f5f69f5d677b26511780bfa077d36bd6a80 (patch)
tree50d0e3846c744fba8e58033e73455f3b32b11fc7
parent8b60bdfd121637f6e89639e4fe4264cb8f430756 (diff)
properly initialize cvs_specified_date so we dont end up with
random stuff going on
-rw-r--r--usr.bin/cvs/annotate.c4
-rw-r--r--usr.bin/cvs/checkout.c6
-rw-r--r--usr.bin/cvs/entries.c11
-rw-r--r--usr.bin/cvs/file.c4
-rw-r--r--usr.bin/cvs/rcs.c4
-rw-r--r--usr.bin/cvs/update.c8
6 files changed, 19 insertions, 18 deletions
diff --git a/usr.bin/cvs/annotate.c b/usr.bin/cvs/annotate.c
index d868e07d963..935ef87c6e2 100644
--- a/usr.bin/cvs/annotate.c
+++ b/usr.bin/cvs/annotate.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: annotate.c,v 1.54 2008/02/09 16:05:08 tobias Exp $ */
+/* $OpenBSD: annotate.c,v 1.55 2008/02/10 10:21:42 joris Exp $ */
/*
* Copyright (c) 2007 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
@@ -203,7 +203,7 @@ cvs_annotate_local(struct cvs_file *cf)
}
rcsnum_free(rev);
} else {
- rcs_rev_getlines(cf->file_rcs, cvs_specified_date ?
+ rcs_rev_getlines(cf->file_rcs, (cvs_specified_date != -1) ?
cf->file_rcsrev : cf->file_rcs->rf_head, &alines);
}
diff --git a/usr.bin/cvs/checkout.c b/usr.bin/cvs/checkout.c
index 1467acdab92..241db2abf03 100644
--- a/usr.bin/cvs/checkout.c
+++ b/usr.bin/cvs/checkout.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: checkout.c,v 1.135 2008/02/09 20:04:00 xsa Exp $ */
+/* $OpenBSD: checkout.c,v 1.136 2008/02/10 10:21:42 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -48,7 +48,7 @@ static char *dateflag = NULL;
static int nflag = 0;
char *checkout_target_dir = NULL;
-time_t cvs_specified_date;
+time_t cvs_specified_date = -1;
struct cvs_cmd cvs_cmd_checkout = {
CVS_OP_CHECKOUT, CVS_USE_WDIR, "checkout",
@@ -496,7 +496,7 @@ cvs_checkout_file(struct cvs_file *cf, RCSNUM *rnum, char *tag, int co_flags)
if (co_flags & CO_SETSTICKY)
if (tag != NULL)
(void)xsnprintf(sticky, sizeof(sticky), "T%s", tag);
- else if (cvs_specified_date != 0) {
+ else if (cvs_specified_date != -1) {
datetm = gmtime(&cvs_specified_date);
strftime(sticky, sizeof(sticky), "D%Y.%m.%d.%H.%M.%S",
datetm);
diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c
index 03cbe878b9f..cc751d8403a 100644
--- a/usr.bin/cvs/entries.c
+++ b/usr.bin/cvs/entries.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: entries.c,v 1.91 2008/02/10 10:10:15 joris Exp $ */
+/* $OpenBSD: entries.c,v 1.92 2008/02/10 10:21:42 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -137,6 +137,8 @@ cvs_ent_parse(const char *entry)
ent->ce_status = CVS_ENT_REG;
ent->ce_name = fields[1];
ent->ce_rev = NULL;
+ ent->ce_date = -1;
+ ent->ce_tag = NULL;
if (ent->ce_type == CVS_ENT_FILE) {
if (*fields[2] == '-') {
@@ -202,8 +204,7 @@ cvs_ent_parse(const char *entry)
default:
fatal("invalid sticky entry");
}
- } else
- ent->ce_tag = NULL;
+ }
return (ent);
}
@@ -445,7 +446,7 @@ cvs_parse_tagfile(char *dir, char **tagp, char **datep, int *nbp)
datetm.tm_year -= 1900;
datetm.tm_mon -= 1;
- if (cvs_specified_date == 0)
+ if (cvs_specified_date == -1)
cvs_specified_date = timegm(&datetm);
if (datep != NULL)
@@ -487,7 +488,7 @@ cvs_write_tagfile(const char *dir, char *tag, char *date)
if (i < 0 || i >= MAXPATHLEN)
return;
- if (tag != NULL || cvs_specified_date != 0) {
+ if (tag != NULL || cvs_specified_date != -1) {
if ((fp = fopen(tagpath, "w+")) == NULL) {
if (errno != ENOENT) {
cvs_log(LP_NOTICE, "failed to open `%s' : %s",
diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c
index 991a0f7d18d..537292ee74e 100644
--- a/usr.bin/cvs/file.c
+++ b/usr.bin/cvs/file.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: file.c,v 1.219 2008/02/09 12:20:33 tobias Exp $ */
+/* $OpenBSD: file.c,v 1.220 2008/02/10 10:21:42 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
@@ -771,7 +771,7 @@ cvs_file_classify(struct cvs_file *cf, const char *tag)
if (!strcmp(state, RCS_STATE_DEAD))
rcsdead = 1;
- if (cvs_specified_date == 0 && tag == NULL && cf->in_attic &&
+ if (cvs_specified_date == -1 && tag == NULL && cf->in_attic &&
!RCSNUM_ISBRANCHREV(cf->file_rcsrev))
rcsdead = 1;
diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c
index 4d3c3f3e2ae..efc2482fae4 100644
--- a/usr.bin/cvs/rcs.c
+++ b/usr.bin/cvs/rcs.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rcs.c,v 1.247 2008/02/09 13:41:22 joris Exp $ */
+/* $OpenBSD: rcs.c,v 1.248 2008/02/10 10:21:42 joris Exp $ */
/*
* Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org>
* All rights reserved.
@@ -3551,7 +3551,7 @@ rcs_translate_tag(const char *revstr, RCSFILE *rfp)
if ((rdp = rcs_findrev(rfp, rev)) == NULL)
fatal("rcs_translate_tag: cannot find revision");
- if (cvs_specified_date == 0)
+ if (cvs_specified_date == -1)
return rev;
if (frev != NULL) {
diff --git a/usr.bin/cvs/update.c b/usr.bin/cvs/update.c
index cad31560a8a..1d111081b73 100644
--- a/usr.bin/cvs/update.c
+++ b/usr.bin/cvs/update.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: update.c,v 1.130 2008/02/10 10:10:15 joris Exp $ */
+/* $OpenBSD: update.c,v 1.131 2008/02/10 10:21:42 joris Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
@@ -204,7 +204,7 @@ cvs_update_enterdir(struct cvs_file *cf)
cf->file_path, CVS_PATH_TAG);
(void)unlink(fpath);
} else {
- if (cvs_specified_tag != NULL || cvs_specified_date != 0)
+ if (cvs_specified_tag != NULL || cvs_specified_date != -1)
cvs_write_tagfile(cf->file_path,
cvs_specified_tag, NULL);
}
@@ -405,7 +405,7 @@ cvs_update_local(struct cvs_file *cf)
case FILE_LOST:
case FILE_CHECKOUT:
case FILE_PATCH:
- if ((tag != NULL && !reset_tag) || cvs_specified_date != 0 ||
+ if ((tag != NULL && !reset_tag) || cvs_specified_date != -1 ||
(((cf->file_ent != NULL) && cf->file_ent->ce_tag != NULL) &&
!reset_tag))
flags = CO_SETSTICKY;
@@ -444,7 +444,7 @@ cvs_update_local(struct cvs_file *cf)
if (cf->file_rcsrev == NULL)
break;
- if (tag == NULL && cvs_specified_date == 0)
+ if (tag == NULL && cvs_specified_date == -1)
break;
if (cf->file_rcs->rf_dead != 1 &&