Commit ba9e2a5a9cc097047517257383795a3335faea43

Guillem Jover 2017-06-05T06:33:47

man: Add new libbsd(7) library overview man page

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
diff --git a/COPYING b/COPYING
index 3b943fd..eedf465 100644
--- a/COPYING
+++ b/COPYING
@@ -3,7 +3,7 @@ Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
 Files:
  *
 Copyright:
- Copyright © 2004-2006, 2008-2015 Guillem Jover <guillem@hadrons.org>
+ Copyright © 2004-2006, 2008-2017 Guillem Jover <guillem@hadrons.org>
 License: BSD-3-clause
 
 Files:
diff --git a/man/arc4random.3bsd b/man/arc4random.3bsd
index 9602ad9..8958099 100644
--- a/man/arc4random.3bsd
+++ b/man/arc4random.3bsd
@@ -44,7 +44,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdlib.h
+.In stdlib.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft uint32_t
 .Fn arc4random "void"
 .Ft void
diff --git a/man/bitstring.3bsd b/man/bitstring.3bsd
index cd9b5bf..4eb0be3 100644
--- a/man/bitstring.3bsd
+++ b/man/bitstring.3bsd
@@ -45,7 +45,10 @@
 .Nm bit_test
 .Nd bit-string manipulation macros
 .Sh SYNOPSIS
-.In bsd/bitstring.h
+.In bitstring.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft bitstr_t *
 .Fn bit_alloc "int nbits"
 .Ft void
diff --git a/man/byteorder.3bsd b/man/byteorder.3bsd
index ddb010f..21214ee 100644
--- a/man/byteorder.3bsd
+++ b/man/byteorder.3bsd
@@ -33,6 +33,9 @@
 .Nd byte order operations
 .Sh SYNOPSIS
 .In sys/endian.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft uint16_t
 .Fn be16dec "const void *"
 .Ft uint32_t
diff --git a/man/closefrom.3bsd b/man/closefrom.3bsd
index 472c985..1af7e67 100644
--- a/man/closefrom.3bsd
+++ b/man/closefrom.3bsd
@@ -35,7 +35,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/unistd.h
+.In unistd.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft void
 .Fn closefrom "int lowfd"
 .Sh DESCRIPTION
diff --git a/man/errc.3bsd b/man/errc.3bsd
index 1b1579f..6b8b3fd 100644
--- a/man/errc.3bsd
+++ b/man/errc.3bsd
@@ -41,6 +41,9 @@
 .Lb libbsd
 .Sh SYNOPSIS
 .In err.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft void
 .Fn errc "int status" "int code" "const char *fmt" "..."
 .Ft void
diff --git a/man/expand_number.3bsd b/man/expand_number.3bsd
index b97f5e5..cd36ab9 100644
--- a/man/expand_number.3bsd
+++ b/man/expand_number.3bsd
@@ -35,7 +35,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/libutil.h
+.In libutil.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft int
 .Fo expand_number
 .Fa "const char *buf" "uint64_t *num"
diff --git a/man/explicit_bzero.3bsd b/man/explicit_bzero.3bsd
index 2bed62a..bfe583a 100644
--- a/man/explicit_bzero.3bsd
+++ b/man/explicit_bzero.3bsd
@@ -39,7 +39,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/string.h
+.In string.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft void
 .Fn explicit_bzero "void *buf" "size_t len"
 .Sh DESCRIPTION
diff --git a/man/fgetln.3bsd b/man/fgetln.3bsd
index cc7b735..992e245 100644
--- a/man/fgetln.3bsd
+++ b/man/fgetln.3bsd
@@ -38,7 +38,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdio.h
+.In stdio.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft char *
 .Fn fgetln "FILE *stream" "size_t *len"
 .Sh DESCRIPTION
diff --git a/man/fgetwln.3bsd b/man/fgetwln.3bsd
index 7557d52..5c05388 100644
--- a/man/fgetwln.3bsd
+++ b/man/fgetwln.3bsd
@@ -39,7 +39,10 @@
 .Lb libbsd
 .Sh SYNOPSIS
 .In stdio.h
