diff options
author | 2007-05-26 20:50:05 +0000 | |
---|---|---|
committer | 2007-05-26 20:50:05 +0000 | |
commit | 4a75f6e0eb02af3190b96fdb8b91fb55916206e4 (patch) | |
tree | fbf418d96d5b71f8065ed17fba347827803d11ad /gnu/usr.bin/cvs/src | |
parent | chop ETHER_ALIGN off the size of the packet we tell the hw we can do (diff) | |
download | wireguard-openbsd-4a75f6e0eb02af3190b96fdb8b91fb55916206e4.tar.xz wireguard-openbsd-4a75f6e0eb02af3190b96fdb8b91fb55916206e4.zip |
introduce Mdocdate tag, requested by jmc.
Diffstat (limited to 'gnu/usr.bin/cvs/src')
-rw-r--r-- | gnu/usr.bin/cvs/src/rcs.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/gnu/usr.bin/cvs/src/rcs.c b/gnu/usr.bin/cvs/src/rcs.c index 4ddcfc69be3..bc97627ab65 100644 --- a/gnu/usr.bin/cvs/src/rcs.c +++ b/gnu/usr.bin/cvs/src/rcs.c @@ -9,6 +9,7 @@ */ #include <assert.h> +#include <err.h> #include "cvs.h" #include "edit.h" #include "hardlink.h" @@ -86,6 +87,7 @@ static char *RCS_addbranch PROTO ((RCSNode *, const char *)); static char *truncate_revnum_in_place PROTO ((char *)); static char *truncate_revnum PROTO ((const char *)); static char *printable_date PROTO((const char *)); +static char *mdoc_date PROTO((const char *)); static char *escape_keyword_value PROTO ((const char *, int *)); static void expand_keywords PROTO((RCSNode *, RCSVers *, const char *, const char *, size_t, enum kflag, char *, @@ -3355,6 +3357,7 @@ static struct rcs_keyword keywords[] = { KEYWORD_INIT ("Revision") }, { KEYWORD_INIT ("Source") }, { KEYWORD_INIT ("State") }, + { KEYWORD_INIT ("Mdocdate") }, { NULL, 0 }, { NULL, 0 } }; @@ -3371,6 +3374,7 @@ enum keyword KEYWORD_REVISION, KEYWORD_SOURCE, KEYWORD_STATE, + KEYWORD_MDOCDATE, KEYWORD_LOCALID }; @@ -3393,6 +3397,24 @@ printable_date (rcs_date) return xstrdup (buf); } +static char * +mdoc_date (rcs_date) + const char *rcs_date; +{ + int year, mon, mday, hour, min, sec; + char buf[100]; + char *months[] = { "January", "Febuary", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; + (void) sscanf (rcs_date, SDATEFORM, &year, &mon, &mday, &hour, &min, + &sec); + if (mon < 1 || mon > 12) + errx(1, "mdoc_date: month index out of bounds"); + + if (year < 1900) + year += 1900; + sprintf (buf, "%s %d %04d", months[mon - 1], mday, year); + return xstrdup (buf); +} + /* Escape the characters in a string so that it can be included in an RCS value. */ @@ -3605,6 +3627,11 @@ expand_keywords (rcs, ver, name, log, loglen, expand, buf, len, retbuf, retlen) free_value = 1; break; + case KEYWORD_MDOCDATE: + value = mdoc_date (ver->date); + free_value = 1; + break; + case KEYWORD_HEADER: case KEYWORD_ID: case KEYWORD_LOCALID: |