#! /bin/sh
#*****************************************************************************
# 	  (c) Copyright  1989 Thinking Machines Corporation, Inc.,	     *
#		of Cambridge, Mass.   All rights reserved.		     *
#									     *
#  This notice is intended as a precaution against inadvertent publication   *
#  and does not constitute an admission or acknowledgement that publication  *
#  has occurred or constitute a waiver of confidentiality.		     *
#									     *
#  Connection Machine software is the proprietary and confidential property  *
#  of Thinking Machines Corporation.					     *
#****************************************************************************/
#
# $Id: CMMAKEDEV.sh,v 1.12 1992/06/23 22:23:36 taylor Exp $
#
# Connection Machine device "make" file.  Valid arguments:
#	std	standard devices
#	tape	Generic UNIX tape interface
#	mem	file server memory (read only) [not shared memory!]
#	disk	raw disk
#
umask 22
cmmkdir /dev >/dev/null 2>&1
umask 77
for i
do
case $i in

std)
	umask 0
	cmrm -f /dev/null; cmmknod /dev/null c 1 0
	cmrm -f /dev/zero; cmmknod /dev/zero c 2 0
	cmrm -f /dev/sequence; cmmknod /dev/sequence c 2 1
	cmrm -f /dev/random; cmmknod /dev/random c 2 2
	umask 77
	;;

mt*)
	umask 0 ; unit=`expr $i : '..\(.*\)'`
	case $i in
	mt*) chr=3 ;;
	esac
	case $unit in
	0|1|2|3)
		rew=`expr $unit '*' 4`
		norew=`expr $rew + 16`
		cmrm -f /dev/rmt$unit ; cmmknod /dev/rmt$unit	c $chr $rew
		cmrm -f /dev/nrmt$unit ; cmmknod /dev/nrmt$unit	c $chr $norew
		umask 77
		;;
	*)
		echo "bad unit number in: $i; use mt0 thru mt3"
		;;
	esac
	;;
mem)
	umask 77
	cmrm -f /dev/fsmem; cmmknod /dev/fsmem c 5 0; cmchmod 400 /dev/fsmem
	;;
disk)
	umask 77
	cmrm -f /dev/rawdisk; cmmknod /dev/rawdisk c 8 0; cmchmod 600 /dev/rawdisk
	;;
*)
	echo "I don't know how to CMMAKEDEV $i."
	;;
esac
done
