diff options
author | Josh Rickmar <jrick@devio.us> | 2012-05-16 16:11:54 -0400 |
---|---|---|
committer | Josh Rickmar <jrick@devio.us> | 2012-05-16 19:33:39 -0400 |
commit | 1b1398e0f206ca1e445e5768feda331065ea01f4 (patch) | |
tree | ab5ac4474e6b3e4821bf73423a46aed38583b6f9 | |
parent | dfe584d1a656f4d95764dd06fa8502aa45b187fe (diff) | |
download | xombrero-1b1398e0f206ca1e445e5768feda331065ea01f4.tar.gz |
Add a setting to read additional config files from any other config
file and document it. This fixes FS#238.
-rw-r--r-- | settings.c | 19 | ||||
-rw-r--r-- | xxxterm.1 | 24 | ||||
-rw-r--r-- | xxxterm.conf | 3 |
3 files changed, 43 insertions, 3 deletions
diff --git a/settings.c b/settings.c index 9efae47..b0d773e 100644 --- a/settings.c +++ b/settings.c @@ -102,6 +102,7 @@ char *external_editor = NULL; int referer_mode = XT_REFERER_ALWAYS; char *referer_custom = NULL; int download_notifications = 0; +char *include_config = NULL; char *cmd_font_name = NULL; char *oops_font_name = NULL; @@ -392,6 +393,7 @@ struct settings rs[] = { { "enable_favicon_tabs", XT_S_INT, 0, &enable_favicon_tabs, NULL, NULL, NULL, set_enable_favicon_tabs }, { "referer", XT_S_STR, 0, NULL, NULL,&s_referer, NULL, set_referer_rt }, { "download_notifications", XT_S_INT, 0, &download_notifications, NULL, NULL, NULL, set_download_notifications }, + { "include_config", XT_S_STR, 0, NULL, &include_config, NULL, NULL, NULL }, /* font settings */ { "cmd_font", XT_S_STR, 0, NULL, &cmd_font_name, NULL, NULL, set_cmd_font }, @@ -1981,15 +1983,26 @@ walk_pl_wl(struct settings *s, int settings_add(char *var, char *val) { - int i, rv, *p; - gfloat *f; - char **s; + int i, rv, *p; + gfloat *f; + char c[PATH_MAX], **s; /* get settings */ for (i = 0, rv = 0; i < LENGTH(rs); i++) { if (strcmp(var, rs[i].name)) continue; + if (!strcmp(var, "include_config")) { + if (val[0] == '~') + snprintf(c, PATH_MAX, "%s" PS "%s", pwd->pw_dir, + &val[1]); + else + strlcpy(c, val, PATH_MAX); + config_parse(c, 0); + rv = 1; + break; + } + if (rs[i].s) { if (rs[i].s->set(&rs[i], val)) errx(1, "invalid value for %s: %s", var, val); diff --git a/xxxterm.1 b/xxxterm.1 index fa43c63..a9bc91a 100644 --- a/xxxterm.1 +++ b/xxxterm.1 @@ -1000,6 +1000,30 @@ This field delineates the cookie policy. Possible values are: no3rdparty, reject 3rd party cookies. accept, accept all cookies. reject, reject all cookies. +.It Cm include_config +This must be a path to another configuration file. +Configuration files are usually read from top to bottom, however, if +this option is set, +.Nm +will begin reading the included file at this location and continue +reading the rest of the configuation after the included file has +finished being read. +.Pp +Any simple settings set before the include may +be overridden by settings in the included file, and any simple +settings set in the included file may be overridden later by settings +after the include or at runtime using the +.Cm :set +command. +However, database settings (for example, +.Cm cookie_wl , js_wl , pl_wl , +and +.Cm keybinding ) +are only ever added to the database, and so the order of an included +configuration file is not pertinent to these database settings. +.Pp +This feature is likely best used as the last item in +.Pa ~/.xxxterm.conf . .It Cm cookie_wl This is a cookie whitelist item. Use multiple times to add multiple entries. diff --git a/xxxterm.conf b/xxxterm.conf index 67967b7..6ebdf51 100644 --- a/xxxterm.conf +++ b/xxxterm.conf @@ -364,3 +364,6 @@ # keybinding = focusreset,C-0 # keybinding = editelement,!C-i # keybinding = passthrough,C-z + +# parse the contents of another configuration file +# include_config = ~/.xxxterm_alternate.conf |