summaryrefslogtreecommitdiff
path: root/riscos/gui.c
diff options
context:
space:
mode:
authorJohn Mark Bell <jmb@netsurf-browser.org>2004-09-27 05:21:00 +0000
committerJohn Mark Bell <jmb@netsurf-browser.org>2004-09-27 05:21:00 +0000
commit5802723281ef8b6672e1c3f0e76c9b2a42bd22f9 (patch)
treed288162056410f45622e5c9291821a610efa3ad7 /riscos/gui.c
parentebc39ef41fb0407a58a66b740b143f299c526e31 (diff)
downloadnetsurf-5802723281ef8b6672e1c3f0e76c9b2a42bd22f9.tar.gz
netsurf-5802723281ef8b6672e1c3f0e76c9b2a42bd22f9.tar.bz2
[project @ 2004-09-27 05:21:00 by jmb]
Improve !Boot file and support protocol fallback positions. svn path=/import/netsurf/; revision=1287
Diffstat (limited to 'riscos/gui.c')
-rw-r--r--riscos/gui.c85
1 files changed, 71 insertions, 14 deletions
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);
}