-.In bsd/wchar.h
+.In wchar.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft wchar_t *
 .Fn fgetwln "FILE * restrict stream" "size_t * restrict len"
 .Sh DESCRIPTION
diff --git a/man/flopen.3bsd b/man/flopen.3bsd
index f430dc0..4bb23b2 100644
--- a/man/flopen.3bsd
+++ b/man/flopen.3bsd
@@ -36,7 +36,10 @@
 .Lb libbsd
 .Sh SYNOPSIS
 .In sys/fcntl.h
-.In bsd/libutil.h
+.In libutil.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft int
 .Fn flopen "const char *path" "int flags"
 .Ft int
diff --git a/man/fmtcheck.3bsd b/man/fmtcheck.3bsd
index 7bf5d39..0a1797f 100644
--- a/man/fmtcheck.3bsd
+++ b/man/fmtcheck.3bsd
@@ -37,7 +37,10 @@ format string
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdio.h
+.In stdio.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft const char *
 .Fn fmtcheck "const char *fmt_suspect" "const char *fmt_default"
 .Sh DESCRIPTION
diff --git a/man/fparseln.3bsd b/man/fparseln.3bsd
index 9170417..a3fd325 100644
--- a/man/fparseln.3bsd
+++ b/man/fparseln.3bsd
@@ -32,7 +32,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdio.h
+.In stdio.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft "char *"
 .Fo "fparseln"
 .Fa "FILE *stream" "size_t *len" "size_t *lineno"
diff --git a/man/fpurge.3bsd b/man/fpurge.3bsd
index d4d0b89..96a4017 100644
--- a/man/fpurge.3bsd
+++ b/man/fpurge.3bsd
@@ -42,6 +42,9 @@
 .Lb libbsd
 .Sh SYNOPSIS
 .In stdio.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft int
 .Fn fpurge "FILE *stream"
 .Sh DESCRIPTION
diff --git a/man/funopen.3bsd b/man/funopen.3bsd
index 123c124..7c867b6 100644
--- a/man/funopen.3bsd
+++ b/man/funopen.3bsd
@@ -42,7 +42,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdio.h
+.In stdio.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft FILE *
 .Fn funopen "const void *cookie" "int (*readfn)(void *, char *, int)" "int (*writefn)(void *, const char *, int)" "off_t (*seekfn)(void *, off_t, int)" "int (*closefn)(void *)"
 .Ft FILE *
diff --git a/man/getbsize.3bsd b/man/getbsize.3bsd
index 38ec41a..817711e 100644
--- a/man/getbsize.3bsd
+++ b/man/getbsize.3bsd
@@ -38,7 +38,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdlib.h
+.In stdlib.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft char *
 .Fn getbsize "int *headerlenp" "long *blocksizep"
 .Sh DESCRIPTION
diff --git a/man/getpeereid.3bsd b/man/getpeereid.3bsd
index 84c776e..9292ed3 100644
--- a/man/getpeereid.3bsd
+++ b/man/getpeereid.3bsd
@@ -36,7 +36,10 @@
 .Lb libbsd
 .Sh SYNOPSIS
 .In sys/types.h
-.In bsd/unistd.h
+.In unistd.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft int
 .Fn getpeereid "int s" "uid_t *euid" "gid_t *egid"
 .Sh DESCRIPTION
diff --git a/man/getprogname.3bsd b/man/getprogname.3bsd
index fe32efb..d29064f 100644
--- a/man/getprogname.3bsd
+++ b/man/getprogname.3bsd
@@ -42,7 +42,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdlib.h
+.In stdlib.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft const char *
 .Fn getprogname "void"
 .Ft void
diff --git a/man/heapsort.3bsd b/man/heapsort.3bsd
index eefe157..48b4d8f 100644
--- a/man/heapsort.3bsd
+++ b/man/heapsort.3bsd
@@ -42,7 +42,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdlib.h
+.In stdlib.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft int
 .Fo heapsort
 .Fa "void *base"
