summaryrefslogtreecommitdiff
path: root/devio/MAKEDEV
blob: b113e3c12dda740c95bd42b74a6060a2aa2d8857 (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
#!/bin/sh
#
# Make standard devices
#

PATH=/bin

ST="settrans -cg"

_CWD=${_CWD:-`pwd`}
export _CWD

for I; do
  case "$I" in
    std)
      $0 console tty null zero fd time
      ;;
    console|tty[0-9]?|tty[0-9a-f])
      $ST $I /hurd/term $_CWD/$I device $I;;
    null)
      $ST $I /hurd/null 
      chmod 666 $I
      ;;
    zero)
      $ST $I /hurd/null -z
      chmod 666 $I
      ;;
    tty)
      $ST $I /hurd/magic tty
      chmod 666 $I
      ;;
    fd)
      $ST $I /hurd/magic fd
      chmod 666 $I
      ln -f -s fd/0 stdin
      ln -f -s fd/1 stdout
      ln -f -s fd/2 stderr
      ;;
    time)
      $ST $I /hurd/devport time
      chmod 666 $I
      ;;

    # ptys
    [pt]ty[pqPQ]?)
      # Make one pty, both the master and slave halves
      ID="`expr substr $I 4 99`"
      $ST pty$ID /hurd/term $_CWD/pty$ID pty-master $_CWD/tty$ID
      $ST tty$ID /hurd/term $_CWD/tty$ID pty-slave $_CWD/pty$ID
      chmod 666 pty$ID tty$ID
      ;;
    [pt]ty[pqPQ])
      # Make a bunch of ptys
      $0 ${I}0 ${I}1 ${I}2 ${I}3 ${I}4 ${I}5 ${I}6 ${I}7
      $0 ${I}8 ${I}9 ${I}a ${I}b ${I}c ${I}d ${I}e ${I}f
      ;;

    fd*|mt*)
      $ST r$I /hurd/devio $I
      $ST $I /hurd/devio -b $I
      ;;

    [hrs]d*)
      case "$I" in
      [a-z][a-z][0-9][a-z] | [a-z][a-z][0-9]s[1-9])
        $ST r$I /hurd/devio $I
        $ST $I /hurd/devio -b $I
	;;
      *)
	echo 1>&2 $0: $I: Must supply a device number and partition or slice
	exit 1
	;;
      esac
      ;;

    *)
      echo >&2 $0: $I: Unknown device
      exit 1
      ;;
  esac
done