Add support for SOURCE_DATE_EPOCH environment variable (Issue #193)

pull/196/head
Michael Sweet 7 years ago
parent 3700ebd2c3
commit b79d3e0f07
  1. 2
      CHANGES.md
  2. 2
      doc/mxml.man
  3. 9
      mxmldoc.c

@ -6,6 +6,8 @@
(Issue #184)
- The configure script now properly supports cross-compilation (Issue #188)
- The mxmldoc utility now supports generation of EPUB files (Issue #189)
- The mxmldoc utility now supports the `SOURCE_DATE_EPOCH` environment
variable for reproducible builds (Issue #193)
- The mxmldoc utility now supports Markdown (Issue #194)

@ -1,4 +1,4 @@
.TH mxml 3 "Mini-XML API" "04/21/17" "Mini-XML API"
.TH mxml 3 "Mini-XML API" "04/23/17" "Mini-XML API"
.SH NAME
mxml \- Mini-XML API
.SH INCLUDE FILE

@ -5604,6 +5604,7 @@ write_man(const char *man_name, /* I - Name of manpage */
*parent; /* Parent class */
int inscope; /* Variable/method scope */
char prefix; /* Prefix character */
const char *source_date_epoch; /* SOURCE_DATE_EPOCH environment variable */
time_t curtime; /* Current time */
struct tm *curdate; /* Current date */
char buffer[1024]; /* String buffer */
@ -5617,9 +5618,15 @@ write_man(const char *man_name, /* I - Name of manpage */
/*
* Standard man page...
*
* Get the current date, using the SOURCE_DATE_EPOCH environment variable, if
* present, for the number of seconds since the epoch - this enables
* reproducible builds (Issue #193).
*/
curtime = time(NULL);
if ((source_date_epoch = getenv("SOURCE_DATE_EPOCH")) == NULL || (curtime = (time_t)strtol(source_date_epoch, NULL, 10)) <= 0)
curtime = time(NULL);
curdate = localtime(&curtime);
strftime(buffer, sizeof(buffer), "%x", curdate);

Loading…
Cancel
Save