aboutsummaryrefslogtreecommitdiff
path: root/sys/fio/frmbfs.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/fio/frmbfs.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/fio/frmbfs.x')
-rw-r--r--sys/fio/frmbfs.x38
1 files changed, 38 insertions, 0 deletions
diff --git a/sys/fio/frmbfs.x b/sys/fio/frmbfs.x
new file mode 100644
index 00000000..ec1df5e7
--- /dev/null
+++ b/sys/fio/frmbfs.x
@@ -0,0 +1,38 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <config.h>
+include <fio.h>
+
+# FRMBFS -- Return file buffer. Called by FSET to change the buffer size,
+# and by FRTNFD when a file is closed.
+
+procedure frmbfs (fd)
+
+int fd # file descriptor
+
+long offset
+errchk mfree, flush
+include <fio.com>
+
+begin
+ fp = fiodes[fd]
+ if (bufptr[fd] == NULL)
+ return
+ else
+ call fcanpb (fd)
+
+ # Note file offset, return buffer and initialize i/o pointers,
+ # restore seek offset (which depends on buffer pointer, buf offset).
+
+ offset = LNOTE(fd)
+ call mfree (bufptr[fd], TY_CHAR)
+ call mfree (FPBBUF(fp), TY_CHAR)
+
+ bufptr[fd] = NULL
+ boffset[fd] = NULL
+ buftop[fd] = NULL
+ itop[fd] = NULL
+ otop[fd] = NULL
+
+ LSEEK (fd, offset)
+end