From e58bb9fa0d8286a7bd26e4ddb40051a327e82fbf Mon Sep 17 00:00:00 2001 From: Niall O'Higgins Date: Sat, 26 May 2007 20:58:37 +0000 Subject: add support for Mdocdate rcs keyword in opencvs too. also add check for strftime return in date keyword parsing while here. requested by jmc@, ok ray@ --- usr.bin/cvs/rcs.c | 15 +++++++++++++-- usr.bin/cvs/rcs.h | 3 ++- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index b30ed4ef176..b0e57cb7065 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.210 2007/02/22 06:42:09 otto Exp $ */ +/* $OpenBSD: rcs.c,v 1.211 2007/05/26 20:58:36 niallo Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -175,6 +175,7 @@ struct rcs_kw rcs_expkw[] = { { "Revision", RCS_KW_REVISION }, { "Source", RCS_KW_SOURCE }, { "State", RCS_KW_STATE }, + { "Mdocdate", RCS_KW_MDOCDATE }, }; #define NB_COMTYPES (sizeof(rcs_comments)/sizeof(rcs_comments[0])) @@ -2982,7 +2983,17 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct cvs_line *line, if (kwtype & RCS_KW_DATE) { fmt = "%Y/%m/%d %H:%M:%S "; - strftime(buf, sizeof(buf), fmt, &rdp->rd_date); + if (strftime(buf, sizeof(buf), fmt, &rdp->rd_date) == 0) + fatal("rcs_kwexp_line: strftime failure"); + if (strlcat(expbuf, buf, sizeof(expbuf)) >= sizeof(expbuf)) + fatal("rcs_kwexp_line: string truncated"); + } + + if (kwtype & RCS_KW_MDOCDATE) { + fmt = "%B %e %Y "; + + if (strftime(buf, sizeof(buf), fmt, &rdp->rd_date) == 0) + fatal("rcs_kwexp_line: strftime failure"); if (strlcat(expbuf, buf, sizeof(expbuf)) >= sizeof(expbuf)) fatal("rcs_kwexp_line: string truncated"); } diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h index 10d740e0037..ff0a4240722 100644 --- a/usr.bin/cvs/rcs.h +++ b/usr.bin/cvs/rcs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.75 2007/02/19 11:40:00 otto Exp $ */ +/* $OpenBSD: rcs.h,v 1.76 2007/05/26 20:58:36 niallo Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau * All rights reserved. @@ -68,6 +68,7 @@ #define RCS_KW_SOURCE 0x0400 #define RCS_KW_STATE 0x0800 #define RCS_KW_FULLPATH 0x0010 +#define RCS_KW_MDOCDATE 0x0020 #define RCS_KW_ID \ (RCS_KW_RCSFILE | RCS_KW_REVISION | RCS_KW_DATE \ -- cgit v1.2.3