logo

oasis

Own branch of Oasis Linux (upstream: <https://git.sr.ht/~mcf/oasis/>) git clone https://anongit.hacktivis.me/git/oasis.git
commit: 3563d08c8e64b4f890a8a8550d2ba3a0d658bc91
parent e0453f2035b3696939ecd1b7f20d03964dd3bf98
Author: Michael Forney <mforney@mforney.org>
Date:   Sun, 11 Nov 2018 14:34:40 -0800

texi2mdoc: Allow overriding date of generated man page

Diffstat:

Apkg/texi2mdoc/patch/0001-Use-mtime-of-source-for-date-and-allow-override.patch114+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Mpkg/texi2mdoc/rev2+-
2 files changed, 115 insertions(+), 1 deletion(-)

diff --git a/pkg/texi2mdoc/patch/0001-Use-mtime-of-source-for-date-and-allow-override.patch b/pkg/texi2mdoc/patch/0001-Use-mtime-of-source-for-date-and-allow-override.patch @@ -0,0 +1,114 @@ +From b011ba98eb147ebd87aedd4b10bee9fc878cdf45 Mon Sep 17 00:00:00 2001 +From: Michael Forney <mforney@mforney.org> +Date: Sun, 11 Nov 2018 14:24:00 -0800 +Subject: [PATCH] Use mtime of source for date, and allow override + +--- + extern.h | 1 + + main.c | 29 ++++++++++++++++++++--------- + 2 files changed, 21 insertions(+), 9 deletions(-) + +diff --git a/extern.h b/extern.h +index f713e0b..643edde 100644 +--- a/extern.h ++++ b/extern.h +@@ -365,6 +365,7 @@ struct texi { + size_t dirsz; /* number of texi directories */ + char *title; /* title of document */ + char *subtitle; /* subtitle of document */ ++ char *date; /* date of document */ + int secoffs; /* see sectioner() */ + char **indexs; /* @defindex indices */ + size_t indexsz; /* entries in indexs */ +diff --git a/main.c b/main.c +index d343727..0492a79 100644 +--- a/main.c ++++ b/main.c +@@ -28,6 +28,7 @@ + #include <string.h> + #include <time.h> + #include <unistd.h> ++#include <sys/stat.h> + + #include "extern.h" + +@@ -1587,8 +1588,6 @@ static void + dotop(struct texi *p, enum texicmd cmd, size_t *pos) + { + const char *cp; +- time_t t; +- char date[32]; + + if (--p->ign) + texierr(p, "@top command while ignoring"); +@@ -1598,13 +1597,10 @@ dotop(struct texi *p, enum texicmd cmd, size_t *pos) + * We use the title set with @settitle for the `Nd' description + * and the source document filename (the first one as invoked on + * the command line) for the title. +- * The date is set to the current date. + */ +- t = time(NULL); +- strftime(date, sizeof(date), "%F", localtime(&t)); + + teximacroopen(p, "Dd"); +- texiputchars(p, date); ++ texiputchars(p, p->date); + teximacroclose(p); + teximacroopen(p, "Dt"); + for (cp = p->title; '\0' != *cp; cp++) +@@ -1865,8 +1861,10 @@ main(int argc, char *argv[]) + { + struct texi texi; + int c; +- char *dirpath, *dir, *ccp; ++ char *dirpath, *dir, *ccp, date[32]; + const char *progname, *Idir, *cp; ++ struct stat st; ++ time_t t; + + progname = strrchr(argv[0], '/'); + if (progname == NULL) +@@ -1878,8 +1876,11 @@ main(int argc, char *argv[]) + texi.ign = 1; + Idir = NULL; + +- while (-1 != (c = getopt(argc, argv, "I:"))) ++ while (-1 != (c = getopt(argc, argv, "d:I:"))) + switch (c) { ++ case ('d'): ++ texi.date = optarg; ++ break; + case ('I'): + Idir = optarg; + break; +@@ -1905,16 +1906,26 @@ main(int argc, char *argv[]) + *ccp = '\0'; + texi.dirs = parsedirs(&texi, dir, Idir, &texi.dirsz); + free(dirpath); ++ if (!texi.date) { ++ t = stat(argv[0], &st) == 0 ? st.st_mtime : time(NULL); ++ strftime(date, sizeof(date), "%F", localtime(&t)); ++ texi.date = date; ++ } + parsefile(&texi, argv[0], 1); + } else { + texi.title = strdup("Unknown Manual"); + texi.dirs = parsedirs(&texi, NULL, Idir, &texi.dirsz); ++ if (!texi.date) { ++ t = time(NULL); ++ strftime(date, sizeof(date), "%F", localtime(&t)); ++ texi.date = date; ++ } + parsestdin(&texi); + } + + texiexit(&texi); + return(EXIT_FAILURE); + usage: +- fprintf(stderr, "usage: %s [-Idirs] [file]\n", progname); ++ fprintf(stderr, "usage: %s [-d date] [-Idirs] [file]\n", progname); + return(EXIT_FAILURE); + } +-- +2.19.1 + diff --git a/pkg/texi2mdoc/rev b/pkg/texi2mdoc/rev @@ -1 +1 @@ -1 +2