aboutsummaryrefslogtreecommitdiff
path: root/sys/mtio/mtlocknam.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/mtlocknam.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/mtio/mtlocknam.x')
-rw-r--r--sys/mtio/mtlocknam.x40
1 files changed, 40 insertions, 0 deletions
diff --git a/sys/mtio/mtlocknam.x b/sys/mtio/mtlocknam.x
new file mode 100644
index 00000000..0820645a
--- /dev/null
+++ b/sys/mtio/mtlocknam.x
@@ -0,0 +1,40 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <ctype.h>
+include <chars.h>
+include "mtio.h"
+
+# MT_LOCKNAME -- Generate the file name of the magtape lock file, given the
+# logical drive name. We are called from a z-routine, so do not use any high
+# level i/o routines. The generated lockfile name is of the form
+#
+# [node!]dir$mta.lok
+#
+# The lock file is maintained on the same node as the drive to which it
+# refers.
+
+procedure mt_lockname (device, lockfile, maxch)
+
+char device[ARB] #I device name
+char lockfile[maxch] #O receives generated lockfile name
+int maxch #I max chars out
+
+int ip, op
+int gstrcpy(), strlen()
+
+begin
+ lockfile[1] = EOS
+
+ # Copy the node name prefix, if any.
+ call ki_xnode (device, lockfile, maxch)
+ op = strlen (lockfile) + 1
+ ip = op
+
+ # Add the directory name prefix, "mt", and device name.
+ op = op + gstrcpy (LOCKLDIR, lockfile[op], maxch-op+1)
+ op = op + gstrcpy (LOCKFILE, lockfile[op], maxch-op+1)
+ op = op + gstrcpy (device[ip], lockfile[op], maxch-op+1)
+
+ # Add file extension.
+ op = op + gstrcpy (LOCKEXTN, lockfile[op], maxch-op+1)
+end