aboutsummaryrefslogtreecommitdiff
path: root/sys/fmio/fmlfparse.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/fmio/fmlfparse.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
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