aboutsummaryrefslogtreecommitdiff
path: root/sys/mtio/mtcap.x
diff options
context:
space:
mode:
authorJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
committerJoe Hunkeler <jhunkeler@gmail.com>2015-08-11 16:51:37 -0400
commit40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch)
tree4464880c571602d54f6ae114729bf62a89518057 /sys/mtio/mtcap.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/mtio/mtcap.x')
-rw-r--r--sys/mtio/mtcap.x36
1 files changed, 36 insertions, 0 deletions
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