tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: -mdoc: how to handle surrounding types?



On Thu, 8 Feb 2024, Mouse wrote:

I'm writing a manpage for a library and want to describe a function
which returns a pointer to a function.

Specifically, it takes a handler of type void (*)(const char *, int)
and returns the previous handler.  If we call it foo, then:

extern void (*foo(void (*)(const char *, int)))(const char *, int);


After a bit of fiddling with signal.3:

```
diff -urN a/signal.3 b/signal.3
--- a/signal.3	2024-01-29 23:14:46.000000000 +0000
+++ b/signal.3	2024-02-09 06:39:14.062233348 +0000
@@ -41,8 +41,9 @@
 .In signal.h
 .\" The following is Quite Ugly, but syntactically correct.  Don't try to
 .\" fix it.
+.ds cm \f[R],\f[]
 .Ft void \*(lp*
-.Fn signal "int sig" "void \*(lp*func\*(rp\*(lpint\*(rp\*(rp\*(rp\*(lpint"
+.Fn foo "void \*(lp*\*(rp\*(lpconst char *\*(cm int\*(rp\*(rp\*(rp\*(lpconst char *\*(cm int"
 .Sh DESCRIPTION
 This
 .Fn signal
```
(the `cm' string is for nroff only)

-RVP


Home | Main Index | Thread Index | Old Index