summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--!NetSurf/!Boot,feb81
-rw-r--r--!NetSurf/!Run,feb26
-rw-r--r--desktop/gui.h2
-rw-r--r--desktop/netsurf.c4
-rw-r--r--gtk/gtk_gui.c2
-rw-r--r--riscos/gui.c85
6 files changed, 164 insertions, 36 deletions
diff --git a/!NetSurf/!Boot,feb b/!NetSurf/!Boot,feb
index b42526e65..578af5c6f 100644
--- a/!NetSurf/!Boot,feb
+++ b/!NetSurf/!Boot,feb
@@ -1,14 +1,37 @@
+| Boot file for NetSurf. ( $Revision: 1.10 $ )
+|
+| This file sets up various system variables which NetSurf may use.
+| Additionally, it places the NetSurf application sprites into the Wimp
+| sprite pool.
+|
+| This file may be executed in two ways:
+| 1. When NetSurf is first seen by the OS.
+| 2. When NetSurf is run by the user (called from the !Run file).
+| In the first instance, NetSurf-specific variables are set and non
+| NetSurf-specific variables which are unset are initialised.
+| In the second instance, all variables are set, irrespective of their
+| previous state. This is achieved by use of the NetSurf$ForceVars
+| variable, which is set by the !Run file prior to calling this file.
+
+| Set up NetSurf$Dir
Set NetSurf$Dir <Obey$Dir>
+| Filetype -> Type name mappings
+|
+| These get set whether they were previously set or not
Set File$Type_695 GIF
+Set File$Type_B28 URL
Set File$Type_B60 PNG
Set File$Type_C85 JPEG
Set File$Type_F78 JNG
Set File$Type_F79 CSS
Set File$Type_F83 MNG
+Set File$Type_F91 URI
Set File$Type_FAF HTML
| Application system variables
+|
+| See http://www.iyonix.com/32bit/help.shtml for more details.
Set NetSurf$Help <NetSurf$Dir>.Docs.docs_en
Set NetSurf$Version "Development Build"
Set NetSurf$Web "http://netsurf.sourceforge.net/"
@@ -17,21 +40,49 @@ Set NetSurf$Publisher "The NetSurf Developers"
Set NetSurf$Description "Web browser"
| NetSurf Sprites
+|
+| The sprite file used is based on the OS version:
+| RO < Select 3 uses !Sprites<nn>
+| RO >= Select 3 uses ASprites<nn>
+| RO >= 5 uses 5Sprites<nn>
If "<Boot$OSVersion>" < "436" Then IconSprites <Obey$Dir>.!Sprites Else If "<Boot$OSVersion>" < "500" Then IconSprites <Obey$Dir>.ASprites Else IconSprites <Obey$Dir>.5Sprites
| Acorn URI protocol
-If "<Alias$Open_URI_http>" = "" Then Set Alias$Open_URI_http <NetSurf$Dir>.URILaunch
-If "<Alias$Open_URI_https>" = "" Then Set Alias$Open_URI_https <NetSurf$Dir>.URILaunch
-If "<Alias$Open_URI_file>" = "" Then Set Alias$Open_URI_file <NetSurf$Dir>.URILaunch
-
-| ANT URI protocol
-| Not yet ;)
-|If "" = "<Alias$URLOpen_http>" Then Set Alias$URLOpen_http <NetSurf$Dir>.URILaunch %%*0
-|If "" = "<Alias$URLOpen_https>" Then Set Alias$URLOpen_https <NetSurf$Dir>.URILaunch %%*0
-|If "" = "<Alias$URLOpen_file>" Then Set Alias$URLOpen_file <NetSurf$Dir>.URILaunch %%*0
-
-| Claim HTML and URI files
-| Not Yet ;)
-|If "" = "<Alias$@RunType_FAF>" Then Set Alias$@RunType_FAF <NetSurf$Dir>.URILaunch
-|If "" = "<Alias$@RunType_B28>" Then Set Alias$@RunType_B28 <NetSurf$Dir>.URILaunch
-|If "" = "<FTPc$Dir>" Then If "<Alias$@RunType_F91>" = "" Then Set Alias$@RunType_F91 <NetSurf$Dir>.URILaunch
+|
+| Format: Alias$Open_URI_<scheme> <command to run>
+|
+| These are basically a last resort. The URI module will initially broadcast
+| Message_URI_MProcess. If this isn't claimed, then it'll check if an
+| appropriate Alias$Open_URI_<scheme> variable is set. If such a variable
+| exists, then it will attempt to launch the task named by the variable.
+| If the launch is successful, the Message_URI_MProcess is rebroadcast.
+| The -nowin is required to ensure only one window is opened (this only has
+| an effect if the user has configured auto window opening at startup).
+If (("<Alias$Open_URI_http>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$Open_URI_http <NetSurf$Dir>.!Run -nowin
+If (("<Alias$Open_URI_https>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$Open_URI_https <NetSurf$Dir>.!Run -nowin
+If (("<Alias$Open_URI_file>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$Open_URI_file <NetSurf$Dir>.!Run -nowin
+
+| ANT URL protocol
+|
+| Format: Alias$URLOpen_<scheme> <command to run>
+|
+| These handle the "load" stage of the protocol. The appropriate variable's
+| existence is checked then, if it is present, the URL to be opened is
+| appended to the string "URLOpen_<scheme> " and this is then fed to
+| Wimp_StartTask.
+If (("<Alias$URLOpen_http>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$URLOpen_http /<NetSurf$Dir>.!Run -url %%*0
+If (("<Alias$URLOpen_https>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$URLOpen_https /<NetSurf$Dir>.!Run -url %%*0
+If (("<Alias$URLOpen_file>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$URLOpen_file /<NetSurf$Dir>.!Run -url %%*0
+
+| Claim HTML and URL files
+|
+| Format: Alias$@RunType_<hex> <command to run>
+|
+| Again, a fallback. The filer initially tries a DataOpen message. If that
+| bounces, it looks at these variables.
+If (("<Alias$@RunType_FAF>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$@RunType_FAF /<NetSurf$Dir>.!Run -html %%*0
+If (("<Alias$@RunType_B28>" = "") OR ("<NetSurf$ForceVars>" = "1")) Then Set Alias$@RunType_B28 /<NetSurf$Dir>.!Run -urlf %%*0
+
+| We don't claim the URI filetype as the spec tells us not to:
+| "Applications must not set an Alias$@RunType variable for the URI filetype"
+| Obviously this means that Browse/Phoenix and the Oreganos are incorrect.
diff --git a/!NetSurf/!Run,feb b/!NetSurf/!Run,feb
index ab38922a1..ecc17ffdc 100644
--- a/!NetSurf/!Run,feb
+++ b/!NetSurf/!Run,feb
@@ -1,14 +1,26 @@
+| Run file for NetSurf. ( $Revision: 1.29 $ )
+|
+| This file ensures that the system resources required by NetSurf are
+| present. Additionally, it forces setting of system variables related
+| to NetSurf.
+
+| Set system variables and application sprites
+Set NetSurf$ForceVars 1
<Obey$Dir>.!Boot
+UnSet NetSurf$ForceVars
| Can't run more than one copy of NetSurf at once.
If "<NetSurf$Running>" = "yes" Then Error NetSurf is already running
-| We need RISC OS 3
+| We need RISC OS 3
RMEnsure UtilityModule 3.00 Error NetSurf needs RISC OS 3 or later
| Ensure Nested WIMP is installed
| http://acorn.riscos.com (in the universal boot archive)
-RMEnsure WindowManager 3.80 Error 0 NetSurf requires the Nested Window Manager. This can be obtained by downloading the Universal Boot sequence from http://acorn.riscos.com/
+RMEnsure WindowManager 3.80 Error NetSurf requires the Nested Window Manager. This can be obtained by downloading the Universal Boot sequence from http://acorn.riscos.com/
+
+| Ensure the System resource exists - can't do much if it doesn't
+If "<System$Path>" = "" Then Set System$Path_Message System resources not found.
| Ensure CallASWI is installed
| http://www.iyonix.com/32bit/
@@ -45,7 +57,13 @@ RMEnsure MimeMap 0.10 Error NetSurf requires MimeMap 0.10 or later
RMEnsure Tinct 0.07 RMLoad System:Modules.Tinct
RMEnsure Tinct 0.07 Error NetSurf requires Tinct 0.07 or later. This can be downloaded from http://www.tinct.net
-Wimpslot -min 2240k -max 2240k
+| Ensure Iconv
+| http://moose.mine.nu:6888/iconv002.zip
+| Not an error if not present - there'll be no charset conversion.
+RMEnsure Iconv 0.02 RMLoad System:Modules.Iconv
+
+WimpSlot -min 2240k -max 2240k
+
Set NetSurf$Running yes
-Run <NetSurf$Dir>.!RunImage 2><NetSurf$Dir>.stderr
+Run <NetSurf$Dir>.!RunImage %*0 2><NetSurf$Dir>.stderr
UnSet NetSurf$Running \ No newline at end of file
diff --git a/desktop/gui.h b/desktop/gui.h
index fbb4f8525..1db455c6f 100644
--- a/desktop/gui.h
+++ b/desktop/gui.h
@@ -26,7 +26,7 @@ typedef enum { GUI_POINTER_DEFAULT, GUI_POINTER_POINT, GUI_POINTER_CARET,
#include "netsurf/desktop/browser.h"
void gui_init(int argc, char** argv);
-void gui_init2(void);
+void gui_init2(int argc, char** argv);
void gui_multitask(void);
void gui_poll(bool active);
void gui_quit(void);
diff --git a/desktop/netsurf.c b/desktop/netsurf.c
index 24583daa8..06b105a23 100644
--- a/desktop/netsurf.c
+++ b/desktop/netsurf.c
@@ -9,6 +9,7 @@
#include <locale.h>
#include <stdbool.h>
+#include <stdio.h>
#include <stdlib.h>
#include <sys/utsname.h>
#include "netsurf/utils/config.h"
@@ -35,6 +36,7 @@ static void lib_init(void);
int main(int argc, char** argv)
{
+ setbuf(stderr, NULL);
netsurf_init(argc, argv);
while (!netsurf_quit)
@@ -75,7 +77,7 @@ void netsurf_init(int argc, char** argv)
setlocale(LC_ALL, "");
fetch_init();
fetchcache_init();
- gui_init2();
+ gui_init2(argc, argv);
}
/**
diff --git a/gtk/gtk_gui.c b/gtk/gtk_gui.c
index 291ea3b74..f30e3f767 100644
--- a/gtk/gtk_gui.c
+++ b/gtk/gtk_gui.c
@@ -32,7 +32,7 @@ void gui_init(int argc, char** argv)
}
-void gui_init2(void)
+void gui_init2(int argc, char** argv)
{
browser_window_create("http://netsurf.sourceforge.net/", 0);
}
diff --git a/riscos/gui.c b/riscos/gui.c
index ad9e513bc..339dffed6 100644
--- a/riscos/gui.c
+++ b/riscos/gui.c
@@ -427,24 +427,81 @@ void ro_gui_check_resolvers(void)
* Last-minute gui init, after all other modules have initialised.
*/
-void gui_init2(void)
+void gui_init2(int argc, char** argv)
{
-#ifdef WITH_KIOSK_BROWSING
- browser_window_create("file:/<NetSurf$Dir>/Docs/intro_en", NULL);
-#else
- char url[80];
-
- if (option_open_browser_at_startup) {
- if (option_homepage_url && option_homepage_url[0]) {
- browser_window_create(option_homepage_url, NULL);
- } else {
- snprintf(url, sizeof url,
- "file:/<NetSurf$Dir>/Docs/intro_%s",
- option_language);
- browser_window_create(url, NULL);
+ char *url = 0;
+ bool open_window = option_open_browser_at_startup;
+
+ /* parse command-line arguments */
+ if (argc == 2) {
+ LOG(("parameters: '%s'", argv[1]));
+ /* this is needed for launching URI files */
+ if (strcasecmp(argv[1], "-nowin") == 0)
+ open_window = false;
+ }
+ else if (argc == 3) {
+ LOG(("parameters: '%s' '%s'", argv[1], argv[2]));
+ open_window = true;
+
+ /* HTML files */
+ if (strcasecmp(argv[1], "-html") == 0) {
+ url = ro_path_to_url(argv[2]);
+ if (!url) {
+ LOG(("malloc failed"));
+ die("Insufficient memory for URL");
+ }
+ }
+ /* URL files */
+ else if (strcasecmp(argv[1], "-urlf") == 0) {
+ url = ro_gui_url_file_parse(argv[2]);
+ if (!url) {
+ LOG(("malloc failed"));
+ die("Insufficient memory for URL");
+ }
+ }
+ /* ANT URL Load */
+ else if (strcasecmp(argv[1], "-url") == 0) {
+ url = strdup(argv[2]);
+ if (!url) {
+ LOG(("malloc failed"));
+ die("Insufficient memory for URL");
+ }
+ }
+ /* Unknown => exit here. */
+ else {
+ LOG(("Unknown parameters: '%s' '%s'",
+ argv[1], argv[2]));
+ return;
}
}
+ /* get user's homepage (if configured) */
+ else if (option_homepage_url && option_homepage_url[0]) {
+ url = calloc(strlen(option_homepage_url) + 5, sizeof(char));
+ if (!url) {
+ LOG(("malloc failed"));
+ die("Insufficient memory for URL");
+ }
+ sprintf(url, "%s", option_homepage_url);
+ }
+ /* default homepage */
+ else {
+ url = calloc(80, sizeof(char));
+ if (!url) {
+ LOG(("malloc failed"));
+ die("Insufficient memory for URL");
+ }
+ snprintf(url, 80, "file:/<NetSurf$Dir>/Docs/intro_%s",
+ option_language);
+ }
+
+#ifdef WITH_KIOSK_BROWSING
+ open_window = true;
#endif
+
+ if (open_window)
+ browser_window_create(url, NULL);
+
+ free(url);
}