aboutsummaryrefslogtreecommitdiff
path: root/sys/ki/kimapchan.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/kimapchan.x
downloadiraf-osx-40e5a5811c6ffce9b0974e93cdd927cbcf60c157.tar.gz
Repatch (from linux) of OSX IRAF
Diffstat (limited to 'sys/ki/kimapchan.x')
-rw-r--r--sys/ki/kimapchan.x44
1 files changed, 44 insertions, 0 deletions
diff --git a/sys/ki/kimapchan.x b/sys/ki/kimapchan.x
new file mode 100644
index 00000000..196619d2
--- /dev/null
+++ b/sys/ki/kimapchan.x
@@ -0,0 +1,44 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <config.h>
+include <mach.h>
+include <knet.h>
+include "ki.h"
+
+# KI_MAPCHAN -- Return the OS channel number or pid and the node name of the
+# resource associated with a given KI channel. This procedure may be called
+# whether or not networking is enabled.
+
+int procedure ki_mapchan (chan, nodename, maxch)
+
+int chan # KI channel (ret. by kopnbf, etc.)
+char nodename[maxch] # receives node name
+int maxch
+
+int node
+bool netenab
+data netenab /KNET/
+include "kichan.com"
+include "kinode.com"
+
+begin
+ if (netenab) {
+ # Networking is enabled. Every channel or pid returned to the VOS
+ # by the kernel is actually a KI channel index.
+
+ node = k_node[chan]
+ if (node == NULL || n_nnodes == 0)
+ call strcpy (n_localnode, nodename, maxch)
+ else
+ call strcpy (n_alias[1,1,node], nodename, maxch)
+
+ return (k_oschan[chan])
+
+ } else {
+ # Networking is disabled. Return the name of the local node
+ # and return the channel argument unchanged.
+
+ call strcpy (n_localnode, nodename, maxch)
+ return (chan)
+ }
+end