PROGRAM NAME:  ass - assign system resources

AUTHOR:  pavo

DATE WRITTEN:  november 21, 1976

SOURCE LANGUAGE:  c

LOCATION OF SOURCE:  /usr/pavo/ass.c

LOCATION OF BINARY:  /usr/bin/ass

SYNTAX:
	ass  [dev1  [dev2 ... ]  ]

	"dev" is any system device that resides in directory /dev.
	A user may type the valid device name (/dev/xxxxx) or simply
	the commonly-used mnemonic (xxxxx); for example, ass will
	recognize "/dev/ct0" or just "ct0" as COMTAL 0.
	If no devices are to be assigned, ass prints the assignment
	list -- all assignable devices and their current owners.

DESCRIPTION:
	Ass logically assigns devices that can be assigned (system resources).
Presently, unfortunately, there is no system mechanism to force a user to
assign and deassign resources before using them.  However, considering that
anyone can write to any writable device at any time regardless of what is 
there (backup tape on a dec-drive, image on a COMTAL memory ...), these pro-
cedures (ass and deass) will safeguard devices that are in use but presently
idle.  Ass and deass can easily be thought of as a "begin/end" pair that
enclose (protect) a device.  Obviously, a chain is only as strong as it's
weakest link and the weak link in this mechanism is that everyone must use
ass and deass to ensure device integrity.
	If a user logs out of UNIX after being assigned a resource, this
resource may still be assigned long after the user logged-off.  It
will mean least confusion for all if explicitly assigned devices
are explicitly deassigned.  There are only 2 ways a device is deassigned:
(1) if the owner explicitly deassigns it and (2) if ass is invoked with
no parameters, any devices assigned to non-logged-on users 
will be returned to the system and marked available.

MESSAGES & DIAGNOSTICS:

	Invoking ass with no parameters will cause a "usage" message to be
printed, informing the user the correct syntax for assigning a device.
Following the message will be the assignment list (all assignable
devices and their current status).
	Attepting to assign a user-owned device causes a message such
as:	
	/dev/xxxx:	assigned to yyyy
which indicates that user yyyy is logged-on and assigned the device.
Any further attempts to assign the device will similiarly be ignored
until user yyyy deassigns the device or logs off of UNIX.

SEE ALSO:
	/usr/pavo/deass.c		source program for companion procedure
	"ls -l /dev"			device directory (all system resources)
	chown(ii)			procedure to change file owner
	chmod(ii)			procedure to change file mode

FILES USED:
	/etc/passwd		password file
	/etc/utmp		user information (users logged-on to UNIX)
	/usr/sys/sbuf.h		inode structure for "stat"  calls

KNOWN BUGS:
	If a user logs-off after having been assigned a resource, the resource
may still be assigned to that user for some time after he has left.
To avoid this, each user that assigns himself/herself a device should
remember to deassign it as soon as possible.  Keep in mind, that there
are only 2 ways to deassign a device:  (1) if the current owner ex-
plicitly deassigns it or (2) if ass is called with no paramters, all devices being held by non-
logged-on users will be deassigned and indicated as such in the device
listing.

IMPLEMENTATION DESCRIPTION:
	Ass is a miniscule main program which calls assign.  Assign coordinates
the calling of other procedures to determine current device status, requesting
user's name, size and relationship of strings...
	logdin 	-- a Boolean procedure (returns a 1 if user is logged-on, else
			returns a 0) that determines if a user-id is logged-on.
	list    -- an output procedure only; prints out the assignment list.
			List also will deassign a device if it finds a device
			with no logged-on user as it's owner.
	getun   -- this procedure gets a name (logon name) given a user's id
			number.  It calls the system procedure "getpw" and extracts
			the first 8 chars to obtain a name.
	compstr -- this procedure compares two strings char by char to determine
			whether they represent the same object.  It calculates
			their size first by calling sizstr.
	sizstr  -- sizes a string; that is, it scans the string passed to it
			by a pointer until it encounters a null (0 or '\0') char,
			then returns the string size.  Obviously, strings which do not
			terminate with a null char leads one to disaster.
	chdev   -- changes the current device owner to that of the requesting
			user.  It also changes the device's mode to disable anyone
			except the super-user and the device owner from
			writing or using the device.
