scdoc2mdoc

A fork of scdoc to output mdoc(7)
git clone git://git.sgregoratto.me/scdoc2mdoc
Log | Files | Refs | README | LICENSE

commit 688923fabc4b09aff9f92f5b0c62d96fff7aced7
parent a4c7cc6187134c6d916b72d02c2f21b65a31aece
Author: Drew DeVault <sir@cmpwn.com>
Date:   Sun, 10 Dec 2017 00:52:56 -0500

That code belongs elsewhere

Diffstat:
Msrc/main.c | 11+++++------
1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -9,8 +9,6 @@ #include "unicode.h" #include "util.h" -char date[256]; - static int parse_section(struct parser *p) { str_t *section = str_create(); uint32_t ch; @@ -41,6 +39,11 @@ static void parse_preamble(struct parser *p) { str_t *name = str_create(); int section = -1; uint32_t ch; + char date[256]; + time_t now; + time(&now); + struct tm *now_tm = localtime(&now); + strftime(date, sizeof(date), "%F", now_tm); while ((ch = parser_getch(p)) != UTF8_INVALID) { if (isalnum(ch)) { assert(str_append_ch(name, ch) != -1); @@ -248,10 +251,6 @@ int main(int argc, char **argv) { fprintf(stderr, "Usage: scdoc < input.scd > output.roff"); return 1; } - time_t now; - time(&now); - struct tm *now_tm = localtime(&now); - strftime(date, sizeof(date), "%F", now_tm); struct parser p = { .input = stdin, .output = stdout,