aboutsummaryrefslogtreecommitdiff
path: root/sys/mtio/mtencode.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/mtencode.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/mtio/mtencode.x')
-rw-r--r--sys/mtio/mtencode.x44
1 files changed, 44 insertions, 0 deletions
diff --git a/sys/mtio/mtencode.x b/sys/mtio/mtencode.x
new file mode 100644
index 00000000..b6bf6b0f
--- /dev/null
+++ b/sys/mtio/mtencode.x
@@ -0,0 +1,44 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+# MTENCODE -- Construct a full magtape device specification. This routine is
+# the opposite of MTPARSE. If the file and record numbers are to be omitted
+# from the output mtname they should be passed as ERR.
+
+procedure mtencode (outstr, maxch, device, fileno, recno, attrl)
+
+char outstr[ARB] #O magtape device specification
+int maxch #I max chars out
+char device[ARB] #I device name (incl node)
+int fileno, recno #I file and record numbers, or ERR
+char attrl[ARB] #I tapecap attributes
+
+int op
+int gstrcpy()
+int itoc()
+
+begin
+ if (fileno != ERR || recno != ERR || attrl[1] != EOS) {
+ op = gstrcpy (device, outstr, maxch) + 1
+ outstr[op] = '['; op = op + 1
+ if (fileno != ERR) {
+ if (fileno == EOT)
+ op = op + gstrcpy ("EOT", outstr[op], maxch-op+1)
+ else
+ op = op + itoc (fileno, outstr[op], maxch-op+1)
+ }
+ if (recno != ERR) {
+ outstr[op] = '.'; op = op + 1
+ op = op + itoc (recno, outstr[op], maxch-op+1)
+ }
+ if (attrl[1] != EOS) {
+ if (attrl[1] != ':') {
+ outstr[op] = ':'
+ op = op + 1
+ }
+ op = op + gstrcpy (attrl, outstr[op], maxch-op+1)
+ }
+ outstr[op] = ']'; op = op + 1
+ outstr[op] = EOS
+ } else
+ call strcpy (device, outstr, maxch)
+end