diff --git a/man/humanize_number.3bsd b/man/humanize_number.3bsd
index e0ffdf0..5d5472a 100644
--- a/man/humanize_number.3bsd
+++ b/man/humanize_number.3bsd
@@ -38,7 +38,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdlib.h
+.In stdlib.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft int
 .Fn dehumanize_number "const char *str" "int64_t *result"
 .Ft int
diff --git a/man/libbsd.7 b/man/libbsd.7
new file mode 100644
index 0000000..216bc01
--- /dev/null
+++ b/man/libbsd.7
@@ -0,0 +1,206 @@
+.\" libbsd man page
+.\"
+.\" Copyright © 2017 Gullem Jover <guillem@hadrons.org>
+.\"
+.\" Redistribution and use in source and binary forms, with or without
+.\" modification, are permitted provided that the following conditions
+.\" are met:
+.\" 1. Redistributions of source code must retain the above copyright
+.\"    notice, this list of conditions and the following disclaimer.
+.\" 2. Redistributions in binary form must reproduce the above copyright
+.\"    notice, this list of conditions and the following disclaimer in the
+.\"    documentation and/or other materials provided with the distribution.
+.\" 3. The name of the author may not be used to endorse or promote products
+.\"    derived from this software without specific prior written permission.
+.\"
+.\" THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
+.\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
+.\" AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL
+.\" THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+.\" EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+.\" PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+.\" OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+.\" WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+.\" OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+.\" ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+.\"
+.Dd May 31 2017
+.Dt LIBBSD 7
+.Os
+.Sh NAME
+.Nm libbsd
+.Nd utility functions from BSD systems
+.Sh DESCRIPTION
+The
+.Nm libbsd
+library provides a set if compatibility macros and functions commonly found
+on BSD-based systems.
+Its purpose is to make those available on non-BSD based systems to ease
+portability.
+.Pp
+The library can be used in an overlay mode, which is the preferred way, so
+that the code is portable and requires no modification to the original BSD
+code.
+This can be done easily with the
+.Xr pkg-config 3
+library named
+.Pa libbsd-overlay .
+Or by adding the system-specific include directory with the
+.Pa bsd/
+suffix to the list of system include paths.
+With
+.Nm gcc
+this could be
+.Ar -isystem ${includedir}/bsd .
+In addition the
+.Dv LIBBSD_OVERLAY
+pre-processor variable needs to be defined.
+The includes in this case should be the usual system ones, such as
+.In unistd.h .
+.Pp
+The other way to use the library is to use the namespaced headers,
+this is less portable as it makes using
+.Nm libbsd
+mandatory and it will not work on BSD-based systems, and requires
+modifying original BSD code.
+This can be done with the
+.Xr pkg-config 3
+library named
+.Pa libbsd .
+The includes in this case should be namespaced with
+.Pa bsd/ ,
+such as
+.In bsd/unistd.h .
+.Pp
+The package also provides a
+.Pa bsd-ctor
+static library that can be used to inject automatic constructors into a
+program so that the
+.Fn setproctitle
+function gets invoked automatically at startup time.
+This can be done with the
+.Xr pkg-config 3
+library named
+.Pa libbsd-ctor .
+.Sh HEADERS
+The following are the headers provided by
+.Nm libbsd ,
+that extend the standard system headers.
+They can work in normal or overlay modes, for the former they need to
+be prefixed with
+.Pa bsd/ .
+.Pp
+.Bl -tag -width 4m -compact
+.It In bitstring.h
+.It In err.h
+.It In getopt.h
+.It In libutil.h
+.It In md5.h
+.It In netinet/ip_icmp.h
+.It In nlist.h
+.It In readpassphrase.h
+.It In stdio.h
+.It In stdlib.h
+.It In string.h
+.It In stringlist.h
+.It In sys/bitstring.h
+.It In sys/cdefs.h
+.It In sys/endian.h
+.It In sys/poll.h
+.It In sys/queue.h
+.It In sys/tree.h
+.It In timeconv.h
+.It In unistd.h
+.It In vis.h
+.It In wchar.h
+.El
+.Pp
+The following is a
+.Pa libbsd
+specific convenience header, that includes some of the extended headers.
+It only works in non-overlay mode.
+.Pp
+.Bl -tag -width 4m -compact
+.It In bsd/bsd.h
+.El
+.Sh DEPRECATED
+Some functions have been deprecated, they will emit warnings at compile time
+and possibly while being linked at run-time.
+This might be due to the functions not being portable at all to other
+systems, making the package not buildable there; not portable in a correct
+or non-buggy way; or because there are better more portable replacements now.
+.Pp
+This is the list of currently deprecated macros and functions:
+.Bl -tag -width 4m
+.It Fn fgetln
+Unportable, requires assistance from the stdio layer.
+An implementation has to choose between leaking buffers or being reentrant
+for a limited amount of streams (this implementation chose the latter with
+a limit of 32).
+Use
+.Fn getline 3
+instead, which is available in many systems and required by
+.St -p1003.1-2008 .
+.It Fn funopen
+Unportable, requires assistance from the stdio layer or some hook framework.
+On GNU systems the
+.Fn fopencookie
+function can be used.
+Otherwise the code needs to be prepared for neither of these functions being
+available.
+.El
+.Pp
+In addition, the MD5 set of digest funtions are now provided by the
+.Nm libmd
+companion library, so it is advised to use that instead, as the ones
+provided in
+.Nm libbsd
+might disappear on the next SONAME bump.
+.Sh SEE ALSO
+.Xr arc4random 3bsd ,
+.Xr bitstring 3bsd ,
+.Xr byteorder 3bsd ,
+.Xr closefrom 3bsd ,
+.Xr errc 3bsd ,
+.Xr expand_number 3bsd ,
+.Xr explicit_bzero 3bsd ,
+.Xr fgetln 3bsd ,
+.Xr fgetwln 3bsd ,
+.Xr flopen 3bsd ,
+.Xr fmtcheck 3bsd ,
+.Xr fparseln 3bsd ,
+.Xr fpurge 3bsd ,
+.Xr funopen 3bsd ,
+.Xr getbsize 3bsd ,
+.Xr getpeereid 3bsd ,
+.Xr getprogname 3bsd ,
+.Xr heapsort 3bsd ,
+.Xr humanize_number 3bsd ,
+.Xr md5 3bsd ,
+.Xr nlist 3bsd ,
+.Xr pidfile 3bsd ,
+.Xr queue 3bsd ,
+.Xr radixsort 3bsd ,
+.Xr readpassphrase 3bsd ,
+.Xr reallocarray 3bsd ,
+.Xr reallocf 3bsd ,
+.Xr setmode 3bsd ,
+.Xr setproctitle 3bsd ,
+.Xr stringlist 3bsd ,
+.Xr strlcpy 3bsd ,
+.Xr strmode 3bsd ,
+.Xr strnstr 3bsd ,
+.Xr strtonum 3bsd ,
+.Xr tree 3bsd ,
+.Xr unvis 3bsd ,
+.Xr vis 3bsd ,
+.Xr wcslcpy 3bsd .
+.Sh HISTORY
+The
+.Nm libbsd
+project started in the Debian GNU/kFreeBSD port as a way to ease porting
+code from FreeBSD to the GNU-based system.
+Pretty early on it was generalized and a project created on FreeDesktop.org
+for other distributions and projects to use.
+.Pp
+It is now distributed as part of most non-BSD distributions.
diff --git a/man/mdX.3bsd b/man/mdX.3bsd
index 095a269..38ed0d3 100644
--- a/man/mdX.3bsd
+++ b/man/mdX.3bsd
@@ -28,7 +28,10 @@
 .Lb libbsd
 .Sh SYNOPSIS
 .Fd #include <sys/types.h>
