aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/mandoc.3
diff options
context:
space:
mode:
authorIngo Schwarze <schwarze@openbsd.org>2014-09-03 23:21:47 +0000
committerIngo Schwarze <schwarze@openbsd.org>2014-09-03 23:21:47 +0000
commita828d911328c6ac46d0f8c2f2d99e9f0bb46e21d (patch)
tree2e2600805b20efd2527183ad36ab9f087484bdb9 /mandoc.3
parent248398820acb6a81f0d92b7a33dc1e449dda483b (diff)
downloadmandoc-a828d911328c6ac46d0f8c2f2d99e9f0bb46e21d.tar.gz
mandoc-a828d911328c6ac46d0f8c2f2d99e9f0bb46e21d.tar.zst
mandoc-a828d911328c6ac46d0f8c2f2d99e9f0bb46e21d.zip
Add *.gz support to apropos(1) -a, man(1), and even mandoc(1).
Implemented by moving the zip code from makewhatis(8) to the parser lib.
Diffstat (limited to 'mandoc.3')
-rw-r--r--mandoc.366
1 files changed, 64 insertions, 2 deletions
diff --git a/mandoc.3 b/mandoc.3
index 8f76ad21..2ee6eae1 100644
--- a/mandoc.3
+++ b/mandoc.3
@@ -1,4 +1,4 @@
-.\" $Id: mandoc.3,v 1.25 2014/08/05 05:48:56 schwarze Exp $
+.\" $Id: mandoc.3,v 1.26 2014/09/03 23:21:47 schwarze Exp $
.\"
.\" Copyright (c) 2009, 2010, 2011 Kristaps Dzonsons <kristaps@bsd.lv>
.\" Copyright (c) 2010 Ingo Schwarze <schwarze@openbsd.org>
@@ -15,7 +15,7 @@
.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
.\"
-.Dd $Mdocdate: August 5 2014 $
+.Dd $Mdocdate: September 3 2014 $
.Dt MANDOC 3
.Os
.Sh NAME
@@ -31,11 +31,13 @@
.Nm mparse_free ,
.Nm mparse_getkeep ,
.Nm mparse_keep ,
+.Nm mparse_open ,
.Nm mparse_readfd ,
.Nm mparse_reset ,
.Nm mparse_result ,
.Nm mparse_strerror ,
.Nm mparse_strlevel
+.Nm mparse_wait ,
.Nd mandoc macro compiler library
.Sh LIBRARY
.Lb libmandoc
@@ -74,6 +76,13 @@
.Fa "struct mparse *parse"
.Fc
.Ft "enum mandoclevel"
+.Fo mparse_open
+.Fa "struct mparse *parse"
+.Fa "int *fd"
+.Fa "const char *fname"
+.Fa "pid_t *child_pid"
+.Fc
+.Ft "enum mandoclevel"
.Fo mparse_readfd
.Fa "struct mparse *parse"
.Fa "int fd"
@@ -98,6 +107,11 @@
.Fo mparse_strlevel
.Fa "enum mandoclevel"
.Fc
+.Ft "enum mandoclevel"
+.Fo mparse_wait
+.Fa "struct mparse *parse"
+.Fa "pid_t child_pid"
+.Fc
.In sys/types.h
.In mandoc.h
.In mdoc.h
@@ -361,6 +375,33 @@ Declared in
.In mandoc.h ,
implemented in
.Pa read.c .
+.It Fn mparse_open
+If the
+.Fa fname
+ends in
+.Pa .gz ,
+open with
+.Xr gunzip 1 ;
+otherwise, with
+.Xr open 2 .
+Return a file descriptor open for reading in
+.Fa fd ,
+or -1 on failure.
+It can be passed to
+.Fn mparse_readfd
+or used directly.
+If applicable, return the
+.Xr gunzip 1
+child process ID in
+.Fa child_pid ,
+or otherwise 0.
+If non-zero, it should be passed to
+.Fn mparse_wait
+after completing the parse sequence.
+Declared in
+.In mandoc.h ,
+implemented in
+.Pa read.c .
.It Fn mparse_readfd
Parse a file or file descriptor.
If
@@ -413,6 +454,27 @@ Declared in
.In mandoc.h ,
implemented in
.Pa read.c .
+.It Fn mparse_wait
+Bury a
+.Xr gunzip 1
+child process
+.Fa child_pid
+that was spawned with
+.Fn mparse_open .
+To be called after the parse sequence is complete.
+Returns
+.Dv MANDOCLEVEL_OK
+on success and
+.Dv MANDOCLEVEL_SYSERR
+on failure, that is, when
+.Xr wait 2
+fails, or when
+.Xr gunzip 1
+died from a signal or exited with non-zero status.
+Declared in
+.In mandoc.h ,
+implemented in
+.Pa read.c .
.El
.Ss Variables
.Bl -ohang