summaryrefslogtreecommitdiff
path: root/etc/MAKEDEV.mansub
blob: 5c4627c01b80c951a6ca93015313a57228bea118 (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
dnl	$OpenBSD: MAKEDEV.mansub,v 1.2 2004/02/20 19:13:01 miod Exp $
dnl
dnl Copyright (c) 2004, Miodrag Vallat
dnl Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org>
dnl
dnl Permission to use, copy, modify, and distribute this software for any
dnl purpose with or without fee is hereby granted, provided that the above
dnl copyright notice and this permission notice appear in all copies.
dnl
dnl THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
dnl WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
dnl MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
dnl ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
dnl WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
dnl ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
dnl OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
dnl
dnl This file is an m4 file, really. It's a clone of MAKEDEV.sub, then
dnl adapted to mdoc output. This means, mostly removed from any non-trivial
dnl content...
dnl
dnl o First, a change of quote to make shell statements like: `command`
dnl   possible
dnl
changequote(`{-', `-}')dnl
dnl
dnl o version info must be stripped of $ so we can say 'generated from' below
dnl
dnl  If we just use the version string how are we going to know what arch
dnl  'MAKEDEV.md,v' came from?
dnl
dnl  Thus, I have used the below to create a version string looking like
dnl  'OpenBSD: etc.sparc/MAKEDEV.inc,v...' which works, although requires
dnl  some attention if ported to another Id string setup.
dnl
dnl
dnl Initialize the stacks stored in _m4_*
dnl
undefine({-_m4_cvs_ver-})dnl
pushdef({-_m4_cvs_ver-}, {-done-})dnl
dnl
undefine({-_m4_devs-})dnl
pushdef({-_m4_devs-}, {-done-})dnl
dnl
undefine({-_m4_disks-})dnl
undefine({-_m4_disks2-})dnl
pushdef({-_m4_disks-}, {-done-})dnl
pushdef({-_m4_disks2-}, {-done-})dnl
dnl
dnl define stack 'add to' functions, only unique names queued
dnl
define({-ver_q-}, {-ifelse(index($1_ver, y), 0, ,
{-pushdef({-_m4_cvs_ver-}, {-$2-})define({-$1_ver-}, {-y-})-})-})dnl ver_q
dnl
define({-dev_q-}, {-ifelse(index(_q_$1_dev, :), 0,
{-errprint({-duplicated dev id: $1 at -}__file__{-:-}__line__ originally at _q_$1_dev)-},
{-pushdef({-_m4_devs-}, {-$1-})dnl
define({-_q_$1_dev-}, {-:-}__file__{-:-}__line__)-})-})dnl dev_q
dnl
define({-disk_q-}, {-ifelse(index(_q_$1_disk, :), 0,
{-errprint({-duplicated disk id: $1 at -}__file__{-:-}__line__ originally at _q_$1_disk)-}, {-pushdef({-_m4_disks-}, {-$1-})dnl
pushdef({-_m4_disks2-}, {-$1-})dnl
define({-_q_$1_disks-}, {-:-}__file__{-:-}__line__)-})-})dnl disk_q
dnl
dnl store a version string for 'this' file
dnl
dnl vers ( uniqueidstring, versionstring, subdir )
dnl
dnl example1: vers(__file__, {-$OpenBSD: MAKEDEV.mansub,v 1.2 2004/02/20 19:13:01 miod Exp $-})
dnl example2: vers(__file__, {-$OpenBSD: MAKEDEV.mansub,v 1.2 2004/02/20 19:13:01 miod Exp $-}, etc.MACHINE)
dnl
dnl if subdir is defined, prepend it to the filename in the version string
dnl
define({-vers-},
{-ifelse({-$3-}, {--},
{-ver_q(hstcl({-$1-}), {-translit({-{-$2-}-}, {-$-}, {--})-})-},
{-ver_q(hstcl({-$1-}), {-_addsubdir({-{-$2-}-}, $3)-})-})-})dnl
dnl
dnl Version info for this file:
dnl
vers(__file__, {-$OpenBSD: MAKEDEV.mansub,v 1.2 2004/02/20 19:13:01 miod Exp $-})dnl
dnl
dnl
define({-_addsubdir-},
{-patsubst({-$1-}, {-\$(OpenBSD:) ([^\$]*)\$-}, {-\1 $2/\2-})-})dnl
dnl
dnl do the 'showing' of the version info
dnl
define({-do_vers-}, {-COMM	$1-})dnl
dnl
dnl show version function, to be called at the place when all versions are
dnl   queued, and it is time to show all of them
dnl
define({-show_vers-},
{-ifelse(_m4_cvs_ver, {-done-}, {--},
{-do_vers(_m4_cvs_ver)
popdef({-_m4_cvs_ver-})dnl
show_vers()dnl
-})-})dnl
dnl
dnl _devxr(name,optional different xr name)
dnl
define({-_devxr-},{-.Xr $1 ifelse(index($1,{- -}),-1,{-4 -})-})dnl
dnl
dnl _devitem(pattern, description)
dnl
define({-_devitem-},{-.It Ar $2
$3{--}ifelse($4,nothing,,{-, see
_devxr({-ifelse($4,,$1,$4)-})-})dnl
.-})dnl
dnl
dnl _devtitle(name,description)
dnl
define({-_devtitle-},{-ifelse($1,make,,{-.El
-}).Pp
.Sy $2
.Bl -tag -width tenletters -compact-})dnl
dnl
dnl _DEV(name, [character major], [block major])
dnl
define({-_DEV-}, {-$1_dev{--}dnl
define({-$1__DEV-}, {-Y-})-})dnl
dnl
define({-_MKDEV-}, {-$1_mkdev-})dnl
define({-_TITLE-}, {-$1_title-})dnl
dnl
define({-__devitem-}, {-define($1_dev, {-_devitem($1,$2,$3,$4)-})-})dnl
dnl
define({-__devtitle-}, {-define($1_title, {-_devtitle($1,$2)-})-})dnl
define({-_mkdev-})dnl
define({-_mcdev-})dnl
define({-_cdev-})dnl
define({-__mkdev-})dnl
define({-target-})dnl
define({-twrget-})dnl