scdoc2mdoc

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

commit 309ff4672b7f5cba9bca1ce8657f767b51f32220
parent 18ea2825267f5ce4464db8f0d4cfe15df52956af
Author: Drew DeVault <sir@cmpwn.com>
Date:   Tue,  5 Feb 2019 15:01:42 -0500

Add pkg-config file, scdoc -v

Diffstat:
MMakefile | 2++
Rinclude/string.h -> include/str.h | 0
Ascdoc.pc | 7+++++++
Msrc/main.c | 8++++++--
Msrc/string.c | 2+-
5 files changed, 16 insertions(+), 3 deletions(-)

diff --git a/Makefile b/Makefile @@ -6,6 +6,7 @@ PREFIX?=/usr/local _INSTDIR=$(DESTDIR)$(PREFIX) BINDIR?=$(_INSTDIR)/bin MANDIR?=$(_INSTDIR)/share/man +PCDIR?=$(_INSTDIR)/lib/pkgconfig OUTDIR=.build HOST_SCDOC=./scdoc .DEFAULT_GOAL=all @@ -43,6 +44,7 @@ install: all install -Dm755 scdoc $(BINDIR)/scdoc install -Dm644 scdoc.1 $(MANDIR)/man1/scdoc.1 install -Dm644 scdoc.5 $(MANDIR)/man5/scdoc.5 + install -Dm644 scdoc.pc $(PCDIR)/scdoc.pc check: scdoc scdoc.1 scdoc.5 @find test -perm -111 -exec '{}' \; diff --git a/include/string.h b/include/str.h diff --git a/scdoc.pc b/scdoc.pc @@ -0,0 +1,7 @@ +prefix=/usr +exec_prefix=${prefix} +scdoc=${exec_prefix}/bin/scdoc + +Name: scdoc +Description: Man page generator +Version: 1.8.1 diff --git a/src/main.c b/src/main.c @@ -6,9 +6,10 @@ #include <stdbool.h> #include <stdio.h> #include <stdlib.h> +#include <string.h> #include <time.h> #include <unistd.h> -#include "string.h" +#include "str.h" #include "unicode.h" #include "util.h" @@ -686,7 +687,10 @@ static void output_scdoc_preamble(struct parser *p) { } int main(int argc, char **argv) { - if (argc > 1) { + if (argc == 2 && strcmp(argv[1], "-v") == 0) { + printf("scdoc " VERSION "\n"); + return 0; + } else if (argc > 1) { fprintf(stderr, "Usage: scdoc < input.scd > output.roff\n"); return 1; } diff --git a/src/string.c b/src/string.c @@ -1,6 +1,6 @@ #include <stdlib.h> #include <stdint.h> -#include "string.h" +#include "str.h" #include "unicode.h" static int ensure_capacity(str_t *str, size_t len) {