Gitweb links:
...log
http://git.netsurf-browser.org/netsurf.git/shortlog/d7907bfe4ca4180dd926d...
...commit
http://git.netsurf-browser.org/netsurf.git/commit/d7907bfe4ca4180dd926dbe...
...tree
http://git.netsurf-browser.org/netsurf.git/tree/d7907bfe4ca4180dd926dbe40...
The branch, master has been updated
via d7907bfe4ca4180dd926dbe4088e9b2be477c2bc (commit)
via 80e14dce527cc0b276a3a1082e95c20ed38c389d (commit)
via 4ad94124a693528f2ac47a9b4b2e12880586aedf (commit)
via e27525123baa045d2400cfb5133f55d3ed4cb2a8 (commit)
from fa87f197c214620b00bc07c38034b38efa638210 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=d7907bfe4ca4180dd92...
commit d7907bfe4ca4180dd926dbe4088e9b2be477c2bc
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Allow specifying location of the users directories on the commandline
Arg USERSDIR/K
diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide
index 4c1d348..a1c3941 100755
--- a/amiga/dist/NetSurf.guide
+++ b/amiga/dist/NetSurf.guide
@@ -109,12 +109,13 @@ This section contains options for exporting to PDF. It is not
enabled in curren
@endnode
@node cli "Command line options"
-NetSurf URL/K,FORCE/S,NSOPTS/M
+NetSurf NSOPTS/M,URL/K,USERSDIR/K,FORCE/S
Where:
-URL = Address of page to open on startup
-FORCE = Force new instance of NetSurf to open (has some limitations, use for debugging
only)
-NSOPTS = Catches everything else and passes it to the NetSurf core command line parser
+URL = Address of page to open on startup
+USERSDIR = Locations of user directories (see @{"tooltypes" link tooltypes})
+FORCE = Force new instance of NetSurf to open (has some limitations, use for debugging
only)
+NSOPTS = Catches everything else and passes it to the NetSurf core command line parser
@endnode
@node tooltypes "ToolTypes"
diff --git a/amiga/gui.c b/amiga/gui.c
index c9bca6f..dbcc2f3 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -797,12 +797,13 @@ static struct RDArgs *ami_gui_commandline(int *argc, char **argv,
int *nargc, ch
{
int new_argc = 1;
struct RDArgs *args;
- CONST_STRPTR template = "NSOPTS/M,URL/K,FORCE/S";
- long rarray[] = {0,0,0};
+ CONST_STRPTR template = "NSOPTS/M,URL/K,USERSDIR/K,FORCE/S";
+ long rarray[] = {0,0,0,0};
enum
{
A_NSOPTS, /* ignored */
A_URL,
+ A_USERSDIR,
A_FORCE
};
@@ -814,6 +815,11 @@ static struct RDArgs *ami_gui_commandline(int *argc, char **argv, int
*nargc, ch
temp_homepage_url = ami_to_utf8_easy((char *)rarray[A_URL]);
}
+ if(rarray[A_USERSDIR]) {
+ LOG("USERSDIR %s specified on command line", rarray[A_USERSDIR]);
+ users_dir = ASPrintf("%s", rarray[A_USERSDIR]);
+ }
+
if(rarray[A_FORCE]) {
LOG("FORCE specified on command line");
cli_force = true;
@@ -5419,6 +5425,8 @@ int main(int argc, char** argv)
BPTR lock = 0;
int32 user = 0;
nserror ret;
+ int nargc = 0;
+ char *nargv = NULL;
struct netsurf_table amiga_table = {
.browser = &amiga_browser_table,
@@ -5470,9 +5478,6 @@ int main(int argc, char** argv)
return RETURN_FAIL;
}
- int nargc;
- char *nargv;
-
ami_gui_read_all_tooltypes(argc, argv);
struct RDArgs *args = ami_gui_commandline(&argc, argv, &nargc, &nargv);
@@ -5493,8 +5498,8 @@ int main(int argc, char** argv)
}
}
-#ifdef __amigaos4__
if(LIB_IS_AT_LEAST((struct Library *)DOSBase, 51, 96)) {
+#ifdef __amigaos4__
struct InfoData *infodata = AllocDosObject(DOS_INFODATA, 0);
if(infodata == NULL) {
ami_misc_fatal_error("Failed to allocate memory");
@@ -5515,13 +5520,12 @@ int main(int argc, char** argv)
return RETURN_FAIL;
}
FreeDosObject(DOS_INFODATA, infodata);
- } else {
#else
-//FIXME for OS3 and older OS4
+#warning FIXME for OS3 and older OS4
#endif
-#ifdef __amigaos4__
+ } else {
+//TODO: check volume write status using old API
}
-#endif
int len = strlen(current_user);
len += strlen(users_dir);
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=80e14dce527cc0b276a...
commit 80e14dce527cc0b276a3a1082e95c20ed38c389d
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Move ReadArgs commandline processing earlier whilst leaving core commandline
processing where it was previously
diff --git a/amiga/gui.c b/amiga/gui.c
index a47ac98..c9bca6f 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -793,7 +793,7 @@ static void ami_openscreenfirst(void)
ami_theme_throbber_setup();
}
-static void ami_gui_commandline(int *argc, char **argv)
+static struct RDArgs *ami_gui_commandline(int *argc, char **argv, int *nargc, char
**nargv)
{
int new_argc = 1;
struct RDArgs *args;
@@ -806,7 +806,7 @@ static void ami_gui_commandline(int *argc, char **argv)
A_FORCE
};
- if(*argc == 0) return; // argc==0 is started from wb
+ if(*argc == 0) return NULL; // argc==0 is started from wb
if((args = ReadArgs(template, rarray, NULL))) {
if(rarray[A_URL]) {
@@ -840,22 +840,21 @@ static void ami_gui_commandline(int *argc, char **argv)
const char *new_argv = malloc(sizeof(char *) * new_argc);
const char **new_argvp = &new_argv;
- *new_argvp = messages_get("NetSurf");
p = (char **)rarray[A_NSOPTS];
do {
- new_argvp++;
*new_argvp = *p;
+ new_argvp++;
p++;
} while(*p != NULL);
- nsoption_commandline(&new_argc, (char **)&new_argv, NULL);
+ *nargc = new_argc;
+ *nargv = new_argv;
}
-
- FreeArgs(args);
} else {
LOG("ReadArgs failed to parse command line");
}
+ return args;
}
static void ami_gui_read_tooltypes(struct WBArg *wbarg)
@@ -5471,7 +5470,11 @@ int main(int argc, char** argv)
return RETURN_FAIL;
}
+ int nargc;
+ char *nargv;
+
ami_gui_read_all_tooltypes(argc, argv);
+ struct RDArgs *args = ami_gui_commandline(&argc, argv, &nargc, &nargv);
if(current_user == NULL) {
user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
@@ -5567,7 +5570,10 @@ int main(int argc, char** argv)
return RETURN_FAIL;
}
nsoption_read(current_user_options, NULL);
- ami_gui_commandline(&argc, argv); /* calls nsoption_commandline */
+ if(args != NULL) {
+ nsoption_commandline(&nargc, &nargv, NULL);
+ FreeArgs(args);
+ }
if (ami_locate_resource(messages, "Messages") == false) {
ami_misc_fatal_error("Cannot open Messages file");
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=4ad94124a693528f2ac...
commit 4ad94124a693528f2ac47a9b4b2e12880586aedf
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Skip invalid commandline args instead of aborting
diff --git a/utils/nsoption.c b/utils/nsoption.c
index ccdd23a..c83f779 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -734,8 +734,10 @@ nsoption_commandline(int *pargc, char **argv, struct nsoption_s
*opts)
/* check we have an option */
/* option must start -- and be as long as the shortest option*/
- if ((arglen < (2+5) ) || (arg[0] != '-') || (arg[1] != '-'))
- break;
+ if ((arglen < (2+5) ) || (arg[0] != '-') || (arg[1] != '-')) {
+ idx++;
+ continue;
+ }
arg += 2; /* skip -- */
commitdiff
http://git.netsurf-browser.org/netsurf.git/commit/?id=e27525123baa045d240...
commit e27525123baa045d2400cfb5133f55d3ed4cb2a8
Author: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Commit: Chris Young <chris(a)unsatisfactorysoftware.co.uk>
Make an effort to free resources when a fatal error occurs during initialisation
diff --git a/amiga/gui.c b/amiga/gui.c
index 6859143..a47ac98 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -5459,11 +5459,15 @@ int main(int argc, char** argv)
if (ami_open_resources() == false) { /* alloc message ports */
ami_misc_fatal_error("Unable to allocate resources");
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
if(ami_scheduler_process_create(schedulermsgport) != NSERROR_OK) {
ami_misc_fatal_error("Failed to initialise scheduler");
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
@@ -5479,6 +5483,9 @@ int main(int argc, char** argv)
users_dir = ASPrintf("%s", USERS_DIR);
if(users_dir == NULL) {
ami_misc_fatal_error("Failed to allocate memory");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
}
@@ -5488,6 +5495,9 @@ int main(int argc, char** argv)
struct InfoData *infodata = AllocDosObject(DOS_INFODATA, 0);
if(infodata == NULL) {
ami_misc_fatal_error("Failed to allocate memory");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
GetDiskInfoTags(GDI_StringNameInput, users_dir,
@@ -5495,7 +5505,10 @@ int main(int argc, char** argv)
TAG_DONE);
if(infodata->id_DiskState == ID_DISKSTATE_WRITE_PROTECTED) {
FreeDosObject(DOS_INFODATA, infodata);
- ami_misc_fatal_error("Cannot run with user dir on a write-protected
volume");
+ ami_misc_fatal_error("User directory MUST be on a writeable volume");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
FreeDosObject(DOS_INFODATA, infodata);
@@ -5514,6 +5527,9 @@ int main(int argc, char** argv)
current_user_dir = AllocVecTags(len, NULL);
if(current_user_dir == NULL) {
ami_misc_fatal_error("Failed to allocate memory");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
@@ -5545,6 +5561,9 @@ int main(int argc, char** argv)
ret = nsoption_init(ami_set_options, &nsoptions, &nsoptions_default);
if (ret != NSERROR_OK) {
ami_misc_fatal_error("Options failed to initialise");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
nsoption_read(current_user_options, NULL);
@@ -5552,6 +5571,9 @@ int main(int argc, char** argv)
if (ami_locate_resource(messages, "Messages") == false) {
ami_misc_fatal_error("Cannot open Messages file");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
@@ -5560,6 +5582,9 @@ int main(int argc, char** argv)
ret = netsurf_init(current_user_cache);
if (ret != NSERROR_OK) {
ami_misc_fatal_error("NetSurf failed to initialise");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
-----------------------------------------------------------------------
Summary of changes:
amiga/dist/NetSurf.guide | 9 ++++---
amiga/gui.c | 67 +++++++++++++++++++++++++++++++++++-----------
utils/nsoption.c | 6 +++--
3 files changed, 60 insertions(+), 22 deletions(-)
diff --git a/amiga/dist/NetSurf.guide b/amiga/dist/NetSurf.guide
index 4c1d348..a1c3941 100755
--- a/amiga/dist/NetSurf.guide
+++ b/amiga/dist/NetSurf.guide
@@ -109,12 +109,13 @@ This section contains options for exporting to PDF. It is not
enabled in curren
@endnode
@node cli "Command line options"
-NetSurf URL/K,FORCE/S,NSOPTS/M
+NetSurf NSOPTS/M,URL/K,USERSDIR/K,FORCE/S
Where:
-URL = Address of page to open on startup
-FORCE = Force new instance of NetSurf to open (has some limitations, use for debugging
only)
-NSOPTS = Catches everything else and passes it to the NetSurf core command line parser
+URL = Address of page to open on startup
+USERSDIR = Locations of user directories (see @{"tooltypes" link tooltypes})
+FORCE = Force new instance of NetSurf to open (has some limitations, use for debugging
only)
+NSOPTS = Catches everything else and passes it to the NetSurf core command line parser
@endnode
@node tooltypes "ToolTypes"
diff --git a/amiga/gui.c b/amiga/gui.c
index 6859143..dbcc2f3 100644
--- a/amiga/gui.c
+++ b/amiga/gui.c
@@ -793,20 +793,21 @@ static void ami_openscreenfirst(void)
ami_theme_throbber_setup();
}
-static void ami_gui_commandline(int *argc, char **argv)
+static struct RDArgs *ami_gui_commandline(int *argc, char **argv, int *nargc, char
**nargv)
{
int new_argc = 1;
struct RDArgs *args;
- CONST_STRPTR template = "NSOPTS/M,URL/K,FORCE/S";
- long rarray[] = {0,0,0};
+ CONST_STRPTR template = "NSOPTS/M,URL/K,USERSDIR/K,FORCE/S";
+ long rarray[] = {0,0,0,0};
enum
{
A_NSOPTS, /* ignored */
A_URL,
+ A_USERSDIR,
A_FORCE
};
- if(*argc == 0) return; // argc==0 is started from wb
+ if(*argc == 0) return NULL; // argc==0 is started from wb
if((args = ReadArgs(template, rarray, NULL))) {
if(rarray[A_URL]) {
@@ -814,6 +815,11 @@ static void ami_gui_commandline(int *argc, char **argv)
temp_homepage_url = ami_to_utf8_easy((char *)rarray[A_URL]);
}
+ if(rarray[A_USERSDIR]) {
+ LOG("USERSDIR %s specified on command line", rarray[A_USERSDIR]);
+ users_dir = ASPrintf("%s", rarray[A_USERSDIR]);
+ }
+
if(rarray[A_FORCE]) {
LOG("FORCE specified on command line");
cli_force = true;
@@ -840,22 +846,21 @@ static void ami_gui_commandline(int *argc, char **argv)
const char *new_argv = malloc(sizeof(char *) * new_argc);
const char **new_argvp = &new_argv;
- *new_argvp = messages_get("NetSurf");
p = (char **)rarray[A_NSOPTS];
do {
- new_argvp++;
*new_argvp = *p;
+ new_argvp++;
p++;
} while(*p != NULL);
- nsoption_commandline(&new_argc, (char **)&new_argv, NULL);
+ *nargc = new_argc;
+ *nargv = new_argv;
}
-
- FreeArgs(args);
} else {
LOG("ReadArgs failed to parse command line");
}
+ return args;
}
static void ami_gui_read_tooltypes(struct WBArg *wbarg)
@@ -5420,6 +5425,8 @@ int main(int argc, char** argv)
BPTR lock = 0;
int32 user = 0;
nserror ret;
+ int nargc = 0;
+ char *nargv = NULL;
struct netsurf_table amiga_table = {
.browser = &amiga_browser_table,
@@ -5459,15 +5466,20 @@ int main(int argc, char** argv)
if (ami_open_resources() == false) { /* alloc message ports */
ami_misc_fatal_error("Unable to allocate resources");
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
if(ami_scheduler_process_create(schedulermsgport) != NSERROR_OK) {
ami_misc_fatal_error("Failed to initialise scheduler");
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
ami_gui_read_all_tooltypes(argc, argv);
+ struct RDArgs *args = ami_gui_commandline(&argc, argv, &nargc, &nargv);
if(current_user == NULL) {
user = GetVar("user", temp, 1024, GVF_GLOBAL_ONLY);
@@ -5479,15 +5491,21 @@ int main(int argc, char** argv)
users_dir = ASPrintf("%s", USERS_DIR);
if(users_dir == NULL) {
ami_misc_fatal_error("Failed to allocate memory");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
}
-#ifdef __amigaos4__
if(LIB_IS_AT_LEAST((struct Library *)DOSBase, 51, 96)) {
+#ifdef __amigaos4__
struct InfoData *infodata = AllocDosObject(DOS_INFODATA, 0);
if(infodata == NULL) {
ami_misc_fatal_error("Failed to allocate memory");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
GetDiskInfoTags(GDI_StringNameInput, users_dir,
@@ -5495,17 +5513,19 @@ int main(int argc, char** argv)
TAG_DONE);
if(infodata->id_DiskState == ID_DISKSTATE_WRITE_PROTECTED) {
FreeDosObject(DOS_INFODATA, infodata);
- ami_misc_fatal_error("Cannot run with user dir on a write-protected
volume");
+ ami_misc_fatal_error("User directory MUST be on a writeable volume");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
FreeDosObject(DOS_INFODATA, infodata);
- } else {
#else
-//FIXME for OS3 and older OS4
+#warning FIXME for OS3 and older OS4
#endif
-#ifdef __amigaos4__
+ } else {
+//TODO: check volume write status using old API
}
-#endif
int len = strlen(current_user);
len += strlen(users_dir);
@@ -5514,6 +5534,9 @@ int main(int argc, char** argv)
current_user_dir = AllocVecTags(len, NULL);
if(current_user_dir == NULL) {
ami_misc_fatal_error("Failed to allocate memory");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
@@ -5545,13 +5568,22 @@ int main(int argc, char** argv)
ret = nsoption_init(ami_set_options, &nsoptions, &nsoptions_default);
if (ret != NSERROR_OK) {
ami_misc_fatal_error("Options failed to initialise");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
nsoption_read(current_user_options, NULL);
- ami_gui_commandline(&argc, argv); /* calls nsoption_commandline */
+ if(args != NULL) {
+ nsoption_commandline(&nargc, &nargv, NULL);
+ FreeArgs(args);
+ }
if (ami_locate_resource(messages, "Messages") == false) {
ami_misc_fatal_error("Cannot open Messages file");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
@@ -5560,6 +5592,9 @@ int main(int argc, char** argv)
ret = netsurf_init(current_user_cache);
if (ret != NSERROR_OK) {
ami_misc_fatal_error("NetSurf failed to initialise");
+ ami_scheduler_process_delete();
+ ami_gui_splash_close(splash_window);
+ ami_libs_close();
return RETURN_FAIL;
}
diff --git a/utils/nsoption.c b/utils/nsoption.c
index ccdd23a..c83f779 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -734,8 +734,10 @@ nsoption_commandline(int *pargc, char **argv, struct nsoption_s
*opts)
/* check we have an option */
/* option must start -- and be as long as the shortest option*/
- if ((arglen < (2+5) ) || (arg[0] != '-') || (arg[1] != '-'))
- break;
+ if ((arglen < (2+5) ) || (arg[0] != '-') || (arg[1] != '-')) {
+ idx++;
+ continue;
+ }
arg += 2; /* skip -- */
--
NetSurf Browser