aboutsummaryrefslogtreecommitdiff
path: root/sys/fio/deletefg.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/deletefg.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/fio/deletefg.x')
-rw-r--r--sys/fio/deletefg.x37
1 files changed, 37 insertions, 0 deletions
diff --git a/sys/fio/deletefg.x b/sys/fio/deletefg.x
new file mode 100644
index 00000000..be397efd
--- /dev/null
+++ b/sys/fio/deletefg.x
@@ -0,0 +1,37 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <error.h>
+
+# DELETEFG -- Delete a file group, i.e., the file, all subfiles, and all
+# versions. It is an error if the file does not exist, is protected, or
+# if the file simply cannot be deleted. A subfile is a physical file which
+# is logically subordinate to another file and which must be deleted if the
+# main file is deleted (e.g., a pixel storage file is a subfile of an
+# imagefile).
+
+procedure deletefg (fname, versions, subfiles)
+
+char fname[ARB] # file or file group to be deleted
+int versions # delete all versions
+int subfiles # delete any subfiles (no subsubfiles)
+
+int n, max_versions
+errchk delete, erract
+
+begin
+ max_versions = 1
+ if (versions == YES)
+ max_versions = 30000
+
+ for (n=0; n < max_versions; n=n+1) {
+ # Delete the main file.
+ iferr (call delete (fname))
+ if (n == 0)
+ call erract (EA_ERROR)
+ else
+ break
+ # Delete any subfiles.
+ if (subfiles == YES)
+ call fsfdelete (fname)
+ }
+end