aboutsummaryrefslogtreecommitdiff
path: root/sys/ki/kfpath.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/kfpath.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/ki/kfpath.x')
-rw-r--r--sys/ki/kfpath.x56
1 files changed, 56 insertions, 0 deletions
diff --git a/sys/ki/kfpath.x b/sys/ki/kfpath.x
new file mode 100644
index 00000000..6522e5f2
--- /dev/null
+++ b/sys/ki/kfpath.x
@@ -0,0 +1,56 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <chars.h>
+include "ki.h"
+
+# KFPATH -- Convert a VFN into a net pathname. The VFN may contain a node
+# pathname and the final pathname will always include the node name.
+
+procedure kfpath (vfn, osfn, maxch, nchars)
+
+char vfn[ARB] # virtual filename
+char osfn[maxch] # receives pathname
+int maxch # max chars out
+int nchars # receives length of osfn string
+
+int delim, op, nodeflag, junk
+int ki_gnode(), gstrcpy(), ki_gethosts()
+include "kinode.com"
+
+begin
+ # Read the host name table if it has not been read yet.
+ if (n_nnodes == 0)
+ junk = ki_gethosts()
+
+ # If no VFN is given return the current working directory.
+ if (vfn[1] == EOS) {
+ call kfgcwd (osfn, maxch, nchars)
+ call strupk (osfn, osfn, maxch)
+ return
+ }
+
+ # Determine what node the given VFN resides on.
+ nodeflag = ki_gnode (vfn, osfn, delim)
+
+ # Append the node delimiter to the node name if there is a node name.
+ for (op=1; osfn[op] != EOS; op=op+1)
+ ;
+ if (op > 1) {
+ osfn[op] = FNNODE_CHAR
+ op = op + 1
+ }
+
+ if (nodeflag == LOCAL) {
+ # File is on the local node. Return the mapped pathname with
+ # the node name of the local node prepended.
+
+ call zfpath (vfn[delim+1], osfn[op], maxch-op+1, nchars)
+ nchars = nchars + op - 1
+
+ } else {
+ # File is on a remote node. Do not map the filename; leave that
+ # to the kernel when the file is referenced at runtime.
+
+ nchars = gstrcpy (vfn[delim+1], osfn[op], maxch-op+1) + op - 1
+ }
+end