aboutsummaryrefslogtreecommitdiff
path: root/sys/etc/proscmd.x
diff options
context:
space:
mode:
Diffstat (limited to 'sys/etc/proscmd.x')
-rw-r--r--sys/etc/proscmd.x32
1 files changed, 32 insertions, 0 deletions
diff --git a/sys/etc/proscmd.x b/sys/etc/proscmd.x
new file mode 100644
index 00000000..cf1e5bb3
--- /dev/null
+++ b/sys/etc/proscmd.x
@@ -0,0 +1,32 @@
+# Copyright(c) 1986 Association of Universities for Research in Astronomy Inc.
+
+include <config.h>
+
+# PROSCMD -- Process an OS escape command from a subprocess. Execute the
+# command and return the exit status to the subprocess via IPC.
+
+procedure proscmd (pr, cmd)
+
+int pr # subprocess process slot number
+char cmd[ARB] # host command to be executed
+
+char statbuf[5]
+int fd, status, op
+int itoc(), oscmd()
+include "prc.com"
+
+begin
+ fd = pr_outfd[pr]
+
+ # Execute the command (waits for completion).
+ status = oscmd (cmd, "", "", "")
+
+ # Encode the return status.
+ op = itoc (status, statbuf, 5) + 1
+ statbuf[op] = '\n'
+ statbuf[op+1] = EOS
+
+ # Return the status to the subprocess.
+ call write (fd, statbuf, op)
+ call flush (fd)
+end