-.Fd #include <bsd/mdX.h>
+.Fd #include <mdX.h>
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft void
 .Fn MDXInit "MDX_CTX *context"
 .Ft void
diff --git a/man/nlist.3bsd b/man/nlist.3bsd
index 25624c7..aa6e1ea 100644
--- a/man/nlist.3bsd
+++ b/man/nlist.3bsd
@@ -38,7 +38,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/nlist.h
+.In nlist.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft int
 .Fn nlist "const char *filename" "struct nlist *nl"
 .Sh DESCRIPTION
diff --git a/man/pidfile.3bsd b/man/pidfile.3bsd
index 91596dc..2eede98 100644
--- a/man/pidfile.3bsd
+++ b/man/pidfile.3bsd
@@ -37,7 +37,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/libutil.h
+.In libutil.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft "struct pidfh *"
 .Fn pidfile_open "const char *path" "mode_t mode" "pid_t *pidptr"
 .Ft int
diff --git a/man/queue.3bsd b/man/queue.3bsd
index 7a5ed95..272f253 100644
--- a/man/queue.3bsd
+++ b/man/queue.3bsd
@@ -113,7 +113,10 @@
 .Nd implementations of singly-linked lists, singly-linked tail queues,
 lists and tail queues
 .Sh SYNOPSIS
