Discussion:
RCS: Mdocdate expansion
Ingo Schwarze
2016-01-25 17:43:17 UTC
Permalink
Hi,

tj@ just noticed that our RCS still doesn't know how to expand Mdocdate.
One consequence is that rcsdiff(1) shows wrong Mdocdate lines -
typically, for each revision, the ones from the previous revision.
That in turn causes cvsweb to show wrong Mdocdate lines in diffs.

I'm showing the patch here because RCS is still somewhat important
infrastructure.

OK?
Ingo


Index: rcs.c
===================================================================
RCS file: /cvs/src/usr.bin/rcs/rcs.c,v
retrieving revision 1.84
diff -u -p -r1.84 rcs.c
--- rcs.c 2 Nov 2015 16:45:21 -0000 1.84
+++ rcs.c 25 Jan 2016 17:41:18 -0000
@@ -66,6 +66,7 @@ struct rcs_kw rcs_expkw[] = {
{ "Revision", RCS_KW_REVISION },
{ "Source", RCS_KW_SOURCE },
{ "State", RCS_KW_STATE },
+ { "Mdocdate", RCS_KW_MDOCDATE },
};

int rcs_errno = RCS_ERR_NOERR;
@@ -1594,6 +1595,16 @@ rcs_expand_keywords(char *rcsfile_in, st
if (kwtype & RCS_KW_SOURCE) {
buf_puts(newbuf, rcsfile);
buf_putc(newbuf, ' ');
+ }
+
+ if (kwtype & RCS_KW_MDOCDATE) {
+ strftime(buf, sizeof(buf), "%B", &tb);
+ buf_puts(newbuf, buf);
+ /* Only one blank before single-digit day. */
+ snprintf(buf, sizeof(buf), " %d", tb.tm_mday);
+ buf_puts(newbuf, buf);
+ strftime(buf, sizeof(buf), " %Y ", &tb);
+ buf_puts(newbuf, buf);
}

if (kwtype & RCS_KW_NAME)
Index: rcs.h
===================================================================
RCS file: /cvs/src/usr.bin/rcs/rcs.h,v
retrieving revision 1.16
diff -u -p -r1.16 rcs.h
--- rcs.h 3 Jun 2013 17:04:35 -0000 1.16
+++ rcs.h 25 Jan 2016 17:41:18 -0000
@@ -69,6 +69,7 @@
#define RCS_KW_SOURCE 0x0400
#define RCS_KW_STATE 0x0800
#define RCS_KW_FULLPATH 0x0010
+#define RCS_KW_MDOCDATE 0x0020
#define RCS_KW_LOCKER 0x10000

#define RCS_KW_ID \

Loading...