From fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 8 Jul 2015 20:46:52 -0400 Subject: Initial commit --- sys/mtio/mtcap.x | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 sys/mtio/mtcap.x (limited to 'sys/mtio/mtcap.x') diff --git a/sys/mtio/mtcap.x b/sys/mtio/mtcap.x new file mode 100644 index 00000000..d3f859fa --- /dev/null +++ b/sys/mtio/mtcap.x @@ -0,0 +1,36 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include "mtio.h" + +# MTCAP -- Return the tapecap descriptor for the given magtape device. The +# device is specified by the full specification (as passed to mtopen), hence +# there may be tapecap attributes in the device specification which override +# those in the tapecap file. + +pointer procedure mtcap (mtname) + +char mtname[ARB] #I magtape device specification + +int fileno, recno +pointer sp, device, devcap, cache_gty, gty +pointer mt_gtyopen(), gtycaps(), gtyopen() +errchk mtparse, mt_gtyopen + +begin + call smark (sp) + call salloc (device, SZ_DEVICE, TY_CHAR) + call salloc (devcap, SZ_DEVCAP, TY_CHAR) + + call mtparse (mtname, Memc[device], SZ_DEVICE, fileno, recno, + Memc[devcap], SZ_DEVCAP) + + # Do not return the cached MTIO device entry, as we do not want the + # application to close this with gtyclose. Open a new GTY descriptor + # using the capabilities in the cached entry. + + cache_gty = mt_gtyopen (Memc[device], Memc[devcap]) + gty = gtyopen ("", "", Memc[gtycaps(cache_gty)]) + + call sfree (sp) + return (gty) +end -- cgit