summaryrefslogtreecommitdiff
path: root/utils/nsoption.c
diff options
context:
space:
mode:
Diffstat (limited to 'utils/nsoption.c')
-rw-r--r--utils/nsoption.c17
1 files changed, 12 insertions, 5 deletions
diff --git a/utils/nsoption.c b/utils/nsoption.c
index 8f05a911b..09529a0d0 100644
--- a/utils/nsoption.c
+++ b/utils/nsoption.c
@@ -187,7 +187,7 @@ static void nsoption_validate(struct nsoption_s *opts, struct nsoption_s *defs)
break;
}
}
- if (black == true) {
+ if (black == true && defs != NULL) {
for (cloop = NSOPTION_SYS_COLOUR_START;
cloop <= NSOPTION_SYS_COLOUR_END;
cloop++) {
@@ -209,6 +209,9 @@ static void nsoption_validate(struct nsoption_s *opts, struct nsoption_s *defs)
opts[NSOPTION_max_retried_fetches].value.u) > 60) &&
(opts[NSOPTION_max_retried_fetches].value.u > 1))
opts[NSOPTION_max_retried_fetches].value.u--;
+
+ /* We ignore the result because we can't fail to validate. Yay */
+ (void)nslog_set_filter_by_options();
}
/**
@@ -648,11 +651,12 @@ nsoption_read(const char *path, struct nsoption_s *opts)
fp = fopen(path, "r");
if (!fp) {
- LOG("Failed to open file '%s'", path);
+ NSLOG(netsurf, INFO, "Failed to open file '%s'", path);
return NSERROR_NOT_FOUND;
}
- LOG("Successfully opened '%s' for Options file", path);
+ NSLOG(netsurf, INFO, "Successfully opened '%s' for Options file",
+ path);
while (fgets(s, NSOPTION_MAX_LINE_LEN, fp)) {
char *colon, *value;
@@ -718,7 +722,8 @@ nsoption_write(const char *path,
fp = fopen(path, "w");
if (!fp) {
- LOG("failed to open file '%s' for writing", path);
+ NSLOG(netsurf, INFO, "failed to open file '%s' for writing",
+ path);
return NSERROR_NOT_FOUND;
}
@@ -798,7 +803,7 @@ nsoption_commandline(int *pargc, char **argv, struct nsoption_s *opts)
/* arg+arglen is the option to set, val is the value */
- LOG("%.*s = %s", arglen, arg, val);
+ NSLOG(netsurf, INFO, "%.*s = %s", arglen, arg, val);
for (entry_loop = 0;
entry_loop < NSOPTION_LISTEND;
@@ -818,6 +823,8 @@ nsoption_commandline(int *pargc, char **argv, struct nsoption_s *opts)
}
*pargc -= (idx - 1);
+ nsoption_validate(opts, nsoptions_default);
+
return NSERROR_OK;
}