summaryrefslogtreecommitdiff
path: root/support/hypertex/tanmoy/X
diff options
context:
space:
mode:
Diffstat (limited to 'support/hypertex/tanmoy/X')
-rw-r--r--support/hypertex/tanmoy/X/.index.html103
-rw-r--r--support/hypertex/tanmoy/X/Mosaic6
-rw-r--r--support/hypertex/tanmoy/X/callmosaic36
-rw-r--r--support/hypertex/tanmoy/X/newpg.c37
4 files changed, 182 insertions, 0 deletions
diff --git a/support/hypertex/tanmoy/X/.index.html b/support/hypertex/tanmoy/X/.index.html
new file mode 100644
index 0000000000..1451189154
--- /dev/null
+++ b/support/hypertex/tanmoy/X/.index.html
@@ -0,0 +1,103 @@
+<header><title>external URL's under X</title></header>
+<h1>external URL's under X</h1>
+<pre>
+Date: Sat, 16 Jul 94 12:49:47 MDT
+From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
+To: ginsparg@qfwfq.lanl.gov
+Subject: more things needed
+</pre>
+The script for Mosaic is not really that good right now: and we should
+probably think a bit more, and probably should talk to the Mosaic guys
+as well. That is why I do not yet want to publish it. We can put it up
+as an example of how it can be done within the present framework
+itself: not as a way in which we think these should be done.
+<p>
+At the minimum we need Mosaic (and any other www client)
+to set two environmentvariables containing respectively:
+(1) its own pid, and (2) The URL of the document it is calling,
+and should accept by `remote control' either (a) an absolute URL, OR
+(b) a relative URL and a BASE HREF. <br>
+(Instead of using an environment variable for (2), it could instead put
+the URL into a file and name the file in the environment.
+[Does mac have environment variables? It is easy to overflow
+IBM PC environment space].)
+<hr>
+Anyway, here is how the system on nqcd works. No portability issues
+had been considered when writing them: I have tried to express my
+concerns below.
+
+<ol>
+<li> There is a c-program
+<a href="newpg.c">newpg.c</a> which takes 2 or more parameters.
+<ol>
+<li> <b>if</b> the first parameter is non-zero,
+it sets its pgid to the first parameter,
+<b>else</b> it sets its pgid to its pid.
+<li> it replaces itself (without changing pid's) with the program
+ named by its second parameter and passes the rest of the
+ arguments to it.
+<li>Note that it requires ANSI C, the header <sys/types.h> to define pid_t, and
+ the routines setpgid (I haven't checked to see if it exists in
+ SYSV) and execvp.
+</ol>
+
+<li>The actual Mosaic is renamed Mosaic.binary
+
+<li> <a href="Mosaic">Mosaic</a>
+ is a script that calls the c-program (newpg) which starts the
+ actual Mosaic. (It also provides default values to a few environment
+ variables: only WWWBROWSER is relevant to this project). It should
+ work on all unices unchanged provided $0 gets correctly translated,
+ and the paths are corrected.
+
+<li> <a href="callmosaic">callmosaic</a> takes two parameters and does the
+ following:
+ <ol>
+ <li> Ignores the second parameter. See later.
+ <li> It clears the PATH environment variable, and changes the MOSAIC
+ environment variable, if present, to /usr/local/bin/Mosaic. (As
+ a result it uses absolute paths for all system programs,
+ bringing in system dependencies). It redirects standard output
+ to standard error. (should it?)
+ <li> gets its own pgid. (call it x) Doing this from shell is
+ extremely machine dependent. (depends on exact format of ps
+ output! On some machines like IBM Risc stations, may be next to
+ impossible). Should be done with a two line C program instead.
+ <li> checks process with PID x to see if it exists and its
+ identification as returned by ps contains the string
+ `Mosaic'. If so, goes to step 6. (There may be differences
+ between BSD and SYSV ps calls). Probably should also check the
+ DISPLAY environment variable, but no sure way of doing that
+ unless one call call a process which has group kmem
+ permissions. (Unless pstat, which is such a process gives us a
+ way of doing it: I do not know). A less than perfect way does
+ exist with ps -e.
+ <li> checks to see if ${HOME}/.mosaicpid exists and is readable.
+ If so, call the pid in it as x (probably crash if file not in
+ right format), else go to step 6.
+ <li> checks to see if process with PID x exists and its
+ identification as returned by ps contains the string
+ `Mosaic'. If so goto step 6. (BSD and SYSV ps calls may
+ differ). (Note that it does not check to see if the DISPLAY is
+ the same! See point 2)
+ <li> Start a Mosaic passing it the first parameter; and exit when
+ that exits. (should probably `exec' the Mosaic instead. Should
+ it also try a ps -x and check for an unique Mosaic on this
+ display before it starts a new one? See point 2 about
+ display). (The redirection of standard output to standard error
+ stays!) (What happens if the parameter contains backquotes?
+ Haven't checked!)
+ <li> Creates /tmp/Mosaic.x (x being the aforementioned pid) and
+ writes two lines into it (probably crashes if it cannot): the
+ first being `goto' and the second contains whatever came in as
+ the first parameter. Then it signals USR1 to x, and
+ exits. (probably should write the second parameter as a third
+ line.) (What happens if the parameter contains backquotes?
+ Haven't checked!)
+ <li> Note that the second parameter is always ignored. (It is supposed
+ to be the BASE HREF of the document which is calling callmosaic).
+ </ol>
+
+</ol>
+
+</body>
diff --git a/support/hypertex/tanmoy/X/Mosaic b/support/hypertex/tanmoy/X/Mosaic
new file mode 100644
index 0000000000..0d75e4f6d8
--- /dev/null
+++ b/support/hypertex/tanmoy/X/Mosaic
@@ -0,0 +1,6 @@
+#!/bin/sh --
+WWWBROWSER=${WWWBROWSER-/usr/local/bin/callmosaic} \
+PATH=/usr/ucb:$PATH \
+NNTPSERVER=${NNTPSERVER-newshost} \
+WWW_wais_GATEWAY=${WWW_wais_GATEWAY-http://www.ncsa.uiuc.edu:8001} \
+/usr/local/bin/newpg 0 $0.binary $*
diff --git a/support/hypertex/tanmoy/X/callmosaic b/support/hypertex/tanmoy/X/callmosaic
new file mode 100644
index 0000000000..a0eec1463b
--- /dev/null
+++ b/support/hypertex/tanmoy/X/callmosaic
@@ -0,0 +1,36 @@
+#!/bin/sh --
+# This is a generic shell script for messaging Mosaic written by
+# tanmoy@lanl.gov based on an idea by Paul F. Mende and
+# an implementation by krobison@nucleus.harvard.edu
+#
+# It takes two params: an URL and a base URL to interpret it with
+# respect to. It currently ignores this second parameter.
+#
+# stdout to stderr anyway
+exec >&2
+# Note that it sets PATH to null to avoid security
+# problems.
+PATH=
+MOSAIC=/usr/local/bin/Mosaic
+# Find my invoking Mosaic. (pid with our pgid)
+mypid=`/bin/ps -jx$$ | /usr/ucb/tail -1 | /bin/cut -c 12-17`
+mypid=`/bin/expr $mypid`
+if /bin/ps -lww$mypid | /bin/grep Mosaic > /dev/null; then /bin/true;
+else
+ if [ -r ${HOME}/.mosaicpid ]; then
+ mypid=`/bin/cat ${HOME}/.mosaicpid`
+ mypid=`/bin/expr $mypid`
+ if /bin/ps -lww$mypid | /bin/grep Mosaic > /dev/null; then /bin/true;
+ else
+ ${MOSAIC} "$1" &
+ exit 0
+ fi
+ else
+ ${MOSAIC} "$1" &
+ exit 0
+ fi
+fi
+/bin/rm -f /tmp/Mosaic.$mypid
+/bin/echo goto >/tmp/Mosaic.$mypid
+/bin/echo "$1" >>/tmp/Mosaic.$mypid
+/bin/kill -USR1 $mypid
diff --git a/support/hypertex/tanmoy/X/newpg.c b/support/hypertex/tanmoy/X/newpg.c
new file mode 100644
index 0000000000..d17832f49e
--- /dev/null
+++ b/support/hypertex/tanmoy/X/newpg.c
@@ -0,0 +1,37 @@
+#include <stdlib.h>
+#include <stdio.h>
+#include <sys/types.h>
+
+#ifndef EXIT_FAILURE
+ #define EXIT_FAILURE 1
+#endif
+
+#define abrt() return EXIT_FAILURE
+
+int main(int argc, char *argv[])
+{
+ pid_t pgid, pid=0; int arg1;
+
+ if (argc < 3) {
+ fprintf(stderr,"Usage: %s pgid command args\n",argv[0]);
+ abrt();
+ }
+
+ if(sscanf(argv[1],"%d",&arg1)!=1) {
+ fprintf(stderr,"Usage: %s pgid command args\n",argv[0]);
+ abrt();
+ }
+ pgid = arg1;
+
+ if (setpgid(0,pgid)) {
+ fprintf(stderr,"Error changing pgid\n");
+ abrt();
+ }
+
+ if(execvp(argv[2],&argv[2])) {
+ fprintf(stderr,"Error execvping\n");
+ abrt();
+ }
+
+ return 0; /* Impossible */
+}