diff options
author | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
---|---|---|
committer | Joseph Hunkeler <jhunkeler@gmail.com> | 2015-07-08 20:46:52 -0400 |
commit | fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4 (patch) | |
tree | bdda434976bc09c864f2e4fa6f16ba1952b1e555 /sys/fio/fsymlink.x | |
download | iraf-linux-fa080de7afc95aa1c19a6e6fc0e0708ced2eadc4.tar.gz |
Initial commit
Diffstat (limited to 'sys/fio/fsymlink.x')
-rw-r--r-- | sys/fio/fsymlink.x | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/sys/fio/fsymlink.x b/sys/fio/fsymlink.x new file mode 100644 index 00000000..c742baa7 --- /dev/null +++ b/sys/fio/fsymlink.x @@ -0,0 +1,53 @@ +# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc. + +include <syserr.h> +include <knet.h> + +# FSYMLINK -- Remove a symlink. + +procedure fsymlink (link, target) + +char link[ARB] # link name +char target[ARB] # target file + +int status +pointer sp, oslnk, ostgt, lname, tname +int access() +errchk syserrs + +begin + call smark (sp) + call salloc (lname, SZ_PATHNAME, TY_CHAR) + call salloc (tname, SZ_PATHNAME, TY_CHAR) + call salloc (oslnk, SZ_PATHNAME, TY_CHAR) + call salloc (ostgt, SZ_PATHNAME, TY_CHAR) + + # It is an error if the link file already exists. + if (access (link, 0, 0) == YES) + call syserrs (SYS_FSYMLINK, link) + + # Always present ZFLINK with a full pathname (rather than an + # absolute or cwd relative filename), in case the kernel procedure + # is not smart enough to handle all these possibilities. + call aclrc (Memc[oslnk], SZ_PATHNAME) + iferr (call fmapfn (link, Memc[oslnk], SZ_PATHNAME)) + call syserrs (SYS_FSYMLINK, link) + +# call strupk (Memc[oslnk], Memc[oslnk], SZ_PATHNAME) +# call strpak (Memc[oslnk], Memc[oslnk], SZ_PATHNAME) + + + call aclrc (Memc[ostgt], SZ_PATHNAME) + iferr (call fmapfn (target, Memc[ostgt], SZ_PATHNAME)) + call syserrs (SYS_FSYMLINK, target) + +# call strupk (Memc[ostgt], Memc[ostgt], SZ_PATHNAME) +# call strpak (Memc[ostgt], Memc[ostgt], SZ_PATHNAME) + + # Try to create the symlink. + call zflink (Memc[ostgt], Memc[oslnk], status) + if (status == ERR) + call syserrs (SYS_FSYMLINK, link) + + call sfree (sp) +end |