aboutsummaryrefslogtreecommitdiff
path: root/sys/mtio/mtstatus.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/mtstatus.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/mtio/mtstatus.x')
-rw-r--r--sys/mtio/mtstatus.x34
1 files changed, 34 insertions, 0 deletions
diff --git a/sys/mtio/mtstatus.x b/sys/mtio/mtstatus.x
new file mode 100644
index 00000000..967d25df
--- /dev/null
+++ b/sys/mtio/mtstatus.x
@@ -0,0 +1,34 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# MTSTATUS -- Print the status of an allocated magtape device, i.e., print the
+# lock file as a text file. Called by the DEVSTATUS task.
+
+procedure mtstatus (out, mtname)
+
+int out #I output file
+char mtname[ARB] #I magtape specification
+
+int in
+pointer sp, lockfile
+errchk open, fcopyo
+int open(), access()
+
+begin
+ call smark (sp)
+ call salloc (lockfile, SZ_FNAME, TY_CHAR)
+
+ call mt_sync (OK)
+
+ call mt_glock (mtname, Memc[lockfile], SZ_FNAME)
+ if (access (Memc[lockfile], 0, 0) == NO) {
+ call fprintf (out, "tape position for %s is undefined\n")
+ call pargstr (mtname)
+ } else {
+ # Print the lockfile.
+ in = open (Memc[lockfile], READ_ONLY, TEXT_FILE)
+ call fcopyo (in, out)
+ call close (in)
+ }
+
+ call sfree (sp)
+end