diff -r -U 2 dillo-0.8.4.orig/src/dillo.c dillo-0.8.4/src/dillo.c --- dillo-0.8.4/src/dillo.c 2005-01-06 04:14:39.000000000 -0800 +++ dillo-0.8.4.new/src/dillo.c 2005-01-13 14:45:17.887722637 -0800 @@ -51,4 +51,54 @@ #include "cookies.h" +/* SAM This lets us open an URL by remote control. + * This mimics mosaic. + */ +static void a_Remote_url() +{ + extern BrowserWindow **browser_window; /* interface.c */ + DilloUrl *remote_url; + FILE *fp; + char url[256]; + BrowserWindow *bw = browser_window[0]; + + if(!bw) return; + + signal(SIGUSR1, SIG_IGN); + + sprintf(url, "/tmp/Mosaic.%d", getpid()); + if((fp = fopen(url, "r"))) { + if(fgets(url, sizeof(url) - 1, fp) && + strncmp(url, "goto", 4) == 0 && + fgets(url, sizeof(url) - 1, fp)) { + fclose(fp); + remote_url = a_Url_new(url, "http:/", 0, 0, 0); + a_Nav_push(bw, remote_url); + a_Url_free(remote_url); + } + else + fclose(fp); + } + + signal(SIGUSR1, a_Remote_url); +} + +static void a_Remote_init() +{ + gchar *file; + FILE *fp; + + signal(SIGUSR1, SIG_IGN); + + /* Write the pidfile */ + file = a_Misc_prepend_user_home(".mosaicpid"); + if((fp = fopen(file, "w"))) { + fprintf (fp, "%d\n", getpid()); + fclose (fp); + signal(SIGUSR1, a_Remote_url); + } + g_free(file); +} +/* SAM */ + /* @@ -286,4 +336,5 @@ a_Dw_init(); a_Cookies_init(); + a_Remote_init(); /* SAM */ /* -f overrides dillorc */ diff -r -U 2 dillo-0.8.4.orig/src/interface.c dillo-0.8.4/src/interface.c --- dillo-0.8.4/src/interface.c 2004-12-29 05:26:48.000000000 -0800 +++ dillo-0.8.4.new/src/interface.c 2005-01-13 14:45:17.894721705 -0800 @@ -57,5 +57,5 @@ /* BrowserWindow holds all the widgets (and perhaps more) * for each new_browser.*/ -static BrowserWindow **browser_window; +/* SAM static */ BrowserWindow **browser_window; static gint num_bw, num_bw_max;