DataMuseum.dk

Presents historical artifacts from the history of:

Regnecentalen RC-900

This is an automatic "excavation" of a thematic subset of
artifacts from Datamuseum.dk's BitArchive.

See our Wiki for more about Regnecentalen RC-900

Excavated with: AutoArchaeologist - Free & Open Source Software.


top - metrics - download

⟦bd4f50212⟧ TextFile

    Length: 2351 (0x92f)
    Types: TextFile
    Notes: UNIX file
    Names: »ectmknod«

Derivation

└─⟦0cfe73749⟧ Bits:30004154/config.imd SW95707I VP/ix MS-DOS emulator Rel. 1.1
└─⟦0cfe73749⟧ UNIX Filesystem
    └─⟦this⟧ »vc/new/usr/vpix/etc/ectmknod« 

TextFile

#
#  Copyrighted as an unpublished work.
#  (c) Copyright 1988 INTERACTIVE Systems Corporation
#  All rights reserved.
#
#  RESTRICTED RIGHTS
#
#  These programs are supplied under a license.  They may be used,
#  disclosed, and/or copied only as permitted under such license
#  agreement.  Any copy must contain the above copyright notice and
#  this restricted rights notice.  Use, copying, and/or disclosure
#  of the programs is strictly prohibited unless otherwise provided
#  in the license agreement.
#

#ident  "@(#)ectmknod	1.1 - 88/07/27"

# do a "mknod" for DDA device specified in $1

# cleanup function (called with exit code as argument

cleanup()
{
     rm -f $TMP1
     rm -f $TMP2
     exit $1
}

trap "cleanup 1" 1 2 3 15

# define variables

TMP1=tmp1               # temp file
TMP2=tmp2               # temp file
BIN=/usr/vpix/etc       # location of IEM tools

# make sure our EUID is "root"

${BIN}/ectuid
if [ $? -ne 0 ]
then
	echo No permission!
	cleanup 1
fi

# make sure device name was specified

if [ $# -ne 1 ]
then
	echo Usage: $0 device
	cleanup 1
fi

# make sure device name is lower-case

DEVNAME=`echo $1 | tr "[A-Z]" "[a-z]"`

# list /dev to temporary file (no point in doing it twice...)

ls -l /dev > $TMP1

# check whether we already have a special device file - if so, ERROR

cat $TMP1 | grep ${DEVNAME} > /dev/null
if [ $? -ne 1 ]
then
    echo /dev/${DEVNAME} already exists!
    cleanup 1
fi

# find next minor device number for VDI device

MAJOR=38
MINOR=-1

# generate a sorted list of all devices with the same major as VDI device

cat $TMP1 | grep $MAJOR, | sort > $TMP2

# if there are none, then we'll just use 0 as the minor
# else we'll have to look for the first unused minor number

COUNT=`cat $TMP2 | wc -l`

if [ $COUNT -eq 0 ]
then
	MINOR=0
else
	COUNT=0                         # initialize loop counter

	# read the /dev directory listing, getting minor number into $NEXT

	exec < $TMP2
	while read junk1 junk2 junk3 junk4 junk5 NEXT junk6
	do
	    if [ $NEXT -ne $COUNT ]     # unused minor number
	    then
		MINOR=$COUNT
		break
	    fi
	    COUNT=`expr $COUNT + 1`
	done
fi

if [ $MINOR -eq -1 ]                    # all minors used - take next
then
    MINOR=$COUNT
fi

# do the mknod...

/etc/mknod /dev/${DEVNAME} c $MAJOR $MINOR
chmod 666 /dev/${DEVNAME}

# cleanup and exit

cleanup 0