fork-execvp-kludge for xmosaic (2.0 pre 8)

Kim Nyberg (kny@tekla.fi)
Wed, 10 Nov 93 15:09:31 +0200


Still missing the completely non-blocking i/o of erwise (RIP) I
decided to make a really ugly (DON'T try this at home kids) quick'n
dirty hack for xmosaic to simulate the erwise behaviour. When using
the middle button to open up a new window (following the new url)
the patched xmosaic forks off a new process and does an execvp
restarting itself with the new url as an argument.

Note that you have to remove Marc's #ifdef PRERELEASE in gui.c in
order to get xmosaic to load the requested url. The name of the binary
is hardcoded as "xmosaic", please change if needed.

Kim

Ps. Marc, feel free to include the patch in the next release, tho I
understand if you wont include it (it really is a dirty hack, but it made
xmosaic more useable for me)

Ps2. Of course I'm waiting for non-blocking multiple loads ... >:)

-- cut here --
*** gui.c~ Tue Nov 9 12:19:57 1993
--- gui.c Wed Nov 10 14:11:58 1993
***************
*** 495,507 ****
if (strncmp (url, "telnet:", 7) && strncmp (url, "tn3270:", 7) &&
strncmp (url, "rlogin:", 7))
{
/* Not a telnet anchor. */

! /* Open the window (generating a new cached_url). */
! mo_open_another_window (win, url, reftext, target);

! /* Now redisplay this window. */
! mo_redisplay_window (win);
}
else
/* Just do mo_load_window_text go get the xterm forked off. */
--- 495,522 ----
if (strncmp (url, "telnet:", 7) && strncmp (url, "tn3270:", 7) &&
strncmp (url, "rlogin:", 7))
{
+ int pid;
/* Not a telnet anchor. */

! pid = fork();
! if (pid == (-1))
! {
! /* Open the window (generating a new cached_url). */
! mo_open_another_window (win, url, reftext, target);

! /* Now redisplay this window. */
! mo_redisplay_window (win);
! }
! else
! if (!pid)
! {
! char *argv[3];
!
! argv[0] = "xmosaic";
! argv[1] = url;
! argv[2] = NULL;
! execvp("xmosaic", argv);
! }
}
else
/* Just do mo_load_window_text go get the xterm forked off. */
-- cut here --