aboutsummaryrefslogtreecommitdiff
path: root/sys/fio/funlink.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/funlink.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/fio/funlink.x')
-rw-r--r--sys/fio/funlink.x33
1 files changed, 33 insertions, 0 deletions
diff --git a/sys/fio/funlink.x b/sys/fio/funlink.x
new file mode 100644
index 00000000..402076f0
--- /dev/null
+++ b/sys/fio/funlink.x
@@ -0,0 +1,33 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <syserr.h>
+include <knet.h>
+
+# FUNLINK -- Remove a symlink.
+
+procedure funlink (lname)
+
+char lname[ARB] # link name
+
+int status
+pointer sp, oslnk
+int access()
+errchk syserrs
+
+begin
+ call smark (sp)
+ call salloc (oslnk, SZ_PATHNAME, TY_CHAR)
+
+ # It is an error if the link file doesn't exist.
+ if (access (lname, 0, 0) == NO)
+ call syserrs (SYS_FOPEN, lname)
+
+ # Try to remove the symlink.
+ iferr (call fmapfn (lname, Memc[oslnk], SZ_PATHNAME))
+ call syserrs (SYS_FSYMLINK, lname)
+ call zfulnk (Memc[oslnk], status)
+ if (status == ERR)
+ call syserrs (SYS_FUNLINK, lname)
+
+ call sfree (sp)
+end