-.In bsd/sys/queue.h
+.In sys/queue.h
+(See
+.Xr libbsd 7
+for include usage.)
 .\"
 .Fn SLIST_EMPTY "SLIST_HEAD *head"
 .Fn SLIST_ENTRY "TYPE"
diff --git a/man/radixsort.3bsd b/man/radixsort.3bsd
index 069e401..cb1222b 100644
--- a/man/radixsort.3bsd
+++ b/man/radixsort.3bsd
@@ -41,7 +41,10 @@
 .Lb libbsd
 .Sh SYNOPSIS
 .In limits.h
-.In bsd/stdlib.h
+.In stdlib.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft int
 .Fn radixsort "const unsigned char **base" "int nmemb" "const unsigned char *table" "unsigned endbyte"
 .Ft int
diff --git a/man/readpassphrase.3bsd b/man/readpassphrase.3bsd
index 967f8d3..d0237b5 100644
--- a/man/readpassphrase.3bsd
+++ b/man/readpassphrase.3bsd
@@ -28,7 +28,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.Fd #include <bsd/readpassphrase.h>
+.Fd #include <readpassphrase.h>
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft char *
 .Fn readpassphrase "const char *prompt" "char *buf" "size_t bufsiz" "int flags"
 .Sh DESCRIPTION
diff --git a/man/reallocarray.3bsd b/man/reallocarray.3bsd
index 71a047e..fb96d1c 100644
--- a/man/reallocarray.3bsd
+++ b/man/reallocarray.3bsd
@@ -42,7 +42,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdlib.h
+.In stdlib.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft void *
 .Fn reallocarray "void *ptr" "size_t nmemb" "size_t size"
 .Sh DESCRIPTION
diff --git a/man/reallocf.3bsd b/man/reallocf.3bsd
index 99152b6..764ea34 100644
--- a/man/reallocf.3bsd
+++ b/man/reallocf.3bsd
@@ -42,7 +42,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stdlib.h
+.In stdlib.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft void *
 .Fn reallocf "void *ptr" "size_t size"
 .Sh DESCRIPTION
diff --git a/man/setmode.3bsd b/man/setmode.3bsd
index 5073d43..4f425c3 100644
--- a/man/setmode.3bsd
+++ b/man/setmode.3bsd
@@ -41,7 +41,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/unistd.h
+.In unistd.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft void *
 .Fn setmode "const char *mode_str"
 .Ft mode_t
diff --git a/man/setproctitle.3bsd b/man/setproctitle.3bsd
index dd5df59..304e01f 100644
--- a/man/setproctitle.3bsd
+++ b/man/setproctitle.3bsd
@@ -31,7 +31,10 @@
 .Lb libbsd
 .Sh SYNOPSIS
 .In sys/types.h
-.In bsd/unistd.h
+.In unistd.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft void
 .Fn setproctitle_init "int argc" "char *argv[]" "char *envp[]"
 .Ft void
