aboutsummaryrefslogtreecommitdiff
path: root/sys/fmio/fmlfparse.x
diff options
context:
space:
mode:
authorJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
committerJoseph Hunkeler <jhunkeler@gmail.com>2015-07-08 20:46:52 -0400
commitfa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch)
treebdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/fmio/fmlfparse.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/fmio/fmlfparse.x')
-rw-r--r--sys/fmio/fmlfparse.x45
1 files changed, 45 insertions, 0 deletions
diff --git a/sys/fmio/fmlfparse.x b/sys/fmio/fmlfparse.x
new file mode 100644
index 00000000..63f43a84
--- /dev/null
+++ b/sys/fmio/fmlfparse.x
@@ -0,0 +1,45 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <fmset.h>
+
+# FM_LFPARSE -- Parse an encoded lfile filename.
+# The filename syntax is "Tddd.fff" where
+#
+# T is 'B' or 'T' for text or binary
+# ddd is the encoded descriptor pointer
+# fff is the encoded lfile number
+
+int procedure fm_lfparse (lfname, fm, lfile, type)
+
+char lfname[ARB] #I encoded lfile filename
+pointer fm #O FMIO descriptor
+int lfile #O lfile number
+int type #O lfile file type (text or binary)
+
+int ip
+int ctoi()
+
+begin
+ # Determine file type.
+ if (lfname[1] == 'T')
+ type = TEXT_FILE
+ else
+ type = BINARY_FILE
+
+ # Get FMIO descriptor.
+ ip = 2
+ if (ctoi (lfname, ip, fm) <= 0)
+ return (ERR)
+
+ # Skip . delimiter.
+ if (lfname[ip] == '.')
+ ip = ip + 1
+ else
+ return (ERR)
+
+ # Get lfile number.
+ if (ctoi (lfname, ip, lfile) <= 0)
+ return (ERR)
+
+ return (OK)
+end