summaryrefslogtreecommitdiff
path: root/share/man/man7/mdoc.samples.7
blob: 549fcce8de9aeb0ccb99a4ba2e2024de6cbadac6 (plain)
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
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
1357
1358
1359
1360
1361
1362
1363
1364
1365
1366
1367
1368
1369
1370
1371
1372
1373
1374
1375
1376
1377
1378
1379
1380
1381
1382
1383
1384
1385
1386
1387
1388
1389
1390
1391
1392
1393
1394
1395
1396
1397
1398
1399
1400
1401
1402
1403
1404
1405
1406
1407
1408
1409
1410
1411
1412
1413
1414
1415
1416
1417
1418
1419
1420
1421
1422
1423
1424
1425
1426
1427
1428
1429
1430
1431
1432
1433
1434
1435
1436
1437
1438
1439
1440
1441
1442
1443
1444
1445
1446
1447
1448
1449
1450
1451
1452
1453
1454
1455
1456
1457
1458
1459
1460
1461
1462
1463
1464
1465
1466
1467
1468
1469
1470
1471
1472
1473
1474
1475
1476
1477
1478
1479
1480
1481
1482
1483
1484
1485
1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
1505
1506
1507
1508
1509
1510
1511
1512
1513
1514
1515
1516
1517
1518
1519
1520
1521
1522
1523
1524
1525
1526
1527
1528
1529
1530
1531
1532
1533
1534
1535
1536
1537
1538
1539
1540
1541
1542
1543
1544
1545
1546
1547
1548
1549
1550
1551
1552
1553
1554
1555
1556
1557
1558
1559
1560
1561
1562
1563
1564
1565
1566
1567
1568
1569
1570
1571
1572
1573
1574
1575
1576
1577
1578
1579
1580
1581
1582
1583
1584
1585
1586
1587
1588
1589
1590
1591
1592
1593
1594
1595
1596
1597
1598
1599
1600
1601
1602
1603
1604
1605
1606
1607
1608
1609
1610
1611
1612
1613
1614
1615
1616
1617
1618
1619
1620
1621
1622
1623
1624
1625
1626
1627
1628
1629
1630
1631
1632
1633
1634
1635
1636
1637
1638
1639
1640
1641
1642
1643
1644
1645
1646
1647
1648
1649
1650
1651
1652
1653
1654
1655
1656
1657
1658
1659
1660
1661
1662
1663
1664
1665
1666
1667
1668
1669
1670
1671
1672
1673
1674
1675
1676
1677
1678
1679
1680
1681
1682
1683
1684
1685
1686
1687
1688
1689
1690
1691
1692
1693
1694
1695
1696
1697
1698
1699
1700
1701
1702
1703
1704
1705
1706
1707
1708
1709
1710
1711
1712
1713
1714
1715
1716
1717
1718
1719
1720
1721
1722
1723
1724
1725
1726
1727
1728
1729
1730
1731
1732
1733
1734
1735
1736
1737
1738
1739
1740
1741
1742
1743
1744
1745
1746
1747
1748
1749
1750
1751
1752
1753
1754
1755
1756
1757
1758
1759
1760
1761
1762
1763
1764
1765
1766
1767
1768
1769
1770
1771
1772
1773
1774
1775
1776
1777
1778
1779
1780
1781
1782
1783
1784
1785
1786
1787
1788
1789
1790
1791
1792
1793
1794
1795
1796
1797
1798
1799
1800
1801
1802
1803
1804
1805
1806
1807
1808
1809
1810
1811
1812
1813
1814
1815
1816
1817
1818
1819
1820
1821
1822
1823
1824
1825
1826
1827
1828
1829
1830
1831
1832
1833
1834
1835
1836
1837
1838
1839
1840
1841
1842
1843
1844
1845
1846
1847
1848
1849
1850
1851
1852
1853
1854
1855
1856
1857
1858
1859
1860
1861
1862
1863
1864
1865
1866
1867
1868
1869
1870
1871
1872
1873
1874
1875
1876
1877
1878
1879
1880
1881
1882
1883
1884
1885
1886
1887
1888
1889
1890
1891
1892
1893
1894
1895
1896
1897
1898
1899
1900
1901
1902
1903
1904
1905
1906
1907
1908
1909
1910
1911
1912
1913
1914
1915
1916
1917
1918
1919
1920
1921
1922
1923
1924
1925
1926
1927
1928
1929
1930
1931
1932
1933
1934
1935
1936
1937
1938
1939
1940
1941
1942
1943
1944
1945
1946
1947
1948
1949
1950
1951
1952
1953
1954
1955
1956
1957
1958
1959
1960
1961
1962
1963
1964
1965
1966
1967
1968
1969
1970
1971
1972
1973
1974
1975
1976
1977
1978
1979
1980
1981
1982
1983
1984
1985
1986
1987
1988
1989
1990
1991
1992
1993
1994
1995
1996
1997
1998
1999
2000
2001
2002
2003
2004
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
2027
2028
2029
2030
2031
2032
2033
2034
2035
2036
2037
2038
2039
2040
2041
2042
2043
2044
2045
2046
2047
2048
2049
2050
2051
2052
2053
2054
2055
2056
2057
2058
2059
2060
2061
2062
2063
2064
2065
2066
2067
2068
2069
2070
2071
2072
2073
2074
2075
2076
2077
2078
2079
2080
2081
2082
2083
2084
2085
2086
2087
2088
2089
2090
2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
2117
2118
2119
2120
2121
2122
2123
2124
2125
2126
2127
2128
2129
2130
2131
2132
2133
2134
2135
2136
2137
2138
2139
2140
2141
2142
2143
2144
2145
2146
2147
2148
2149
2150
2151
2152
2153
2154
2155
2156
2157
2158
2159
2160
2161
2162
2163
2164
2165
2166
2167
2168
2169
2170
2171
2172
2173
2174
2175
2176
2177
2178
2179
2180
2181
2182
2183
2184
2185
2186
2187
2188
2189
2190
2191
2192
2193
2194
2195
2196
2197
2198
2199
2200
2201
2202
2203
2204
2205
2206
2207
2208
2209
2210
2211
2212
2213
2214
2215
2216
2217
2218
2219
2220
2221
2222
2223
2224
2225
2226
2227
2228
2229
2230
2231
2232
2233
2234
2235
2236
2237
2238
2239
2240
2241
2242
2243
2244
2245
2246
2247
2248
2249
2250
2251
2252
2253
2254
2255
2256
2257
2258
2259
2260
2261
2262
2263
2264
2265
2266
2267
2268
2269
2270
2271
2272
2273
2274
2275
2276
2277
2278
2279
2280
2281
2282
2283
2284
2285
2286
2287
2288
2289
2290
2291
2292
2293
2294
2295
2296
2297
2298
2299
2300
2301
2302
2303
2304
2305
2306
2307
2308
2309
2310
2311
2312
2313
2314
2315
2316
2317
2318
2319
2320
2321
2322
2323
2324
2325
2326
2327
2328
2329
2330
2331
2332
2333
2334
2335
2336
2337
2338
2339
2340
2341
2342
2343
2344
2345
2346
2347
2348
2349
2350
2351
2352
2353
2354
2355
2356
2357
2358
2359
2360
2361
2362
2363
2364
2365
2366
2367
2368
2369
2370
2371
2372
2373
2374
2375
2376
2377
2378
2379
2380
2381
2382
2383
2384
2385
2386
2387
2388
2389
2390
2391
2392
2393
2394
2395
2396
2397
2398
2399
2400
2401
2402
2403
2404
2405
2406
2407
2408
2409
2410
2411
2412
2413
2414
2415
2416
2417
2418
2419
2420
2421
2422
2423
2424
2425
2426
2427
2428
2429
2430
2431
2432
2433
2434
2435
2436
2437
2438
2439
2440
2441
2442
2443
2444
2445
2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
2458
2459
2460
2461
2462
2463
2464
2465
2466
2467
2468
2469
2470
2471
2472
2473
2474
2475
2476
2477
2478
2479
2480
2481
2482
2483
2484
2485
2486
2487
2488
2489
2490
2491
2492
2493
2494
2495
2496
2497
2498
2499
2500
2501
2502
2503
2504
2505
2506
2507
2508
2509
2510
2511
2512
2513
2514
2515
2516
2517
2518
2519
2520
2521
2522
2523
2524
2525
2526
2527
2528
2529
2530
2531
2532
2533
2534
2535
2536
2537
2538
2539
2540
2541
2542
2543
2544
2545
2546
2547
2548
2549
2550
2551
2552
2553
2554
2555
2556
2557
2558
2559
2560
2561
2562
2563
2564
2565
2566
2567
2568
2569
2570
2571
2572
2573
2574
2575
2576
2577
2578
2579
2580
2581
2582
2583
2584
2585
2586
2587
2588
2589
2590
2591
2592
2593
2594
2595
2596
2597
2598
2599
2600
2601
2602
2603
2604
2605
2606
2607
2608
2609
2610
2611
2612
2613
2614
2615
2616
2617
2618
2619
2620
2621
2622
2623
2624
2625
2626
2627
2628
2629
2630
2631
2632
2633
2634
2635
2636
2637
2638
2639
2640
2641
2642
2643
2644
2645
2646
2647
2648
2649
2650
2651
2652
2653
2654
2655
2656
2657
2658
2659
2660
2661
2662
2663
2664
2665
2666
2667
2668
2669
2670
2671
2672
2673
2674
2675
2676
2677
2678
2679
2680
2681
2682
2683
2684
2685
2686
2687
2688
2689
2690
2691
2692
2693
2694
2695
2696
2697
2698
2699
2700
2701
2702
2703
2704
2705
2706
2707
2708
2709
2710
2711
2712
2713
2714
2715
2716
2717
2718
2719
2720
2721
2722
2723
2724
2725
2726
2727
2728
2729
2730
2731
2732
2733
2734
2735
2736
2737
2738
2739
2740
2741
2742
2743
2744
2745
2746
2747
2748
2749
2750
2751
2752
2753
2754
2755
2756
2757
2758
2759
2760
2761
2762
2763
2764
2765
2766
2767
2768
2769
2770
2771
2772
2773
2774
2775
2776
2777
2778
2779
2780
2781
2782
2783
2784
2785
2786
2787
2788
2789
2790
2791
2792
2793
2794
2795
2796
2797
2798
2799
2800
2801
2802
2803
2804
2805
2806
2807
2808
2809
2810
2811
2812
2813
2814
2815
2816
2817
2818
2819
2820
2821
2822
2823
2824
2825
2826
2827
2828
2829
2830
2831
2832
2833
2834
2835
2836
2837
2838
2839
2840
2841
2842
2843
2844
2845
2846
2847
2848
2849
2850
2851
2852
2853
2854
2855
2856
2857
2858
2859
2860
2861
2862
2863
2864
2865
2866
2867
2868
2869
2870
2871
2872
2873
2874
2875
2876
2877
2878
2879
2880
2881
2882
2883
2884
2885
2886
2887
2888
2889
2890
2891
2892
2893
2894
2895
2896
2897
2898
2899
2900
2901
2902
2903
2904
2905
2906
2907
2908
2909
2910
2911
2912
2913
2914
2915
2916
2917
2918
2919
2920
2921
2922
2923
2924
2925
2926
2927
2928
2929
2930
2931
2932
2933
2934
2935
2936
2937
2938
2939
2940
2941
2942
2943
2944
2945
2946
2947
2948
2949
2950
2951
2952
2953
2954
2955
2956
2957
2958
2959
2960
2961
2962
2963
2964
2965
2966
2967
2968
2969
2970
2971
2972
2973
2974
2975
2976
2977
2978
2979
2980
2981
2982
2983
2984
2985
2986
2987
2988
2989
2990
2991
2992
2993
2994
2995
2996
2997
2998
2999
3000
3001
3002
3003
3004
3005
3006
3007
3008
3009
3010
3011
3012
3013
3014
3015
3016
3017
3018
3019
3020
3021
3022
3023
3024
3025
3026
3027
3028
3029
3030
3031
3032
3033
3034
3035
.\"	$OpenBSD: mdoc.samples.7,v 1.39 2003/02/25 08:51:31 jmc Exp $
.\"	$NetBSD: mdoc.samples.7,v 1.5 1996/04/03 20:17:34 jtc Exp $
.\"
.\" Copyright (c) 1990, 1993
.\"	The Regents of the University of California.  All rights reserved.
.\"
.\" 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. All advertising materials mentioning features or use of this software
.\"    must display the following acknowledgement:
.\"	This product includes software developed by the University of
.\"	California, Berkeley and its contributors.
.\" 4. Neither the name of the University nor the names of its contributors
.\"    may be used to endorse or promote products derived from this software
.\"    without specific prior written permission.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``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 REGENTS OR CONTRIBUTORS 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.
.\"
.\"     @(#)mdoc.samples.7	8.2 (Berkeley) 12/30/93
.\"
.\" This tutorial sampler invokes every macro in the package several
.\" times and is guaranteed to give a worst case performance
.\" for an already extremely slow package.
.\"
.Dd December 30, 1993
.Dt MDOC.SAMPLES 7
.Os
.Sh NAME
.Nm mdoc.samples
.Nd tutorial sampler for writing
.Ox
manuals with
.Nm \-mdoc
.Sh SYNOPSIS
.Nm man mdoc.samples
.Sh DESCRIPTION
A tutorial sampler for writing
.Ox
manual pages with the
.Nm \-mdoc
macro package, a
.Em content Ns \-based
and
.Em domain Ns \-based
formatting
package for
.Xr troff 1 .
Its predecessor, the \-man package (see
.Xr man 7 )
addressed page layout leaving the
manipulation of fonts and other
typesetting details to the individual author.
.Pp
In
.Nm \-mdoc ,
page layout macros
make up the
.Em "page structure domain"
which consists of macros for titles, section headers, displays
and lists.
Essentially items which affect the physical position
of text on a formatted page.
In addition to the page structure domain, there are two more domains,
the manual domain and the general text domain.
.Pp
The general text domain is defined as macros which
perform tasks such as quoting or emphasizing pieces of text.
The manual domain is defined as macros that are a subset of the
day to day informal language used to describe commands, routines
and related
.Ox
files.
Macros in the manual domain handle
command names, command line arguments and options, function names,
function parameters, pathnames, variables, cross
references to other manual pages, and so on.
These domain
items have value
for both the author and the future user of the manual page.
It is hoped the consistency gained
across the manual set will provide easier
translation to future documentation tools.
.Pp
Throughout the
.Ux
manual pages, a manual entry
is simply referred
to as a man page, regardless of actual length and without
sexist intention.
.Sh GETTING STARTED
Since a tutorial document is normally read when a person
desires to use the material immediately, the assumption has
been made that the user of this document may be impatient.
The material presented in the remainder of this document is
outlined as follows:
.Bl -enum -offset indent
.It
.Tn "TROFF IDIOSYNCRASIES"
.Bl -tag -width flag -compact -offset indent
.It "Macro Usage" .
.It "Passing Space Characters in an Argument" .
.It "Trailing Blank Space Characters (a warning)" .
.It "Escaping Special Characters" .
.El
.It
.Tn "THE ANATOMY OF A MAN PAGE"
.Bl -tag -width flag -compact -offset indent
.It "A manual page template" .
.El
.It
.Tn "TITLE MACROS"
.It
.Tn "INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS"
.Bl -tag -width flag -compact -offset indent
.It "What's in a name..." .
.It "General Syntax" .
.El
.It
.Tn "MANUAL DOMAIN"
.Bl -tag -width flag -compact -offset indent
.It "Addresses" .
.It "Arguments" .
.It "Configuration Declarations (section four only)" .
.It "Command Modifier" .
.It "Defined Variables" .
.It "Errno (Section two only)" .
.It "Environment Variables" .
.It "Function Argument" .
.It "Function Declaration" .
.It "Flags" .
.It "Functions (library routines)" .
.It "Function Types" .
.\" .It "Header File (including source code)" .
.It "Interactive Commands" .
.It "Literals" .
.It "Names" .
.It "Options" .
.It "Pathnames" .
.It "Standards" .
.It "Variables" .
.It "Cross References" .
.El
.It
.Tn "GENERAL TEXT DOMAIN"
.Bl -tag -width flag -compact -offset indent
.It "AT&T Macro" .
.It "BSD Macro" .
.It "BSDI Macro" .
.It "OpenBSD/FreeBSD/NetBSD Macros" .
.It "UNIX Macro" .
.It "Emphasis Macro" .
.It "Enclosure/Quoting Macros"
.Bl -tag -width flag -compact -offset indent
.It "Angle Bracket Quote/Enclosure" .
.It "Bracket Quotes/Enclosure" .
.It "Double Quote macro/Enclosure" .
.It "Parenthesis Quote/Enclosure" .
.It "Single Quotes/Enclosure" .
.It "Prefix Macro" .
.El
.It "Extended Arguments" .
.It "No\-Op or Normal Text Macro" .
.It "No Space Macro" .
.It "Section Cross References" .
.It "Symbolic Macro" .
.It "References and Citations" .
.It "Trade Names (Acronyms and Type Names)" .
.El
.It
.Tn "PAGE STRUCTURE DOMAIN"
.Bl -tag -width flag -compact -offset indent
.It "Section Headers" .
.It "Paragraphs and Line Spacing" .
.It "Keeps" .
.It "Displays" .
.It "Lists and Columns" .
.El
.It
.Tn "PREDEFINED STRINGS"
.It
.Tn "DIAGNOSTICS"
.It
.Tn "FORMATTING WITH GROFF, TROFF AND NROFF"
.It
.Tn "BUGS"
.El
.Sh TROFF IDIOSYNCRASIES
The
.Nm \-mdoc
package attempts to simplify the process of writing a man page.
Theoretically, one should not have to learn the dirty details of
.Xr troff 1
to use
.Nm \-mdoc ;
however, there are a few
limitations which are unavoidable and best gotten out
of the way.
And, too, be forewarned, this package is
.Em not
fast.
.Ss Macro Usage
As in
.Xr troff 1 ,
a macro is called by placing a
.Ql \&\.
(dot character)
at the beginning of
a line followed by the two character name for the macro.
Arguments may follow the macro separated by spaces.
It is the dot character at the beginning of the line which causes
.Xr troff 1
to interpret the next two characters as a macro name.
To place a
.Ql \&\.
(dot character)
at the beginning of a line in some context other than
a macro invocation, precede the
.Ql \&\.
(dot) with the
.Ql \e&
escape sequence.
The
.Ql \e&
translates literally to a zero width space, and is never displayed in the
output.
.Pp
In general,
.Xr troff 1
macros accept up to nine arguments, any
extra arguments are ignored.
Most macros in
.Nm \-mdoc
accept nine arguments and,
in limited cases, arguments may be continued or extended
on the
next line (See
.Sx Extended Arguments ) .
A few macros handle quoted arguments (see
.Sx Passing Space Characters in an Argument
below).
.Pp
Most of the
.Nm \-mdoc
general text domain and manual domain macros are special
in that their argument lists are
.Em parsed
for callable macro names.
This means an argument on the argument list which matches
a general text or manual domain macro name and is determined
to be callable will be executed
or called when it is processed.
In this case
the argument, although the name of a macro,
is not preceded by a
.Ql \&\.
(dot).
It is in this manner that many macros are nested; for
example
the option macro,
.Ql \&.Op ,
may
.Em call
the flag and argument macros,
.Ql \&Fl
and
.Ql \&Ar ,
to specify an optional flag with an argument:
.Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
.It Op Fl s Ar bytes
is produced by
.Li \&.Op \&Fl s \&Ar bytes
.El
.Pp
To prevent a two character
string from being interpreted as a macro name, precede
the string with the
escape sequence
.Ql \e& :
.Bl -tag -width "\&.Op \&Fl s \&Ar bytes" -offset indent
.It Op \&Fl s \&Ar bytes
is produced by
.Li \&.Op \e&Fl s \e&Ar bytes
.El
.Pp
Here the strings
.Ql \&Fl
and
.Ql \&Ar
are not interpreted as macros.
Macros whose argument lists are parsed for callable arguments
are referred to
as parsed and macros which may be called from an argument
list are referred to as callable
throughout this document and in the companion quick reference
manual
.Xr mdoc 7 .
This is a technical
.Em faux pas
as almost all of the macros in
.Nm \-mdoc
are parsed, but as it was cumbersome to constantly refer to macros
as being callable and being able to call other macros,
the term parsed has been used.
.Ss Passing Space Characters in an Argument
Sometimes it is desirable to give as one argument a string
containing one or more blank space characters.
This may be necessary
to defeat the nine argument limit or to specify arguments to macros
which expect particular arrangement of items in the argument list.
For example,
the function macro
.Ql \&.Fn
expects the first argument to be the name of a function and any
remaining arguments to be function parameters.
As
.Tn "ANSI C"
stipulates the declaration of function parameters in the
parenthesized parameter list, each parameter is guaranteed
to be at minimum a two word string.
For example,
.Fa int foo .
.Pp
There are two possible ways to pass an argument which contains
an embedded space.
.Em Implementation note :
Unfortunately, the most convenient way
of passing spaces in between quotes by reassigning individual
arguments before parsing was fairly expensive speed wise
and space wise to implement in all the macros for
.Tn AT&T
.Xr troff 1 .
It is not expensive for
.Xr groff 1
but for the sake of portability, has been limited
to the following macros which need
it the most:
.Pp
.Bl -tag -width 4n -offset indent -compact
.It Li \&Cd
Configuration declaration (section 4
.Sx SYNOPSIS )
.It Li \&Bl
Begin list (for the width specifier).
.It Li \&Em
Emphasized text.
.It Li \&Fn
Functions (sections two and four).
.It Li \&It
List items.
.It Li \&Li
Literal text.
.It Li \&Sy
Symbolic text.
.It Li \&%B
Book titles.
.It Li \&%J
Journal names.
.It Li \&%O
Optional notes for a reference.
.It Li \&%R
Report title (in a reference).
.It Li \&%T
Title of article in a book or journal.
.El
.Pp
One way of passing a string
containing blank spaces is to use the hard or unpaddable space character
.Ql \e\  ,
that is, a blank space preceded by the escape character
.Ql \e .
This method may be used with any macro but has the side effect
of interfering with the adjustment of text
over the length of a line.
.Em Troff
sees the hard space as if it were any other printable character and
cannot split the string into blank or newline separated pieces as one
would expect.
The method is useful for strings which are not expected
to overlap a line boundary.
For example:
.Bl -tag -width "fetch(char *str)" -offset indent
.It Fn fetch char\ *str
is created by
.Ql \&.Fn fetch char\e *str
.It Fn fetch "char *str"
can also be created by
.Ql \&.Fn fetch "\\*qchar *str\\*q"
.El
.Pp
If the
.Ql \e
or quotes
were omitted,
.Ql \&.Fn
would see three arguments and
the result would be:
.Pp
.Dl Fn fetch char *str
.Pp
For an example of what happens when the parameter list overlaps
a newline boundary, see the
.Sx BUGS
section.
.Ss Trailing Blank Space Characters
.Em Troff
can be confused by blank space characters at the end of a line.
It
is a wise preventive measure to globally remove all blank spaces
from <blank-space><end-of-line> character sequences.
Should the need
arise to force a blank character at the end of a line,
it may be forced with an unpaddable space and the
.Ql \e&
escape character.
For example,
.Ql string\e\ \e& .
.Ss Escaping Special Characters
Special characters
like the newline character
.Ql \en ,
are handled by replacing the
.Ql \e
with
.Ql \ee
(e.g.,
.Ql \een )
to preserve
the backslash.
.Sh THE ANATOMY OF A MAN PAGE
The body of a man page is easily constructed from a basic
template found in the file
.Pa /usr/share/misc/mdoc.template .
.Bd -literal -offset indent
\&.\e" /usr/share/misc/mdoc.template:
\&.\e" The following six lines are required for all man pages.
\&.Dd Month day, year
\&.Dt DOCUMENT_TITLE [section number] [volume]
\&.Os OPERATING_SYSTEM [version/release]
\&.Sh NAME
\&.Sh SYNOPSIS
\&.Sh DESCRIPTION
\&.\e" The following requests should be uncommented and
\&.\e" used where appropriate.  This next request is
\&.\e" for sections 2 and 3 function return values only.
\&.\e" .Sh RETURN VALUES
\&.\e" This next request is for sections 1, 6, 7 & 8 only
\&.\e" .Sh ENVIRONMENT
\&.\e" .Sh FILES
\&.\e" .Sh EXAMPLES
\&.\e" This next request is for sections 1, 6, 7 & 8 only
\&.\e"     (command return values (to shell) and
\&.\e"	  fprintf/stderr type diagnostics)
\&.\e" .Sh DIAGNOSTICS
\&.\e" The next request is for sections 2 and 3 error
\&.\e" and signal handling only.
\&.\e" .Sh ERRORS
\&.\e" .Sh SEE ALSO
\&.\e" .Sh STANDARDS
\&.\e" .Sh HISTORY
\&.\e" .Sh AUTHORS
\&.\e" .Sh BUGS
.Ed
.Pp
The first items in the template are the macros
.Pq Li \&.Dd , \&.Dt , \&.Os ;
the document date,
the man page title
.Pq Em in upper case
along with the section of the manual the page
belongs in,
and the operating system the man page or subject source is developed or
modified for.
These macros identify the page,
and are discussed below in
.Sx TITLE MACROS .
.Pp
The remaining items in the template are section headers
.Pq Li \&.Sh ;
of which
.Sx NAME ,
.Sx SYNOPSIS
and
.Sx DESCRIPTION
are mandatory.
The
headers are
discussed in
.Sx PAGE STRUCTURE DOMAIN ,
after
presentation of
.Sx MANUAL DOMAIN .
Several content macros are used to demonstrate page layout macros;
reading about content macros before page layout macros is
recommended.
.Sh TITLE MACROS
The title macros are the first portion of the page structure
domain, but are presented first and separate for someone who
wishes to start writing a man page yesterday.
Three header macros designate the document title or manual page title,
the operating system,
and the date of authorship.
These macros are called once at the very beginning of the document
and are used to construct the headers and footers only.
.Bl -tag -width 6n
.It Li \&.Dd month day, year
The date should be written formally:
.Pp
.Dl January 25, 1989
.It Li \&.Dt DOCUMENT_TITLE section# [volume]
The document title is the
subject of the man page and must be in
.Tn CAPITALS
due to troff
limitations.
The section number may be 1,\ ...,\ 9,
and if it is specified,
the volume title may be omitted.
A volume title may be arbitrary or one of the following:
.\" .Cl
.\" USD	UNIX User's Supplementary Documents
.\" .Cl
.\" PS1	UNIX Programmer's Supplementary Documents
.Pp
.Bl -column SMM -offset indent -compact
.It Li AMD	OpenBSD Ancestral Manual Documents
.It Li SMM	OpenBSD System Manager's Manual
.It Li URM	OpenBSD Reference Manual
.It Li PRM	OpenBSD Programmer's Manual
.It Li KM	OpenBSD Kernel Manual
.El
.Pp
The default volume labeling is
.Li URM
for sections 1, 6, and 7;
.Li SMM
for section 8;
.Li PRM
for sections 2, 3, 4, and 5;
.Li KM
for section 9.
.\" .Cl
.\" MMI	UNIX Manual Master Index
.\" .Cl
.\" CON	UNIX Contributed Software Manual
.\" .Cl
.\" LOC	UNIX Local Manual
.It Li \&.Os operating_system release#
The name of the operating system
should be the common acronym, e.g.,
.Tn OpenBSD
or
.Tn ATT .
The release should be the standard release
nomenclature for the system specified, e.g., 4.3, 4.3+Tahoe, V.3,
V.4.
Unrecognized arguments are displayed as given in the page footer.
For instance, a typical footer might be:
.Pp
.Dl \&.Os OpenBSD 3.2
.Pp
or for a locally produced set
.Pp
.Dl \&.Os CS Department
.Pp
The 
.Ox
default,
.Ql \&.Os
without an argument, has been defined as
.Ox 2.7
in the site specific file
.Pa /usr/share/tmac/mdoc/doc-common .
It really should default to
.Tn LOCAL .
Note, if the
.Ql \&.Os
macro is not present, the bottom left corner of the page
will be ugly.
.El
.Sh INTRODUCTION OF MANUAL AND GENERAL TEXT DOMAINS
.Ss What's in a name...
The manual domain macro names are derived from the day to day
informal language used to describe commands, subroutines and related
files.
Slightly
different variations of this language are used to describe
the three different aspects of writing a man page.
First, there is the description of
.Nm \-mdoc
macro request usage.
Second is the description of a
.Ux
command
.Em with
.Nm \-mdoc
macros and third,
the
description of a command to a user in the verbal sense;
that is, discussion of a command in the text of a man page.
.Pp
In the first case,
.Xr troff 1
macros are themselves a type of command;
the general syntax for a
.Xr troff 1
command is:
.Bd -literal -offset indent
\&.Va argument1 argument2 ... argument9
.Ed
.Pp
The
.Ql \&.Va
is a macro command or request, and anything following it is an argument to
be processed.
In the second case,
the description of a
.Ux
command using the content macros is a
bit more involved;
a typical
.Sx SYNOPSIS
command line might be displayed as:
.Bd -filled -offset indent
.Nm filter
.Op Fl flag
.Ar infile outfile
.Ed
.Pp
Here,
.Nm filter
is the command name and the
bracketed string
.Fl flag
is a
.Em flag
argument designated as optional by the option brackets.
In
.Nm \-mdoc
terms,
.Ar infile
and
.Ar outfile
are
called
.Em arguments .
The macros which formatted the above example:
.Bd -literal -offset indent
\&.Nm filter
\&.Op \&Fl flag
\&.Ar infile outfile
.Ed
.Pp
In the third case, discussion of commands and command syntax
includes both examples above, but may add more detail.
The
arguments
.Ar infile
and
.Ar outfile
from the example above might be referred to as
.Em operands
or
.Em file arguments .
Some command line argument lists are quite long:
.Bl -tag -width make -offset indent
.It Nm make
.Op Fl eiknqrstv
.Op Fl D Ar variable
.Op Fl d Ar flags
.Op Fl f Ar makefile
.Bk -words
.Op Fl I Ar directory
.Ek
.Op Fl j Ar max_jobs
.Op Ar variable=value
.Bk -words
.Op Ar target ...
.Ek
.El
.Pp
Here one might talk about the command
.Nm make
and qualify the argument
.Ar makefile ,
as an argument to the flag,
.Fl f ,
or discuss the optional
file
operand
.Ar target .
In the verbal context, such detail can prevent confusion;
however, the
.Nm \-mdoc
package
does not have a macro for an argument
.Em to
a flag.
Instead the
.Ql \&Ar
argument macro is used for an operand or file argument like
.Ar target
as well as an argument to a flag like
.Ar variable .
The make command line was produced from:
.Bd -literal -offset indent
\&.Nm make
\&.Op Fl eiknqrstv
\&.Op Fl D Ar variable
\&.Op Fl d Ar flags
\&.Op Fl f Ar makefile
\&.Op Fl I Ar directory
\&.Op Fl j Ar max_jobs
\&.Op Ar variable=value
\&.Bk -words
\&.Op Ar target ...
\&.Ek
.Ed
.Pp
The
.Ql \&.Bk
and
.Ql \&.Ek
macros are explained in
.Sx Keeps .
.Ss General Syntax
The manual domain and general text domain macros share a similar
syntax with a few minor deviations:
.Ql \&.Ar ,
.Ql \&.Fl ,
.Ql \&.Nm ,
and
.Ql \&.Pa
differ only when called without arguments;
.Ql \&.Fn
and
.Ql \&.Xr
impose an order on their argument lists
and the
.Ql \&.Op
and
.Ql \&.Fn
macros
have nesting limitations.
All content macros
are capable of recognizing and properly handling punctuation,
provided each punctuation character is separated by a leading space.
If a request is given:
.Pp
.Dl \&.Li sptr, ptr),
.Pp
The result is:
.Pp
.Dl Li sptr, ptr),
.Pp
The punctuation is not recognized and all is output in the
literal font.
If the punctuation is separated by a leading white space:
.Pp
.Dl \&.Li "sptr , ptr ) ,"
.Pp
The result is:
.Pp
.Dl Li sptr , ptr ) ,
.Pp
The punctuation is now recognized and is output in the
default font distinguishing it from the strings in literal font.
.Pp
To remove the special meaning from a punctuation character
escape it with
.Ql \e& .
.Em Troff
is limited as a macro language, and has difficulty
when presented with a string containing
a member of the mathematical, logical or
quotation set:
.Bd -literal -offset indent-two
\&{+,\-,/,*,\&%,<,>,<=,>=,=,==,&,`,',"}
.Ed
.Pp
The problem is that
.Xr troff 1
may assume it is supposed to actually perform the operation
or evaluation suggested by the characters.
To prevent the accidental evaluation of these characters,
escape them with
.Ql \e& .
Typical syntax is shown in the first content macro displayed
below,
.Ql \&.Ad .
.Sh MANUAL DOMAIN
.Ss Address Macro
The address macro identifies an address construct
of the form addr1[,addr2[,addr3]].
.Pp
.Dl Usage: .Ad address ... \*(Pu
.Bl -tag -width ".Ad f1 , f2 , f3 :" -compact -offset 14n
.It Li \&.Ad addr1
.Ad addr1
.It Li \&.Ad addr1\ .
.Ad addr1 .
.It Li \&.Ad addr1\ , file2
.Ad addr1 , file2
.It Li \&.Ad f1\ , f2\ , f3\ :
.Ad f1 , f2 , f3 :
.It Li \&.Ad addr\ )\ )\ ,
.Ad addr ) ) ,
.El
.Pp
It is an error to call
.Ql \&.Ad
without arguments.
.Ql \&.Ad
is callable by other macros and is parsed.
.Ss Argument Macro
The
.Ql \&.Ar
argument macro may be used whenever
a command line argument is referenced.
.Pp
.Dl Usage: .Ar argument ... \*(Pu
.Bl -tag -width ".Ar file1 file2" -compact -offset 15n
.It Li \&.Ar
.Ar
.It Li \&.Ar file1
.Ar file1
.It Li \&.Ar file1\ .
.Ar file1 .
.It Li \&.Ar file1 file2
.Ar file1 file2
.It Li \&.Ar f1 f2 f3\ :
.Ar f1 f2 f3 :
.It Li \&.Ar file\ )\ )\ ,
.Ar file ) ) ,
.El
.Pp
If
.Ql \&.Ar
is called without arguments
.Ql Ar
is assumed.
The
.Ql \&.Ar
macro is parsed and is callable.
.Ss Configuration Declaration (section four only)
The
.Ql \&.Cd
macro is used to demonstrate a
.Xr config 8
declaration for a device interface in a section four manual.
This macro accepts quoted arguments (double quotes only).
.Pp
.Bl -tag -width "device le0 at scode?" -offset indent
.It Cd "device le0 at scode?"
produced by:
.Ql ".Cd device le0 at scode?" .
.El
.Ss Command Modifier
The command modifier is identical to the
.Ql \&.Fl
(flag) command with the exception
the
.Ql \&.Cm
macro does not assert a dash
in front of every argument.
Traditionally flags are marked by the
preceding dash, some commands or subsets of commands do not use them.
Command modifiers may also be specified in conjunction with interactive
commands such as editor commands.
See
.Sx Flags .
.Ss Defined Variables
A variable which is defined in an include file is specified
by the macro
.Ql \&.Dv .
.Pp
.Dl Usage: .Dv defined_variable ... \*(Pu
.Bl -tag -width ".Dv MAXHOSTNAMELEN" -compact -offset 14n
.It Li ".Dv MAXHOSTNAMELEN"
.Dv MAXHOSTNAMELEN
.It Li ".Dv TIOCGPGRP )"
.Dv TIOCGPGRP )
.El
.Pp
It is an error to call
.Ql \&.Dv
without arguments.
.Ql \&.Dv
is parsed and is callable.
.Ss Errno (Section two only)
The
.Ql \&.Er
errno macro specifies the error return value
for section two library routines.
The second example
below shows
.Ql \&.Er
used with the
.Ql \&.Bq
general text domain macro, as it would be used in
a section two manual page.
.Pp
.Dl Usage: .Er ERRNOTYPE ... \*(Pu
.Bl -tag -width ".Bq Er ENOTDIR" -compact -offset 14n
.It Li \&.Er ENOENT
.Er ENOENT
.It Li \&.Er ENOENT\ )\ ;
.Er ENOENT ) ;
.It Li \&.Bq \&Er ENOTDIR
.Bq Er ENOTDIR
.El
.Pp
It is an error to call
.Ql \&.Er
without arguments.
The
.Ql \&.Er
macro is parsed and is callable.
.Ss Environment Variables
The
.Ql \&.Ev
macro specifies an environment variable.
.Pp
.Dl Usage: .Ev argument ... \*(Pu
.Bl -tag -width ".Ev PRINTER ) ) ," -compact -offset 14n
.It Li \&.Ev DISPLAY
.Ev DISPLAY
.It Li \&.Ev PATH\ .
.Ev PATH .
.It Li \&.Ev PRINTER\ )\ )\ ,
.Ev PRINTER ) ) ,
.El
.Pp
It is an error to call
.Ql \&.Ev
without arguments.
The
.Ql \&.Ev
macro is parsed and is callable.
.Ss Function Argument
The
.Ql \&.Fa
macro is used to refer to function arguments (parameters)
outside of the
.Sx SYNOPSIS
section of the manual or inside
the
.Sx SYNOPSIS
section should a parameter list be too
long for the
.Ql \&.Fn
macro and the enclosure macros
.Ql \&.Fo
and
.Ql \&.Fc
must be used.
.Ql \&.Fa
may also be used to refer to structure members.
.Pp
.Dl Usage: .Fa function_argument ... \*(Pu
.Bl -tag -width ".Fa d_namlen\ )\ )\ ," -compact -offset 14n
.It Li \&.Fa d_namlen\ )\ )\ ,
.Fa d_namlen ) ) ,
.It Li \&.Fa iov_len
.Fa iov_len
.El
.Pp
It is an error to call
.Ql \&.Fa
without arguments.
.Ql \&.Fa
is parsed and is callable.
.Ss Function Declaration
The
.Ql \&.Fd
macro is used in the
.Sx SYNOPSIS
section with section two or three
functions.
The
.Ql \&.Fd
macro does not call other macros and is not callable by other
macros.
.Pp
.Dl Usage: .Fd include_file (or defined variable)
.Pp
In the
.Sx SYNOPSIS
section a
.Ql \&.Fd
request causes a line break if a function has already been presented
and a break has not occurred.
This leaves a nice vertical space
in between the previous function call and the declaration for the
next function.
.Ss Flags
The
.Ql \&.Fl
macro handles command line flags.
It prepends
a dash,
.Ql \- ,
to the flag.
For interactive command flags, which
are not prepended with a dash, the
.Ql \&.Cm
(command modifier)
macro is identical, but without the dash.
.Pp
.Dl Usage: .Fl argument ... \*(Pu
.Bl -tag -width ".Fl \-s \-t \-v" -compact -offset 14n
.It Li \&.Fl
.Fl
.It Li \&.Fl cfv
.Fl cfv
.It Li \&.Fl cfv\ .
.Fl cfv .
.It Li \&.Fl s v t
.Fl s v t
.It Li \&.Fl -\ ,
.Fl - ,
.It Li \&.Fl xyz\ )\ ,
.Fl xyz ) ,
.El
.Pp
The
.Ql \&.Fl
macro without any arguments results
in a dash representing stdin/stdout.
Note that giving
.Ql \&.Fl
a single dash, will result in two dashes.
The
.Ql \&.Fl
macro is parsed and is callable.
.Ss Functions (library routines)
The
.Ql \&.Fn
macro is modeled on ANSI C conventions.
.Bd -literal
Usage: .Fn [type] function [[type] parameters ... \*(Pu]
.Ed
.Bl -tag -width ".Fn .int align. .const * char *sptrsxx" -compact
.It Li "\&.Fn getchar"
.Fn getchar
.It Li "\&.Fn strlen ) ,"
.Fn strlen ) ,
.It Li \&.Fn "\\*qint align\\*q" "\\*qconst * char *sptrs\\*q" ,
.Fn "int align" "const * char *sptrs" ,
.El
.Pp
It is an error to call
.Ql \&.Fn
without any arguments.
The
.Ql \&.Fn
macro
is parsed and is callable,
note that any call to another macro signals the end of
the
.Ql \&.Fn
call (it will close-parenthesis at that point).
.Pp
For functions that have more than eight parameters (and this
is rare), the macros
.Ql \&.Fo
(function open)
and
.Ql \&.Fc
(function close)
may be used with
.Ql \&.Fa
(function argument)
to get around the limitation.
For example:
.Bd -literal -offset indent
\&.Ft int
\&.Fo res_mkquery
\&.Fa "int op"
\&.Fa "char *dname"
\&.Fa "int class"
\&.Fa "int type"
\&.Fa "char *data"
\&.Fa "int datalen"
\&.Fa "struct rrec *newrr"
\&.Fa "char *buf"
\&.Fa "int buflen"
\&.Fc
.Ed
.Pp
Produces:
.Bd -filled -offset indent
.Ft int
.Fo res_mkquery
.Fa "int op"
.Fa "char *dname"
.Fa "int class"
.Fa "int type"
.Fa "char *data"
.Fa "int datalen"
.Fa "struct rrec *newrr"
.Fa "char *buf"
.Fa "int buflen"
.Fc
.Ed
.Pp
The
.Ql \&.Fo
and
.Ql \&.Fc
macros are parsed and are callable.
In the
.Sx SYNOPSIS
section, the function will always begin at
the beginning of line.
If there is more than one function
presented in the
.Sx SYNOPSIS
section and a function type has not been
given, a line break will occur, leaving a nice vertical space
between the current function name and the one prior.
At the moment,
.Ql \&.Fn
does not check its word boundaries
against
.Xr troff 1
line lengths and may split across a newline ungracefully.
This will be fixed in the near future.
.Ss Function Type
This macro is intended for the
.Sx SYNOPSIS
section.
It may be used
anywhere else in the man page without problems, but in the
.Sx SYNOPSIS
section it causes a line break after its use.
Its main purpose is to present the function type in kernel normal form
of a section two or three man page by forcing the
function name to appear on the next line.
.Pp
.Dl Usage: .Ft type ... \*(Pu
.Bl -tag -width "\&.Ft struct stat" -offset 14n -compact
.It Li \&.Ft struct stat
.Ft struct stat
.El
.Pp
The
.Ql \&.Ft
request is not callable by other macros.
.Ss Interactive Commands
The
.Ql \&.Ic
macro designates an interactive or internal command.
.Pp
.Dl Usage: .Ic command ... \*(Pu
.Bl -tag -width ".Ic setenv , unsetenvxx" -compact -offset 14n
.It Li \&.Ic :wq
.Ic :wq
.It Li \&.Ic do while {...}
.Ic do while {...}
.It Li \&.Ic setenv\ , unsetenv
.Ic setenv , unsetenv
.El
.Pp
It is an error to call
.Ql \&.Ic
without arguments.
The
.Ql \&.Ic
macro is parsed and is callable.
.Ss Literals
The
.Ql \&.Li
literal macro may be used for special characters,
variable constants, anything which should be displayed as it
would be typed.
.Pp
.Dl Usage: .Li argument ... \*(Pu
.Bl -tag -width ".Li cntrl-D ) ," -compact -offset 14n
.It Li \&.Li \een
.Li \en
.It Li \&.Li M1 M2 M3\ ;
.Li M1 M2 M3 ;
.It Li \&.Li cntrl-D\ )\ ,
.Li cntrl-D ) ,
.It Li \&.Li 1024\ ...
.Li 1024 ...
.El
.Pp
The
.Ql \&.Li
macro is parsed and is callable.
.Ss Name Macro
The
.Ql \&.Nm
macro is used for the document title or subject name.
It has the peculiarity of remembering the first
argument it was called with, which should
always be the subject name of the page.
When called without arguments,
.Ql \&.Nm
regurgitates this initial name for the sole purpose
of making less work for the author.
There are two situations, however, where
.Ql \&.Nm
should
.Em always
be given an argument:
(1) when used in the
.Sx SYNOPSIS
section and (2) when trailing punctuation is required.
.Pp
Note:
a section two
or three document function name is addressed with the
.Ql \&.Nm
in the
.Sx NAME
section, and with
.Ql \&.Fn
in the
.Sx SYNOPSIS
and remaining sections.
For interactive commands, such as the
.Ql while
command keyword in
.Xr csh 1 ,
the
.Ql \&.Ic
macro should be used.
While the
.Ql \&.Ic
is nearly identical
to
.Ql \&.Nm ,
it can not recall the first argument it was invoked with.
.Pp
.Dl Usage: .Nm argument ... \*(Pu
.Bl -tag -width ".Nm mdoc.samples ." -compact -offset 14n
.It Li \&.Nm mdoc.samples
.Nm mdoc.samples
.It Li \&.Nm
.Nm
.It Li \&.Nm mdoc.samples \&.
.Nm mdoc.samples .
.It Li \&.Nm \e-mdoc
.Nm \-mdoc
.It Li \&.Nm foo\ )\ )\ ,
.Nm foo ) ) ,
.El
.Pp
The
.Ql \&.Nm
macro is parsed and is callable.
.Ss Options
The
.Ql \&.Op
macro
places option brackets around any remaining arguments on the command
line, and places any
trailing punctuation outside the brackets.
The macros
.Ql \&.Oc
and
.Ql \&.Oo
may be used across one or more lines.
.Pp
.Dl Usage: .Op options ... \*(Pu
.Bl -tag -width ".Op Fl c Ar objfil Op Ar corfil ," -compact -offset indent
.It Li \&.Op
.Op
.It Li ".Op Fl k"
.Op Fl k
.It Li ".Op Fl k ) ."
.Op Fl k ) .
.It Li ".Op Fl k Ar kookfile"
.Op Fl k Ar kookfile
.It Li ".Op Fl k Ar kookfile ,"
.Op Fl k Ar kookfile ,
.It Li ".Op Ar objfil Op Ar corfil"
.Op Ar objfil Op Ar corfil
.It Li ".Op Fl c Ar objfil Op Ar corfil ,"
.Op Fl c Ar objfil Op Ar corfil ,
.It Li \&.Op word1 word2
.Op word1 word2
.El
.Pp
The
.Ql \&.Oc
and
.Ql \&.Oo
macros:
.Bd -literal -offset indent
\&.Oo
\&.Op \&Fl k \&Ar kilobytes
\&.Op \&Fl i \&Ar interval
\&.Op \&Fl c \&Ar count
\&.Oc
.Ed
.Pp
Produce:
.Oo
.Op Fl k Ar kilobytes
.Op Fl i Ar interval
.Op Fl c Ar count
.Oc
.Pp
The macros
.Ql \&.Op ,
.Ql \&.Oc
and
.Ql \&.Oo
are parsed and are callable.
.Ss Pathnames
The
.Ql \&.Pa
macro formats path or file names.
.Pp
.Dl Usage: .Pa pathname \*(Pu
.Bl -tag -width ".Pa /tmp/fooXXXXX ) ." -compact -offset 14n
.It Li \&.Pa /usr/share
.Pa /usr/share
.It Li \&.Pa /tmp/fooXXXXX\ )\ .
.Pa /tmp/fooXXXXX ) .
.El
.Pp
The
.Ql \&.Pa
macro is parsed and is callable.
.Ss Standards
The
.Ql \&.St
macro replaces standard abbreviature with its formal name.
.Pp
.Dl Usage: .St abbreviature
.Pp
Available pairs for
.Dq Abbreviature/Formal Name
are:
.Pp
.Bl -tag -width "-p1003.2-92XX." -compact -offset indent
.It Li "-p1003.1-88"
.St -p1003.1-88
.It Li "-p1003.1-90"
.St -p1003.1-90
.It Li "-p1003.1"
.St -p1003.1
.It Li "-p1003.1b"
.St -p1003.1b
.It Li "-p1003.1b-93"
.St -p1003.1b-93
.It Li "-p1003.1c-95"
.St -p1003.1c-95
.It Li "-p1003.1-96"
.St -p1003.1-96
.It Li "-p1003.2-92"
.St -p1003.2-92
.It Li "-p1003.2"
.St -p1003.2
.It Li "-p1387.2-95"
.St -p1387.2-95
.It Li "-p1387.2"
.St -p1387.2
.It Li "-ansiC"
.St -ansiC
.It Li "-ansiC-89"
.St -ansiC-89
.It Li "-ieee754"
.St -ieee754
.It Li "-iso8802-3"
.St -iso8802-3
.It Li "-xpg3"
.St -xpg3
.It Li "-xpg4"
.St -xpg4
.It Li "-xpg4.2"
.St -xpg4.2
.It Li "-xbd5"
.St -xbd5
.It Li "-xcu5"
.St -xcu5
.It Li "-xsh5"
.St -xsh5
.It Li "-xns5"
.St -xns5
.It Li "-xns5.2d2.0"
.St -xns5.2d2.0
.It Li "-xcurses4.2"
.St -xcurses4.2
.It Li "-susv2"
.St -susv2
.El
.Ss Variables
Generic variable reference:
.Pp
.Dl Usage: .Va variable ... \*(Pu
.Bl -tag -width ".Va char s ] ) ) ," -compact -offset 14n
.It Li \&.Va count
.Va count
.It Li \&.Va settimer ,
.Va settimer ,
.It Li \&.Va int\ *prt\ )\ :
.Va int\ *prt ) :
.It Li \&.Va char\ s\ ]\ )\ )\ ,
.Va char\ s ] ) ) ,
.El
.Pp
It is an error to call
.Ql \&.Va
without any arguments.
The
.Ql \&.Va
macro is parsed and is callable.
.Ss Manual Page Cross References
The
.Ql \&.Xr
macro expects the first argument to be
a manual page name, and the second argument, if it exists,
to be either a section page number or punctuation.
Any
remaining arguments are assumed to be punctuation.
.Pp
.Dl Usage: .Xr man_page [1,...,9] \*(Pu
.Bl -tag -width ".Xr mdoc 7 ) ) ," -compact -offset 14n
.It Li \&.Xr mdoc
.Xr mdoc
.It Li \&.Xr mdoc\ ,
.Xr mdoc ,
.It Li \&.Xr mdoc 7
.Xr mdoc 7
.It Li \&.Xr mdoc 7\ )\ )\ ,
.Xr mdoc 7 ) ) ,
.El
.Pp
The
.Ql \&.Xr
macro is parsed and is callable.
It is an error to call
.Ql \&.Xr
without
any arguments.
.Sh GENERAL TEXT DOMAIN
.Ss AT&T Macro
.Bd -literal -offset indent -compact
Usage: .At [v6 | v7 | 32v | V.1 | V.4] ... \*(Pu
.Ed
.Bl -tag -width ".At v6 ) ," -compact -offset 14n
.It Li ".At"
.At
.It Li ".At v6 ."
.At v6 .
.El
.Pp
The
.Ql \&.At
macro is
.Em not
parsed and
.Em not
callable.
It accepts at most two arguments.
.Ss BSD Macro
.Dl Usage: .Bx [Version/release] ... \*(Pu
.Bl -tag -width ".Bx 4.3 ) ," -compact -offset 14n
.It Li ".Bx"
.Bx
.It Li ".Bx 4.3 ."
.Bx 4.3 .
.El
.Pp
The
.Ql \&.Bx
macro is parsed and is callable.
.Ss BSDI Macro
.Dl Usage: .Bsx [Version/release] ... \*(Pu
.Bl -tag -width ".Bsx 3.0 ) ," -compact -offset 14n
.It Li ".Bsx"
.Bsx
.It Li ".Bsx 3.0 ."
.Bsx 3.0 .
.El
.Pp
The
.Ql \&.Bsx
macro is parsed and is callable.
.Ss OpenBSD/FreeBSD/NetBSD Macros
.Dl Usage: .Ox [Version/release] ... \*(Pu
.Bl -tag -width ".Ox 2.7 ) ," -compact -offset 14n
.It Li ".Ox"
.Ox
.It Li ".Ox 2.7 ."
.Ox 2.7 .
.El
.Pp
.Dl Usage: .Fx [Version/release] ... \*(Pu
.Bl -tag -width ".Fx 4.0 ) ," -compact -offset 14n
.It Li ".Fx"
.Fx
.It Li ".Fx 4.0 ."
.Fx 4.0 .
.El
.Pp
.Dl Usage: .Nx [Version/release] ... \*(Pu
.Bl -tag -width ".Nx 1.5 ) ," -compact -offset 14n
.It Li ".Nx"
.Nx
.It Li ".Nx 1.5 ."
.Nx 1.5 .
.El
.Pp
The
.Ql \&.Ox ,
.Ql \&.Fx ,
and
.Ql \&.Nx
macros are parsed and callable.
.Ss UNIX Macro
.Dl Usage: .Ux ... \*(Pu
.Bl -tag -width ".Ux 4.3 ) ," -compact -offset 14n
.It Li ".Ux"
.Ux
.El
.Pp
The
.Ql \&.Ux
macro is parsed and is callable.
.Ss Emphasis Macro
Text may be stressed or emphasized with the
.Ql \&.Em
macro.
The usual font for emphasis is italic.
.Pp
.Dl Usage: .Em argument ... \*(Pu
.Bl -tag -width ".Em vide infra ) ) ," -compact -offset 14n
.It Li ".Em does not"
.Em does not
.It Li ".Em exceed 1024 ."
.Em exceed 1024 .
.It Li ".Em vide infra ) ) ,"
.Em vide infra ) ) ,
.El
.\" .Pp
.\" The emphasis can be forced across several lines of text by using
.\" the
.\" .Ql \&.Bf
.\" macro discussed in
.\" .Sx Modes
.\" under
.\" .Sx PAGE STRUCTURE DOMAIN .
.\" .Pp
.\" .Bf -emphasis
.\" We are certain the reason most people desire a Harvard MBA
.\" so they can become to be successful philanthropists.  Only
.\" mathematicians and physicists go to graduate school strictly
.\" to acquire infinite wealthy and fame. Its that infinity
.\" word that does it to them. Ruins them.
.\" .Ef
.Pp
The
.Ql \&.Em
macro is parsed and is callable.
It is an error to call
.Ql \&.Em
without arguments.
.Ss Enclosure and Quoting Macros
The concept of enclosure is similar to quoting.
The object being to enclose one or more strings between
a pair of characters like quotes or parentheses.
The terms quoting and enclosure are used
interchangeably throughout this document.
Most of the
one line enclosure macros end
in small letter
.Ql q
to give a hint of quoting, but there are a few irregularities.
For each enclosure macro
there is also a pair of open and close macros which end
in small letters
.Ql o
and
.Ql c
respectively.
These can be used across one or more lines of text
and while they have nesting limitations, the one line quote macros
can be used inside
of them.
.Pp
.Bd -filled -offset indent
.Bl -column "quote " "close " "open " "Enclose Stringx(in XX) " XXstringXX
.Em " Quote	 Close	 Open	Function	Result"
.It Li ".Aq	.Ac	.Ao" Ta No Angle Bracket Enclosure	<string>
.It Li ".Bq	.Bc	.Bo" Ta No Bracket Enclosure	[string]
.It Li ".Dq	.Dc	.Do" Ta No Double Quote	``string''
.It Li "	.Ec	.Eo" Ta No Enclose String (in XX)	XXstringXX
.It Li ".Pq	.Pc	.Po" Ta No Parenthesis Enclosure	(string)
.It Li ".Ql		" Ta No Quoted Literal	`st' or string
.It Li ".Qq	.Qc	.Qo" Ta No Straight Double Quote	"string"
.It Li ".Sq	.Sc	.So" Ta No Single Quote	`string'
.El
.Ed
.Pp
Except for the irregular macros noted below, all
of the quoting macros are parsed and callable.
All handle punctuation properly, as long as it
is presented one character at a time and separated by spaces.
The quoting macros examine opening and closing punctuation
to determine whether it comes before or after the
enclosing string.
This makes some nesting possible.
.Bl -tag -width xxx,xxxx
.It Li \&.Eo , \&.Ec
These macros expect the first argument to be the
opening and closing strings respectively.
.It Li \&.Ql
The quoted literal macro behaves differently for
.Xr troff 1
than
.Xr nroff 1 .
If formatted with
.Xr nroff 1 ,
a quoted literal is always quoted.
If formatted with
.Xr troff 1 ,
an item is only quoted if the width
of the item is less than three constant width characters.
This is to make short strings more visible where the font change
to literal (constant width) is less noticeable.
.It Li \&.Pf
The prefix macro is not callable, but it is parsed:
.Bl -tag -width "(namexx" -offset indent
.It Li ".Pf ( Fa name2"
becomes
.Pf ( Fa name2 .
.El
.It Li \&.Ns
The
.Ql \&.Ns
(no space) macro, which
.Em is
callable, performs the analogous suffix function.
.El
.Pp
Examples of quoting:
.Bl -tag -width ".Aq Pa ctype.h ) ,xxxxxxxx" -compact -offset indent
.It Li \&.Aq
.Aq
.It Li \&.Aq \&Ar ctype.h\ )\ ,
.Aq Ar ctype.h ) ,
.It Li \&.Bq
.Bq
.It Li \&.Bq \&Em Greek \&, French \&.
.Bq Em Greek , French .
.It Li \&.Dq
.Dq
.It Li ".Dq string abc ."
.Dq string abc .
.It Li ".Dq \'^[A-Z]\'"
.Dq \'^[A-Z]\'
.It Li "\&.Ql man mdoc"
.Ql man mdoc
.It Li \&.Qq
.Qq
.It Li "\&.Qq string ) ,"
.Qq string ) ,
.It Li "\&.Qq string Ns ),"
.Qq string Ns ),
.It Li \&.Sq
.Sq
.It Li "\&.Sq string
.Sq string
.El
.Pp
For a good example of nested enclosure macros, see the
.Ql \&.Op
option macro.
It was created from the same
underlying enclosure macros as those presented in the list
above.
The
.Ql \&.Xo
and
.Ql \&.Xc
extended argument list macros
were also built from the same underlying routines and are a good
example of
.Nm \-mdoc
macro usage at its worst.
.Ss No\-Op or Normal Text Macro
The macro
.Ql \&.No
is
a hack for words in a macro command line which should
.Em not
be formatted and follows the conventional syntax
for content macros.
.Ss No Space Macro
The
.Ql \&.Ns
macro eliminates unwanted spaces in between macro requests.
It is useful for old style argument lists where there is no space
between the flag and argument:
.Bl -tag -width ".Op Fl I Ns Ar directoryxx" -offset indent
.It Li ".Op Fl I Ns Ar directory"
produces
.Op Fl I Ns Ar directory
.El
.Pp
Note: the
.Ql \&.Ns
macro always invokes the
.Ql \&.No
macro after eliminating the space unless another macro name
follows it.
The macro
.Ql \&.Ns
is parsed and is callable.
.Ss Section Cross References
The
.Ql \&.Sx
macro designates a reference to a section header
within the same document.
It is parsed and is callable.
.Pp
.Bl -tag -width "Li \&.Sx FILES" -offset 14n
.It Li \&.Sx FILES
.Sx FILES
.El
.Ss Symbolic
The symbolic emphasis macro is generally a boldface macro in
either the symbolic sense or the traditional English usage.
.Pp
.Dl Usage: .Sy symbol ... \*(Pu
.Bl -tag -width ".Sy Important Noticex" -compact -offset 14n
.It Li \&.Sy Important Notice
.Sy Important Notice
.El
.Pp
The
.Ql \&.Sy
macro is parsed and is callable.
Arguments to
.Ql \&.Sy
may be quoted.
.Ss References and Citations
The following macros make a modest attempt to handle references.
At best, the macros make it convenient to manually drop in a subset of
refer style references.
.Pp
.Bl -tag -width 6n -offset indent -compact
.It Li ".Rs"
Reference Start.
Causes a line break and begins collection
of reference information until the
reference end macro is read.
.It Li ".Re"
Reference End.
The reference is printed.
.It Li ".%A"
Reference author name, one name per invocation.
.It Li ".%B"
Book title.
.It Li ".%D"
Date.
.It Li ".%I"
Issuer/Publisher Name.
.It Li ".%J"
Journal name.
.It Li ".%N"
Issue number.
.It Li ".%O"
Optional information.
.It Li ".%P"
Page number.
.It Li ".%Q"
Corporate or Foreign Author.
.It Li ".%R"
Report name.
.It Li ".%T"
Title of article.
.It Li ".%V"
Volume(s).
.El
.Pp
The macros beginning with
.Ql %
are not callable, and are parsed only for the trade name macro which
returns to its caller.
(And not very predictably at the moment either.)
The purpose is to allow trade names
to be pretty printed in
.Xr troff 1 Ns / Ns ditroff
output.
.Ss Trade Names (or Acronyms and Type Names)
The trade name macro is generally a small caps macro for
all upper case words longer than two characters.
.Pp
.Dl Usage: .Tn symbol ... \*(Pu
.Bl -tag -width ".Tn ASCII" -compact -offset 14n
.It Li \&.Tn DEC
.Tn DEC
.It Li \&.Tn ASCII
.Tn ASCII
.El
.Pp
The
.Ql \&.Tn
macro
is parsed and is callable by other macros.
.Ss Extended Arguments
The
.Ql \&.Xo
and
.Ql \&.Xc
macros allow one to extend an argument list
on a macro boundary.
Argument lists cannot
be extended within a macro
which expects all of its arguments on one line such
as
.Ql \&.Op .
.Pp
Here is an example of
.Ql \&.Xo
using the space mode macro to turn spacing off:
.Bd -literal -offset indent
\&.Sm off
\&.It Xo Sy I Ar operation
\&.No \een Ar count No \een
\&.Xc
\&.Sm on
.Ed
.Pp
Produces
.Bd -filled -offset indent
.Bl -tag -width flag -compact
.Sm off
.It Xo Sy I Ar operation
.No \en Ar count No \en
.Xc
.Sm on
.El
.Ed
.Pp
Another one:
.Bd -literal -offset indent
\&.Sm off
\&.It Cm S No \&/ Ar old_pattern Xo
\&.No \&/ Ar new_pattern
\&.No \&/ Op Cm g
\&.Xc
\&.Sm on
.Ed
.Pp
Produces
.Bd -filled -offset indent
.Bl -tag -width flag -compact
.Sm off
.It Cm S No \&/ Ar old_pattern Xo
.No \&/ Ar new_pattern
.No \&/ Op Cm g
.Xc
.Sm on
.El
.Ed
.Pp
Another example of
.Ql \&.Xo
and using enclosure macros:
Test the value of an variable.
.Bd -literal -offset indent
\&.It Xo
\&.Ic .ifndef
\&.Oo \e&! Oc Ns Ar variable
\&.Op Ar operator variable ...
\&.Xc
.Ed
.Pp
Produces
.Bd -filled -offset indent
.Bl -tag -width flag -compact
.It Xo
.Ic .ifndef
.Oo \&! Oc Ns Ar variable
.Op Ar operator variable ...
.Xc
.El
.Ed
.Pp
All of the above examples have used the
.Ql \&.Xo
macro on the argument list of the
.Ql \&.It
(list-item)
macro.
The extend macros are not used very often, and when they are
it is usually to extend the list-item argument list.
Unfortunately, this is also where the extend macros are the
most finicky.
In the first two examples, spacing was turned off;
in the third, spacing was desired in part of the output but
not all of it.
To make these macros work in this situation make sure
the
.Ql \&.Xo
and
.Ql \&.Xc
macros are placed as shown in the third example.
If the
.Ql \&.Xo
macro is not alone on the
.Ql \&.It
argument list, spacing will be unpredictable.
The
.Ql \&.Ns
(no space macro)
must not occur as the first or last macro on a line
in this situation.
Out of 900 manual pages (about 1500 actual pages)
currently released with
.Bx
only fifteen use the
.Ql \&.Xo
macro.
.Sh PAGE STRUCTURE DOMAIN
.Ss Section Headers
The first three
.Ql \&.Sh
section header macros
listed below are required in every
man page.
The remaining section headers
are recommended at the discretion of the author
writing the manual page.
The
.Ql \&.Sh
macro can take up to nine arguments.
It is parsed but is not callable.
.Bl -tag -width ".Sh SYNOPSIS"
.It Li \&.Sh NAME
The
.Ql \&.Sh NAME
macro is mandatory.
If not specified,
the headers, footers and page layout defaults
will not be set and things will be rather unpleasant.
The
.Sx NAME
section consists of at least three items.
The first is the
.Ql \&.Nm
name macro naming the subject of the man page.
The second is the Name Description macro,
.Ql \&.Nd ,
which separates the subject
name from the third item, which is the description.
The
description should be the most terse and lucid possible,
as the space available is small.
.It Li \&.Sh SYNOPSIS
The
.Sx SYNOPSIS
section describes the typical usage of the
subject of a man page.
The macros required are either
.Ql \&.Nm ,
.Ql \&.Cd ,
.Ql \&.Fn ,
(and possibly
.Ql \&.Fo ,
.Ql \&.Fc ,
.Ql \&.Fd ,
.Ql \&.Ft
macros).
The function name macro
.Ql \&.Fn
is required for manual page sections 2 and 3, the command and general
name macro
.Ql \&.Nm
is required for sections 1, 5, 6, 7, 8.
Section 4 manuals require a
.Ql \&.Nm ,
.Ql \&.Fd ,
or a
.Ql \&.Cd
configuration device usage macro.
Several other macros may be necessary to produce
the synopsis line as shown below:
.Pp
.Bd -filled -offset indent
.Nm cat
.Op Fl benstuv
.Op Fl
.Ar
.Ed
.Pp
The following macros were used:
.Pp
.Dl \&.Nm cat
.Dl \&.Op \&Fl benstuv
.Dl \&.Op \&Fl
.Dl \&.Ar
.Pp
.Sy Note :
The macros
.Ql \&.Op ,
.Ql \&.Fl ,
and
.Ql \&.Ar
recognize the pipe bar character
.Ql \*(Ba ,
so a command line such as:
.Pp
.Dl ".Op Fl a | Fl b"
.Pp
will not go orbital.
.Em Troff
normally interprets a \*(Ba as a special operator.
See
.Sx PREDEFINED STRINGS
for a usable \*(Ba
character in other situations.
.It Li \&.Sh DESCRIPTION
In most cases the first text in the
.Sx DESCRIPTION
section
is a brief paragraph on the command, function or file,
followed by a lexical list of options and respective
explanations.
To create such a list, the
.Ql \&.Bl
begin-list,
.Ql \&.It
list-item and
.Ql \&.El
end-list
macros are used (see
.Sx Lists and Columns
below).
.El
.Pp
The following
.Ql \&.Sh
section headers are part of the
preferred manual page layout and must be used appropriately
to maintain consistency.
They are listed in the order
in which they would be used.
.Bl -tag -width SYNOPSIS
.It Li \&.Sh ENVIRONMENT
The
.Sx ENVIRONMENT
section should reveal any related
environment
variables and clues to their behavior and/or usage.
.It Li \&.Sh EXAMPLES
There are several ways to create examples.
See
the
.Sx EXAMPLES
section below
for details.
.It Li \&.Sh FILES
Files which are used or created by the man page subject
should be listed via the
.Ql \&.Pa
macro in the
.Sx FILES
section.
.It Li \&.Sh SEE ALSO
References to other material on the man page topic and
cross references to other relevant man pages should
be placed in the
.Sx SEE ALSO
section.
Cross references
are specified using the
.Ql \&.Xr
macro.
Cross references in the
.Sx SEE ALSO
section should be sorted by section number, and then
placed in alphabetical order and comma separated.
For example:
.Pp
.Xr ls 1 ,
.Xr ps 1 ,
.Xr group 5 ,
.Xr passwd 5
.Pp
At this time
.Xr refer 1
style references are not accommodated.
.It Li \&.Sh STANDARDS
If the command, library function or file adheres to a
specific implementation such as
.St -p1003.2
or
.St -ansiC
this should be noted here.
If the
command does not adhere to any standard, its history
should be noted in the
.Sx HISTORY
section.
.It Li \&.Sh HISTORY
Any command which does not adhere to any specific standards
should be outlined historically in this section.
.It Li \&.Sh AUTHORS
Credits, if need be, should be placed here.
.It Li \&.Sh DIAGNOSTICS
Diagnostics from a command should be placed in this section.
.It Li \&.Sh ERRORS
Specific error handling, especially from library functions
(man page sections 2 and 3) should go here.
The
.Ql \&.Er
macro is used to specify an errno.
.It Li \&.Sh BUGS
Blatant problems with the topic go here...
.El
.Pp
User specified
.Ql \&.Sh
sections may be added,
for example, this section was set with:
.Bd -literal -offset 14n
\&.Sh PAGE STRUCTURE DOMAIN
.Ed
.Ss Paragraphs and Line Spacing.
.Bl -tag -width 6n
.It Li \&.Pp
The
.Ql \&.Pp
paragraph command may be used to specify a line space where necessary.
The macro is not necessary before or after
.Ql \&.Sh
macros,
after a
.Ql \&.Ss
macro or before
a
.Ql \&.Bl
macro.
(The
.Ql \&.Bl
macro asserts a vertical distance unless the
.Fl compact
flag is given).
.El
.\" This worked with version one, need to redo for version three
.\" .Pp
.\" .Ds I
.\" .Cw (ax+bx+c) \ is\ produced\ by\ \&
.\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
.\" .Cl Cx \t\t
.\" .Li \&.Cx\ (
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Va ax
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Sy \+
.\" .Cx
.\" .Cl Cx \&(\&
.\" .Va ax
.\" .Cx +
.\" .Va by
.\" .Cx +
.\" .Va c )
.\" .Cx \t
.\" .Em is produced by
.\" .Cx \t
.\" .Li \&.Va by
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Sy \+
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Va c )
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Cx
.\" .Cx
.\" .Cw
.\" .De
.\" .Pp
.\" This example shows the same equation in a different format.
.\" The spaces
.\" around the
.\" .Li \&+
.\" signs were forced with
.\" .Li \e :
.\" .Pp
.\" .Ds I
.\" .Cw (ax\ +\ bx\ +\ c) \ is\ produced\ by\ \&
.\" .\".Cw (ax+bx+c) \&.Va_by_) \&_and_\& \&[?/]m_b1_e1_f1[?/]\&
.\" .Cl Cx \t\t
.\" .Li \&.Cx\ (
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Va a
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Sy x
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Cx \e\ +\e\ \e&
.\" .Cx
.\" .Cl Cx \&(\&
.\" .Va a
.\" .Sy x
.\" .Cx \ +\ \&
.\" .Va b
.\" .Sy y
.\" .Cx \ +\ \&
.\" .Va c )
.\" .Cx \t
.\" .Em is produced by
.\" .Cl Cx \t\t
.\" .Li \&.Va b
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Sy y
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Cx \e\ +\e\ \e&
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Va c )
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Cx
.\" .Cx
.\" .Cw
.\" .De
.\" .Pp
.\" The incantation below was
.\" lifted from the
.\" .Xr adb 1
.\" manual page:
.\" .Pp
.\" .Ds I
.\" .Cw \&[?/]m_b1_e1_f1[?/]\& is\ produced\ by
.\" .Cl Cx \t\t
.\" .Li \&.Cx Op Sy ?/
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Nm m
.\" .Cx
.\" .Cl Cx Op Sy ?/
.\" .Nm m
.\" .Ad \ b1 e1 f1
.\" .Op Sy ?/
.\" .Cx \t
.\" .Em is produced by
.\" .Cx \t
.\" .Li \&.Ar \e\ b1 e1 f1
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Op Sy ?/
.\" .Cx
.\" .Cl Cx \t\t
.\" .Li \&.Cx
.\" .Cx
.\" .Cw
.\" .De
.\" .Pp
.Ss Keeps
The only keep that is implemented at this time is for words.
The macros are
.Ql \&.Bk
(begin-keep)
and
.Ql \&.Ek
(end-keep).
The only option that
.Ql \&.Bk
accepts is
.Fl words
and is useful for preventing line breaks in the middle of options.
In the example for the make command line arguments (see
.Sx What's in a name ) ,
the keep prevented
.Xr nroff 1
from placing the flag and the argument on separate lines.
(Actually, the option macro used to prevent this from occurring,
but was dropped when the decision (religious) was made to force
right justified margins in
.Xr troff 1
as options in general look atrocious when spread across a sparse
line.
More work needs to be done with the keep macros, a
.Fl line
option needs to be added.)
.Ss Examples and Displays
There are six types of displays: a quickie, one-line indented display
.Ql \&.D1 ;
a quickie one-line literal display
.Ql \&.Dl ;
and a block-ragged, block-unfilled, block-filled, and block-literal
which use the
.Ql \&.Bd
begin-display
and
.Ql \&.Ed
end-display macros.
.Pp
.Bl -tag -width \&.Dlxx
.It Li \&.D1
(D-one) Display one line of indented text.
This macro is parsed, but it is not callable.
.Pp
.Dl Fl ldghfstru
.Pp
The above was produced by:
.Li \&.Dl \&Fl ldghfstru .
.It Li \&.Dl
(D-ell)
Display one line of indented
.Em literal
text.
The
.Ql \&.Dl
example macro has been used throughout this
file.
It allows
the indent (display) of one line of text.
Its default font is set to
constant width (literal) however
it is parsed and will recognize other macros.
It is not callable.
.Pp
.Dl % ls -ldg /usr/local/bin
.Pp
The above was produced by:
.Li \&.Dl % ls -ldg /usr/local/bin .
.It Li \&.Bd
Begin-display.
The
.Ql \&.Bd
display must be ended with the
.Ql \&.Ed
macro.
Displays may be nested within displays and lists, but may
.Em not
contain other displays; this also prohibits nesting of
.Ql \&.D1
and
.Ql \&.Dl
one-line displays.
.Ql \&.Bd
has the following syntax:
.Pp
.Dl ".Bd display-type [-offset offset_value] [-compact]"
.Pp
The display-type must be one of the following four types and
may have an offset specifier for indentation:
.Pp
.Bl -tag -width "file file_name  " -compact
.It Fl ragged
Fill, but do not adjust the right margin.
.It Fl unfilled
Do not fill.
Display a block of text as typed.
The right (and left) margin edges are left ragged.
.It Fl filled
Display a filled (formatted) block.
The block of text is formatted (the edges are filled,
not left unjustified).
.It Fl literal
Display a literal block, useful for source code or
simple tabbed or spaced text.
.It Fl file Ar file_name
The file name following the
.Fl file
flag is read and displayed.
Literal mode is
asserted and tabs are set at 8 constant width character
intervals, however any
.Xr troff 1 Ns / Ns Nm \-mdoc
commands in file will be processed.
.It Fl offset Ar string
If
.Fl offset
is specified with one of the following strings, the string
is interpreted to indicate the level of indentation for the
forthcoming block of text:
.Pp
.Bl -tag -width "indent-two" -compact
.It Ar left
Align block on the current left margin,
this is the default mode of
.Ql \&.Bd .
.It Ar center
Supposedly center the block.
At this time
unfortunately, the block merely gets
left aligned about an imaginary center margin.
.It Ar indent
Indents by one default indent value or tab.
The default
indent value is also used for the
.Ql \&.D1
display so one is guaranteed the two types of displays
will line up.
This indent is normally set to 6n or about two
thirds of an inch (six constant width characters).
.It Ar indent-two
Indents two times the default indent value.
.It Ar right
This
.Em left
aligns the block about two inches from
the right side of the page.
This macro needs
work and perhaps may never do the right thing by
.Xr troff 1 .
.El
.El
.It Li ".Ed"
End-display.
.El
.Ss Tagged Lists and Columns
There are several types of lists which may be initiated with the
.Ql \&.Bl
begin-list macro.
Items within the list
are specified with the
.Ql \&.It
item macro and
each list must end with the
.Ql \&.El
macro.
Lists other than
.Fl enum
may be nested within themselves and within displays.
The use of columns inside of lists or lists inside of columns is unproven.
.Pp
In addition, several list attributes may be specified such as
the width of a tag, the list offset, and compactness
(blank lines between items allowed or disallowed).
Most of this document has been formatted with a tag style list
.Pq Fl tag .
For a change of pace, the list-type used to present the list-types
is an over-hanging list
.Pq Fl ohang .
This type of list is quite popular with
.Tn TeX
users, but might look a bit funny after having read many pages of
tagged lists.
The following list types are accepted by
.Ql \&.Bl :
.Pp
.Bl -ohang -compact
.It Xo Fl bullet , Fl dash ,
.Fl enum , Fl hyphen , Fl item
.Xc
These five are the simplest types of lists.
Once the
.Ql \&.Bl
macro has been given, items in the list are merely
indicated by a line consisting solely of the
.Ql \&.It
macro.
For example, the source text for a simple enumerated list
would look like:
.Bd -literal -offset indent-two
\&.Bl -enum -compact
\&.It
\&Item one goes here.
\&.It
\&And item two here.
\&.It
\&Lastly item three goes here.
\&.El
.Ed
.Pp
The results:
.Pp
.Bl -enum -offset indent-two -compact
.It
Item one goes here.
.It
And item two here.
.It
Lastly item three goes here.
.El
.Pp
A simple bullet list construction:
.Bd -literal -offset indent-two
\&.Bl -bullet -compact
\&.It
\&Bullet one goes here.
\&.It
\&Bullet two here.
\&.El
.Ed
.Pp
Produces:
.Bl -bullet -offset indent-two -compact
.It
Bullet one goes here.
.It
Bullet two here.
.El
.Pp
.It Xo Fl tag , Fl diag ,
.Fl hang , Fl ohang , Fl inset
.Xc
These list types collect arguments specified with the
.Ql \&.It
macro and create a label which may be
.Em inset
into the forthcoming text,
.Em hanged
from the forthcoming text,
.Em overhanged
from above and not indented or
.Em tagged .
This
list was constructed with the
.Ql Fl ohang
list-type.
The
.Ql \&.It
macro is parsed only for the inset, hang
and tag list-types and is not callable.
Here is an example of inset labels:
.Bl -inset -offset indent
.It Em Tag
The tagged list (also called a tagged paragraph) is the
most common type of list used in the Berkeley manuals.
Use a
.Fl width
attribute as described below.
.It Em Diag
Diag lists create section four diagnostic lists
and are similar to inset lists except callable
macros are ignored.
.It Em Hang
Hanged labels are a matter of taste.
.It Em Ohang
Overhanging labels are nice when space is constrained.
.It Em Inset
Inset labels are useful for controlling blocks of
paragraphs and are valuable for converting
.Nm \-mdoc
manuals to other formats.
.El
.Pp
Here is the source text which produced the above example:
.Bd -literal -offset indent
\&.Bl -inset -offset indent
\&.It Em Tag
\&The tagged list (also called a tagged paragraph) is the
\&most common type of list used in the Berkeley manuals.
\&.It Em Diag
\&Diag lists create section four diagnostic lists
\&and are similar to inset lists except callable
\&macros are ignored.
\&.It Em Hang
\&Hanged labels are a matter of taste.
\&.It Em Ohang
\&Overhanging labels are nice when space is constrained.
\&.It Em Inset
\&Inset labels are useful for controlling blocks of
\&paragraphs and are valuable for converting
\&.Nm \-mdoc
\&manuals to other formats.
\&.El
.Ed
.Pp
Here is a hanged list with just two items:
.Bl -hang -offset indent
.It Em Hanged
labels appear similar to tagged lists when the
label is smaller than the label width.
.It Em Longer hanged list labels
blend in to the paragraph unlike
tagged paragraph labels.
.El
.Pp
And the unformatted text which created it:
.Bd -literal -offset indent
\&.Bl -hang -offset indent
\&.It Em Hanged
\&labels appear similar to tagged lists when the
\&label is smaller than the label width.
\&.It Em Longer hanged list labels
\&blend in to the paragraph unlike
\&tagged paragraph labels.
\&.El
.Ed
.Pp
The tagged list which follows uses a width specifier to control
the width of the tag.
.Pp
.Bl -tag -width "PAGEIN" -compact -offset indent
.It SL
sleep time of the process (seconds blocked)
.It PAGEIN
number of disk
.Tn I/O Ns 's
resulting from references
by the process to pages not loaded in core.
.It UID
numerical user ID of process owner
.It PPID
numerical ID of parent of process priority
(non-positive when in non-interruptible wait)
.El
.Pp
The raw text:
.Bd -literal -offset indent
\&.Bl -tag -width "PAGEIN" -compact -offset indent
\&.It SL
\&sleep time of the process (seconds blocked)
\&.It PAGEIN
\&number of disk
\&.Tn I/O Ns 's
\&resulting from references
\&by the process to pages not loaded in core.
\&.It UID
\&numerical user ID of process owner
\&.It PPID
\&numerical ID of parent of process priority
\&(non-positive when in non-interruptible wait)
\&.El
.Ed
.Pp
Acceptable width specifiers:
.Bl -tag -width Ar -offset indent
.It Fl width Ar "\&Fl"
sets the width to the default width for a flag.
All callable
macros have a default width value.
The
.Ql \&.Fl ,
value is presently
set to ten constant width characters or about five sixth of
an inch.
.It Fl width Ar "24n"
sets the width to 24 constant width characters or about two
inches.
The
.Ql n
is absolutely necessary for the scaling to work correctly.
.It Fl width Ar "ENAMETOOLONG"
sets width to the constant width length of the
string given.
.It Fl width Ar "\\*qint mkfifo\\*q"
again, the width is set to the constant width of the string
given.
.El
.Pp
If a width is not specified for the tag list type, the first
time
.Ql \&.It
is invoked, an attempt is made to determine an appropriate
width.
If the first argument to
.Ql \&.It
is a callable macro, the default width for that macro will be used
as if the macro name had been supplied as the width.
However,
if another item in the list is given with a different callable
macro name, a new and nested list is assumed.
This effectively means that
.Fl width
is required for the tag list type.
.Pp
.It Fl column
This list type generates multiple columns.
The number of columns and the width of each column is determined by
the arguments to the
.Fl column
list.
Each
.Ql \&.It
argument is parsed to make a row and each column within the row
is a separate argument separated by a tab or the
.Ql \&.Ta
macro.
.El
.Pp
The table:
.Bl -column "String" "Nroff" "Troff" -offset indent
.It Sy "String" Ta Sy "Nroff" Ta Sy "Troff"
.It Li "<=" Ta \&<\&= Ta \*(<=
.It Li ">=" Ta \&>\&= Ta \*(>=
.El
.Pp
was produced by:
.Bd -literal -offset indent
\&.Bl -column "String" "Nroff" "Troff" -offset indent
\&.It Sy "String" Ta Sy "Nroff" Ta Sy "Troff"
\&.It Li "<=" Ta \e&<\e&= Ta \e*(<=
\&.It Li ">=" Ta \e&>\e&= Ta \e*(>=
\&.El
.Ed
.Sh PREDEFINED STRINGS
The following strings are predefined and may be used by
preceding them with the
.Xr troff 1
string interpreting sequence
.Ql \&\e*(xx
where
.Em xx
is the name of the defined string or as
.Ql \&\e*x
where
.Em x
is the name of the string.
The interpreting sequence may be used any where in the text.
.Pp
.Bl -column "String " "Nroff " "Troff " -offset indent
.It Sy "String	Nroff	Troff"
.It Li "<=" Ta \&<\&= Ta \*(<=
.It Li ">=" Ta \&>\&= Ta \*(>=
.It Li "Rq" Ta "''" Ta \*(Rq
.It Li "Lq" Ta "``" Ta \*(Lq
.It Li "ua" Ta ^ Ta \*(ua
.It Li "aa" Ta ' Ta \*(aa
.It Li "ga" Ta \` Ta \*(ga
.\" .It Li "sL" Ta ` Ta \*(sL
.\" .It Li "sR" Ta ' Ta \*(sR
.It Li "q" Ta \&" Ta \*q
.It Li "Pi" Ta pi Ta \*(Pi
.It Li "Ne" Ta != Ta \*(Ne
.It Li "Le" Ta <= Ta \*(Le
.It Li "Ge" Ta >= Ta \*(Ge
.It Li "Lt" Ta < Ta \*(Gt
.It Li "Gt" Ta > Ta \*(Lt
.It Li "Pm" Ta +- Ta \*(Pm
.It Li "If" Ta infinity Ta \*(If
.It Li "Na" Ta \fINaN\fP Ta \*(Na
.It Li "Ba" Ta \fR\&|\fP Ta \*(Ba
.El
.Pp
.Sy Note :
The string named
.Ql q
should be written as
.Ql \e*q
since it is only one char.
.Sh DIAGNOSTICS
The debugging facilities for
.Nm \-mdoc
are limited, but can help detect subtle errors such
as the collision of an argument name with an internal
register or macro name.
(A what?)
A register is an arithmetic storage class for
.Xr troff 1
with a one or two character name.
All registers internal to
.Nm \-mdoc
for
.Xr troff 1
and
.Em ditroff
are two characters and
of the form <upper_case><lower_case> such as
.Ql \&Ar ,
<lower_case><upper_case> as
.Ql \&aR
or
<upper or lower letter><digit> as
.Ql \&C\&1 .
And adding to the muddle,
.Xr troff
has its own internal registers all of which are either
two lower case characters or a dot plus a letter or meta-character
character.
In one of the introduction examples, it was shown how to
prevent the interpretation of a macro name with the escape sequence
.Ql \e& .
This is sufficient for the internal register names also.
.Pp
.\" Every callable macro name has a corresponding register
.\" of the same name (<upper_case><lower_case>).
.\" There are also specific registers which have
.\" been used for stacks and arrays and are listed in the
.\" .Sx Appendix .
.\" .Bd -ragged -offset 4n
.\" [A-Z][a-z]	registers corresponding to macro names (example ``Ar'')
.\" [a-z][A-Z]	registers corresponding to macro names (example ``aR'')
.\" C[0-9]		argument types (example C1)
.\" O[0-9]		offset stack (displays)
.\" h[0-9]		horizontal spacing stack (lists)
.\" o[0-9]		offset (stack) (lists)
.\" t[0-9]		tag stack (lists)
.\" v[0-9]		vertical spacing stack (lists)
.\" w[0-9]		width tag/label stack
.\" .Ed
.\" .Pp
If a non-escaped register name is given in the argument list of a request
unpredictable behavior will occur.
In general, any time huge portions
of text do not appear where expected in the output, or small strings
such as list tags disappear, chances are there is a misunderstanding
about an argument type in the argument list.
Your mother never intended for you to remember this evil stuff - so here
is a way to find out whether or not your arguments are valid: The
.Ql \&.Db
(debug)
macro displays the interpretation of the argument list for most
macros.
Macros such as the
.Ql \&.Pp
(paragraph)
macro do not contain debugging information.
All of the callable macros do,
and it is strongly advised whenever in doubt,
turn on the
.Ql \&.Db
macro.
.Pp
.Dl Usage: \&.Db [on | off]
.Pp
An example of a portion of text with
the debug macro placed above and below an
artificially created problem (a flag argument
.Ql \&aC
which should be
.Ql \e&aC
in order to work):
.Bd -literal -offset indent
\&.Db on
\&.Op Fl aC Ar file )
\&.Db off
.Ed
.Pp
The resulting output:
.Bd -literal -offset indent
DEBUGGING ON
DEBUG(argv) MACRO: `.Op'  Line #: 2
	Argc: 1  Argv: `Fl'  Length: 2
	Space: `'  Class: Executable
	Argc: 2  Argv: `aC'  Length: 2
	Space: `'  Class: Executable
	Argc: 3  Argv: `Ar'  Length: 2
	Space: `'  Class: Executable
	Argc: 4  Argv: `file'  Length: 4
	Space: ` '  Class: String
	Argc: 5  Argv: `)'  Length: 1
	Space: ` '  Class: Closing Punctuation or suffix
	MACRO REQUEST: .Op Fl aC Ar file )
DEBUGGING OFF
.Ed
.Pp
The first line of information tells the name of the calling
macro, here
.Ql \&.Op ,
and the line number it appears on.
If one or more files are involved
(especially if text from another file is included) the line number
may be bogus.
If there is only one file, it should be accurate.
The second line gives the argument count, the argument
.Pq Li \&Fl
and its length.
If the length of an argument is two characters, the
argument is tested to see if it is executable (unfortunately, any
register which contains a non-zero value appears executable).
The third line gives the space allotted for a class, and the
class type.
The problem here is the argument
.Ql \&aC
should not be executable.
The four types of classes are string, executable, closing
punctuation and opening punctuation.
The last line shows the entire
argument list as it was read.
In this next example, the offending
.Ql \&aC
is escaped:
.Bd -literal -offset indent
\&.Db on
\&.Em An escaped \e&aC
\&.Db off
.Ed
.Bd -literal -offset indent
DEBUGGING ON
DEBUG(fargv) MACRO: `.Em'  Line #: 2
	Argc: 1  Argv: `An'  Length: 2
	Space: ` '  Class: String
	Argc: 2  Argv: `escaped'  Length: 7
	Space: ` '  Class: String
	Argc: 3  Argv: `aC'  Length: 2
	Space: ` '  Class: String
	MACRO REQUEST: .Em An escaped &aC
DEBUGGING OFF
.Ed
.Pp
The argument
.Ql \e&aC
shows up with the same length of 2 as the
.Ql \e&
sequence produces a zero width, but a register
named
.Ql \e&aC
was not found and the type classified as string.
.Pp
Other diagnostics consist of usage statements and are self explanatory.
.Sh GROFF, TROFF AND NROFF
The
.Nm \-mdoc
package does not need compatibility mode with
.Xr groff 1 .
.Pp
The package inhibits page breaks, and the headers and footers
which normally occur at those breaks with
.Xr nroff 1 ,
to make the manual more efficient for viewing on-line.
At the moment,
.Xr groff 1
with
.Fl T Ns Ar ascii
does eject the imaginary remainder of the page at end of file.
The inhibiting of the page breaks makes
.Xr nroff 1 Ns 'd
files unsuitable for hardcopy.
There is a register named
.Ql \&cR
which can be set to zero in the site dependent style file
.Pa /usr/share/tmac/mdoc/doc-nroff
to restore the old style behavior.
.Sh FILES
.Bl -tag -width /usr/share/misc/mdoc.template -compact
.It Pa /usr/share/tmac/tmac.doc
manual macro package
.It Pa /usr/share/misc/mdoc.template
template for writing a man page
.El
.Sh SEE ALSO
.Xr man 1 ,
.Xr groff 1 ,
.Xr nroff 1 ,
.Xr troff 1 ,
.Xr mdoc 7
.Sh BUGS
Undesirable hyphenation on the dash of a flag
argument is not yet resolved, and causes
occasional mishaps in the
.Sx DESCRIPTION
section.
(line break on the hyphen).
.Pp
Predefined strings are not declared in documentation.
.Pp
Section 3f has not been added to the header routines.
.Pp
.Ql \&.Nm
font should be changed in
.Sx NAME
section.
.Pp
.Ql \&.Fn
needs to have a check to prevent splitting up
if the line length is too short.
Occasionally it
separates the last parenthesis, and sometimes
looks ridiculous if a line is in fill mode.
.Pp
The method used to prevent header and footer page
breaks (other than the initial header and footer) when using
.Xr nroff 1
occasionally places an unsightly partially filled line (blank)
at the would be bottom of the page.
.Pp
If the outer-most list definition does not have a
.Fl width
argument, the
.Ql \&.It
elements of inner lists may not work (producing a list where
each successive element
.Dq walks
to the right).
.Pp
The list and display macros do not do any keeps
and certainly should be able to.
.\" Note what happens if the parameter list overlaps a newline
.\" boundary.
.\" to make sure a line boundary is crossed:
.\" .Bd -literal
.\" \&.Fn struct\e\ dictionarytable\e\ *dictionarylookup struct\e\ dictionarytable\e\ *tab[]
.\" .Ed
.\" .Pp
.\" produces, nudge nudge,
.\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
.\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] ,
.\" nudge
.\" .Fn struct\ dictionarytable\ *dictionarylookup char\ *h struct\ dictionarytable\ *tab[] .
.\" .Pp
.\" If double quotes are used, for example:
.\" .Bd -literal
.\" \&.Fn \*qstruct dictionarytable *dictionarylookup\*q \*qchar *h\*q \*qstruct dictionarytable *tab[]\*q
.\" .Ed
.\" .Pp
.\" produces, nudge nudge,
.\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
.\" nudge
.\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" ,
.\" nudge
.\" .Fn "struct dictionarytable *dictionarylookup" "char *h" "struct dictionarytable *tab[]" .
.\" .Pp
.\" Not a pretty sight...
.\" In a paragraph, a long parameter containing unpaddable spaces as
.\" in the former example will cause
.\" .Xr troff
.\" to break the line and spread
.\" the remaining words out.
.\" The latter example will adjust nicely to
.\" justified margins, but may break in between an argument and its
.\" declaration.
.\" In
.\" .Xr nroff
.\" the right margin adjustment is normally ragged and the problem is
.\" not as severe.