aboutsummaryrefslogtreecommitdiff
path: root/sys/imio/iki/oif/oifclose.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/imio/iki/oif/oifclose.x
downloadiraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz
Initial commit
Diffstat (limited to 'sys/imio/iki/oif/oifclose.x')
-rw-r--r--sys/imio/iki/oif/oifclose.x36
1 files changed, 36 insertions, 0 deletions
diff --git a/sys/imio/iki/oif/oifclose.x b/sys/imio/iki/oif/oifclose.x
new file mode 100644
index 00000000..8eb58b4f
--- /dev/null
+++ b/sys/imio/iki/oif/oifclose.x
@@ -0,0 +1,36 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <protect.h>
+include <error.h>
+include <imhdr.h>
+include <imio.h>
+
+# OIF_CLOSE -- Close an OIF format image. There is little for us to do, since
+# IMIO will already have updated the header if necessary and flushed any pixel
+# output. Neither do we have to deallocate the IMIO descriptor, since it was
+# allocated by IMIO.
+
+procedure oif_close (im, status)
+
+pointer im # image descriptor
+int status
+
+int junk
+int protect()
+
+begin
+ # Close the pixel file and header file, if open.
+ if (IM_PFD(im) != NULL)
+ call close (IM_PFD(im))
+ if (IM_HFD(im) != NULL)
+ call close (IM_HFD(im))
+
+ # If we are closing a new image, set delete protection on the
+ # header file to prevent the user from using DELETE to delete
+ # the image header file, which would leave a headerless pixel
+ # storage file lying about somewhere.
+
+ if (IM_ACMODE(im) == NEW_IMAGE || IM_ACMODE(im) == NEW_COPY)
+ iferr (junk = protect (IM_HDRFILE(im), SET_PROTECTION))
+ call erract (EA_WARN)
+end