aboutsummaryrefslogtreecommitdiff
path: root/devel/c2mdoc
diff options
context:
space:
mode:
authorJohn Marino <marino@FreeBSD.org>2014-06-11 12:23:25 +0000
committerJohn Marino <marino@FreeBSD.org>2014-06-11 12:23:25 +0000
commit6163fcb80d10a1bcee60bfce156e5a3fb291f5ad (patch)
tree50484972d14e732b1c71ba59c2767101236536da /devel/c2mdoc
parent89f5d7f26da610e2f89088f753f22ea1e3f0293b (diff)
downloadports-6163fcb80d10a1bcee60bfce156e5a3fb291f5ad.tar.gz
ports-6163fcb80d10a1bcee60bfce156e5a3fb291f5ad.zip
Notes
Diffstat (limited to 'devel/c2mdoc')
-rw-r--r--devel/c2mdoc/Makefile29
-rw-r--r--devel/c2mdoc/files/c2mdoc17
-rw-r--r--devel/c2mdoc/files/c2mdoc.awk15
-rw-r--r--devel/c2mdoc/pkg-descr5
4 files changed, 66 insertions, 0 deletions
diff --git a/devel/c2mdoc/Makefile b/devel/c2mdoc/Makefile
new file mode 100644
index 000000000000..58f5067504ec
--- /dev/null
+++ b/devel/c2mdoc/Makefile
@@ -0,0 +1,29 @@
+# Created by: Bruce M. Simpson <bms@FreeBSD.org>
+# $FreeBSD$
+
+PORTNAME= c2mdoc
+PORTVERSION= 20040302
+PORTREVISION= 1
+CATEGORIES= devel textproc
+MASTER_SITES= #
+DISTFILES=
+
+MAINTAINER= portmaster@bsdforge.com
+COMMENT= Script to generate mdoc(7) markup from C functions
+
+RUN_DEPENDS= cproto:${PORTSDIR}/devel/cproto
+
+NO_BUILD= yes
+NO_WRKSUBDIR= yes
+
+PLIST_FILES= bin/c2mdoc libexec/c2mdoc.awk
+
+post-extract:
+ ${SED} -e "s|%%LIBEXECDIR%%|${PREFIX}/libexec|g;" \
+ ${FILESDIR}/c2mdoc > ${WRKDIR}/c2mdoc
+
+do-install:
+ ${INSTALL_SCRIPT} ${FILESDIR}/c2mdoc.awk ${STAGEDIR}${PREFIX}/libexec
+ ${INSTALL_SCRIPT} ${WRKDIR}/c2mdoc ${STAGEDIR}${PREFIX}/bin
+
+.include <bsd.port.mk>
diff --git a/devel/c2mdoc/files/c2mdoc b/devel/c2mdoc/files/c2mdoc
new file mode 100644
index 000000000000..e1b789998d04
--- /dev/null
+++ b/devel/c2mdoc/files/c2mdoc
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# c2mdoc -- Front-end which abuses the cproto parser to spit out
+# mdoc(7) format prototypes for use in FreeBSD documentation.
+#
+# $FreeBSD$
+#
+
+AWKSCRIPT="%%LIBEXECDIR%%/c2mdoc.awk"
+CPROTO='-P"int\tf\t(\ta\t,\tb\t)" -pq -f3'
+CPROTO_BIN=cproto
+export CPROTO
+
+${CPROTO_BIN} $1 | \
+ grep -v '/\*.*\*/' | \
+ sed -e 's/[,();]//g' | \
+ ${AWKSCRIPT}
diff --git a/devel/c2mdoc/files/c2mdoc.awk b/devel/c2mdoc/files/c2mdoc.awk
new file mode 100644
index 000000000000..447153bbc163
--- /dev/null
+++ b/devel/c2mdoc/files/c2mdoc.awk
@@ -0,0 +1,15 @@
+#!/usr/bin/awk -f
+#
+# c2mdoc.awk -- Takes tabulated output from cproto(1) and turns it into
+# mdoc(7) markup.
+#
+# $FreeBSD$
+#
+BEGIN { FS="\t" }
+{
+ printf ".Ft %s\n", $1 ;
+ printf ".Fn %s", $2 ;
+ for (i = 4; i < NF; i++)
+ printf " \"%s\"", $i
+ printf "\n" ;
+}
diff --git a/devel/c2mdoc/pkg-descr b/devel/c2mdoc/pkg-descr
new file mode 100644
index 000000000000..1f3aa49d5d37
--- /dev/null
+++ b/devel/c2mdoc/pkg-descr
@@ -0,0 +1,5 @@
+c2mdoc is a shell and awk script wrapper which abuses devel/cproto's
+parser to spit out function prototypes in a format ready to paste into
+FreeBSD developer documentation. c2man already claims to do such a
+thing, but seems crippled in the face of our kernel source. The
+toolchain used by this port whinges but still generates markup.