diff options
author | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
---|---|---|
committer | Joe Hunkeler <jhunkeler@gmail.com> | 2015-08-11 16:51:37 -0400 |
commit | 40e5a5811c6ffce9b0974e93cdd927cbcf60c157 (patch) | |
tree | 4464880c571602d54f6ae114729bf62a89518057 /sys/fio/deletefg.x | |
download | iraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz |
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/fio/deletefg.x')
-rw-r--r-- | sys/fio/deletefg.x | 37 |
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 |