diff --git a/man/stringlist.3bsd b/man/stringlist.3bsd
index c62e444..7c5833a 100644
--- a/man/stringlist.3bsd
+++ b/man/stringlist.3bsd
@@ -41,7 +41,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/stringlist.h
+.In stringlist.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft StringList *
 .Fn sl_init "void"
 .Ft int
diff --git a/man/strlcpy.3bsd b/man/strlcpy.3bsd
index bf14b4f..4a16bc7 100644
--- a/man/strlcpy.3bsd
+++ b/man/strlcpy.3bsd
@@ -25,7 +25,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/string.h
+.In string.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft size_t
 .Fn strlcpy "char *dst" "const char *src" "size_t size"
 .Ft size_t
diff --git a/man/strmode.3bsd b/man/strmode.3bsd
index b505537..5796fca 100644
--- a/man/strmode.3bsd
+++ b/man/strmode.3bsd
@@ -38,7 +38,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/string.h
+.In string.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft void
 .Fn strmode "mode_t mode" "char *bp"
 .Sh DESCRIPTION
diff --git a/man/strnstr.3bsd b/man/strnstr.3bsd
index 28bb0f8..19cf4cc 100644
--- a/man/strnstr.3bsd
+++ b/man/strnstr.3bsd
@@ -43,7 +43,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/string.h
+.In string.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft char *
 .Fn strnstr "const char *big" "const char *little" "size_t len"
 .Sh DESCRIPTION
diff --git a/man/strtonum.3bsd b/man/strtonum.3bsd
index f159a23..d279ff1 100644
--- a/man/strtonum.3bsd
+++ b/man/strtonum.3bsd
@@ -26,7 +26,10 @@
 .Lb libbsd
 .Sh SYNOPSIS
 .In limits.h
-.In bsd/stdlib.h
+.In stdlib.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft long long
 .Fo strtonum
 .Fa "const char *nptr"
diff --git a/man/tree.3bsd b/man/tree.3bsd
index 643b0ee..0c30d67 100644
--- a/man/tree.3bsd
+++ b/man/tree.3bsd
@@ -76,7 +76,10 @@
 .Nm RB_REMOVE
 .Nd implementations of splay and red-black trees
 .Sh SYNOPSIS
-.In bsd/sys/tree.h
+.In sys/tree.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Fn SPLAY_PROTOTYPE NAME TYPE FIELD CMP
 .Fn SPLAY_GENERATE NAME TYPE FIELD CMP
 .Fn SPLAY_ENTRY TYPE
diff --git a/man/unvis.3bsd b/man/unvis.3bsd
index 5ff42fe..58f88d9 100644
--- a/man/unvis.3bsd
+++ b/man/unvis.3bsd
@@ -39,7 +39,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/vis.h
+.In vis.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft int
 .Fn unvis "char *cp" "char c" "int *astate" "int flag"
 .Ft int
diff --git a/man/vis.3bsd b/man/vis.3bsd
index cf2cd98..b77266d 100644
--- a/man/vis.3bsd
+++ b/man/vis.3bsd
@@ -41,7 +41,10 @@
 .Lb libbsd
 .Sh SYNOPSIS
 .In stdlib.h
-.In bsd/vis.h
+.In vis.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft char *
 .Fn vis "char *dst" "int c" "int flag" "int nextc"
 .Ft int
diff --git a/man/wcslcpy.3bsd b/man/wcslcpy.3bsd
index 0d6011b..5c60d95 100644
--- a/man/wcslcpy.3bsd
+++ b/man/wcslcpy.3bsd
@@ -46,7 +46,10 @@
 .ds str-Lb-libbsd Utility functions from BSD systems (libbsd, \-lbsd)
 .Lb libbsd
 .Sh SYNOPSIS
-.In bsd/wchar.h
+.In wchar.h
+(See
+.Xr libbsd 7
+for include usage.)
 .Ft size_t
 .Fn wcslcat "wchar_t *s1" "const wchar_t *s2" "size_t n"
 .Ft size_t