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.

239 lines
5.0 KiB

7 years ago
19 years ago
7 years ago
  1. define(COMM,`#')dnl
  2. include(MAKEDEV.sub)dnl
  3. dnl
  4. vers(a, {-$OpenBSD: MAKEDEV.mi,v 1.83 2016/09/11 03:06:31 deraadt Exp $-})dnl
  5. dnl
  6. divert(1)dnl
  7. {-#-}
  8. {-#-} Copyright (c) 2001-2004 Todd T. Fries <todd@OpenBSD.org>
  9. {-#-}
  10. {-#-} Permission to use, copy, modify, and distribute this software for any
  11. {-#-} purpose with or without fee is hereby granted, provided that the above
  12. {-#-} copyright notice and this permission notice appear in all copies.
  13. {-#-}
  14. {-#-} THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  15. {-#-} WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  16. {-#-} MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  17. {-#-} ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  18. {-#-} WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  19. {-#-} ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  20. {-#-} OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  21. {-#-}
  22. define(quote,{-"$1" -})dnl
  23. include(MAKEDEV.common)dnl
  24. dnl
  25. __devtitle(make, {-Device "make" file. Valid arguments-})dnl
  26. __devitem({-all-}, {-all-}, {-makes all known devices{-,-} including local devices.
  27. {-#-} Tries to make the ``standard'' number of each type.-})dnl
  28. __devitem(std,{-std-},Standard devices)dnl
  29. __devitem(local,local,Configuration specific devices)dnl
  30. dnl
  31. dnl _std
  32. dnl
  33. dnl $1: tty
  34. dnl $2: memstuff
  35. dnl $3: ksyms
  36. dnl $4: klog
  37. dnl
  38. define({-_std-},{-dnl
  39. std)
  40. M console c 0 0 600
  41. M tty c $1 0
  42. M mem c $2 0 640 kmem
  43. M kmem c $2 1 640 kmem
  44. M null c $2 2
  45. M zero c $2 12
  46. M stdin c major_fdesc_c 0
  47. M stdout c major_fdesc_c 1
  48. M stderr c major_fdesc_c 2
  49. M ksyms c $3 0 640 kmem
  50. M klog c $4 0 600-})dnl
  51. dnl
  52. divert(1)dnl
  53. define(__mddivert,7)dnl
  54. include(MAKEDEV.md)dnl
  55. dnl
  56. dnl
  57. divert(0)dnl
  58. #!/bin/sh -
  59. #
  60. # THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
  61. # generated from:
  62. #
  63. show_vers()dnl <-- now that all files are included, show versions
  64. #
  65. dnl
  66. divert(2)dnl
  67. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  68. T=$0
  69. # set this to echo for Echo-Only debugging
  70. [ "$eo" ] || eo=
  71. hex()
  72. {
  73. case ${--}1 in
  74. [0-9]) echo -n {-$-}1;;
  75. 10) echo -n a;;
  76. 11) echo -n b;;
  77. 12) echo -n c;;
  78. 13) echo -n d;;
  79. 14) echo -n e;;
  80. 15) echo -n f;;
  81. esac
  82. }
  83. alph2d()
  84. {
  85. local t="$1"
  86. local p="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
  87. local sub=${p%${t}*}
  88. echo ${#sub}
  89. }
  90. h2d()
  91. {
  92. local s="$1"
  93. local f=${s%*[0-9a-f]} n=${s#[0-9a-f]*}
  94. echo $(($(_h2d $f)*16+ $(_h2d $n) ))
  95. }
  96. _h2d()
  97. {
  98. case $1 in
  99. [0-9]) echo -n $1;;
  100. a) echo -n 10;;
  101. b) echo -n 11;;
  102. c) echo -n 12;;
  103. d) echo -n 13;;
  104. e) echo -n 14;;
  105. f) echo -n 15;;
  106. esac
  107. }
  108. unt()
  109. {
  110. # XXX pdksh can't seem to deal with locally scoped variables
  111. # in ${foo#$bar} expansions
  112. arg="{-$-}1"
  113. tmp="${arg#[a-zA-Z]*}"
  114. tmp="${tmp%*[a-zA-Z]}"
  115. while [ "$tmp" != "$arg" ]
  116. do
  117. arg=$tmp
  118. tmp="${arg#[a-zA-Z]*}"
  119. tmp="${tmp%*[a-zA-Z]}"
  120. done
  121. echo $arg
  122. }
  123. dnl
  124. dnl dodisk(name, unit, blkmaj, chrmaj, unit, off[, stepping])
  125. dnl arg: 1 2 3 4 5 6 7
  126. dnl
  127. dodisk()
  128. {
  129. [ "$DEBUG" ] && set -x
  130. n=Add(Mult(${5}, ${7:-16}), ${6}) count=0
  131. [ 0$7 -ne 8 ] && l="i j k l m n o p"
  132. for d in a b c d e f g h $l
  133. do
  134. M {-$-}1{-$-}2$d b {-$-}3 Add($n, $count) 640 operator
  135. M r{-$-}1{-$-}2$d c {-$-}4 Add($n, $count) 640 operator
  136. let count=count+1
  137. done
  138. }
  139. dnl
  140. dnl dodisk2(name, unit, blkmaj, chrmaj, unit, off[, stepping])
  141. dnl
  142. dnl 1. name - prefix name of the device
  143. dnl 2. unit - beginning unit number for block devices
  144. dnl 3. blkmaj - block device major number
  145. dnl 4. chrmaj - character device major number
  146. dnl 5. unit - beginning unit number for character devices
  147. dnl 6. off - offset from 0 for all minor numbers
  148. dnl 7. step - optional, defaults to 16, number of partitions per device
  149. dnl
  150. dodisk2()
  151. {
  152. n=Add(Mult({-$-}5, ${7:-16}), {-$-}6)
  153. M {-$-}1{-$-}2a b {-$-}3 $n 640 operator
  154. M r{-$-}1{-$-}2a c {-$-}4 $n 640 operator
  155. n=Add($n, 2)
  156. M {-$-}1{-$-}2c b {-$-}3 $n 640 operator
  157. M r{-$-}1{-$-}2c c {-$-}4 $n 640 operator
  158. }
  159. # M name b/c major minor [mode] [group]
  160. RMlist[0]="rm -f"
  161. mkl() {
  162. dnl
  163. dnl multi mknod
  164. dnl
  165. : {-$-}{mklist[0]:=";mknod"}
  166. mklist[{-$-}{#mklist[*]}]=" -m {-$-}1 {-$-}2 {-$-}3 {-$-}4 {-$-}5"
  167. }
  168. M() {
  169. RMlist[{-$-}{#RMlist[*]}]={-$-}1
  170. mkl ${5-666} {-$-}1 {-$-}2 {-$-}3 {-$-}4
  171. G={-$-}{6:-wheel}
  172. [ "{-$-}7" ] && {
  173. MKlist[{-$-}{#MKlist[*]}]="&& chown {-$-}7:{-$-}G {-$-}1"
  174. } || {
  175. case $G in
  176. wheel)
  177. [ {-$-}{#whlist[*]} = 0 ] && whlist[0]="&& chgrp wheel"
  178. whlist[{-$-}{#whlist[*]}]="$1"
  179. ;;
  180. operator)
  181. [ {-$-}{#oplist[*]} = 0 ] && oplist[0]="&& chgrp operator"
  182. oplist[{-$-}{#oplist[*]}]="$1"
  183. ;;
  184. *)
  185. MKlist[{-$-}{#MKlist[*]}]="&& chgrp $G $1";
  186. esac
  187. }
  188. return 0
  189. }
  190. divert(7)dnl
  191. dnl
  192. dnl there is no blank line at the end of etc.arch/MAKEDEV.md files, so add one
  193. dnl on the following line:
  194. show_devs()dnl
  195. dnl
  196. divert(9)dnl
  197. *)
  198. echo $i: unknown device
  199. ;;
  200. esac
  201. done
  202. }
  203. _recurse "$@"
  204. {
  205. echo -n ${RMlist[*]}
  206. echo -n ${mklist[*]}
  207. echo -n ${MKlist[*]}
  208. echo -n ${whlist[*]}
  209. echo ${oplist[*]}
  210. } | if [ "$eo" = "echo" ]; then
  211. cat
  212. else
  213. sh
  214. fi
  215. divert(3)dnl
  216. dnl
  217. R() {
  218. [ "$DEBUG" ] && set -x
  219. for i in "$@"
  220. do
  221. U=`unt $i`
  222. [ "$U" ] || U=0
  223. case $i in
  224. dnl