-/* $OpenBSD: annotate.c,v 1.61 2010/07/23 21:46:05 ray Exp $ */
+/* $OpenBSD: annotate.c,v 1.62 2010/07/30 21:47:18 ray Exp $ */
/*
* Copyright (c) 2007 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Xavier Santolaria <xsa@openbsd.org>
switch (ch) {
case 'D':
dateflag = optarg;
- cvs_specified_date = date_parse(dateflag);
+ if ((cvs_specified_date = date_parse(dateflag)) == -1)
+ fatal("invalid date: %s", dateflag);
break;
case 'f':
force_head = 1;
-/* $OpenBSD: checkout.c,v 1.166 2010/07/23 21:46:05 ray Exp $ */
+/* $OpenBSD: checkout.c,v 1.167 2010/07/30 21:47:18 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
exit(0);
case 'D':
dateflag = optarg;
- cvs_specified_date = date_parse(dateflag);
+ if ((cvs_specified_date = date_parse(dateflag)) == -1)
+ fatal("invalid date: %s", dateflag);
reset_tag = 0;
break;
case 'd':
-/* $OpenBSD: diff.c,v 1.158 2010/07/28 21:19:30 nicm Exp $ */
+/* $OpenBSD: diff.c,v 1.159 2010/07/30 21:47:18 ray Exp $ */
/*
* Copyright (c) 2008 Tobias Stoeckmann <tobias@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
break;
case 'D':
if (date1 == -1 && rev1 == NULL) {
- date1 = date_parse(optarg);
+ if ((date1 = date_parse(optarg)) == -1)
+ fatal("invalid date: %s", optarg);
dateflag1 = optarg;
} else if (date2 == -1 && rev2 == NULL) {
- date2 = date_parse(optarg);
+ if ((date2 = date_parse(optarg)) == -1)
+ fatal("invalid date: %s", optarg);
dateflag2 = optarg;
} else {
fatal("no more than 2 revisions/dates can"
-/* $OpenBSD: getlog.c,v 1.94 2010/07/23 21:46:05 ray Exp $ */
+/* $OpenBSD: getlog.c,v 1.95 2010/07/30 21:47:18 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
if (logrev != NULL)
nrev = cvs_revision_select(cf->file_rcs, logrev);
- else if (logdate != NULL)
- nrev = date_select(cf->file_rcs, logdate);
- else
+ else if (logdate != NULL) {
+ if ((nrev = date_select(cf->file_rcs, logdate)) == -1) {
+ cvs_log(LP_ERR, "invalid date: %s", logdate);
+ return;
+ }
+ } else
nrev = cf->file_rcs->rf_ndelta;
cvs_printf("\nRCS file: %s", cf->file_rpath);
if (last == NULL) {
flags |= LDATE_SINGLE;
- firstdate = date_parse(first);
+ if ((firstdate = date_parse(first)) == -1)
+ return -1;
delim = '\0';
last = "\0";
} else {
if (delim == '>' && *last == '\0') {
flags |= LDATE_EARLIER;
- firstdate = date_parse(first);
+ if ((firstdate = date_parse(first)) == -1)
+ return -1;
}
if (delim == '>' && *first == '\0' && *last != '\0') {
flags |= LDATE_LATER;
- firstdate = date_parse(last);
+ if ((firstdate = date_parse(last)) == -1)
+ return -1;
}
if (delim == '<' && *last == '\0') {
flags |= LDATE_LATER;
- firstdate = date_parse(first);
+ if ((firstdate = date_parse(first)) == -1)
+ return -1;
}
if (delim == '<' && *first == '\0' && *last != '\0') {
flags |= LDATE_EARLIER;
- firstdate = date_parse(last);
+ if ((firstdate = date_parse(last)) == -1)
+ return -1;
}
if (*first != '\0' && *last != '\0') {
firstdate = date_parse(last);
lastdate = date_parse(first);
}
+ if (firstdate == -1 || lastdate == -1)
+ return -1;
}
TAILQ_FOREACH(rdp, &(file->rf_delta), rd_list) {
-/* $OpenBSD: update.c,v 1.162 2010/07/23 21:46:05 ray Exp $ */
+/* $OpenBSD: update.c,v 1.163 2010/07/30 21:47:18 ray Exp $ */
/*
* Copyright (c) 2006 Joris Vink <joris@openbsd.org>
*
break;
case 'D':
dateflag = optarg;
- cvs_specified_date = date_parse(dateflag);
+ if ((cvs_specified_date = date_parse(dateflag)) == -1)
+ fatal("invalid date: %s", dateflag);
reset_tag = 0;
break;
case 'd':
if ((p = strchr(jrev2, ':')) != NULL) {
(*p++) = '\0';
- cvs_specified_date = date_parse(p);
+ if ((cvs_specified_date = date_parse(p)) == -1) {
+ cvs_printf("invalid date: %s", p);
+ goto out;
+ }
}
rev2 = rcs_translate_tag(jrev2, cf->file_rcs);
if (jrev1 != NULL) {
if ((p = strchr(jrev1, ':')) != NULL) {
(*p++) = '\0';
- cvs_specified_date = date_parse(p);
+ if ((cvs_specified_date = date_parse(p)) == -1) {
+ cvs_printf("invalid date: %s", p);
+ goto out;
+ }
}
rev1 = rcs_translate_tag(jrev1, cf->file_rcs);
-/* $OpenBSD: ci.c,v 1.209 2010/07/28 09:07:11 ray Exp $ */
+/* $OpenBSD: ci.c,v 1.210 2010/07/30 21:47:18 ray Exp $ */
/*
* Copyright (c) 2005, 2006 Niall O'Higgins <niallo@openbsd.org>
* All rights reserved.
case 'd':
if (rcs_optarg == NULL)
pb.date = DATE_MTIME;
- else if ((pb.date = date_parse(rcs_optarg)) <= 0)
+ else if ((pb.date = date_parse(rcs_optarg)) == -1)
errx(1, "invalid date");
break;
case 'f':
if (i < 5)
break;
(void)xasprintf(&datestring, "%s %s", tokens[3], tokens[4]);
- if ((*date = date_parse(datestring)) <= 0)
+ if ((*date = date_parse(datestring)) == -1)
errx(1, "could not parse date");
xfree(datestring);
if (i < 3)
break;
(void)xasprintf(&datestring, "%s %s", tokens[1], tokens[2]);
- if ((*date = date_parse(datestring)) <= 0)
+ if ((*date = date_parse(datestring)) == -1)
errx(1, "could not parse date");
xfree(datestring);
break;
-/* $OpenBSD: co.c,v 1.112 2010/07/28 09:07:11 ray Exp $ */
+/* $OpenBSD: co.c,v 1.113 2010/07/30 21:47:18 ray Exp $ */
/*
* Copyright (c) 2005 Joris Vink <joris@openbsd.org>
* All rights reserved.
RCSNUM *rev;
rcsdate = givendate = -1;
- if (date != NULL)
- givendate = date_parse(date);
+ if (date != NULL && (givendate = date_parse(date)) == -1) {
+ warnx("invalid date: %s", date);
+ return -1;
+ }
if (file->rf_ndelta == 0 && !(flags & QUIET))
(void)fprintf(stderr,
TAILQ_FOREACH(rdp, &file->rf_delta, rd_list) {
if (date != NULL) {
fdate = asctime(&rdp->rd_date);
- rcsdate = date_parse(fdate);
+ if ((rcsdate = date_parse(fdate)) == -1) {
+ warnx("invalid date: %s", fdate);
+ return -1;
+ }
if (givendate <= rcsdate)
continue;
}
-/* $OpenBSD: rlog.c,v 1.63 2010/07/23 21:46:05 ray Exp $ */
+/* $OpenBSD: rlog.c,v 1.64 2010/07/30 21:47:18 ray Exp $ */
/*
* Copyright (c) 2005, 2009 Joris Vink <joris@openbsd.org>
* Copyright (c) 2005, 2006 Xavier Santolaria <xsa@openbsd.org>
if (last == NULL) {
flags |= RLOG_DATE_SINGLE;
- firstdate = date_parse(first);
+ if ((firstdate = date_parse(first)) == -1)
+ return -1;
delim = '\0';
last = "\0";
} else {
if (delim == '>' && *last == '\0') {
flags |= RLOG_DATE_EARLIER;
- firstdate = date_parse(first);
+ if ((firstdate = date_parse(first)) == -1)
+ return -1;
}
if (delim == '>' && *first == '\0' && *last != '\0') {
flags |= RLOG_DATE_LATER;
- firstdate = date_parse(last);
+ if ((firstdate = date_parse(last)) == -1)
+ return -1;
}
if (delim == '<' && *last == '\0') {
flags |= RLOG_DATE_LATER;
- firstdate = date_parse(first);
+ if ((firstdate = date_parse(first)) == -1)
+ return -1;
}
if (delim == '<' && *first == '\0' && *last != '\0') {
flags |= RLOG_DATE_EARLIER;
- firstdate = date_parse(last);
+ if ((firstdate = date_parse(last)) == -1)
+ return -1;
}
if (*first != '\0' && *last != '\0') {
firstdate = date_parse(last);
lastdate = date_parse(first);
}
+ if (firstdate == -1 || lastdate == -1)
+ return -1;
}
TAILQ_FOREACH(rdp, &(rcsfile->rf_delta), rd_list) {
if (rflag == 1)
nrev = rcs_rev_select(file, revisions);
- else if (dflag == 1)
- nrev = rlog_select_daterev(file, rlog_dates);
- else
+ else if (dflag == 1) {
+ if ((nrev = rlog_select_daterev(file, rlog_dates)) == -1)
+ errx(1, "invalid date: %s", rlog_dates);
+ } else
nrev = file->rf_ndelta;
if ((workfile = basename(fname)) == NULL)