aboutsummaryrefslogtreecommitdiff
path: root/sys/ki/kfsubd.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/ki/kfsubd.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/ki/kfsubd.x')
-rw-r--r--sys/ki/kfsubd.x52
1 files changed, 52 insertions, 0 deletions
diff --git a/sys/ki/kfsubd.x b/sys/ki/kfsubd.x
new file mode 100644
index 00000000..93f2d655
--- /dev/null
+++ b/sys/ki/kfsubd.x
@@ -0,0 +1,52 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include "ki.h"
+
+# KFSUBD -- Compute the net pathname of a subdirectory given the net pathname
+# of the parent directory and the name of the subdirectory (the logical
+# subdirectory names . and .. are supported). If the subdirectory resides on
+# the local node we call the local kernel to compute the new directory pathname.
+# If the directory resides on a remote node we merely append to the virtual
+# pathname, leaving resolution of the final pathname to the remote kernel when
+# the file is referenced at runtime.
+
+procedure kfsubd (osdir, maxch, subdir, nchars)
+
+char osdir[maxch] #RW net pathname of directory
+int maxch #RO max chars out in osdir string
+char subdir[ARB] #RO receives pathname
+int nchars #WO receives length of osfn string
+
+int delim, op
+char alias[SZ_ALIAS]
+int ki_gnode(), gstrcat()
+
+begin
+ if (ki_gnode (osdir, alias, delim) == LOCAL) {
+ # Directory is on the local node.
+
+ if (osdir[delim+1] == EOS) {
+ call zfgcwd (osdir[delim+1], maxch - delim, nchars)
+ if (nchars == ERR)
+ return
+ call strupk (osdir[delim+1], osdir[delim+1], maxch-delim)
+ }
+ call zfsubd (osdir[delim+1], maxch - delim, subdir, nchars)
+ if (nchars != ERR)
+ nchars = nchars + delim
+
+ } else {
+ # File is on a remote node. Do not map the filename; leave that
+ # to the kernel when the file is referenced at runtime. The OSDIR
+ # string is assumed to be a concatenatable VFN (with node prefix).
+
+ op = gstrcat (subdir, osdir, maxch) + 1
+ if (op > 1 && osdir[op-1] != '/') {
+ osdir[op] = '/'
+ op = op + 1
+ osdir[op] = EOS
+ }
+
+ nchars = op - 1
+ }
+end