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.

501 lines
9.7 KiB

22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
22 years ago
26 years ago
22 years ago
22 years ago
22 years ago
26 years ago
22 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
28 years ago
22 years ago
22 years ago
28 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
28 years ago
22 years ago
28 years ago
22 years ago
22 years ago
26 years ago
22 years ago
26 years ago
22 years ago
22 years ago
22 years ago
22 years ago
22 years ago
  1. #!/bin/sh -
  2. #
  3. # THIS FILE AUTOMATICALLY GENERATED. DO NOT EDIT.
  4. # generated from:
  5. #
  6. # OpenBSD: etc.amiga/MAKEDEV.md,v 1.8 2002/05/16 21:11:20 miod Exp
  7. # OpenBSD: MAKEDEV.mi,v 1.47 2002/06/09 04:19:15 todd Exp
  8. # OpenBSD: MAKEDEV.sub,v 1.7 2002/02/16 01:19:52 deraadt Exp
  9. #
  10. #
  11. # Copyright (c) 2001,2002 Todd T. Fries <todd@OpenBSD.org>
  12. # All rights reserved.
  13. #
  14. # Redistribution and use in source and binary forms, with or without
  15. # modification, are permitted provided that the following conditions
  16. # are met:
  17. # 1. Redistributions of source code must retain the above copyright
  18. # notice, this list of conditions and the following disclaimer.
  19. # 2. The name of the author may not be used to endorse or promote products
  20. # derived from this software without specific prior written permission.
  21. #
  22. # THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
  23. # INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
  24. # AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
  25. # THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
  26. # EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
  27. # PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
  28. # OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
  29. # WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
  30. # OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
  31. # ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. #
  33. # Device "make" file. Valid arguments:
  34. # all makes all known devices, including local devices.
  35. # Tries to make the ``standard'' number of each type.
  36. # std standard devices
  37. # local configuration specific devices
  38. # Tapes:
  39. # st* SCSI tapes
  40. # Disks:
  41. # ramdisk devices needed for install floppies
  42. # sd* SCSI disks
  43. # rd* "rd" pseudo-disks
  44. # ccd* concatenated disk devices
  45. # wd* "winchester" disk drives (ST506, IDE, ESDI, RLL, ...)
  46. # cd* SCSI cdrom drives
  47. # vnd* "file" pseudo-disks
  48. # Console ports:
  49. # ttye* ite bitmapped consoles
  50. # Pointing devices:
  51. # mouse* Amiga mice
  52. # Terminal ports:
  53. # tty0* NS16x50 serial ports
  54. # ttyA* mfc serial ports
  55. # ttyB* ISA COM ports
  56. # Pseudo terminals:
  57. # tty* set of 16 slave psuedo terminals
  58. # pty* set of 16 master pseudo terminals
  59. # Printers:
  60. # par* motherboard parallel port
  61. # lpt* IEEE 1284 centronics printer
  62. # lpa* interruptless lp
  63. # Special purpose devices:
  64. # grf* Motherboard bitmapped video.
  65. # kbd keyboard (provides events, for X11)
  66. # joy* joystick driver
  67. # kbd Amiga keyboard
  68. # view* generic interface to graphic displays
  69. # aconf autoconfig information (not yet)
  70. # lkm loadable kernel modules interface
  71. # bpf* Berkeley Packet Filter
  72. # tun* network tunnel driver
  73. # pf* Packet Filter
  74. # ss* SCSI scanners
  75. # uk* SCSI Unknown device
  76. # *random inkernel random data source
  77. # audio* audio device
  78. # xfs* XFS filesystem devices
  79. # ch* SCSI media changer
  80. # altq/ ALTQ control interface
  81. # fd makes fd/* for the fdescfs
  82. # systrace* system call tracing device
  83. PATH=/sbin:/usr/sbin:/bin:/usr/bin
  84. T=$0
  85. # set this to echo for Echo-Only debugging
  86. [ "$eo" ] || eo=
  87. hex()
  88. {
  89. case $1 in
  90. [0-9]) echo -n $1;;
  91. 10) echo -n a;;
  92. 11) echo -n b;;
  93. 12) echo -n c;;
  94. 13) echo -n d;;
  95. 14) echo -n e;;
  96. 15) echo -n f;;
  97. esac
  98. }
  99. trunc()
  100. {
  101. # XXX pdksh can't seem to deal with locally scoped variables
  102. # in ${foo#$bar} expansions
  103. arg1="$1"
  104. arg2="$2"
  105. case $3 in
  106. l) echo ${arg2#$arg1} ;;
  107. r|*) echo ${arg1#$arg2} ;;
  108. esac
  109. }
  110. unt()
  111. {
  112. # XXX pdksh can't seem to deal with locally scoped variables
  113. # in ${foo#$bar} expansions
  114. arg="$1"
  115. tmp="${arg#[a-zA-Z]*}"
  116. tmp="${tmp%*[a-zA-Z]}"
  117. while [ "$tmp" != "$arg" ]
  118. do
  119. arg=$tmp
  120. tmp="${arg#[a-zA-Z]*}"
  121. tmp="${tmp%*[a-zA-Z]}"
  122. done
  123. echo $arg
  124. }
  125. dodisk()
  126. {
  127. [ "$DEBUG" ] && set -x
  128. n=$(($((${5}*${7:-16}))+${6})) count=0
  129. RMlist="$RMlist $1$2? r$1$2?"
  130. [ 0$7 -ne 8 ] && l="i j k l m n o p"
  131. for d in a b c d e f g h $l
  132. do
  133. M $1$2$d b $3 $(($n+$count)) 640
  134. M r$1$2$d c $4 $(($n+$count)) 640
  135. let count=count+1
  136. done
  137. MKlist="$MKlist;chown root.operator $1$2? r$1$2?"
  138. }
  139. dodisk2()
  140. {
  141. n=$(($(($5*${7:-16}))+$6))
  142. M $1$2a b $3 $n 640 operator
  143. M r$1$2a c $4 $n 640 operator
  144. n=$(($n+2))
  145. M $1$2c b $3 $n 640 operator
  146. M r$1$2c c $4 $n 640 operator
  147. }
  148. # M name b/c major minor [mode] [group]
  149. RMlist="rm -f"
  150. MKlist=":"
  151. mkl() {
  152. [ "${mklist[$1]}" ] && {
  153. mklist[$1]="${mklist[$1]};mknod -m $1 $2 $3 $4 $5"
  154. } || {
  155. mklist[$1]="mknod -m $1 $2 $3 $4 $5"
  156. modes="$modes $1"
  157. }
  158. }
  159. M() {
  160. RMlist="$RMlist $1"
  161. mkl ${5-666} $1 $2 $3 $4
  162. mklist="$mklist $1"
  163. G=${6:-wheel}
  164. [ "$7" ] && {
  165. MKlist="$MKlist;chown $7.$G $1"
  166. } || {
  167. case $G in
  168. wheel)g=0;;kmem)g=2;;operator)g=5;;tty)g=4;;dialer)g=117;;
  169. esac
  170. [ "${grplist[$g]}" ] && {
  171. grplist[$g]="${grplist[$g]} $1"
  172. } || {
  173. groups="$groups $g"
  174. grplist[$g]="chgrp $G $1"
  175. }
  176. }
  177. return 0
  178. }
  179. R() {
  180. [ "$DEBUG" ] && set -x
  181. for i in "$@"
  182. do
  183. U=`unt $i`
  184. [ "$U" ] || U=0
  185. case $i in
  186. ramdisk)
  187. R std kbd pty0 tty00 ttyA0 ttyA1 ttyB0 ttyB1
  188. R ttye0 ttye1 ttye2 ttye3 ttye4 ttye5 ttye6
  189. R cd0 cd1 sd0 sd1 sd2 sd3 st0 st1
  190. R fd0 fd1 wd0 wd1 rd0 random
  191. ;;
  192. std)
  193. M console c 0 0 600
  194. M tty c 1 0
  195. M mem c 2 0 640 kmem
  196. M kmem c 2 1 640 kmem
  197. M null c 2 2
  198. M zero c 2 12
  199. M stdin c 21 0
  200. M stdout c 21 1
  201. M stderr c 21 2
  202. M ksyms c 42 0 640 kmem
  203. M drum c 3 0 640 kmem
  204. M klog c 6 0 600
  205. M reload c 2 20 600
  206. ;;
  207. ttyA[01])
  208. M ttyA$U c 17 $U 660 dialer uucp
  209. M ttyM$U c 17 $(($U+128)) 660 dialer uucp
  210. ;;
  211. par*)
  212. case $U in
  213. 0)
  214. M par$U c 11 $U 600
  215. ;;
  216. *)
  217. echo bad unit for par in: $i
  218. ;;
  219. esac
  220. ;;
  221. ttye*)
  222. case $U in
  223. 0|1|2|3|4|5|6)
  224. M ttye$U c 13 $U 600
  225. ;;
  226. *)
  227. echo bad unit for ttye in: $i
  228. ;;
  229. esac
  230. ;;
  231. grf*)
  232. case $U in
  233. 0|1|2|3|4|5|6)
  234. M grf$U c 10 $U
  235. ;;
  236. *)
  237. echo bad unit for grf in: $i
  238. ;;
  239. esac
  240. # for those that need it, also make overlay and image devices:
  241. case $U in
  242. 4)
  243. M grfov$U c 10 $(($U+16)) 600
  244. M grfim$U c 10 $(($U+32)) 600
  245. ;;
  246. esac
  247. ;;
  248. mouse*)
  249. case $U in
  250. 0|1)
  251. M mouse$U c 15 $U
  252. if [ $U = 0 ]
  253. then
  254. MKlist="$MKlist;rm -f mouse; ln -s mouse$U mouse"
  255. fi
  256. ;;
  257. *)
  258. echo bad unit for mouse in: $i
  259. ;;
  260. esac
  261. ;;
  262. view*)
  263. case $U in
  264. 00|01|02|03|04|05|06|07|08|09)
  265. M view$U c 16 $U
  266. ;;
  267. *)
  268. echo bad unit for view in: $i
  269. ;;
  270. esac
  271. ;;
  272. ttyB*)
  273. M ttyB$U c 32 $U 660 dialer uucp
  274. M cuaB$U c 32 $(($U+128)) 660 dialer uucp
  275. ;;
  276. systrace)
  277. M systrace c 50 0 644
  278. ;;
  279. fd)
  280. RMlist="mkdir -p fd;$RMlist" n=0
  281. while [ $n -lt 64 ];do M fd/$n c 21 $n;n=$(($n+1));done
  282. MKlist="$MKlist;chmod 555 fd"
  283. ;;
  284. altq)
  285. RMlist="mkdir -p altq;$RMlist"
  286. for d in altq cbq wfq afm fifoq red rio localq hfsc cdnr blue priq; do
  287. M altq/$d c 52 $U 644
  288. U=$(($U+1))
  289. done
  290. ;;
  291. ch*)
  292. M ch$U c 40 $U 660 operator
  293. ;;
  294. xfs*)
  295. M xfs$U c 51 $U 600
  296. ;;
  297. audio*)
  298. M sound$U c 39 $U
  299. M mixer$U c 39 $(($U+16))
  300. M audio$U c 39 $(($U+128))
  301. M audioctl$U c 39 $(($U+192))
  302. MKlist="$MKlist;[ -e audio ] || ln -s audio$U audio"
  303. MKlist="$MKlist;[ -e mixer ] || ln -s mixer$U mixer"
  304. MKlist="$MKlist;[ -e sound ] || ln -s sound$U sound"
  305. MKlist="$MKlist;[ -e audioctl ] || ln -s audioctl$U audioctl"
  306. ;;
  307. *random)
  308. n=0
  309. for pre in " " s u p a
  310. do
  311. M ${pre}random c 35 $n 644
  312. n=$(($n+1))
  313. done
  314. ;;
  315. uk*)
  316. M uk$U c 36 $U 640 operator
  317. ;;
  318. ss*)
  319. M ss$U c 25 $(($U*16)) 640 operator
  320. M nss$U c 25 $(($(($U*16))+1)) 640 operator
  321. M enss$U c 25 $(($(($U*16))+3)) 640 operator
  322. RMlist="$RMlist scan$U"
  323. MKlist="$MKlist;umask 77;ln -s ss$U scan$U"
  324. ;;
  325. pf*)
  326. M pf c 34 0 600
  327. ;;
  328. tun*)
  329. M tun$U c 23 $U 600
  330. ;;
  331. bpf*)
  332. M bpf$U c 22 $U 600
  333. ;;
  334. lkm)
  335. M lkm c 24 0 640 kmem
  336. ;;
  337. joy*)
  338. M joy$U c 43 $U 666
  339. ;;
  340. kbd)
  341. M kbd c 14 0 600
  342. ;;
  343. lpt*|lpa*)
  344. case $i in
  345. lpt*) n=lpt f=0;;
  346. lpa*) n=lpa f=128;;
  347. esac
  348. M $n$U c 33 $(($U+$f)) 600
  349. ;;
  350. pty*)
  351. if [ $U -gt 15 ]; then
  352. echo bad unit for pty in: $i
  353. continue
  354. fi
  355. set -A tbl p q r s t u v w x y z P Q R S T
  356. name=${tbl[$U]}
  357. n=0
  358. while [ $n -lt 16 ]
  359. do
  360. nam=$name$(hex $n)
  361. off=$(($U*16))
  362. M tty$nam c 4 $(($off+$n))
  363. M pty$nam c 5 $(($off+$n))
  364. n=$(($n+1))
  365. done
  366. ;;
  367. tty0*)
  368. M tty$U c 12 $U 660 dialer uucp
  369. M cua$U c 12 $(($U+128)) 660 dialer uucp
  370. ;;
  371. vnd*)
  372. dodisk vnd $U 6 19 $U 0
  373. dodisk svnd $U 6 19 $U 128
  374. ;;
  375. cd*)
  376. dodisk2 cd $U 7 9 $U 0 8
  377. ;;
  378. rd*)
  379. dodisk2 rd $U 16 41 $U 0
  380. ;;
  381. fd*)
  382. case $U in 0|1|2|3)
  383. M fd${U}a b 2 $(($U*16)) 640 operator
  384. M fd${U}b b 2 $(($(($U*16))+1)) 640 operator
  385. M rfd${U}a c 18 $(($U*16)) 640 operator
  386. M rfd${U}b c 18 $(($(($U*16))+1)) 640 operator;;
  387. *) echo bad unit for floppy disk in: $i;;
  388. esac
  389. ;;
  390. st*)
  391. n=$(($U*16))
  392. for pre in " " n e en
  393. do
  394. M ${pre}st$U b 5 $n 660 operator
  395. M ${pre}rst$U c 20 $n 660 operator
  396. n=$(($n+1))
  397. done
  398. ;;
  399. local)
  400. test -s $T.local && sh $T.local
  401. ;;
  402. all)
  403. R ccd0 ccd1 ccd2 ccd3 vnd0 vnd1 vnd2 vnd3 sd0 sd1 sd2 sd3 sd4
  404. R sd5 sd6 sd7 sd8 sd9 cd0 cd1 rd0 tun0 tun1 tun2 tun3 bpf0
  405. R bpf1 bpf2 bpf3 bpf4 bpf5 bpf6 bpf7 bpf8 bpf9 pty0 pty1 pty2
  406. R xfs0 ss0 ss1 ch0 local kbd mouse0 mouse1 par0 grf0 grf1 grf2
  407. R grf3 grf4 grf5 grf6 audio0 uk0 random joy0 joy1 lpa0 lpa1
  408. R lpa2 lpt0 lpt1 lpt2 lkm ttye0 ttye1 ttye2 ttye3 ttye4 ttye5
  409. R ttye6 tty00 tty01 tty02 tty03 ttyB0 ttyB1 ttyB2 ttyB3 ttyB4
  410. R ttyA0 ttyA1 pf altq systrace fd0 fd1 fd2 fd3 wd0 wd1 wd2 wd3
  411. R std st0 st1 fd
  412. ;;
  413. wd*|sd*|ccd*)
  414. case $i in
  415. wd*) dodisk wd $U 0 37 $U 0;;
  416. sd*) dodisk sd $U 4 8 $U 0;;
  417. ccd*) dodisk ccd $U 8 7 $U 0;;
  418. esac
  419. ;;
  420. *)
  421. echo $i: unknown device
  422. ;;
  423. esac
  424. done
  425. }
  426. R "$@"
  427. if [ "$os" = "SunOS" ]; then
  428. eo=transform
  429. transform() {
  430. case $mode in
  431. 600) mask=077;;
  432. 640) mask=027;;
  433. 660) mask=007;;
  434. 644) mask=022;;
  435. 666) mask=0;;
  436. 440) mask=227;;
  437. esac
  438. echo `echo "$@"|sed \
  439. 's/mknod -m \([0-9]*\) /umask '$mask';mknod /;s/-m [0-9]* //g;\
  440. s/operator/5/g;s/root.kmem/root.2/g;s/root\./root:/g'`
  441. }
  442. fi
  443. list="$RMlist"
  444. for mode in $modes; do
  445. list="$list;${mklist[$mode]}"
  446. done
  447. for group in $groups; do
  448. list="$list;${grplist[$group]}"
  449. done
  450. list="$list;$MKlist"
  451. if [ "$eo" = "echo" -o "$eo" = "transform" ]; then
  452. $eo "$list"
  453. else
  454. echo "$list" | sh
  455. fi