Source code pulled from OpenBSD for OpenNTPD. The place to contribute to this code is via the OpenBSD CVS tree.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

135 lines
4.6 KiB

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