mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
get_opt_*: Add ses parameter
Add a session parameter to get_opt_ and its wrappers in preparation for session-specific and domain-specific options.
This commit is contained in:
parent
3975d28bce
commit
ea372bd0cd
@ -218,7 +218,8 @@ display_button(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
int hk_pos = widget_data->widget->info.button.hotkey_pos;
|
||||
int attr;
|
||||
|
||||
attr = get_opt_bool("ui.dialogs.underline_button_shortcuts")
|
||||
attr = get_opt_bool("ui.dialogs.underline_button_shortcuts",
|
||||
NULL)
|
||||
? SCREEN_ATTR_UNDERLINE : 0;
|
||||
|
||||
#ifdef CONFIG_UTF8
|
||||
|
@ -297,7 +297,7 @@ select_button_by_key(struct dialog_data *dlg_data)
|
||||
|
||||
#ifdef CONFIG_UTF8
|
||||
key = unicode_fold_label_case(get_kbd_key(ev));
|
||||
codepage = get_opt_codepage_tree(dlg_data->win->term->spec, "charset");
|
||||
codepage = get_opt_codepage_tree(dlg_data->win->term->spec, "charset", NULL);
|
||||
#else
|
||||
key = toupper(get_kbd_key(ev));
|
||||
#endif
|
||||
@ -659,7 +659,7 @@ draw_dialog(struct dialog_data *dlg_data, int width, int height)
|
||||
draw_box(term, &dlg_data->box, ' ', 0,
|
||||
get_bfu_color(term, "dialog.generic"));
|
||||
|
||||
if (get_opt_bool("ui.dialogs.shadows")) {
|
||||
if (get_opt_bool("ui.dialogs.shadows", NULL)) {
|
||||
/* Draw shadow */
|
||||
draw_shadow(term, &dlg_data->box,
|
||||
get_bfu_color(term, "dialog.shadow"), 2, 1);
|
||||
|
@ -939,7 +939,8 @@ search_hierbox_browser(void *data, unsigned char *text)
|
||||
scan_for_matches, context);
|
||||
|
||||
if (!context->item && *text) {
|
||||
switch (get_opt_int("document.browse.search.show_not_found")) {
|
||||
switch (get_opt_int("document.browse.search.show_not_found",
|
||||
NULL)) {
|
||||
case 2:
|
||||
info_box(term, MSGBOX_FREE_TEXT,
|
||||
N_("Search"), ALIGN_CENTER,
|
||||
|
@ -127,7 +127,7 @@ check_hotkeys_common(struct menu *menu, term_event_char_T hotkey, struct termina
|
||||
{
|
||||
#ifdef CONFIG_UTF8
|
||||
unicode_val_T key = unicode_fold_label_case(hotkey);
|
||||
int codepage = get_opt_codepage_tree(term->spec, "charset");
|
||||
int codepage = get_opt_codepage_tree(term->spec, "charset", NULL);
|
||||
#else
|
||||
unsigned char key = toupper(hotkey);
|
||||
#endif
|
||||
|
@ -692,7 +692,8 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
|
||||
* is in the terminal's charset. */
|
||||
ins = u2cp_no_nbsp(get_kbd_key(ev),
|
||||
get_opt_codepage_tree(term->spec,
|
||||
"charset"));
|
||||
"charset",
|
||||
NULL));
|
||||
inslen = strlen(ins);
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
|
@ -193,7 +193,7 @@ draw_leds(struct session *ses)
|
||||
|
||||
/* This should be done elsewhere, but this is very nice place where we
|
||||
* could do that easily. */
|
||||
if (get_opt_int("ui.timer.enable") == 2) {
|
||||
if (get_opt_int("ui.timer.enable", NULL) == 2) {
|
||||
led_color = get_bfu_color(term, "status.status-text");
|
||||
if (!led_color) goto end;
|
||||
|
||||
@ -276,7 +276,7 @@ redraw_leds(void *xxx)
|
||||
struct session *ses;
|
||||
|
||||
if (!get_leds_panel_enable()
|
||||
&& get_opt_int("ui.timer.enable") != 2) {
|
||||
&& get_opt_int("ui.timer.enable", NULL) != 2) {
|
||||
redraw_timer = TIMER_ID_UNDEF;
|
||||
return;
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ dlg_format_listbox(struct terminal *term, struct widget_data *widget_data,
|
||||
|
||||
/* This is only weird heuristic, it could scale well I hope. */
|
||||
optimal_h = max_height * 7 / 10 - VERTICAL_LISTBOX_MARGIN;
|
||||
min = get_opt_int("ui.dialogs.listbox_min_height");
|
||||
min = get_opt_int("ui.dialogs.listbox_min_height", NULL);
|
||||
|
||||
if (max_height - VERTICAL_LISTBOX_MARGIN < min) {
|
||||
/* Big trouble: can't satisfy even the minimum :-(. */
|
||||
|
@ -404,7 +404,7 @@ draw_menu_left_text_hk(struct terminal *term, unsigned char *text,
|
||||
{
|
||||
struct color_pair *hk_color = get_bfu_color(term, "menu.hotkey.normal");
|
||||
struct color_pair *hk_color_sel = get_bfu_color(term, "menu.hotkey.selected");
|
||||
enum screen_char_attr hk_attr = get_opt_bool("ui.dialogs.underline_hotkeys")
|
||||
enum screen_char_attr hk_attr = get_opt_bool("ui.dialogs.underline_hotkeys", NULL)
|
||||
? SCREEN_ATTR_UNDERLINE : 0;
|
||||
unsigned char c;
|
||||
int xbase = x + L_TEXT_SPACE;
|
||||
@ -556,7 +556,7 @@ display_menu(struct terminal *term, struct menu *menu)
|
||||
draw_box(term, &box, ' ', 0, normal_color);
|
||||
draw_border(term, &box, frame_color, 1);
|
||||
|
||||
if (get_opt_bool("ui.dialogs.shadows")) {
|
||||
if (get_opt_bool("ui.dialogs.shadows", NULL)) {
|
||||
/* Draw shadow */
|
||||
draw_shadow(term, &menu->box,
|
||||
get_bfu_color(term, "dialog.shadow"), 2, 1);
|
||||
|
@ -38,7 +38,7 @@ get_bfu_color(struct terminal *term, unsigned char *stylename)
|
||||
|
||||
if (!term) return NULL;
|
||||
|
||||
color_mode = get_opt_int_tree(term->spec, "colors");
|
||||
color_mode = get_opt_int_tree(term->spec, "colors", NULL);
|
||||
|
||||
if (!bfu_colors) {
|
||||
/* Initialize the style hash. */
|
||||
@ -86,8 +86,8 @@ get_bfu_color(struct terminal *term, unsigned char *stylename)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
entry->foreground = &get_opt_color_tree(opt, "text");
|
||||
entry->background = &get_opt_color_tree(opt, "background");
|
||||
entry->foreground = &get_opt_color_tree(opt, "text", NULL);
|
||||
entry->background = &get_opt_color_tree(opt, "background", NULL);
|
||||
}
|
||||
|
||||
/* Always update the color pair. */
|
||||
|
@ -45,7 +45,7 @@ static int loaded_backend_num = -1;
|
||||
void
|
||||
bookmarks_read(void)
|
||||
{
|
||||
int backend_num = get_opt_int("bookmarks.file_format");
|
||||
int backend_num = get_opt_int("bookmarks.file_format", NULL);
|
||||
struct bookmarks_backend *backend = bookmarks_backends[backend_num];
|
||||
unsigned char *file_name;
|
||||
FILE *f;
|
||||
@ -76,7 +76,7 @@ bookmarks_read(void)
|
||||
void
|
||||
bookmarks_write(LIST_OF(struct bookmark) *bookmarks_list)
|
||||
{
|
||||
int backend_num = get_opt_int("bookmarks.file_format");
|
||||
int backend_num = get_opt_int("bookmarks.file_format", NULL);
|
||||
struct bookmarks_backend *backend = bookmarks_backends[backend_num];
|
||||
struct secure_save_info *ssi;
|
||||
unsigned char *file_name;
|
||||
|
@ -130,7 +130,7 @@ static void
|
||||
write_bookmarks_default(struct secure_save_info *ssi,
|
||||
LIST_OF(struct bookmark) *bookmarks_list)
|
||||
{
|
||||
int folder_state = get_opt_bool("bookmarks.folder_state");
|
||||
int folder_state = get_opt_bool("bookmarks.folder_state", NULL);
|
||||
struct bookmark *bm;
|
||||
|
||||
foreach (bm, *bookmarks_list) {
|
||||
|
@ -136,7 +136,7 @@ static void
|
||||
write_bookmarks_xbel(struct secure_save_info *ssi,
|
||||
LIST_OF(struct bookmarks) *bookmarks_list)
|
||||
{
|
||||
int folder_state = get_opt_bool("bookmarks.folder_state");
|
||||
int folder_state = get_opt_bool("bookmarks.folder_state", NULL);
|
||||
/* We check for readok in filename_bookmarks_xbel(). */
|
||||
|
||||
secure_fputs(ssi,
|
||||
|
@ -109,7 +109,7 @@ static void bookmark_snapshot();
|
||||
static enum evhook_status
|
||||
bookmark_write_hook(va_list ap, void *data)
|
||||
{
|
||||
if (get_opt_bool("ui.sessions.snapshot")
|
||||
if (get_opt_bool("ui.sessions.snapshot", NULL)
|
||||
&& !get_cmd_opt_bool("anonymous"))
|
||||
bookmark_snapshot();
|
||||
|
||||
@ -534,10 +534,10 @@ bookmark_auto_save_tabs(struct terminal *term)
|
||||
unsigned char *foldername;
|
||||
|
||||
if (get_cmd_opt_bool("anonymous")
|
||||
|| !get_opt_bool("ui.sessions.auto_save"))
|
||||
|| !get_opt_bool("ui.sessions.auto_save", NULL))
|
||||
return;
|
||||
|
||||
foldername = get_opt_str("ui.sessions.auto_save_foldername");
|
||||
foldername = get_opt_str("ui.sessions.auto_save_foldername", NULL);
|
||||
if (!*foldername) return;
|
||||
|
||||
/* Ensure uniqueness of the auto save folder, so it is possible to
|
||||
@ -559,7 +559,8 @@ bookmark_snapshot(void)
|
||||
|
||||
#ifdef HAVE_STRFTIME
|
||||
add_to_string(&folderstring, " - ");
|
||||
add_date_to_string(&folderstring, get_opt_str("ui.date_format"), NULL);
|
||||
add_date_to_string(&folderstring, get_opt_str("ui.date_format", NULL),
|
||||
NULL);
|
||||
#endif
|
||||
|
||||
folder = add_bookmark(NULL, 1, folderstring.source, NULL);
|
||||
|
@ -698,7 +698,7 @@ bookmark_terminal_tabs_dialog(struct terminal *term)
|
||||
|
||||
#ifdef HAVE_STRFTIME
|
||||
add_to_string(&string, " - ");
|
||||
add_date_to_string(&string, get_opt_str("ui.date_format"), NULL);
|
||||
add_date_to_string(&string, get_opt_str("ui.date_format", NULL), NULL);
|
||||
#endif
|
||||
|
||||
input_dialog(term, NULL,
|
||||
|
10
src/cache/cache.c
vendored
10
src/cache/cache.c
vendored
@ -188,7 +188,7 @@ get_validated_cache_entry(struct uri *uri, enum cache_mode cache_mode)
|
||||
* remove the redirect or the entry expired. Please enlighten me.
|
||||
* --jonas */
|
||||
if ((cached->cache_mode == CACHE_MODE_NEVER && cache_mode != CACHE_MODE_ALWAYS)
|
||||
|| (cached->redirect && !get_opt_bool("document.cache.cache_redirects"))
|
||||
|| (cached->redirect && !get_opt_bool("document.cache.cache_redirects", NULL))
|
||||
|| (cached->expire && cache_entry_has_expired(cached))) {
|
||||
if (!is_object_used(cached)) delete_cache_entry(cached);
|
||||
return NULL;
|
||||
@ -197,8 +197,8 @@ get_validated_cache_entry(struct uri *uri, enum cache_mode cache_mode)
|
||||
if (cached->cache_mode <= CACHE_MODE_CHECK_IF_MODIFIED
|
||||
&& cache_mode <= CACHE_MODE_CHECK_IF_MODIFIED
|
||||
&& (cached->last_modified || cached->etag)
|
||||
&& get_opt_int("document.cache.revalidation_interval") >= 0) {
|
||||
if (cached->seconds + get_opt_int("document.cache.revalidation_interval") < time(NULL))
|
||||
&& get_opt_int("document.cache.revalidation_interval", NULL) >= 0) {
|
||||
if (cached->seconds + get_opt_int("document.cache.revalidation_interval", NULL) < time(NULL))
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -753,7 +753,7 @@ garbage_collection(int whole)
|
||||
/* The maximal cache size tolerated by user. Note that this is only
|
||||
* size of the "just stored" unused cache entries, used cache entries
|
||||
* are not counted to that. */
|
||||
unsigned longlong opt_cache_size = get_opt_long("document.cache.memory.size");
|
||||
unsigned longlong opt_cache_size = get_opt_long("document.cache.memory.size", NULL);
|
||||
/* The low-treshold cache size. Basically, when the cache size is
|
||||
* higher than opt_cache_size, we free the cache so that there is no
|
||||
* more than this value in the cache anymore. This is to make sure we
|
||||
@ -895,7 +895,7 @@ shrinked_enough:
|
||||
DBG("garbage collection doesn't work, cache size %ld > %ld, "
|
||||
"document.cache.memory.size set to: %ld bytes",
|
||||
cache_size, gc_cache_size,
|
||||
get_opt_long("document.cache.memory.size"));
|
||||
get_opt_long("document.cache.memory.size", NULL));
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
2
src/cache/dialogs.c
vendored
2
src/cache/dialogs.c
vendored
@ -123,7 +123,7 @@ get_cache_entry_info(struct listbox_item *item, struct terminal *term)
|
||||
time_t expires = timeval_to_seconds(&cached->max_age);
|
||||
|
||||
add_format_to_string(&msg, "\n%s: ", _("Expires", term));
|
||||
add_date_to_string(&msg, get_opt_str("ui.date_format"), &expires);
|
||||
add_date_to_string(&msg, get_opt_str("ui.date_format", NULL), &expires);
|
||||
}
|
||||
#endif
|
||||
#ifdef CONFIG_DEBUG
|
||||
|
@ -144,7 +144,7 @@ eval_cmd(struct option *o, unsigned char ***argv, int *argc)
|
||||
static unsigned char *
|
||||
forcehtml_cmd(struct option *o, unsigned char ***argv, int *argc)
|
||||
{
|
||||
safe_strncpy(get_opt_str("mime.default_type"), "text/html", MAX_STR_LEN);
|
||||
safe_strncpy(get_opt_str("mime.default_type", NULL), "text/html", MAX_STR_LEN);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
@ -685,7 +685,7 @@ printconfigdump_cmd(struct option *option, unsigned char ***argv, int *argc)
|
||||
unsigned char *config_string;
|
||||
|
||||
/* Print all. */
|
||||
get_opt_int("config.saving_style") = 2;
|
||||
get_opt_int("config.saving_style", NULL) = 2;
|
||||
|
||||
config_string = create_config_string("", "", config_options);
|
||||
if (config_string) {
|
||||
|
@ -692,8 +692,8 @@ create_config_string(unsigned char *prefix, unsigned char *name,
|
||||
/* Don't write headers if nothing will be added anyway. */
|
||||
struct string tmpstring;
|
||||
int origlen;
|
||||
int savestyle = get_opt_int("config.saving_style");
|
||||
int i18n = get_opt_bool("config.i18n");
|
||||
int savestyle = get_opt_int("config.saving_style", NULL);
|
||||
int i18n = get_opt_bool("config.i18n", NULL);
|
||||
|
||||
if (!init_string(&config)) return NULL;
|
||||
|
||||
@ -755,8 +755,8 @@ create_config_string(unsigned char *prefix, unsigned char *name,
|
||||
|
||||
if (savestyle == 0) goto get_me_out;
|
||||
|
||||
indentation = get_opt_int("config.indentation");
|
||||
comments = get_opt_int("config.comments");
|
||||
indentation = get_opt_int("config.indentation", NULL);
|
||||
comments = get_opt_int("config.comments", NULL);
|
||||
|
||||
if (!init_string(&tmpstring)) goto get_me_out;
|
||||
|
||||
|
@ -34,7 +34,7 @@
|
||||
static void
|
||||
disable_success_msgbox(void *dummy)
|
||||
{
|
||||
get_opt_bool("ui.success_msgbox") = 0;
|
||||
get_opt_bool("ui.success_msgbox", NULL) = 0;
|
||||
option_changed(NULL, get_opt_rec(config_options, "ui.success_msgbox"));
|
||||
}
|
||||
|
||||
@ -47,7 +47,7 @@ write_config_dialog(struct terminal *term, unsigned char *config_file,
|
||||
unsigned char *strerr;
|
||||
|
||||
if (secsave_error == SS_ERR_NONE && !stdio_error) {
|
||||
if (!get_opt_bool("ui.success_msgbox")) return;
|
||||
if (!get_opt_bool("ui.success_msgbox", NULL)) return;
|
||||
|
||||
msg_box(term, NULL, MSGBOX_FREE_TEXT,
|
||||
N_("Write config success"), ALIGN_CENTER,
|
||||
|
@ -248,9 +248,17 @@ get_opt_(
|
||||
#ifdef CONFIG_DEBUG
|
||||
unsigned char *file, int line, enum option_type option_type,
|
||||
#endif
|
||||
struct option *tree, unsigned char *name)
|
||||
struct option *tree, unsigned char *name, struct session *ses)
|
||||
{
|
||||
struct option *opt = get_opt_rec(tree, name);
|
||||
struct option *opt = NULL;
|
||||
|
||||
/* TODO: Look for a session-specific option. */
|
||||
|
||||
/* TODO: Look for a domain-specific option. */
|
||||
|
||||
/* Else, return the real option. */
|
||||
if (!opt)
|
||||
opt = get_opt_rec(tree, name);
|
||||
|
||||
#ifdef CONFIG_DEBUG
|
||||
errfile = file;
|
||||
@ -397,7 +405,7 @@ add_opt_rec(struct option *tree, unsigned char *path, struct option *option)
|
||||
object_nolock(option, "option");
|
||||
|
||||
if (option->box_item && option->name && !strcmp(option->name, "_template_"))
|
||||
option->box_item->visible = get_opt_bool("config.show_template");
|
||||
option->box_item->visible = get_opt_bool("config.show_template", NULL);
|
||||
|
||||
if (tree->flags & OPT_AUTOCREATE && !option->desc) {
|
||||
struct option *template = get_opt_rec(tree, "_template_");
|
||||
@ -656,25 +664,25 @@ static inline void
|
||||
register_autocreated_options(void)
|
||||
{
|
||||
/* TODO: Use table-driven initialization. --jonas */
|
||||
get_opt_int("terminal.linux.type") = 2;
|
||||
get_opt_int("terminal.linux.colors") = 1;
|
||||
get_opt_bool("terminal.linux.m11_hack") = 1;
|
||||
get_opt_int("terminal.vt100.type") = 1;
|
||||
get_opt_int("terminal.vt110.type") = 1;
|
||||
get_opt_int("terminal.xterm.type") = 1;
|
||||
get_opt_bool("terminal.xterm.underline") = 1;
|
||||
get_opt_int("terminal.xterm-color.type") = 1;
|
||||
get_opt_int("terminal.xterm-color.colors") = COLOR_MODE_16;
|
||||
get_opt_bool("terminal.xterm-color.underline") = 1;
|
||||
get_opt_int("terminal.linux.type", NULL) = 2;
|
||||
get_opt_int("terminal.linux.colors", NULL) = 1;
|
||||
get_opt_bool("terminal.linux.m11_hack", NULL) = 1;
|
||||
get_opt_int("terminal.vt100.type", NULL) = 1;
|
||||
get_opt_int("terminal.vt110.type", NULL) = 1;
|
||||
get_opt_int("terminal.xterm.type", NULL) = 1;
|
||||
get_opt_bool("terminal.xterm.underline", NULL) = 1;
|
||||
get_opt_int("terminal.xterm-color.type", NULL) = 1;
|
||||
get_opt_int("terminal.xterm-color.colors", NULL) = COLOR_MODE_16;
|
||||
get_opt_bool("terminal.xterm-color.underline", NULL) = 1;
|
||||
#ifdef CONFIG_88_COLORS
|
||||
get_opt_int("terminal.xterm-88color.type") = 1;
|
||||
get_opt_int("terminal.xterm-88color.colors") = COLOR_MODE_88;
|
||||
get_opt_bool("terminal.xterm-88color.underline") = 1;
|
||||
get_opt_int("terminal.xterm-88color.type", NULL) = 1;
|
||||
get_opt_int("terminal.xterm-88color.colors", NULL) = COLOR_MODE_88;
|
||||
get_opt_bool("terminal.xterm-88color.underline", NULL) = 1;
|
||||
#endif
|
||||
#ifdef CONFIG_256_COLORS
|
||||
get_opt_int("terminal.xterm-256color.type") = 1;
|
||||
get_opt_int("terminal.xterm-256color.colors") = COLOR_MODE_256;
|
||||
get_opt_bool("terminal.xterm-256color.underline") = 1;
|
||||
get_opt_int("terminal.xterm-256color.type", NULL) = 1;
|
||||
get_opt_int("terminal.xterm-256color.colors", NULL) = COLOR_MODE_256;
|
||||
get_opt_bool("terminal.xterm-256color.underline", NULL) = 1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -945,7 +953,7 @@ void
|
||||
update_options_visibility(void)
|
||||
{
|
||||
update_visibility(config_options->value.tree,
|
||||
get_opt_bool("config.show_template"));
|
||||
get_opt_bool("config.show_template", NULL));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -208,41 +208,41 @@ extern void checkout_option_values(struct option_resolver *resolvers,
|
||||
|
||||
/* Basically, for main hiearchy addressed from root (almost always) you want to
|
||||
* use get_opt_type() and add_opt_type(). For command line options, you want to
|
||||
* use get_opt_type_tree(cmdline_options, "option"). */
|
||||
* use get_opt_type_tree(cmdline_options, "option", NULL). */
|
||||
|
||||
extern struct option *get_opt_rec(struct option *, const unsigned char *);
|
||||
extern struct option *get_opt_rec_real(struct option *, const unsigned char *);
|
||||
#ifdef CONFIG_DEBUG
|
||||
extern union option_value *get_opt_(unsigned char *, int, enum option_type, struct option *, unsigned char *);
|
||||
#define get_opt(tree, name, type) get_opt_(__FILE__, __LINE__, type, tree, name)
|
||||
extern union option_value *get_opt_(unsigned char *, int, enum option_type, struct option *, unsigned char *, struct session *);
|
||||
#define get_opt(tree, name, ses, type) get_opt_(__FILE__, __LINE__, type, tree, name, ses)
|
||||
#else
|
||||
extern union option_value *get_opt_(struct option *, unsigned char *);
|
||||
#define get_opt(tree, name, type) get_opt_(tree, name)
|
||||
extern union option_value *get_opt_(struct option *, unsigned char *, struct session *);
|
||||
#define get_opt(tree, name, ses, type) get_opt_(tree, name, ses)
|
||||
#endif
|
||||
|
||||
#define get_opt_bool_tree(tree, name) get_opt(tree, name, OPT_BOOL)->number
|
||||
#define get_opt_int_tree(tree, name) get_opt(tree, name, OPT_INT)->number
|
||||
#define get_opt_long_tree(tree, name) get_opt(tree, name, OPT_LONG)->big_number
|
||||
#define get_opt_str_tree(tree, name) get_opt(tree, name, OPT_STRING)->string
|
||||
#define get_opt_codepage_tree(tree, name) get_opt(tree, name, OPT_CODEPAGE)->number
|
||||
#define get_opt_color_tree(tree, name) get_opt(tree, name, OPT_COLOR)->color
|
||||
#define get_opt_tree_tree(tree_, name) get_opt(tree_, name, OPT_TREE)->tree
|
||||
#define get_opt_bool_tree(tree, name, ses) get_opt(tree, name, ses, OPT_BOOL)->number
|
||||
#define get_opt_int_tree(tree, name, ses) get_opt(tree, name, ses, OPT_INT)->number
|
||||
#define get_opt_long_tree(tree, name, ses) get_opt(tree, name, ses, OPT_LONG)->big_number
|
||||
#define get_opt_str_tree(tree, name, ses) get_opt(tree, name, ses, OPT_STRING)->string
|
||||
#define get_opt_codepage_tree(tree, name, ses) get_opt(tree, name, ses, OPT_CODEPAGE)->number
|
||||
#define get_opt_color_tree(tree, name, ses) get_opt(tree, name, ses, OPT_COLOR)->color
|
||||
#define get_opt_tree_tree(tree_, name, ses) get_opt(tree_, name, ses, OPT_TREE)->tree
|
||||
|
||||
#define get_opt_bool(name) get_opt_bool_tree(config_options, name)
|
||||
#define get_opt_int(name) get_opt_int_tree(config_options, name)
|
||||
#define get_opt_long(name) get_opt_long_tree(config_options, name)
|
||||
#define get_opt_str(name) get_opt_str_tree(config_options, name)
|
||||
#define get_opt_codepage(name) get_opt_codepage_tree(config_options, name)
|
||||
#define get_opt_color(name) get_opt_color_tree(config_options, name)
|
||||
#define get_opt_tree(name) get_opt_tree_tree(config_options, name)
|
||||
#define get_opt_bool(name, ses) get_opt_bool_tree(config_options, name, ses)
|
||||
#define get_opt_int(name, ses) get_opt_int_tree(config_options, name, ses)
|
||||
#define get_opt_long(name, ses) get_opt_long_tree(config_options, name, ses)
|
||||
#define get_opt_str(name, ses) get_opt_str_tree(config_options, name, ses)
|
||||
#define get_opt_codepage(name, ses) get_opt_codepage_tree(config_options, name, ses)
|
||||
#define get_opt_color(name, ses) get_opt_color_tree(config_options, name, ses)
|
||||
#define get_opt_tree(name, ses) get_opt_tree_tree(config_options, name, ses)
|
||||
|
||||
#define get_cmd_opt_bool(name) get_opt_bool_tree(cmdline_options, name)
|
||||
#define get_cmd_opt_int(name) get_opt_int_tree(cmdline_options, name)
|
||||
#define get_cmd_opt_long(name) get_opt_long_tree(cmdline_options, name)
|
||||
#define get_cmd_opt_str(name) get_opt_str_tree(cmdline_options, name)
|
||||
#define get_cmd_opt_codepage(name) get_opt_codepage_tree(cmdline_options, name)
|
||||
#define get_cmd_opt_color(name) get_opt_color_tree(cmdline_options, name)
|
||||
#define get_cmd_opt_tree(name) get_opt_tree_tree(cmdline_options, name)
|
||||
#define get_cmd_opt_bool(name) get_opt_bool_tree(cmdline_options, name, NULL)
|
||||
#define get_cmd_opt_int(name) get_opt_int_tree(cmdline_options, name, NULL)
|
||||
#define get_cmd_opt_long(name) get_opt_long_tree(cmdline_options, name, NULL)
|
||||
#define get_cmd_opt_str(name) get_opt_str_tree(cmdline_options, name, NULL)
|
||||
#define get_cmd_opt_codepage(name) get_opt_codepage_tree(cmdline_options, name, NULL)
|
||||
#define get_cmd_opt_color(name) get_opt_color_tree(cmdline_options, name, NULL)
|
||||
#define get_cmd_opt_tree(name) get_opt_tree_tree(cmdline_options, name, NULL)
|
||||
|
||||
extern struct option *add_opt(struct option *, unsigned char *, unsigned char *,
|
||||
unsigned char *, enum option_flags, enum option_type,
|
||||
|
@ -381,12 +381,13 @@ tree_dup(struct option *opt, struct option *template)
|
||||
if (!new_opt) continue;
|
||||
object_nolock(new_opt, "option");
|
||||
add_to_list_end(*new, new_opt);
|
||||
object_lock(new_opt);
|
||||
new_opt->root = opt;
|
||||
|
||||
if (!new_opt->box_item) continue;
|
||||
|
||||
if (new_opt->name && !strcmp(new_opt->name, "_template_"))
|
||||
new_opt->box_item->visible = get_opt_bool("config.show_template");
|
||||
new_opt->box_item->visible = get_opt_bool("config.show_template", NULL);
|
||||
|
||||
if (opt->box_item) {
|
||||
add_to_list(opt->box_item->child,
|
||||
|
@ -34,7 +34,7 @@ periodic_save_handler(void *xxx)
|
||||
else
|
||||
trigger_event(periodic_save_event_id);
|
||||
|
||||
interval = sec_to_ms(get_opt_int("infofiles.save_interval"));
|
||||
interval = sec_to_ms(get_opt_int("infofiles.save_interval", NULL));
|
||||
if (!interval) {
|
||||
/* We should get here only if @periodic_save_handler
|
||||
* is being called from @periodic_save_change_hook or
|
||||
|
@ -42,7 +42,7 @@ add_cookie_info_to_string(struct string *string, struct cookie *cookie,
|
||||
#ifdef HAVE_STRFTIME
|
||||
} else {
|
||||
add_format_to_string(string, "\n%s: ", _("Expires", term));
|
||||
add_date_to_string(string, get_opt_str("ui.date_format"), &cookie->expires);
|
||||
add_date_to_string(string, get_opt_str("ui.date_format", NULL), &cookie->expires);
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -578,7 +578,7 @@ query_file(struct session *ses, struct uri *uri, void *data,
|
||||
|
||||
if (!init_string(&def)) return;
|
||||
|
||||
add_to_string(&def, get_opt_str("document.download.directory"));
|
||||
add_to_string(&def, get_opt_str("document.download.directory", NULL));
|
||||
if (def.length && !dir_sep(def.source[def.length - 1]))
|
||||
add_char_to_string(&def, '/');
|
||||
|
||||
@ -812,7 +812,8 @@ enum frame_event_status
|
||||
pass_uri_to_command(struct session *ses, struct document_view *doc_view,
|
||||
int which_type)
|
||||
{
|
||||
LIST_OF(struct option) *tree = get_opt_tree("document.uri_passing");
|
||||
LIST_OF(struct option) *tree = get_opt_tree("document.uri_passing",
|
||||
NULL);
|
||||
enum pass_uri_type type = which_type;
|
||||
struct menu_item *items;
|
||||
struct option *option;
|
||||
@ -887,7 +888,8 @@ void
|
||||
add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type,
|
||||
unsigned char *text)
|
||||
{
|
||||
LIST_OF(struct option) *tree = get_opt_tree("document.uri_passing");
|
||||
LIST_OF(struct option) *tree = get_opt_tree("document.uri_passing",
|
||||
NULL);
|
||||
struct option *option;
|
||||
int commands = 0;
|
||||
enum menu_item_flags flags = NO_FLAG;
|
||||
|
@ -50,7 +50,7 @@ charset_list(struct terminal *term, void *xxx, void *ses_)
|
||||
int i, items;
|
||||
int sel = 0;
|
||||
const unsigned char *const sel_mime = get_cp_mime_name(
|
||||
get_opt_codepage_tree(term->spec, "charset"));
|
||||
get_opt_codepage_tree(term->spec, "charset", NULL));
|
||||
struct menu_item *mi = new_menu(FREE_LIST);
|
||||
|
||||
if (!mi) return;
|
||||
|
@ -64,15 +64,16 @@ get_download_msg(struct download *download, struct terminal *term,
|
||||
void
|
||||
update_status(void)
|
||||
{
|
||||
int show_title_bar = get_opt_bool("ui.show_title_bar");
|
||||
int show_status_bar = get_opt_bool("ui.show_status_bar");
|
||||
int show_tabs_bar = get_opt_int("ui.tabs.show_bar");
|
||||
int show_tabs_bar_at_top = get_opt_bool("ui.tabs.top");
|
||||
int show_title_bar = get_opt_bool("ui.show_title_bar", NULL);
|
||||
int show_status_bar = get_opt_bool("ui.show_status_bar", NULL);
|
||||
int show_tabs_bar = get_opt_int("ui.tabs.show_bar", NULL);
|
||||
int show_tabs_bar_at_top = get_opt_bool("ui.tabs.top", NULL);
|
||||
#ifdef CONFIG_LEDS
|
||||
int show_leds = get_opt_bool("ui.leds.enable");
|
||||
int show_leds = get_opt_bool("ui.leds.enable", NULL);
|
||||
#endif
|
||||
int set_window_title = get_opt_bool("ui.window_title");
|
||||
int insert_mode = get_opt_bool("document.browse.forms.insert_mode");
|
||||
int set_window_title = get_opt_bool("ui.window_title", NULL);
|
||||
int insert_mode = get_opt_bool("document.browse.forms.insert_mode",
|
||||
NULL);
|
||||
struct session *ses;
|
||||
int tabs_count = 1;
|
||||
struct terminal *term = NULL;
|
||||
@ -390,7 +391,7 @@ display_title_bar(struct session *ses, struct terminal *term)
|
||||
int height;
|
||||
|
||||
/* Clear the old title */
|
||||
if (!get_opt_bool("ui.show_menu_bar_always")) {
|
||||
if (!get_opt_bool("ui.show_menu_bar_always", NULL)) {
|
||||
struct box box;
|
||||
|
||||
set_box(&box, 0, 0, term->width, 1);
|
||||
|
@ -111,7 +111,7 @@ struct css_stylesheet default_stylesheet = INIT_CSS_STYLESHEET(default_styleshee
|
||||
static void
|
||||
import_default_css(void)
|
||||
{
|
||||
unsigned char *url = get_opt_str("document.css.stylesheet");
|
||||
unsigned char *url = get_opt_str("document.css.stylesheet", NULL);
|
||||
|
||||
if (!css_selector_set_empty(&default_stylesheet.selectors))
|
||||
done_css_stylesheet(&default_stylesheet);
|
||||
|
@ -217,12 +217,12 @@ update_cached_document_options(void)
|
||||
struct active_link_options active_link;
|
||||
|
||||
memset(&active_link, 0, sizeof(active_link)); /* Safer. */
|
||||
active_link.fg = get_opt_color("document.browse.links.active_link.colors.text");
|
||||
active_link.bg = get_opt_color("document.browse.links.active_link.colors.background");
|
||||
active_link.color = get_opt_bool("document.browse.links.active_link.enable_color");
|
||||
active_link.invert = get_opt_bool("document.browse.links.active_link.invert");
|
||||
active_link.underline = get_opt_bool("document.browse.links.active_link.underline");
|
||||
active_link.bold = get_opt_bool("document.browse.links.active_link.bold");
|
||||
active_link.fg = get_opt_color("document.browse.links.active_link.colors.text", NULL);
|
||||
active_link.bg = get_opt_color("document.browse.links.active_link.colors.background", NULL);
|
||||
active_link.color = get_opt_bool("document.browse.links.active_link.enable_color", NULL);
|
||||
active_link.invert = get_opt_bool("document.browse.links.active_link.invert", NULL);
|
||||
active_link.underline = get_opt_bool("document.browse.links.active_link.underline", NULL);
|
||||
active_link.bold = get_opt_bool("document.browse.links.active_link.bold", NULL);
|
||||
|
||||
foreach (document, format_cache) {
|
||||
copy_struct(&document->options.active_link, &active_link);
|
||||
@ -263,7 +263,7 @@ void
|
||||
shrink_format_cache(int whole)
|
||||
{
|
||||
struct document *document, *next;
|
||||
int format_cache_size = get_opt_int("document.cache.format.size");
|
||||
int format_cache_size = get_opt_int("document.cache.format.size", NULL);
|
||||
int format_cache_entries = 0;
|
||||
|
||||
foreachsafe (document, next, format_cache) {
|
||||
|
@ -360,7 +360,7 @@ process_head(struct html_context *html_context, unsigned char *head)
|
||||
|
||||
mem_free(refresh);
|
||||
|
||||
if (!get_opt_bool("document.cache.ignore_cache_control")) {
|
||||
if (!get_opt_bool("document.cache.ignore_cache_control", NULL)) {
|
||||
unsigned char *d;
|
||||
int no_cache = 0;
|
||||
time_t expires = 0;
|
||||
|
@ -286,7 +286,7 @@ not_processed:
|
||||
unsigned char *import_url;
|
||||
struct uri *uri;
|
||||
|
||||
if (!get_opt_bool("ecmascript.enable")) {
|
||||
if (!get_opt_bool("ecmascript.enable", NULL)) {
|
||||
mem_free(src);
|
||||
goto not_processed;
|
||||
}
|
||||
@ -1105,8 +1105,8 @@ html_noscript(struct html_context *html_context, unsigned char *a,
|
||||
/* We shouldn't throw <noscript> away until our ECMAScript support is
|
||||
* halfway decent. */
|
||||
#ifdef CONFIG_ECMASCRIPT
|
||||
if (get_opt_bool("ecmascript.enable")
|
||||
&& get_opt_bool("ecmascript.ignore_noscript"))
|
||||
if (get_opt_bool("ecmascript.enable", NULL)
|
||||
&& get_opt_bool("ecmascript.ignore_noscript", NULL))
|
||||
html_skip(html_context, a);
|
||||
#endif
|
||||
}
|
||||
|
@ -22,73 +22,73 @@
|
||||
|
||||
|
||||
void
|
||||
init_document_options(struct document_options *doo)
|
||||
init_document_options(struct session *ses, struct document_options *doo)
|
||||
{
|
||||
/* Ensure that any padding bytes are cleared. */
|
||||
memset(doo, 0, sizeof(*doo));
|
||||
|
||||
doo->assume_cp = get_opt_codepage("document.codepage.assume");
|
||||
doo->hard_assume = get_opt_bool("document.codepage.force_assumed");
|
||||
doo->assume_cp = get_opt_codepage("document.codepage.assume", NULL);
|
||||
doo->hard_assume = get_opt_bool("document.codepage.force_assumed", NULL);
|
||||
|
||||
doo->use_document_colors = get_opt_int("document.colors.use_document_colors");
|
||||
doo->margin = get_opt_int("document.browse.margin_width");
|
||||
doo->num_links_key = get_opt_int("document.browse.links.number_keys_select_link");
|
||||
doo->meta_link_display = get_opt_int("document.html.link_display");
|
||||
doo->default_form_input_size = get_opt_int("document.browse.forms.input_size");
|
||||
doo->use_document_colors = get_opt_int("document.colors.use_document_colors", NULL);
|
||||
doo->margin = get_opt_int("document.browse.margin_width", NULL);
|
||||
doo->num_links_key = get_opt_int("document.browse.links.number_keys_select_link", NULL);
|
||||
doo->meta_link_display = get_opt_int("document.html.link_display", NULL);
|
||||
doo->default_form_input_size = get_opt_int("document.browse.forms.input_size", NULL);
|
||||
|
||||
/* Color options. */
|
||||
doo->default_fg = get_opt_color("document.colors.text");
|
||||
doo->default_bg = get_opt_color("document.colors.background");
|
||||
doo->default_link = get_opt_color("document.colors.link");
|
||||
doo->default_vlink = get_opt_color("document.colors.vlink");
|
||||
doo->default_fg = get_opt_color("document.colors.text", NULL);
|
||||
doo->default_bg = get_opt_color("document.colors.background", NULL);
|
||||
doo->default_link = get_opt_color("document.colors.link", NULL);
|
||||
doo->default_vlink = get_opt_color("document.colors.vlink", NULL);
|
||||
#ifdef CONFIG_BOOKMARKS
|
||||
doo->default_bookmark_link = get_opt_color("document.colors.bookmark");
|
||||
doo->default_bookmark_link = get_opt_color("document.colors.bookmark", NULL);
|
||||
#endif
|
||||
doo->default_image_link = get_opt_color("document.colors.image");
|
||||
doo->default_image_link = get_opt_color("document.colors.image", NULL);
|
||||
|
||||
doo->active_link.fg = get_opt_color("document.browse.links.active_link.colors.text");
|
||||
doo->active_link.bg = get_opt_color("document.browse.links.active_link.colors.background");
|
||||
doo->active_link.fg = get_opt_color("document.browse.links.active_link.colors.text", NULL);
|
||||
doo->active_link.bg = get_opt_color("document.browse.links.active_link.colors.background", NULL);
|
||||
|
||||
if (get_opt_bool("document.colors.increase_contrast"))
|
||||
if (get_opt_bool("document.colors.increase_contrast", NULL))
|
||||
doo->color_flags |= COLOR_INCREASE_CONTRAST;
|
||||
|
||||
if (get_opt_bool("document.colors.ensure_contrast"))
|
||||
if (get_opt_bool("document.colors.ensure_contrast", NULL))
|
||||
doo->color_flags |= COLOR_ENSURE_CONTRAST;
|
||||
|
||||
/* Boolean options. */
|
||||
#ifdef CONFIG_CSS
|
||||
doo->css_enable = get_opt_bool("document.css.enable");
|
||||
doo->css_import = get_opt_bool("document.css.import");
|
||||
doo->css_enable = get_opt_bool("document.css.enable", NULL);
|
||||
doo->css_import = get_opt_bool("document.css.import", NULL);
|
||||
#endif
|
||||
|
||||
doo->plain_display_links = get_opt_bool("document.plain.display_links");
|
||||
doo->plain_compress_empty_lines = get_opt_bool("document.plain.compress_empty_lines");
|
||||
doo->underline_links = get_opt_bool("document.html.underline_links");
|
||||
doo->wrap_nbsp = get_opt_bool("document.html.wrap_nbsp");
|
||||
doo->use_tabindex = get_opt_bool("document.browse.links.use_tabindex");
|
||||
doo->links_numbering = get_opt_bool("document.browse.links.numbering");
|
||||
doo->plain_display_links = get_opt_bool("document.plain.display_links", NULL);
|
||||
doo->plain_compress_empty_lines = get_opt_bool("document.plain.compress_empty_lines", NULL);
|
||||
doo->underline_links = get_opt_bool("document.html.underline_links", NULL);
|
||||
doo->wrap_nbsp = get_opt_bool("document.html.wrap_nbsp", NULL);
|
||||
doo->use_tabindex = get_opt_bool("document.browse.links.use_tabindex", NULL);
|
||||
doo->links_numbering = get_opt_bool("document.browse.links.numbering", NULL);
|
||||
|
||||
doo->active_link.color = get_opt_bool("document.browse.links.active_link.enable_color");
|
||||
doo->active_link.invert = get_opt_bool("document.browse.links.active_link.invert");
|
||||
doo->active_link.underline = get_opt_bool("document.browse.links.active_link.underline");
|
||||
doo->active_link.bold = get_opt_bool("document.browse.links.active_link.bold");
|
||||
doo->active_link.color = get_opt_bool("document.browse.links.active_link.enable_color", NULL);
|
||||
doo->active_link.invert = get_opt_bool("document.browse.links.active_link.invert", NULL);
|
||||
doo->active_link.underline = get_opt_bool("document.browse.links.active_link.underline", NULL);
|
||||
doo->active_link.bold = get_opt_bool("document.browse.links.active_link.bold", NULL);
|
||||
|
||||
doo->table_order = get_opt_bool("document.browse.table_move_order");
|
||||
doo->tables = get_opt_bool("document.html.display_tables");
|
||||
doo->frames = get_opt_bool("document.html.display_frames");
|
||||
doo->images = get_opt_bool("document.browse.images.show_as_links");
|
||||
doo->display_subs = get_opt_bool("document.html.display_subs");
|
||||
doo->display_sups = get_opt_bool("document.html.display_sups");
|
||||
doo->table_order = get_opt_bool("document.browse.table_move_order", NULL);
|
||||
doo->tables = get_opt_bool("document.html.display_tables", NULL);
|
||||
doo->frames = get_opt_bool("document.html.display_frames", NULL);
|
||||
doo->images = get_opt_bool("document.browse.images.show_as_links", NULL);
|
||||
doo->display_subs = get_opt_bool("document.html.display_subs", NULL);
|
||||
doo->display_sups = get_opt_bool("document.html.display_sups", NULL);
|
||||
|
||||
doo->framename = "";
|
||||
|
||||
doo->image_link.prefix = "";
|
||||
doo->image_link.suffix = "";
|
||||
doo->image_link.filename_maxlen = get_opt_int("document.browse.images.filename_maxlen");
|
||||
doo->image_link.label_maxlen = get_opt_int("document.browse.images.label_maxlen");
|
||||
doo->image_link.display_style = get_opt_int("document.browse.images.display_style");
|
||||
doo->image_link.tagging = get_opt_int("document.browse.images.image_link_tagging");
|
||||
doo->image_link.show_any_as_links = get_opt_bool("document.browse.images.show_any_as_links");
|
||||
doo->image_link.filename_maxlen = get_opt_int("document.browse.images.filename_maxlen", NULL);
|
||||
doo->image_link.label_maxlen = get_opt_int("document.browse.images.label_maxlen", NULL);
|
||||
doo->image_link.display_style = get_opt_int("document.browse.images.display_style", NULL);
|
||||
doo->image_link.tagging = get_opt_int("document.browse.images.image_link_tagging", NULL);
|
||||
doo->image_link.show_any_as_links = get_opt_bool("document.browse.images.show_any_as_links", NULL);
|
||||
}
|
||||
|
||||
int
|
||||
@ -109,8 +109,8 @@ copy_opt(struct document_options *o1, struct document_options *o2)
|
||||
{
|
||||
copy_struct(o1, o2);
|
||||
o1->framename = stracpy(o2->framename);
|
||||
o1->image_link.prefix = stracpy(get_opt_str("document.browse.images.image_link_prefix"));
|
||||
o1->image_link.suffix = stracpy(get_opt_str("document.browse.images.image_link_suffix"));
|
||||
o1->image_link.prefix = stracpy(get_opt_str("document.browse.images.image_link_prefix", NULL));
|
||||
o1->image_link.suffix = stracpy(get_opt_str("document.browse.images.image_link_suffix", NULL));
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -139,7 +139,7 @@ struct document_options {
|
||||
|
||||
/** Fills the structure with values from the option system.
|
||||
* @relates document_options */
|
||||
void init_document_options(struct document_options *doo);
|
||||
void init_document_options(struct session *ses, struct document_options *doo);
|
||||
|
||||
/** Free allocated document options.
|
||||
* @relates document_options */
|
||||
|
@ -97,7 +97,7 @@ do_document_refresh(void *data)
|
||||
void
|
||||
start_document_refresh(struct document_refresh *refresh, struct session *ses)
|
||||
{
|
||||
milliseconds_T minimum = (milliseconds_T) get_opt_int("document.browse.minimum_refresh_time");
|
||||
milliseconds_T minimum = (milliseconds_T) get_opt_int("document.browse.minimum_refresh_time", NULL);
|
||||
milliseconds_T refresh_delay = sec_to_ms(refresh->seconds);
|
||||
milliseconds_T time = ms_max(refresh_delay, minimum);
|
||||
struct type_query *type_query;
|
||||
|
@ -62,7 +62,8 @@ add_snippets(struct ecmascript_interpreter *interpreter,
|
||||
unset_led_value(interpreter->vs->doc_view->session->status.ecmascript_led);
|
||||
#endif
|
||||
|
||||
if (list_empty(*doc_snippets) || !get_opt_bool("ecmascript.enable"))
|
||||
if (list_empty(*doc_snippets)
|
||||
|| !get_opt_bool("ecmascript.enable", NULL))
|
||||
return;
|
||||
|
||||
/* We do this all only once per view_state now. */
|
||||
@ -429,7 +430,7 @@ render_document_frames(struct session *ses, int no_cache)
|
||||
|
||||
if (have_location(ses)) vs = &cur_loc(ses)->vs;
|
||||
|
||||
init_document_options(&doc_opts);
|
||||
init_document_options(ses, &doc_opts);
|
||||
|
||||
set_box(&doc_opts.box, 0, 0,
|
||||
ses->tab->term->width, ses->tab->term->height);
|
||||
@ -444,11 +445,13 @@ render_document_frames(struct session *ses, int no_cache)
|
||||
if (ses->status.show_tabs_bar_at_top) doc_opts.box.y++;
|
||||
}
|
||||
|
||||
doc_opts.color_mode = get_opt_int_tree(ses->tab->term->spec, "colors");
|
||||
if (!get_opt_bool_tree(ses->tab->term->spec, "underline"))
|
||||
doc_opts.color_mode = get_opt_int_tree(ses->tab->term->spec, "colors",
|
||||
NULL);
|
||||
if (!get_opt_bool_tree(ses->tab->term->spec, "underline", NULL))
|
||||
doc_opts.color_flags |= COLOR_ENHANCE_UNDERLINE;
|
||||
|
||||
doc_opts.cp = get_opt_codepage_tree(ses->tab->term->spec, "charset");
|
||||
doc_opts.cp = get_opt_codepage_tree(ses->tab->term->spec, "charset",
|
||||
NULL);
|
||||
doc_opts.no_cache = no_cache & 1;
|
||||
doc_opts.gradual_rerendering = !!(no_cache & 2);
|
||||
|
||||
|
@ -13,7 +13,7 @@ struct terminal;
|
||||
struct uri;
|
||||
struct view_state;
|
||||
|
||||
#define get_ecmascript_enable() get_opt_bool("ecmascript.enable")
|
||||
#define get_ecmascript_enable() get_opt_bool("ecmascript.enable", NULL)
|
||||
|
||||
struct ecmascript_interpreter {
|
||||
struct view_state *vs;
|
||||
|
@ -75,7 +75,7 @@ see_get_interpreter(struct ecmascript_interpreter *interpreter)
|
||||
struct SEE_interpreter *interp = &g->interp;
|
||||
|
||||
interpreter->backend_data = g;
|
||||
g->max_exec_time = get_opt_int("ecmascript.max_exec_time");
|
||||
g->max_exec_time = get_opt_int("ecmascript.max_exec_time", NULL);
|
||||
g->exec_start = time(NULL);
|
||||
/* used by setTimeout */
|
||||
g->interpreter = interpreter;
|
||||
|
@ -112,13 +112,14 @@ document_get(struct SEE_interpreter *interp, struct SEE_object *o,
|
||||
} else if (p == s_location) {
|
||||
SEE_OBJECT_GET(interp, interp->Global, s_location, res);
|
||||
} else if (p == s_referrer) {
|
||||
switch (get_opt_int("protocol.http.referer.policy")) {
|
||||
switch (get_opt_int("protocol.http.referer.policy", NULL)) {
|
||||
case REFERER_NONE:
|
||||
SEE_SET_UNDEFINED(res);
|
||||
break;
|
||||
case REFERER_FAKE:
|
||||
str = string_to_SEE_string(interp,
|
||||
get_opt_str("protocol.http.referer.fake"));
|
||||
get_opt_str("protocol.http.referer.fake",
|
||||
NULL));
|
||||
SEE_SET_STRING(res, str);
|
||||
break;
|
||||
case REFERER_TRUE:
|
||||
|
@ -79,7 +79,7 @@ navigator_get(struct SEE_interpreter *interp, struct SEE_object *o,
|
||||
SEE_SET_STRING(res, str);
|
||||
} else if (p == s_language) {
|
||||
#ifdef CONFIG_NLS
|
||||
if (get_opt_bool("protocol.http.accept_ui_language")) {
|
||||
if (get_opt_bool("protocol.http.accept_ui_language", NULL)) {
|
||||
str = string_to_SEE_string(interp,
|
||||
language_to_iso639(current_language));
|
||||
SEE_SET_STRING(res, str);
|
||||
@ -90,7 +90,8 @@ navigator_get(struct SEE_interpreter *interp, struct SEE_object *o,
|
||||
SEE_SET_STRING(res, str);
|
||||
} else if (p == s_userAgent) {
|
||||
/* FIXME: Code duplication. */
|
||||
unsigned char *optstr = get_opt_str("protocol.http.user_agent");
|
||||
unsigned char *optstr = get_opt_str("protocol.http.user_agent",
|
||||
NULL);
|
||||
|
||||
if (*optstr && strcmp(optstr, " ")) {
|
||||
unsigned char *ustr, ts[64] = "";
|
||||
|
@ -251,7 +251,7 @@ js_window_open(struct SEE_interpreter *interp, struct SEE_object *self,
|
||||
see_check_class(interp, thisobj, &js_window_object_class);
|
||||
|
||||
SEE_SET_OBJECT(res, (struct SEE_object *)win);
|
||||
if (get_opt_bool("ecmascript.block_window_opening")) {
|
||||
if (get_opt_bool("ecmascript.block_window_opening", NULL)) {
|
||||
#ifdef CONFIG_LEDS
|
||||
set_led_value(ses->status.popup_led, 'P');
|
||||
#endif
|
||||
|
@ -76,7 +76,7 @@ error_reporter(JSContext *ctx, const char *message, JSErrorReport *report)
|
||||
set_led_value(interpreter->vs->doc_view->session->status.ecmascript_led, 'J');
|
||||
#endif
|
||||
|
||||
if (!get_opt_bool("ecmascript.error_reporting")
|
||||
if (!get_opt_bool("ecmascript.error_reporting", NULL)
|
||||
|| !init_string(&msg))
|
||||
goto reported;
|
||||
|
||||
@ -113,7 +113,7 @@ static JSBool
|
||||
safeguard(JSContext *ctx, JSScript *script)
|
||||
{
|
||||
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx);
|
||||
int max_exec_time = get_opt_int("ecmascript.max_exec_time");
|
||||
int max_exec_time = get_opt_int("ecmascript.max_exec_time", NULL);
|
||||
|
||||
if (time(NULL) - interpreter->exec_start > max_exec_time) {
|
||||
struct terminal *term = interpreter->vs->doc_view->session->tab->term;
|
||||
|
@ -145,14 +145,14 @@ document_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
JS_GetProperty(ctx, parent_win, "location", vp);
|
||||
break;
|
||||
case JSP_DOC_REF:
|
||||
switch (get_opt_int("protocol.http.referer.policy")) {
|
||||
switch (get_opt_int("protocol.http.referer.policy", NULL)) {
|
||||
case REFERER_NONE:
|
||||
/* oh well */
|
||||
undef_to_jsval(ctx, vp);
|
||||
break;
|
||||
|
||||
case REFERER_FAKE:
|
||||
string_to_jsval(ctx, vp, get_opt_str("protocol.http.referer.fake"));
|
||||
string_to_jsval(ctx, vp, get_opt_str("protocol.http.referer.fake", NULL));
|
||||
break;
|
||||
|
||||
case REFERER_TRUE:
|
||||
|
@ -102,7 +102,7 @@ navigator_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
break;
|
||||
case JSP_NAVIGATOR_LANGUAGE:
|
||||
#ifdef CONFIG_NLS
|
||||
if (get_opt_bool("protocol.http.accept_ui_language"))
|
||||
if (get_opt_bool("protocol.http.accept_ui_language", NULL))
|
||||
string_to_jsval(ctx, vp, language_to_iso639(current_language));
|
||||
|
||||
#endif
|
||||
@ -113,7 +113,8 @@ navigator_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
|
||||
case JSP_NAVIGATOR_USER_AGENT:
|
||||
{
|
||||
/* FIXME: Code duplication. */
|
||||
unsigned char *optstr = get_opt_str("protocol.http.user_agent");
|
||||
unsigned char *optstr = get_opt_str("protocol.http.user_agent",
|
||||
NULL);
|
||||
|
||||
if (*optstr && strcmp(optstr, " ")) {
|
||||
unsigned char *ustr, ts[64] = "";
|
||||
|
@ -353,7 +353,7 @@ window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
|
||||
doc_view = vs->doc_view;
|
||||
ses = doc_view->session;
|
||||
|
||||
if (get_opt_bool("ecmascript.block_window_opening")) {
|
||||
if (get_opt_bool("ecmascript.block_window_opening", NULL)) {
|
||||
#ifdef CONFIG_LEDS
|
||||
set_led_value(ses->status.popup_led, 'P');
|
||||
#endif
|
||||
|
@ -293,7 +293,7 @@ read_encoded_file(struct string *filename, struct string *page)
|
||||
int fd = open(filename->source, O_RDONLY | O_NOCTTY);
|
||||
enum connection_state state = -errno;
|
||||
|
||||
if (fd == -1 && get_opt_bool("protocol.file.try_encoding_extensions")) {
|
||||
if (fd == -1 && get_opt_bool("protocol.file.try_encoding_extensions", NULL)) {
|
||||
encoding = try_encoding_extensions(filename, &fd);
|
||||
|
||||
} else if (fd != -1) {
|
||||
@ -316,7 +316,7 @@ read_encoded_file(struct string *filename, struct string *page)
|
||||
/* Leave @state being the saved errno */
|
||||
|
||||
} else if (!S_ISREG(stt.st_mode) && !is_stdin_pipe(&stt, filename)
|
||||
&& !get_opt_bool("protocol.file.allow_special_files")) {
|
||||
&& !get_opt_bool("protocol.file.allow_special_files", NULL)) {
|
||||
state = S_FILE_TYPE;
|
||||
|
||||
} else if (!(stream = open_encoded(fd, encoding))) {
|
||||
|
@ -44,7 +44,7 @@ get_globhist_item_text(struct listbox_item *box_item, struct terminal *term)
|
||||
struct global_history_item *item = box_item->udata;
|
||||
struct string info;
|
||||
|
||||
if (get_opt_int("document.history.global.display_type")
|
||||
if (get_opt_int("document.history.global.display_type", NULL)
|
||||
&& *item->title)
|
||||
return stracpy(item->title);
|
||||
|
||||
@ -186,7 +186,8 @@ push_toggle_display_button(struct dialog_data *dlg_data, struct widget_data *wid
|
||||
{
|
||||
int *display_type;
|
||||
|
||||
display_type = &get_opt_int("document.history.global.display_type");
|
||||
display_type = &get_opt_int("document.history.global.display_type",
|
||||
NULL);
|
||||
*display_type = !*display_type;
|
||||
|
||||
update_hierbox_browser(&globhist_browser);
|
||||
|
@ -61,7 +61,7 @@ extern int current_charset;
|
||||
static inline void
|
||||
intl_set_charset(struct terminal *term)
|
||||
{
|
||||
int new_charset = get_opt_codepage_tree(term->spec, "charset");
|
||||
int new_charset = get_opt_codepage_tree(term->spec, "charset", NULL);
|
||||
|
||||
/* Prevent useless switching. */
|
||||
if (current_charset != new_charset) {
|
||||
|
@ -71,7 +71,8 @@ check_stdio(LIST_OF(struct string_list_item) *url_list)
|
||||
/* Only start reading from stdin if no URL was given on the
|
||||
* command line. */
|
||||
if (url_list && list_empty(*url_list)) {
|
||||
get_opt_bool("protocol.file.allow_special_files") = 1;
|
||||
get_opt_bool("protocol.file.allow_special_files",
|
||||
NULL) = 1;
|
||||
add_to_string_list(url_list, "file:///dev/stdin", 17);
|
||||
}
|
||||
get_cmd_opt_bool("no-connect") = 1;
|
||||
@ -191,7 +192,7 @@ init(void)
|
||||
/* The ECMAScript code is not good at coping with this. And it
|
||||
* makes currently no sense to evaluate ECMAScript in this
|
||||
* context anyway. */
|
||||
get_opt_bool("ecmascript.enable") = 0;
|
||||
get_opt_bool("ecmascript.enable", NULL) = 0;
|
||||
#endif
|
||||
if (!list_empty(url_list)) {
|
||||
dump_next(&url_list);
|
||||
|
@ -198,11 +198,11 @@ get_mime_handler_default(unsigned char *type, int have_x)
|
||||
handler_opt = get_mime_handler_option(type_opt, have_x);
|
||||
if (!handler_opt) return NULL;
|
||||
|
||||
return init_mime_handler(get_opt_str_tree(handler_opt, "program"),
|
||||
return init_mime_handler(get_opt_str_tree(handler_opt, "program", NULL),
|
||||
type_opt->value.string,
|
||||
default_mime_module.name,
|
||||
get_opt_bool_tree(handler_opt, "ask"),
|
||||
get_opt_bool_tree(handler_opt, "block"));
|
||||
get_opt_bool_tree(handler_opt, "ask", NULL),
|
||||
get_opt_bool_tree(handler_opt, "block", NULL));
|
||||
}
|
||||
|
||||
|
||||
|
@ -90,7 +90,7 @@ add_mime_extension(void *data)
|
||||
add_optname_to_string(&name, ext->ext, strlen(ext->ext));
|
||||
|
||||
really_del_ext(ext->ext_orig); /* ..or rename ;) */
|
||||
safe_strncpy(get_opt_str(name.source), ext->ct, MAX_STR_LEN);
|
||||
safe_strncpy(get_opt_str(name.source, NULL), ext->ct, MAX_STR_LEN);
|
||||
done_string(&name);
|
||||
}
|
||||
|
||||
@ -146,7 +146,7 @@ void
|
||||
menu_list_ext(struct terminal *term, void *fn_, void *xxx)
|
||||
{
|
||||
menu_func_T fn = fn_;
|
||||
LIST_OF(struct option) *opt_tree = get_opt_tree("mime.extension");
|
||||
LIST_OF(struct option) *opt_tree = get_opt_tree("mime.extension", NULL);
|
||||
struct option *opt;
|
||||
struct menu_item *mi = NULL;
|
||||
|
||||
|
@ -759,7 +759,7 @@ abort_connection(struct connection *conn, enum connection_state state)
|
||||
void
|
||||
retry_connection(struct connection *conn, enum connection_state state)
|
||||
{
|
||||
int max_tries = get_opt_int("connection.retries");
|
||||
int max_tries = get_opt_int("connection.retries", NULL);
|
||||
|
||||
assertm(is_in_result_state(state),
|
||||
"connection didn't end in result state (%d)", state);
|
||||
@ -813,8 +813,8 @@ static void
|
||||
check_queue(void)
|
||||
{
|
||||
struct connection *conn;
|
||||
int max_conns_to_host = get_opt_int("connection.max_connections_to_host");
|
||||
int max_conns = get_opt_int("connection.max_connections");
|
||||
int max_conns_to_host = get_opt_int("connection.max_connections_to_host", NULL);
|
||||
int max_conns = get_opt_int("connection.max_connections", NULL);
|
||||
|
||||
again:
|
||||
conn = connection_queue.next;
|
||||
@ -1106,7 +1106,8 @@ detach_connection(struct download *download, off_t pos)
|
||||
total_len = (conn->est_length == -1) ? conn->from
|
||||
: conn->est_length;
|
||||
|
||||
if (total_len < (get_opt_long("document.cache.memory.size")
|
||||
if (total_len < (get_opt_long("document.cache.memory.size",
|
||||
NULL)
|
||||
* MAX_CACHED_OBJECT_PERCENT / 100)) {
|
||||
/* This whole thing will fit to the memory anyway, so
|
||||
* there's no problem in detaching the connection. */
|
||||
@ -1158,8 +1159,8 @@ connection_timeout_1(struct connection *conn)
|
||||
{
|
||||
install_timer(&conn->timer, (milliseconds_T)
|
||||
((conn->unrestartable
|
||||
? get_opt_int("connection.unrestartable_receive_timeout")
|
||||
: get_opt_int("connection.receive_timeout"))
|
||||
? get_opt_int("connection.unrestartable_receive_timeout", NULL)
|
||||
: get_opt_int("connection.receive_timeout", NULL))
|
||||
* 500), (void (*)(void *)) connection_timeout, conn);
|
||||
/* The expired timer ID has now been erased. */
|
||||
}
|
||||
@ -1171,8 +1172,8 @@ set_connection_timeout(struct connection *conn)
|
||||
|
||||
install_timer(&conn->timer, (milliseconds_T)
|
||||
((conn->unrestartable
|
||||
? get_opt_int("connection.unrestartable_receive_timeout")
|
||||
: get_opt_int("connection.receive_timeout"))
|
||||
? get_opt_int("connection.unrestartable_receive_timeout", NULL)
|
||||
: get_opt_int("connection.receive_timeout", NULL))
|
||||
* 500), (void (*)(void *)) connection_timeout_1, conn);
|
||||
}
|
||||
|
||||
|
@ -348,7 +348,7 @@ async_dns_error(struct dnsquery *query)
|
||||
static int
|
||||
init_async_dns_lookup(struct dnsquery *dnsquery, int force_async)
|
||||
{
|
||||
if (!force_async && !get_opt_bool("connection.async_dns")) {
|
||||
if (!force_async && !get_opt_bool("connection.async_dns", NULL)) {
|
||||
dnsquery->h = -1;
|
||||
return 0;
|
||||
}
|
||||
|
@ -492,9 +492,9 @@ connect_socket(struct socket *csocket, enum connection_state state)
|
||||
int saved_errno = 0;
|
||||
int at_least_one_remote_ip = 0;
|
||||
#ifdef CONFIG_IPV6
|
||||
int try_ipv6 = get_opt_bool("connection.try_ipv6");
|
||||
int try_ipv6 = get_opt_bool("connection.try_ipv6", NULL);
|
||||
#endif
|
||||
int try_ipv4 = get_opt_bool("connection.try_ipv4");
|
||||
int try_ipv4 = get_opt_bool("connection.try_ipv4", NULL);
|
||||
/* We tried something but we failed in such a way that we would rather
|
||||
* prefer the connection to retain the information about previous
|
||||
* failures. That is, we i.e. decided we are forbidden to even think
|
||||
|
@ -91,7 +91,7 @@ ssl_want_read(struct socket *socket)
|
||||
switch (ssl_do_connect(socket)) {
|
||||
case SSL_ERROR_NONE:
|
||||
#ifdef CONFIG_GNUTLS
|
||||
if (get_opt_bool("connection.ssl.cert_verify")
|
||||
if (get_opt_bool("connection.ssl.cert_verify", NULL)
|
||||
&& gnutls_certificate_verify_peers(*((ssl_t *) socket->ssl))) {
|
||||
socket->ops->retry(socket, S_SSL_ERROR);
|
||||
return;
|
||||
@ -129,15 +129,16 @@ ssl_connect(struct socket *socket)
|
||||
#ifdef CONFIG_OPENSSL
|
||||
SSL_set_fd(socket->ssl, socket->fd);
|
||||
|
||||
if (get_opt_bool("connection.ssl.cert_verify"))
|
||||
if (get_opt_bool("connection.ssl.cert_verify", NULL))
|
||||
SSL_set_verify(socket->ssl, SSL_VERIFY_PEER
|
||||
| SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
|
||||
NULL);
|
||||
|
||||
if (get_opt_bool("connection.ssl.client_cert.enable")) {
|
||||
if (get_opt_bool("connection.ssl.client_cert.enable", NULL)) {
|
||||
unsigned char *client_cert;
|
||||
|
||||
client_cert = get_opt_str("connection.ssl.client_cert.file");
|
||||
client_cert = get_opt_str("connection.ssl.client_cert.file",
|
||||
NULL);
|
||||
if (!*client_cert) {
|
||||
client_cert = getenv("X509_CLIENT_CERT");
|
||||
if (client_cert && !*client_cert)
|
||||
@ -172,7 +173,7 @@ ssl_connect(struct socket *socket)
|
||||
|
||||
case SSL_ERROR_NONE:
|
||||
#ifdef CONFIG_GNUTLS
|
||||
if (!get_opt_bool("connection.ssl.cert_verify"))
|
||||
if (!get_opt_bool("connection.ssl.cert_verify", NULL))
|
||||
break;
|
||||
|
||||
if (!gnutls_certificate_verify_peers(*((ssl_t *) socket->ssl)))
|
||||
|
@ -216,14 +216,14 @@ uint32_t
|
||||
get_bittorrent_peerwire_max_message_length(void)
|
||||
{
|
||||
return get_opt_int_tree(&bittorrent_protocol_options[0].option,
|
||||
"peerwire.max_message_length");
|
||||
"peerwire.max_message_length", NULL);
|
||||
}
|
||||
|
||||
uint32_t
|
||||
get_bittorrent_peerwire_max_request_length(void)
|
||||
{
|
||||
return get_opt_int_tree(&bittorrent_protocol_options[0].option,
|
||||
"peerwire.max_request_length");
|
||||
"peerwire.max_request_length", NULL);
|
||||
}
|
||||
|
||||
|
||||
|
@ -42,7 +42,7 @@ static void
|
||||
set_bittorrent_connection_timer(struct connection *conn)
|
||||
{
|
||||
struct bittorrent_connection *bittorrent = conn->info;
|
||||
milliseconds_T interval = sec_to_ms(get_opt_int("protocol.bittorrent.choke_interval"));
|
||||
milliseconds_T interval = sec_to_ms(get_opt_int("protocol.bittorrent.choke_interval", NULL));
|
||||
|
||||
install_timer(&bittorrent->timer, interval,
|
||||
(void (*)(void *)) update_bittorrent_connection_state,
|
||||
@ -93,15 +93,15 @@ update_bittorrent_connection_state(struct connection *conn)
|
||||
struct bittorrent_connection *bittorrent = conn->info;
|
||||
struct bittorrent_peer_connection *peer, *next_peer;
|
||||
int peer_conns, max_peer_conns;
|
||||
int min_uploads = get_opt_int("protocol.bittorrent.min_uploads");
|
||||
int max_uploads = get_opt_int("protocol.bittorrent.max_uploads");
|
||||
int min_uploads = get_opt_int("protocol.bittorrent.min_uploads", NULL);
|
||||
int max_uploads = get_opt_int("protocol.bittorrent.max_uploads", NULL);
|
||||
|
||||
set_bittorrent_connection_timer(conn);
|
||||
/* The expired timer ID has now been erased. */
|
||||
set_connection_timeout(conn);
|
||||
|
||||
peer_conns = list_size(&bittorrent->peers);
|
||||
max_peer_conns = get_opt_int("protocol.bittorrent.peerwire.connections");
|
||||
max_peer_conns = get_opt_int("protocol.bittorrent.peerwire.connections", NULL);
|
||||
|
||||
/* First ``age'' the peer rates _before_ the sorting. */
|
||||
foreach (peer, bittorrent->peers)
|
||||
@ -168,7 +168,7 @@ update_bittorrent_connection_state(struct connection *conn)
|
||||
/* Shrink the peer pool. */
|
||||
if (!list_empty(bittorrent->peers)) {
|
||||
struct bittorrent_peer *peer_info, *next_peer_info;
|
||||
int pool_size = get_opt_int("protocol.bittorrent.peerwire.pool_size");
|
||||
int pool_size = get_opt_int("protocol.bittorrent.peerwire.pool_size", NULL);
|
||||
int pool_peers = 0;
|
||||
|
||||
foreachsafe (peer_info, next_peer_info, bittorrent->peer_pool) {
|
||||
|
@ -150,7 +150,7 @@ add_bittorrent_meta_to_string(struct string *msg, struct bittorrent_meta *meta,
|
||||
add_format_to_string(msg, "\n%s: ",
|
||||
_("Creation date", term));
|
||||
add_date_to_string(msg,
|
||||
get_opt_str("ui.date_format"),
|
||||
get_opt_str("ui.date_format", NULL),
|
||||
&meta->creation_date);
|
||||
}
|
||||
#endif
|
||||
|
@ -72,7 +72,7 @@ check_bittorrent_peer_blacklisting(struct bittorrent_peer_connection *peer,
|
||||
enum bittorrent_blacklist_flags flags = BITTORRENT_BLACKLIST_NONE;
|
||||
|
||||
if (bittorrent_id_is_empty(peer->id)
|
||||
|| !get_opt_bool("protocol.http.bugs.allow_blacklist"))
|
||||
|| !get_opt_bool("protocol.http.bugs.allow_blacklist", NULL))
|
||||
return;
|
||||
|
||||
switch (state) {
|
||||
@ -120,7 +120,7 @@ bittorrent_peer_connection_timeout(struct bittorrent_peer_connection *peer)
|
||||
void
|
||||
set_bittorrent_peer_connection_timeout(struct bittorrent_peer_connection *peer)
|
||||
{
|
||||
milliseconds_T timeout = sec_to_ms(get_opt_int("protocol.bittorrent.peerwire.timeout"));
|
||||
milliseconds_T timeout = sec_to_ms(get_opt_int("protocol.bittorrent.peerwire.timeout", NULL));
|
||||
|
||||
kill_timer(&peer->timer);
|
||||
install_timer(&peer->timer, timeout,
|
||||
@ -312,7 +312,7 @@ make_bittorrent_peer_connection(struct bittorrent_connection *bittorrent,
|
||||
/* Number of connections to keep in the listening backlog before dropping new
|
||||
* ones. */
|
||||
#define LISTEN_BACKLOG \
|
||||
get_opt_int("protocol.bittorrent.peerwire.connections")
|
||||
get_opt_int("protocol.bittorrent.peerwire.connections", NULL)
|
||||
|
||||
/* Called when we receive a connection on the listening socket. */
|
||||
static void
|
||||
@ -383,8 +383,8 @@ init_bittorrent_listening_socket(struct connection *conn)
|
||||
|
||||
/* Bind it to some port */
|
||||
|
||||
port = get_opt_int("protocol.bittorrent.ports.min");
|
||||
max_port = get_opt_int("protocol.bittorrent.ports.max");
|
||||
port = get_opt_int("protocol.bittorrent.ports.min", NULL);
|
||||
max_port = get_opt_int("protocol.bittorrent.ports.max", NULL);
|
||||
|
||||
memset(&addr, 0, sizeof(addr));
|
||||
addr.sin_port = htons(port);
|
||||
|
@ -75,7 +75,7 @@ do_read_bittorrent_peer_handshake(struct socket *socket, struct read_buffer *buf
|
||||
static void
|
||||
queue_bittorrent_peer_connection_requests(struct bittorrent_peer_connection *peer)
|
||||
{
|
||||
int size = get_opt_int("protocol.bittorrent.request_queue_size");
|
||||
int size = get_opt_int("protocol.bittorrent.request_queue_size", NULL);
|
||||
int queue_size = list_size(&peer->local.requests);
|
||||
|
||||
for ( ; queue_size < size; queue_size++) {
|
||||
|
@ -95,7 +95,8 @@ handle_bittorrent_mode_changes(struct bittorrent_connection *bittorrent)
|
||||
} else if (bittorrent->mode == BITTORRENT_MODE_PIECELESS) {
|
||||
int cutoff;
|
||||
|
||||
cutoff = get_opt_int("protocol.bittorrent.rarest_first_cutoff");
|
||||
cutoff = get_opt_int("protocol.bittorrent.rarest_first_cutoff",
|
||||
NULL);
|
||||
if (cache->completed_pieces >= cutoff)
|
||||
bittorrent->mode = BITTORRENT_MODE_NORMAL;
|
||||
}
|
||||
@ -348,7 +349,7 @@ add_piece_to_bittorrent_free_list(struct bittorrent_piece_cache *cache,
|
||||
|
||||
piece_offset = 0;
|
||||
piece_length = get_bittorrent_piece_length(&bittorrent->meta, piece);
|
||||
request_length = get_opt_int("protocol.bittorrent.peerwire.request_length");
|
||||
request_length = get_opt_int("protocol.bittorrent.peerwire.request_length", NULL);
|
||||
|
||||
if (request_length > piece_length)
|
||||
request_length = piece_length;
|
||||
@ -624,7 +625,7 @@ get_bittorrent_file_name(struct bittorrent_meta *meta, struct bittorrent_file *f
|
||||
{
|
||||
unsigned char *name;
|
||||
|
||||
name = expand_tilde(get_opt_str("document.download.directory"));
|
||||
name = expand_tilde(get_opt_str("document.download.directory", NULL));
|
||||
if (!name) return NULL;
|
||||
|
||||
add_to_strn(&name, "/");
|
||||
@ -1213,7 +1214,8 @@ update_bittorrent_piece_cache_state(struct bittorrent_connection *bittorrent)
|
||||
{
|
||||
struct bittorrent_piece_cache *cache = bittorrent->cache;
|
||||
struct bittorrent_piece_cache_entry *entry, *next;
|
||||
off_t cache_size = get_opt_int("protocol.bittorrent.piece_cache_size");
|
||||
off_t cache_size = get_opt_int("protocol.bittorrent.piece_cache_size",
|
||||
NULL);
|
||||
off_t current_size = 0;
|
||||
|
||||
if (!cache_size) return;
|
||||
|
@ -37,7 +37,8 @@ static void
|
||||
set_bittorrent_tracker_interval(struct connection *conn)
|
||||
{
|
||||
struct bittorrent_connection *bittorrent = conn->info;
|
||||
int interval = get_opt_int("protocol.bittorrent.tracker.interval");
|
||||
int interval = get_opt_int("protocol.bittorrent.tracker.interval",
|
||||
NULL);
|
||||
|
||||
/* The default HTTP_KEEPALIVE_TIMEOUT is set to 60 seconds so it
|
||||
* probably makes sense to have a default tracker interval that is below
|
||||
@ -190,13 +191,13 @@ do_send_bittorrent_tracker_request(struct connection *conn)
|
||||
/* Sending no IP-address is valid. The tracker figures it out
|
||||
* automatically which is much easier. However, the user might want to
|
||||
* configure a specific IP-address to send. */
|
||||
ip = get_opt_str("protocol.bittorrent.tracker.ip_address");
|
||||
ip = get_opt_str("protocol.bittorrent.tracker.ip_address", NULL);
|
||||
if (*ip) add_format_to_string(&request, "&ip=%s", ip);
|
||||
|
||||
/* This one is required for each request. */
|
||||
add_format_to_string(&request, "&port=%u", bittorrent->port);
|
||||
|
||||
key = get_opt_str("protocol.bittorrent.tracker.key");
|
||||
key = get_opt_str("protocol.bittorrent.tracker.key", NULL);
|
||||
if (*key) {
|
||||
add_to_string(&request, "&key=");
|
||||
encode_uri_string(&request, key, strlen(key), 1);
|
||||
@ -226,9 +227,11 @@ do_send_bittorrent_tracker_request(struct connection *conn)
|
||||
add_format_to_string(&request, "&event=%s", event);
|
||||
}
|
||||
|
||||
min_size = get_opt_int("protocol.bittorrent.tracker.min_skip_size");
|
||||
min_size = get_opt_int("protocol.bittorrent.tracker.min_skip_size",
|
||||
NULL);
|
||||
if (!min_size || list_size(&bittorrent->peer_pool) < min_size) {
|
||||
numwant = get_opt_int("protocol.bittorrent.tracker.numwant");
|
||||
numwant = get_opt_int("protocol.bittorrent.tracker.numwant",
|
||||
NULL);
|
||||
/* Should the server default be used? */
|
||||
if (numwant == 0)
|
||||
numwant = -1;
|
||||
@ -239,7 +242,7 @@ do_send_bittorrent_tracker_request(struct connection *conn)
|
||||
if (numwant >= 0)
|
||||
add_format_to_string(&request, "&numwant=%d", numwant);
|
||||
|
||||
if (get_opt_bool("protocol.bittorrent.tracker.compact"))
|
||||
if (get_opt_bool("protocol.bittorrent.tracker.compact", NULL))
|
||||
add_to_string(&request, "&compact=1");
|
||||
|
||||
uri = get_uri(request.source, 0);
|
||||
|
@ -185,7 +185,7 @@ set_vars(struct connection *conn, unsigned char *script)
|
||||
* standard, so we already filled our environment with we have to have
|
||||
* there and we won't fail anymore if it won't work out. */
|
||||
|
||||
str = get_opt_str("protocol.http.user_agent");
|
||||
str = get_opt_str("protocol.http.user_agent", NULL);
|
||||
if (*str && strcmp(str, " ")) {
|
||||
unsigned char *ustr, ts[64] = "";
|
||||
|
||||
@ -205,13 +205,13 @@ set_vars(struct connection *conn, unsigned char *script)
|
||||
}
|
||||
}
|
||||
|
||||
switch (get_opt_int("protocol.http.referer.policy")) {
|
||||
switch (get_opt_int("protocol.http.referer.policy", NULL)) {
|
||||
case REFERER_NONE:
|
||||
/* oh well */
|
||||
break;
|
||||
|
||||
case REFERER_FAKE:
|
||||
str = get_opt_str("protocol.http.referer.fake");
|
||||
str = get_opt_str("protocol.http.referer.fake", NULL);
|
||||
env_set("HTTP_REFERER", str, -1);
|
||||
break;
|
||||
|
||||
@ -236,12 +236,12 @@ set_vars(struct connection *conn, unsigned char *script)
|
||||
/* We do not set HTTP_ACCEPT_ENCODING. Yeah, let's let the CGI script
|
||||
* gzip the stuff so that the CPU doesn't at least sit idle. */
|
||||
|
||||
str = get_opt_str("protocol.http.accept_language");
|
||||
str = get_opt_str("protocol.http.accept_language", NULL);
|
||||
if (*str) {
|
||||
env_set("HTTP_ACCEPT_LANGUAGE", str, -1);
|
||||
}
|
||||
#ifdef CONFIG_NLS
|
||||
else if (get_opt_bool("protocol.http.accept_ui_language")) {
|
||||
else if (get_opt_bool("protocol.http.accept_ui_language", NULL)) {
|
||||
env_set("HTTP_ACCEPT_LANGUAGE",
|
||||
language_to_iso639(current_language), -1);
|
||||
}
|
||||
@ -279,7 +279,7 @@ set_vars(struct connection *conn, unsigned char *script)
|
||||
static int
|
||||
test_path(unsigned char *path)
|
||||
{
|
||||
unsigned char *cgi_path = get_opt_str("protocol.file.cgi.path");
|
||||
unsigned char *cgi_path = get_opt_str("protocol.file.cgi.path", NULL);
|
||||
unsigned char **path_ptr;
|
||||
unsigned char *filename;
|
||||
|
||||
@ -312,7 +312,7 @@ execute_cgi(struct connection *conn)
|
||||
enum connection_state state = S_OK;
|
||||
int pipe_read[2], pipe_write[2];
|
||||
|
||||
if (!get_opt_bool("protocol.file.cgi.policy")) return 1;
|
||||
if (!get_opt_bool("protocol.file.cgi.policy", NULL)) return 1;
|
||||
|
||||
/* Not file referrer */
|
||||
if (conn->referrer && conn->referrer->protocol != PROTOCOL_FILE) {
|
||||
|
@ -156,8 +156,8 @@ add_dir_entries(struct directory_entry *entries, unsigned char *dirpath,
|
||||
int i;
|
||||
|
||||
/* Setup @dircolor so it's easy to check if we should color dirs. */
|
||||
if (get_opt_bool("document.browse.links.color_dirs")) {
|
||||
color_to_string(get_opt_color("document.colors.dirs"),
|
||||
if (get_opt_bool("document.browse.links.color_dirs", NULL)) {
|
||||
color_to_string(get_opt_color("document.colors.dirs", NULL),
|
||||
(unsigned char *) &dircolor);
|
||||
} else {
|
||||
dircolor[0] = 0;
|
||||
@ -180,7 +180,8 @@ static inline enum connection_state
|
||||
list_directory(struct connection *conn, unsigned char *dirpath,
|
||||
struct string *page)
|
||||
{
|
||||
int show_hidden_files = get_opt_bool("protocol.file.show_hidden_files");
|
||||
int show_hidden_files = get_opt_bool("protocol.file.show_hidden_files",
|
||||
NULL);
|
||||
struct directory_entry *entries;
|
||||
enum connection_state state;
|
||||
|
||||
|
@ -220,12 +220,12 @@ fsp_directory(FSP_SESSION *ses, struct uri *uri)
|
||||
|
||||
puts(buf.source);
|
||||
|
||||
if (get_opt_bool("document.browse.links.color_dirs")) {
|
||||
color_to_string(get_opt_color("document.colors.dirs"),
|
||||
if (get_opt_bool("document.browse.links.color_dirs", NULL)) {
|
||||
color_to_string(get_opt_color("document.colors.dirs", NULL),
|
||||
dircolor);
|
||||
}
|
||||
|
||||
if (get_opt_bool("protocol.fsp.sort")) {
|
||||
if (get_opt_bool("protocol.fsp.sort", NULL)) {
|
||||
sort_and_display_entries(dir, dircolor);
|
||||
} else {
|
||||
FSP_RDENTRY fentry, *fresult;
|
||||
|
@ -466,7 +466,8 @@ ftp_pass(struct connection *conn)
|
||||
add_to_string(&cmd, auth->password);
|
||||
|
||||
} else {
|
||||
add_to_string(&cmd, get_opt_str("protocol.ftp.anon_passwd"));
|
||||
add_to_string(&cmd, get_opt_str("protocol.ftp.anon_passwd",
|
||||
NULL));
|
||||
}
|
||||
add_crlf_to_string(&cmd);
|
||||
|
||||
@ -588,10 +589,10 @@ get_ftp_data_socket(struct connection *conn, struct string *command)
|
||||
{
|
||||
struct ftp_connection_info *ftp = conn->info;
|
||||
|
||||
ftp->use_pasv = get_opt_bool("protocol.ftp.use_pasv");
|
||||
ftp->use_pasv = get_opt_bool("protocol.ftp.use_pasv", NULL);
|
||||
|
||||
#ifdef CONFIG_IPV6
|
||||
ftp->use_epsv = get_opt_bool("protocol.ftp.use_epsv");
|
||||
ftp->use_epsv = get_opt_bool("protocol.ftp.use_epsv", NULL);
|
||||
|
||||
if (conn->socket->protocol_family == EL_PF_INET6) {
|
||||
if (ftp->use_epsv) {
|
||||
@ -1401,10 +1402,10 @@ out_of_mem:
|
||||
if (ftp->dir) {
|
||||
format.libc_codepage = get_cp_index("System");
|
||||
|
||||
format.colorize_dir = get_opt_bool("document.browse.links.color_dirs");
|
||||
format.colorize_dir = get_opt_bool("document.browse.links.color_dirs", NULL);
|
||||
|
||||
if (format.colorize_dir) {
|
||||
color_to_string(get_opt_color("document.colors.dirs"),
|
||||
color_to_string(get_opt_color("document.colors.dirs", NULL),
|
||||
format.dircolor);
|
||||
}
|
||||
}
|
||||
|
@ -172,7 +172,7 @@ show_http_error_document(struct session *ses, void *data)
|
||||
/* The codepage that _("foo", term) used when it was
|
||||
* called by get_http_error_document. */
|
||||
const int gettext_codepage
|
||||
= get_opt_codepage_tree(term->spec, "charset");
|
||||
= get_opt_codepage_tree(term->spec, "charset", NULL);
|
||||
|
||||
if (cached) delete_entry_content(cache);
|
||||
|
||||
|
@ -449,7 +449,7 @@ check_http_server_bugs(struct uri *uri, struct http_connection_info *http,
|
||||
NULL
|
||||
};
|
||||
|
||||
if (!get_opt_bool("protocol.http.bugs.allow_blacklist")
|
||||
if (!get_opt_bool("protocol.http.bugs.allow_blacklist", NULL)
|
||||
|| HTTP_1_0(http->sent_version))
|
||||
return 0;
|
||||
|
||||
@ -476,7 +476,7 @@ http_end_request(struct connection *conn, enum connection_state state,
|
||||
|
||||
if (conn->info && !((struct http_connection_info *) conn->info)->close
|
||||
&& (!conn->socket->ssl) /* We won't keep alive ssl connections */
|
||||
&& (!get_opt_bool("protocol.http.bugs.post_no_keepalive")
|
||||
&& (!get_opt_bool("protocol.http.bugs.post_no_keepalive", NULL)
|
||||
|| !conn->uri->post)) {
|
||||
if (state == S_OK && conn->cached)
|
||||
normalize_cache_entry(conn->cached, !notrunc ? conn->from : -1);
|
||||
@ -533,7 +533,7 @@ init_http_connection_info(struct connection *conn, int major, int minor, int clo
|
||||
http->bl_flags = get_blacklist_flags(conn->proxied_uri);
|
||||
|
||||
if (http->bl_flags & SERVER_BLACKLIST_HTTP10
|
||||
|| get_opt_bool("protocol.http.bugs.http10")) {
|
||||
|| get_opt_bool("protocol.http.bugs.http10", NULL)) {
|
||||
http->sent_version.major = 1;
|
||||
http->sent_version.minor = 0;
|
||||
}
|
||||
@ -550,7 +550,7 @@ http_send_header(struct socket *socket)
|
||||
{
|
||||
struct connection *conn = socket->conn;
|
||||
struct http_connection_info *http;
|
||||
int trace = get_opt_bool("protocol.http.trace");
|
||||
int trace = get_opt_bool("protocol.http.trace", NULL);
|
||||
struct string header;
|
||||
unsigned char *post_data = NULL;
|
||||
struct auth_entry *entry = NULL;
|
||||
@ -627,8 +627,8 @@ http_send_header(struct socket *socket)
|
||||
|
||||
/* CONNECT: Proxy-Authorization is intended to be seen by the proxy. */
|
||||
if (talking_to_proxy) {
|
||||
unsigned char *user = get_opt_str("protocol.http.proxy.user");
|
||||
unsigned char *passwd = get_opt_str("protocol.http.proxy.passwd");
|
||||
unsigned char *user = get_opt_str("protocol.http.proxy.user", NULL);
|
||||
unsigned char *passwd = get_opt_str("protocol.http.proxy.passwd", NULL);
|
||||
|
||||
if (proxy_auth.digest) {
|
||||
unsigned char *response;
|
||||
@ -676,7 +676,7 @@ http_send_header(struct socket *socket)
|
||||
/* CONNECT: User-Agent does not reveal anything about the
|
||||
* resource we're fetching, and it may help the proxy return
|
||||
* better error messages. */
|
||||
optstr = get_opt_str("protocol.http.user_agent");
|
||||
optstr = get_opt_str("protocol.http.user_agent", NULL);
|
||||
if (*optstr && strcmp(optstr, " ")) {
|
||||
unsigned char *ustr, ts[64] = "";
|
||||
|
||||
@ -704,13 +704,13 @@ http_send_header(struct socket *socket)
|
||||
/* CONNECT: Referer probably is a secret page in the HTTPS
|
||||
* server, so don't reveal it to the proxy. */
|
||||
if (!use_connect) {
|
||||
switch (get_opt_int("protocol.http.referer.policy")) {
|
||||
switch (get_opt_int("protocol.http.referer.policy", NULL)) {
|
||||
case REFERER_NONE:
|
||||
/* oh well */
|
||||
break;
|
||||
|
||||
case REFERER_FAKE:
|
||||
optstr = get_opt_str("protocol.http.referer.fake");
|
||||
optstr = get_opt_str("protocol.http.referer.fake", NULL);
|
||||
if (!optstr[0]) break;
|
||||
add_to_string(&header, "Referer: ");
|
||||
add_to_string(&header, optstr);
|
||||
@ -769,19 +769,19 @@ http_send_header(struct socket *socket)
|
||||
}
|
||||
|
||||
if (!(http->bl_flags & SERVER_BLACKLIST_NO_CHARSET)
|
||||
&& !get_opt_bool("protocol.http.bugs.accept_charset")
|
||||
&& !get_opt_bool("protocol.http.bugs.accept_charset", NULL)
|
||||
&& accept_charset) {
|
||||
add_to_string(&header, accept_charset);
|
||||
}
|
||||
|
||||
optstr = get_opt_str("protocol.http.accept_language");
|
||||
optstr = get_opt_str("protocol.http.accept_language", NULL);
|
||||
if (optstr[0]) {
|
||||
add_to_string(&header, "Accept-Language: ");
|
||||
add_to_string(&header, optstr);
|
||||
add_crlf_to_string(&header);
|
||||
}
|
||||
#ifdef CONFIG_NLS
|
||||
else if (get_opt_bool("protocol.http.accept_ui_language")) {
|
||||
else if (get_opt_bool("protocol.http.accept_ui_language", NULL)) {
|
||||
unsigned char *code = language_to_iso639(current_language);
|
||||
|
||||
if (code) {
|
||||
@ -805,7 +805,7 @@ http_send_header(struct socket *socket)
|
||||
add_to_string(&header, "Proxy-Connection: ");
|
||||
}
|
||||
|
||||
if (!uri->post || !get_opt_bool("protocol.http.bugs.post_no_keepalive")) {
|
||||
if (!uri->post || !get_opt_bool("protocol.http.bugs.post_no_keepalive", NULL)) {
|
||||
add_to_string(&header, "Keep-Alive");
|
||||
} else {
|
||||
add_to_string(&header, "close");
|
||||
@ -1576,7 +1576,7 @@ again:
|
||||
}
|
||||
mem_free_set(&conn->cached->head, head);
|
||||
|
||||
if (!get_opt_bool("document.cache.ignore_cache_control")) {
|
||||
if (!get_opt_bool("document.cache.ignore_cache_control", NULL)) {
|
||||
struct cache_entry *cached = conn->cached;
|
||||
|
||||
/* I am not entirely sure in what order we should process these
|
||||
@ -1653,7 +1653,7 @@ again:
|
||||
/* So POST must not be redirected to GET, but some
|
||||
* BUGGY message boards rely on it :-( */
|
||||
if (h == 302
|
||||
&& get_opt_bool("protocol.http.bugs.broken_302_redirect"))
|
||||
&& get_opt_bool("protocol.http.bugs.broken_302_redirect", NULL))
|
||||
use_get_method = 1;
|
||||
|
||||
redirect_cache(conn->cached, d, use_get_method, -1);
|
||||
|
@ -105,7 +105,7 @@ get_protocol_proxy(unsigned char *opt,
|
||||
{
|
||||
unsigned char *proxy;
|
||||
|
||||
proxy = get_opt_str(opt);
|
||||
proxy = get_opt_str(opt, NULL);
|
||||
if (!*proxy) proxy = getenv(env1);
|
||||
if (!proxy || !*proxy) proxy = getenv(env2);
|
||||
|
||||
@ -172,7 +172,7 @@ get_proxy_worker(struct uri *uri, unsigned char *proxy,
|
||||
|
||||
if (slash) *slash = 0;
|
||||
|
||||
no_proxy = get_opt_str("protocol.no_proxy");
|
||||
no_proxy = get_opt_str("protocol.no_proxy", NULL);
|
||||
if (!*no_proxy) no_proxy = getenv("NO_PROXY");
|
||||
if (!no_proxy || !*no_proxy) no_proxy = getenv("no_proxy");
|
||||
|
||||
|
@ -340,7 +340,7 @@ goto_url_hook(va_list ap, void *data)
|
||||
&& !strchr(*url, ':')
|
||||
&& !strchr(*url, '.')
|
||||
&& !strchr(*url, '/')) {
|
||||
uu = get_opt_str("protocol.rewrite.default_template");
|
||||
uu = get_opt_str("protocol.rewrite.default_template", NULL);
|
||||
if (uu && *uu) {
|
||||
arg = *url;
|
||||
} else {
|
||||
|
@ -258,8 +258,8 @@ smb_directory(int dir, struct uri *uri)
|
||||
|
||||
puts(buf.source);
|
||||
|
||||
if (get_opt_bool("document.browse.links.color_dirs")) {
|
||||
color_to_string(get_opt_color("document.colors.dirs"),
|
||||
if (get_opt_bool("document.browse.links.color_dirs", NULL)) {
|
||||
color_to_string(get_opt_color("document.colors.dirs", NULL),
|
||||
dircolor);
|
||||
}
|
||||
|
||||
|
@ -296,7 +296,7 @@ write_cache_entry_to_file(struct cache_entry *cached, struct file_download *file
|
||||
static void
|
||||
abort_download_and_beep(struct file_download *file_download, struct terminal *term)
|
||||
{
|
||||
if (term && get_opt_int("document.download.notify_bell")
|
||||
if (term && get_opt_int("document.download.notify_bell", NULL)
|
||||
+ file_download->notify >= 2) {
|
||||
beep_terminal(term);
|
||||
}
|
||||
@ -403,7 +403,7 @@ download_data_store(struct download *download, struct file_download *file_downlo
|
||||
}
|
||||
|
||||
if (file_download->remotetime
|
||||
&& get_opt_bool("document.download.set_original_time")) {
|
||||
&& get_opt_bool("document.download.set_original_time", NULL)) {
|
||||
struct utimbuf foo;
|
||||
|
||||
foo.actime = foo.modtime = file_download->remotetime;
|
||||
@ -585,7 +585,7 @@ lookup_unique_name(struct terminal *term, unsigned char *ofile, int resume,
|
||||
|
||||
/* !overwrite means always silently overwrite, which may be admitelly
|
||||
* indeed a little confusing ;-) */
|
||||
overwrite = get_opt_int("document.download.overwrite");
|
||||
overwrite = get_opt_int("document.download.overwrite", NULL);
|
||||
if (!overwrite) {
|
||||
/* Nothing special to do... */
|
||||
callback(term, ofile, data, resume);
|
||||
@ -695,7 +695,7 @@ create_download_file_do(struct terminal *term, unsigned char *file, void *data,
|
||||
set_bin(h);
|
||||
|
||||
if (!cdf_hop->safe) {
|
||||
unsigned char *download_dir = get_opt_str("document.download.directory");
|
||||
unsigned char *download_dir = get_opt_str("document.download.directory", NULL);
|
||||
int i;
|
||||
|
||||
safe_strncpy(download_dir, file, MAX_STR_LEN);
|
||||
|
@ -132,7 +132,7 @@ ses_history_move(struct session *ses)
|
||||
|
||||
/* Maybe trash the unhistory. */
|
||||
|
||||
if (get_opt_bool("document.history.keep_unhistory"))
|
||||
if (get_opt_bool("document.history.keep_unhistory", NULL))
|
||||
clean_unhistory(&ses->history);
|
||||
}
|
||||
|
||||
|
@ -592,7 +592,7 @@ doc_loading_callback(struct download *download, struct session *ses)
|
||||
if (ses->doc_view
|
||||
&& ses->doc_view->document
|
||||
&& ses->doc_view->document->refresh
|
||||
&& get_opt_bool("document.browse.refresh")) {
|
||||
&& get_opt_bool("document.browse.refresh", NULL)) {
|
||||
start_document_refresh(ses->doc_view->document->refresh,
|
||||
ses);
|
||||
}
|
||||
@ -751,7 +751,7 @@ setup_first_session(struct session *ses, struct uri *uri)
|
||||
/* [gettext_accelerator_context(setup_first_session)] */
|
||||
struct terminal *term = ses->tab->term;
|
||||
|
||||
if (!*get_opt_str("protocol.http.user_agent")) {
|
||||
if (!*get_opt_str("protocol.http.user_agent", NULL)) {
|
||||
info_box(term, 0,
|
||||
N_("Warning"), ALIGN_CENTER,
|
||||
N_("You have empty string in protocol.http.user_agent - "
|
||||
@ -766,11 +766,11 @@ setup_first_session(struct session *ses, struct uri *uri)
|
||||
"any inconvience caused."));
|
||||
}
|
||||
|
||||
if (!get_opt_bool("config.saving_style_w")) {
|
||||
if (!get_opt_bool("config.saving_style_w", NULL)) {
|
||||
struct option *opt = get_opt_rec(config_options, "config.saving_style_w");
|
||||
opt->value.number = 1;
|
||||
option_changed(ses, opt);
|
||||
if (get_opt_int("config.saving_style") != 3) {
|
||||
if (get_opt_int("config.saving_style", NULL) != 3) {
|
||||
info_box(term, 0,
|
||||
N_("Warning"), ALIGN_CENTER,
|
||||
N_("You have option config.saving_style set to "
|
||||
@ -810,10 +810,10 @@ setup_first_session(struct session *ses, struct uri *uri)
|
||||
if (!uri) return 1;
|
||||
|
||||
#ifdef CONFIG_BOOKMARKS
|
||||
} else if (!uri && get_opt_bool("ui.sessions.auto_restore")) {
|
||||
} else if (!uri && get_opt_bool("ui.sessions.auto_restore", NULL)) {
|
||||
unsigned char *folder;
|
||||
|
||||
folder = get_opt_str("ui.sessions.auto_save_foldername");
|
||||
folder = get_opt_str("ui.sessions.auto_save_foldername", NULL);
|
||||
open_bookmark_folder(ses, folder);
|
||||
return 1;
|
||||
#endif
|
||||
@ -844,7 +844,7 @@ setup_session(struct session *ses, struct uri *uri, struct session *base)
|
||||
goto_uri(ses, uri);
|
||||
|
||||
} else if (!goto_url_home(ses)) {
|
||||
if (get_opt_bool("ui.startup_goto_dialog")) {
|
||||
if (get_opt_bool("ui.startup_goto_dialog", NULL)) {
|
||||
dialog_goto_url_open(ses);
|
||||
}
|
||||
}
|
||||
|
@ -170,7 +170,7 @@ ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame,
|
||||
int referrer_incomplete = 0;
|
||||
int malicious_uri = 0;
|
||||
int confirm_submit = uri->form && get_opt_bool("document.browse.forms"
|
||||
".confirm_submit");
|
||||
".confirm_submit", NULL);
|
||||
unsigned char *m1 = NULL, *message = NULL;
|
||||
|
||||
if (ses->doc_view
|
||||
@ -194,7 +194,7 @@ ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame,
|
||||
* posting form data so this should be more correct. */
|
||||
|
||||
if (uri->user && uri->userlen
|
||||
&& get_opt_bool("document.browse.links.warn_malicious")
|
||||
&& get_opt_bool("document.browse.links.warn_malicious", NULL)
|
||||
&& check_malicious_uri(uri)) {
|
||||
malicious_uri = 1;
|
||||
confirm_submit = 1;
|
||||
@ -388,9 +388,9 @@ ses_imgmap(struct session *ses)
|
||||
&menu, &ml, ses->loading_uri,
|
||||
&doc_view->document->options,
|
||||
ses->task.target.frame,
|
||||
get_opt_codepage_tree(ses->tab->term->spec, "charset"),
|
||||
get_opt_codepage("document.codepage.assume"),
|
||||
get_opt_bool("document.codepage.force_assumed")))
|
||||
get_opt_codepage_tree(ses->tab->term->spec, "charset", NULL),
|
||||
get_opt_codepage("document.codepage.assume", NULL),
|
||||
get_opt_bool("document.codepage.force_assumed", NULL)))
|
||||
return;
|
||||
|
||||
add_empty_window(ses->tab->term, (void (*)(void *)) freeml, ml);
|
||||
@ -582,7 +582,8 @@ do_follow_url(struct session *ses, struct uri *uri, unsigned char *target,
|
||||
}
|
||||
|
||||
if (target && !strcmp(target, "_blank")) {
|
||||
int mode = get_opt_int("document.browse.links.target_blank");
|
||||
int mode = get_opt_int("document.browse.links.target_blank",
|
||||
NULL);
|
||||
|
||||
if (mode == 3
|
||||
&& !get_cmd_opt_bool("anonymous")
|
||||
@ -753,7 +754,7 @@ goto_url_with_hook(struct session *ses, unsigned char *url)
|
||||
int
|
||||
goto_url_home(struct session *ses)
|
||||
{
|
||||
unsigned char *homepage = get_opt_str("ui.sessions.homepage");
|
||||
unsigned char *homepage = get_opt_str("ui.sessions.homepage", NULL);
|
||||
|
||||
if (!*homepage) homepage = getenv("WWW_HOME");
|
||||
if (!homepage || !*homepage) homepage = WWW_HOME_URL;
|
||||
|
@ -75,7 +75,7 @@ draw_border_cross(struct terminal *term, int x, int y,
|
||||
}
|
||||
|
||||
set_term_color(screen_char, color, 0,
|
||||
get_opt_int_tree(term->spec, "colors"));
|
||||
get_opt_int_tree(term->spec, "colors", NULL));
|
||||
}
|
||||
|
||||
void
|
||||
@ -89,7 +89,7 @@ draw_border_char(struct terminal *term, int x, int y,
|
||||
screen_char->data = (unsigned char) border;
|
||||
screen_char->attr = SCREEN_ATTR_FRAME;
|
||||
set_term_color(screen_char, color, 0,
|
||||
get_opt_int_tree(term->spec, "colors"));
|
||||
get_opt_int_tree(term->spec, "colors", NULL));
|
||||
set_screen_dirty(term->screen, y, y);
|
||||
}
|
||||
|
||||
@ -101,7 +101,7 @@ draw_char_color(struct terminal *term, int x, int y, struct color_pair *color)
|
||||
if (!screen_char) return;
|
||||
|
||||
set_term_color(screen_char, color, 0,
|
||||
get_opt_int_tree(term->spec, "colors"));
|
||||
get_opt_int_tree(term->spec, "colors", NULL));
|
||||
set_screen_dirty(term->screen, y, y);
|
||||
}
|
||||
|
||||
@ -351,7 +351,7 @@ draw_char(struct terminal *term, int x, int y,
|
||||
screen_char->data = data;
|
||||
screen_char->attr = attr;
|
||||
set_term_color(screen_char, color, 0,
|
||||
get_opt_int_tree(term->spec, "colors"));
|
||||
get_opt_int_tree(term->spec, "colors", NULL));
|
||||
|
||||
set_screen_dirty(term->screen, y, y);
|
||||
}
|
||||
@ -378,7 +378,7 @@ draw_box(struct terminal *term, struct box *box,
|
||||
end->data = data;
|
||||
if (color) {
|
||||
set_term_color(end, color, 0,
|
||||
get_opt_int_tree(term->spec, "colors"));
|
||||
get_opt_int_tree(term->spec, "colors", NULL));
|
||||
} else {
|
||||
clear_screen_char_color(end);
|
||||
}
|
||||
@ -440,7 +440,7 @@ draw_text_utf8(struct terminal *term, int x, int y,
|
||||
if (color) {
|
||||
start->attr = attr;
|
||||
set_term_color(start, color, 0,
|
||||
get_opt_int_tree(term->spec, "colors"));
|
||||
get_opt_int_tree(term->spec, "colors", NULL));
|
||||
}
|
||||
|
||||
if (start->data == UCS_NO_CHAR && x - 1 > 0)
|
||||
@ -540,7 +540,7 @@ draw_text(struct terminal *term, int x, int y,
|
||||
/* Use the last char as template. */
|
||||
end->attr = attr;
|
||||
set_term_color(end, color, 0,
|
||||
get_opt_int_tree(term->spec, "colors"));
|
||||
get_opt_int_tree(term->spec, "colors", NULL));
|
||||
|
||||
for (; pos < end && *text; text++, pos++) {
|
||||
end->data = *text;
|
||||
@ -564,7 +564,7 @@ set_cursor(struct terminal *term, int x, int y, int blockable)
|
||||
assert(term && term->screen);
|
||||
if_assert_failed return;
|
||||
|
||||
if (blockable && get_opt_bool_tree(term->spec, "block_cursor")) {
|
||||
if (blockable && get_opt_bool_tree(term->spec, "block_cursor", NULL)) {
|
||||
x = term->width - 1;
|
||||
y = term->height - 1;
|
||||
}
|
||||
|
@ -148,7 +148,8 @@ term_send_ucs(struct terminal *term, unicode_val_T u,
|
||||
const unsigned char *recoded;
|
||||
|
||||
set_kbd_term_event(&ev, KBD_UNDEF, modifier);
|
||||
recoded = u2cp_no_nbsp(u, get_opt_codepage_tree(term->spec, "charset"));
|
||||
recoded = u2cp_no_nbsp(u, get_opt_codepage_tree(term->spec, "charset",
|
||||
NULL));
|
||||
if (!recoded) recoded = "*";
|
||||
while (*recoded) {
|
||||
ev.info.keyboard.key = *recoded;
|
||||
@ -185,12 +186,12 @@ check_terminal_name(struct terminal *term, struct terminal_info *info)
|
||||
* term->spec and term->utf8 should be set before decode session info.
|
||||
* --Scrool */
|
||||
term->utf8_cp = is_cp_utf8(get_opt_codepage_tree(term->spec,
|
||||
"charset"));
|
||||
"charset", NULL));
|
||||
/* Force UTF-8 I/O if the UTF-8 charset is selected. Various
|
||||
* places assume that the terminal's charset is unibyte if
|
||||
* UTF-8 I/O is disabled. (bug 827) */
|
||||
term->utf8_io = term->utf8_cp
|
||||
|| get_opt_bool_tree(term->spec, "utf_8_io");
|
||||
|| get_opt_bool_tree(term->spec, "utf_8_io", NULL);
|
||||
#endif /* CONFIG_UTF8 */
|
||||
}
|
||||
|
||||
@ -323,7 +324,7 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
|
||||
* this codepage cannot be UTF-8.
|
||||
* - Otherwise, handle_interlink_event() passes the
|
||||
* bytes straight through. */
|
||||
utf8_io = get_opt_bool_tree(term->spec, "utf_8_io");
|
||||
utf8_io = get_opt_bool_tree(term->spec, "utf_8_io", NULL);
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
/* In UTF-8 byte sequences that have more than one byte, the
|
||||
@ -381,7 +382,8 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
|
||||
* recode from the terminal charset to UCS-4. */
|
||||
|
||||
key = cp2u(get_opt_codepage_tree(term->spec,
|
||||
"charset"),
|
||||
"charset",
|
||||
NULL),
|
||||
key);
|
||||
term_send_ucs(term, key, modifier);
|
||||
break;
|
||||
|
@ -316,8 +316,8 @@ static INIT_LIST_OF(struct screen_driver, active_screen_drivers);
|
||||
static void
|
||||
set_screen_driver_opt(struct screen_driver *driver, struct option *term_spec)
|
||||
{
|
||||
const int cp = get_opt_codepage_tree(term_spec, "charset");
|
||||
int utf8_io = get_opt_bool_tree(term_spec, "utf_8_io");
|
||||
const int cp = get_opt_codepage_tree(term_spec, "charset", NULL);
|
||||
int utf8_io = get_opt_bool_tree(term_spec, "utf_8_io", NULL);
|
||||
|
||||
/* Copy all the original options from constants, so that this
|
||||
* function need not carefully restore options one by one. */
|
||||
@ -335,10 +335,11 @@ set_screen_driver_opt(struct screen_driver *driver, struct option *term_spec)
|
||||
}
|
||||
#endif /* CONFIG_UTF8 */
|
||||
|
||||
driver->opt.color_mode = get_opt_int_tree(term_spec, "colors");
|
||||
driver->opt.transparent = get_opt_bool_tree(term_spec, "transparency");
|
||||
driver->opt.color_mode = get_opt_int_tree(term_spec, "colors", NULL);
|
||||
driver->opt.transparent = get_opt_bool_tree(term_spec, "transparency",
|
||||
NULL);
|
||||
|
||||
if (get_opt_bool_tree(term_spec, "underline")) {
|
||||
if (get_opt_bool_tree(term_spec, "underline", NULL)) {
|
||||
driver->opt.underline = underline_seqs;
|
||||
} else {
|
||||
driver->opt.underline = NULL;
|
||||
@ -353,7 +354,7 @@ set_screen_driver_opt(struct screen_driver *driver, struct option *term_spec)
|
||||
driver->opt.frame_seqs = NULL;
|
||||
|
||||
if (driver->type == TERM_LINUX) {
|
||||
if (get_opt_bool_tree(term_spec, "restrict_852"))
|
||||
if (get_opt_bool_tree(term_spec, "restrict_852", NULL))
|
||||
driver->opt.frame = frame_restrict;
|
||||
driver->opt.charsets[1] = get_cp_index("cp437");
|
||||
|
||||
@ -384,14 +385,14 @@ set_screen_driver_opt(struct screen_driver *driver, struct option *term_spec)
|
||||
driver->opt.charsets[0] = -1;
|
||||
|
||||
if (driver->type == TERM_LINUX) {
|
||||
if (get_opt_bool_tree(term_spec, "restrict_852"))
|
||||
if (get_opt_bool_tree(term_spec, "restrict_852", NULL))
|
||||
driver->opt.frame = frame_restrict;
|
||||
|
||||
if (get_opt_bool_tree(term_spec, "m11_hack"))
|
||||
if (get_opt_bool_tree(term_spec, "m11_hack", NULL))
|
||||
driver->opt.frame_seqs = m11_hack_frame_seqs;
|
||||
|
||||
} else if (driver->type == TERM_FREEBSD) {
|
||||
if (get_opt_bool_tree(term_spec, "m11_hack"))
|
||||
if (get_opt_bool_tree(term_spec, "m11_hack", NULL))
|
||||
driver->opt.frame_seqs = m11_hack_frame_seqs;
|
||||
|
||||
} else if (driver->type == TERM_VT100) {
|
||||
@ -404,7 +405,7 @@ static int
|
||||
screen_driver_change_hook(struct session *ses, struct option *term_spec,
|
||||
struct option *changed)
|
||||
{
|
||||
enum term_mode_type type = get_opt_int_tree(term_spec, "type");
|
||||
enum term_mode_type type = get_opt_int_tree(term_spec, "type", NULL);
|
||||
struct screen_driver *driver;
|
||||
unsigned char *name = term_spec->name;
|
||||
|
||||
@ -445,7 +446,7 @@ add_screen_driver(enum term_mode_type type, struct terminal *term, int env_len)
|
||||
static inline struct screen_driver *
|
||||
get_screen_driver(struct terminal *term)
|
||||
{
|
||||
enum term_mode_type type = get_opt_int_tree(term->spec, "type");
|
||||
enum term_mode_type type = get_opt_int_tree(term->spec, "type", NULL);
|
||||
unsigned char *name = term->spec->name;
|
||||
int len = strlen(name);
|
||||
struct screen_driver *driver;
|
||||
|
@ -139,7 +139,7 @@ switch_to_tab(struct terminal *term, int tab, int tabs_count)
|
||||
if (tabs_count < 0) tabs_count = number_of_tabs(term);
|
||||
|
||||
if (tabs_count > 1) {
|
||||
if (get_opt_bool("ui.tabs.wraparound")) {
|
||||
if (get_opt_bool("ui.tabs.wraparound", NULL)) {
|
||||
tab %= tabs_count;
|
||||
if (tab < 0) tab += tabs_count;
|
||||
} else
|
||||
@ -196,7 +196,7 @@ close_tab(struct terminal *term, struct session *ses)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!get_opt_bool("ui.tabs.confirm_close")) {
|
||||
if (!get_opt_bool("ui.tabs.confirm_close", NULL)) {
|
||||
really_close_tab(ses);
|
||||
return;
|
||||
}
|
||||
@ -240,7 +240,7 @@ close_all_tabs_but_current(struct session *ses)
|
||||
assert(ses);
|
||||
if_assert_failed return;
|
||||
|
||||
if (!get_opt_bool("ui.tabs.confirm_close")) {
|
||||
if (!get_opt_bool("ui.tabs.confirm_close", NULL)) {
|
||||
really_close_tabs(ses);
|
||||
return;
|
||||
}
|
||||
@ -309,7 +309,7 @@ move_current_tab(struct session *ses, int direction)
|
||||
|
||||
new_pos = term->current_tab + direction;
|
||||
|
||||
if (get_opt_bool("ui.tabs.wraparound")) {
|
||||
if (get_opt_bool("ui.tabs.wraparound", NULL)) {
|
||||
new_pos %= tabs;
|
||||
if (new_pos < 0) new_pos = tabs + new_pos;
|
||||
} else {
|
||||
|
@ -171,7 +171,7 @@ static void
|
||||
check_if_no_terminal(void)
|
||||
{
|
||||
program.terminate = list_empty(terminals)
|
||||
&& !get_opt_bool("ui.sessions.keep_session_active");
|
||||
&& !get_opt_bool("ui.sessions.keep_session_active", NULL);
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -94,7 +94,7 @@ secure_open_umask(unsigned char *file_name)
|
||||
goto end;
|
||||
}
|
||||
|
||||
ssi->secure_save = get_opt_bool("infofiles.secure_save");
|
||||
ssi->secure_save = get_opt_bool("infofiles.secure_save", NULL);
|
||||
|
||||
ssi->file_name = stracpy(file_name);
|
||||
if (!ssi->file_name) {
|
||||
@ -252,7 +252,7 @@ secure_close(struct secure_save_info *ssi)
|
||||
#endif
|
||||
|
||||
#ifdef HAVE_FSYNC
|
||||
if (!fail && get_opt_bool("infofiles.secure_save_fsync"))
|
||||
if (!fail && get_opt_bool("infofiles.secure_save_fsync", NULL))
|
||||
fail = fsync(fileno(ssi->fp));
|
||||
#endif
|
||||
|
||||
|
@ -164,7 +164,7 @@ do_action(struct session *ses, enum main_action action_id, int verbose)
|
||||
|
||||
case ACT_MAIN_COOKIES_LOAD:
|
||||
#ifdef CONFIG_COOKIES
|
||||
if (!get_opt_bool("cookies.save")) break;
|
||||
if (!get_opt_bool("cookies.save", NULL)) break;
|
||||
load_cookies();
|
||||
#endif
|
||||
break;
|
||||
|
@ -114,15 +114,15 @@ dump_formatted(int fd, struct download *download, struct cache_entry *cached)
|
||||
|
||||
memset(&formatted, 0, sizeof(formatted));
|
||||
|
||||
init_document_options(&o);
|
||||
width = get_opt_int("document.dump.width");
|
||||
init_document_options(NULL, &o);
|
||||
width = get_opt_int("document.dump.width", NULL);
|
||||
set_box(&o.box, 0, 1, width, DEFAULT_TERMINAL_HEIGHT);
|
||||
|
||||
o.cp = get_opt_codepage("document.dump.codepage");
|
||||
o.color_mode = get_opt_int("document.dump.color_mode");
|
||||
o.cp = get_opt_codepage("document.dump.codepage", NULL);
|
||||
o.color_mode = get_opt_int("document.dump.color_mode", NULL);
|
||||
o.plain = 0;
|
||||
o.frames = 0;
|
||||
o.links_numbering = get_opt_bool("document.dump.numbering");
|
||||
o.links_numbering = get_opt_bool("document.dump.numbering", NULL);
|
||||
|
||||
init_vs(&vs, cached->uri, -1);
|
||||
|
||||
@ -217,7 +217,7 @@ subst_url(unsigned char *str, struct string *url)
|
||||
static void
|
||||
dump_print(unsigned char *option, struct string *url)
|
||||
{
|
||||
unsigned char *str = get_opt_str(option);
|
||||
unsigned char *str = get_opt_str(option, NULL);
|
||||
|
||||
if (str) {
|
||||
unsigned char *realstr = subst_url(str, url);
|
||||
@ -479,7 +479,7 @@ dump_to_file_16(struct document *document, int fd)
|
||||
int bptr = 0;
|
||||
unsigned char *buf = mem_alloc(D_BUF);
|
||||
unsigned char color = 0;
|
||||
int width = get_opt_int("document.dump.width");
|
||||
int width = get_opt_int("document.dump.width", NULL);
|
||||
|
||||
if (!buf) return -1;
|
||||
|
||||
@ -538,7 +538,8 @@ fail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (document->nlinks && get_opt_bool("document.dump.references")) {
|
||||
if (document->nlinks
|
||||
&& get_opt_bool("document.dump.references", NULL)) {
|
||||
int x;
|
||||
unsigned char *header = "\nReferences\n\n Visible links\n";
|
||||
int headlen = strlen(header);
|
||||
@ -603,7 +604,7 @@ dump_to_file_256(struct document *document, int fd)
|
||||
unsigned char *buf = mem_alloc(D_BUF);
|
||||
unsigned char foreground = 0;
|
||||
unsigned char background = 0;
|
||||
int width = get_opt_int("document.dump.width");
|
||||
int width = get_opt_int("document.dump.width", NULL);
|
||||
|
||||
if (!buf) return -1;
|
||||
|
||||
@ -670,7 +671,8 @@ fail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (document->nlinks && get_opt_bool("document.dump.references")) {
|
||||
if (document->nlinks
|
||||
&& get_opt_bool("document.dump.references", NULL)) {
|
||||
int x;
|
||||
unsigned char *header = "\nReferences\n\n Visible links\n";
|
||||
int headlen = strlen(header);
|
||||
@ -735,7 +737,7 @@ dump_to_file_true_color(struct document *document, int fd)
|
||||
unsigned char *buf = mem_alloc(D_BUF);
|
||||
unsigned char *foreground = &color[0];
|
||||
unsigned char *background = &color[3];
|
||||
int width = get_opt_int("document.dump.width");
|
||||
int width = get_opt_int("document.dump.width", NULL);
|
||||
|
||||
if (!buf) return -1;
|
||||
|
||||
@ -802,7 +804,8 @@ fail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (document->nlinks && get_opt_bool("document.dump.references")) {
|
||||
if (document->nlinks
|
||||
&& get_opt_bool("document.dump.references", NULL)) {
|
||||
int x;
|
||||
unsigned char *header = "\nReferences\n\n Visible links\n";
|
||||
int headlen = strlen(header);
|
||||
@ -949,7 +952,8 @@ fail:
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (document->nlinks && get_opt_bool("document.dump.references")) {
|
||||
if (document->nlinks
|
||||
&& get_opt_bool("document.dump.references", NULL)) {
|
||||
int x;
|
||||
unsigned char *header = "\nReferences\n\n Visible links\n";
|
||||
int headlen = strlen(header);
|
||||
|
@ -73,7 +73,8 @@ check_document_fragment(struct session *ses, struct document_view *doc_view)
|
||||
return -2;
|
||||
}
|
||||
|
||||
if (get_opt_bool("document.browse.links.missing_fragment")) {
|
||||
if (get_opt_bool("document.browse.links.missing_fragment",
|
||||
NULL)) {
|
||||
info_box(ses->tab->term, MSGBOX_FREE_TEXT,
|
||||
N_("Missing fragment"), ALIGN_CENTER,
|
||||
msg_text(ses->tab->term, N_("The requested fragment "
|
||||
@ -227,10 +228,10 @@ draw_doc(struct session *ses, struct document_view *doc_view, int active)
|
||||
}
|
||||
}
|
||||
|
||||
color.foreground = get_opt_color("document.colors.text");
|
||||
color.foreground = get_opt_color("document.colors.text", NULL);
|
||||
color.background = doc_view->document->height
|
||||
? doc_view->document->bgcolor
|
||||
: get_opt_color("document.colors.background");
|
||||
: get_opt_color("document.colors.background", NULL);
|
||||
|
||||
vs = doc_view->vs;
|
||||
if (!vs) {
|
||||
@ -354,7 +355,7 @@ draw_formatted(struct session *ses, int rerender)
|
||||
if (ses->doc_view
|
||||
&& ses->doc_view->document
|
||||
&& ses->doc_view->document->refresh
|
||||
&& get_opt_bool("document.browse.refresh")) {
|
||||
&& get_opt_bool("document.browse.refresh", NULL)) {
|
||||
start_document_refresh(ses->doc_view->document->refresh,
|
||||
ses);
|
||||
}
|
||||
|
@ -164,7 +164,7 @@ init_form_state(struct document_view *doc_view,
|
||||
|
||||
doc_cp = doc_view->document->cp;
|
||||
term = doc_view->session->tab->term;
|
||||
viewer_cp = get_opt_codepage_tree(term->spec, "charset");
|
||||
viewer_cp = get_opt_codepage_tree(term->spec, "charset", NULL);
|
||||
|
||||
mem_free_set(&fs->value, NULL);
|
||||
|
||||
@ -1176,7 +1176,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view,
|
||||
|
||||
get_successful_controls(doc_view, fc, &submit);
|
||||
|
||||
cp_from = get_opt_codepage_tree(ses->tab->term->spec, "charset");
|
||||
cp_from = get_opt_codepage_tree(ses->tab->term->spec, "charset", NULL);
|
||||
cp_to = doc_view->document->cp;
|
||||
switch (form->method) {
|
||||
case FORM_METHOD_GET:
|
||||
@ -1198,7 +1198,7 @@ get_form_uri(struct session *ses, struct document_view *doc_view,
|
||||
* a file that is to be uploaded. TODO: Distinguish between
|
||||
* these two classes of errors (is it worth it?). -- Miciah */
|
||||
if (data.source
|
||||
&& get_opt_bool("document.browse.forms.show_formhist"))
|
||||
&& get_opt_bool("document.browse.forms.show_formhist", NULL))
|
||||
memorize_form(ses, &submit, form);
|
||||
#endif
|
||||
|
||||
@ -1562,7 +1562,7 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
* submit the form or the posting fails. */
|
||||
/* FIXME: We should maybe have ACT_EDIT_ENTER_RELOAD */
|
||||
if ((has_form_submit(fc->form)
|
||||
&& !get_opt_bool("document.browse.forms.auto_submit"))
|
||||
&& !get_opt_bool("document.browse.forms.auto_submit", NULL))
|
||||
|| goto_current_link(ses, doc_view, 0)) {
|
||||
if (ses->insert_mode == INSERT_MODE_ON)
|
||||
ses->insert_mode = INSERT_MODE_OFF;
|
||||
@ -1775,7 +1775,8 @@ field_op(struct session *ses, struct document_view *doc_view,
|
||||
/* fs->value is in the charset of the terminal. */
|
||||
ctext = u2cp_no_nbsp(get_kbd_key(ev),
|
||||
get_opt_codepage_tree(ses->tab->term->spec,
|
||||
"charset"));
|
||||
"charset",
|
||||
NULL));
|
||||
length = strlen(ctext);
|
||||
|
||||
if (strlen(fs->value) + length > fc->maxlength
|
||||
@ -1920,7 +1921,8 @@ get_form_info(struct session *ses, struct document_view *doc_view)
|
||||
|
||||
if (!fc->form->action
|
||||
|| (has_form_submit(fc->form)
|
||||
&& !get_opt_bool("document.browse.forms.auto_submit")))
|
||||
&& !get_opt_bool("document.browse.forms.auto_submit",
|
||||
NULL)))
|
||||
break;
|
||||
|
||||
uri = get_uri(fc->form->action, 0);
|
||||
@ -1968,7 +1970,7 @@ get_form_info(struct session *ses, struct document_view *doc_view)
|
||||
}
|
||||
|
||||
if (link->accesskey
|
||||
&& get_opt_bool("document.browse.accesskey.display")) {
|
||||
&& get_opt_bool("document.browse.accesskey.display", NULL)) {
|
||||
add_to_string(&str, " (");
|
||||
add_accesskey_to_string(&str, link->accesskey);
|
||||
add_char_to_string(&str, ')');
|
||||
|
@ -1171,7 +1171,7 @@ goto_link_number_do(struct session *ses, struct document_view *doc_view, int n)
|
||||
|
||||
link = &doc_view->document->links[n];
|
||||
if (!link_is_textinput(link)
|
||||
&& get_opt_bool("document.browse.accesskey.auto_follow"))
|
||||
&& get_opt_bool("document.browse.accesskey.auto_follow", NULL))
|
||||
enter(ses, doc_view, 0);
|
||||
}
|
||||
|
||||
@ -1211,7 +1211,7 @@ try_document_key(struct session *ses, struct document_view *doc_view,
|
||||
key = get_kbd_key(ev);
|
||||
#else /* !CONFIG_UTF8 */
|
||||
key = cp2u(get_opt_codepage_tree(ses->tab->term->spec,
|
||||
"charset"),
|
||||
"charset", NULL),
|
||||
get_kbd_key(ev));
|
||||
#endif /* !CONFIG_UTF8 */
|
||||
/* If @key now is 0 (which is used in link.accesskey if there
|
||||
@ -1455,7 +1455,8 @@ get_current_link_info(struct session *ses, struct document_view *doc_view)
|
||||
/* Add the uri with password and post info stripped */
|
||||
add_string_uri_to_string(&str, uristring, URI_PUBLIC);
|
||||
if (link->accesskey > 0
|
||||
&& get_opt_bool("document.browse.accesskey.display")) {
|
||||
&& get_opt_bool("document.browse.accesskey.display",
|
||||
NULL)) {
|
||||
add_to_string(&str, " (");
|
||||
add_accesskey_to_string(&str, link->accesskey);
|
||||
add_char_to_string(&str, ')');
|
||||
|
@ -310,10 +310,10 @@ init_regex(regex_t *regex, unsigned char *pattern)
|
||||
int regex_flags = REG_NEWLINE;
|
||||
int reg_err;
|
||||
|
||||
if (get_opt_int("document.browse.search.regex") == 2)
|
||||
if (get_opt_int("document.browse.search.regex", NULL) == 2)
|
||||
regex_flags |= REG_EXTENDED;
|
||||
|
||||
if (!get_opt_bool("document.browse.search.case"))
|
||||
if (!get_opt_bool("document.browse.search.case", NULL))
|
||||
regex_flags |= REG_ICASE;
|
||||
|
||||
reg_err = regcomp(regex, pattern, regex_flags);
|
||||
@ -522,7 +522,7 @@ is_in_range_plain(struct document *document, int y, int height,
|
||||
int yy = y + height;
|
||||
UCHAR *txt;
|
||||
int found = 0;
|
||||
int case_sensitive = get_opt_bool("document.browse.search.case");
|
||||
int case_sensitive = get_opt_bool("document.browse.search.case", NULL);
|
||||
|
||||
txt = case_sensitive ? memacpy_u(text, textlen, utf8) : lowered_string(text, textlen, utf8);
|
||||
if (!txt) return -1;
|
||||
@ -591,7 +591,7 @@ is_in_range(struct document *document, int y, int height,
|
||||
return 0;
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (get_opt_int("document.browse.search.regex"))
|
||||
if (get_opt_int("document.browse.search.regex", NULL))
|
||||
return is_in_range_regex(document, y, height, text, textlen,
|
||||
min, max, s1, s2);
|
||||
#endif
|
||||
@ -611,7 +611,7 @@ get_searched_plain(struct document_view *doc_view, struct point **pt, int *pl,
|
||||
struct box *box;
|
||||
int xoffset, yoffset;
|
||||
int len = 0;
|
||||
int case_sensitive = get_opt_bool("document.browse.search.case");
|
||||
int case_sensitive = get_opt_bool("document.browse.search.case", NULL);
|
||||
|
||||
txt = case_sensitive ? memacpy_u(*doc_view->search_word, l, utf8)
|
||||
: lowered_string(*doc_view->search_word, l, utf8);
|
||||
@ -758,7 +758,7 @@ get_searched(struct document_view *doc_view, struct point **pt, int *pl, int utf
|
||||
}
|
||||
|
||||
#ifdef HAVE_REGEX_H
|
||||
if (get_opt_int("document.browse.search.regex"))
|
||||
if (get_opt_int("document.browse.search.regex", NULL))
|
||||
get_searched_regex(doc_view, pt, pl, l, s1, s2);
|
||||
else
|
||||
#endif
|
||||
@ -1049,7 +1049,7 @@ static void
|
||||
print_find_error_not_found(struct session *ses, unsigned char *title,
|
||||
unsigned char *message, unsigned char *search_string)
|
||||
{
|
||||
switch (get_opt_int("document.browse.search.show_not_found")) {
|
||||
switch (get_opt_int("document.browse.search.show_not_found", NULL)) {
|
||||
case 2:
|
||||
info_box(ses->tab->term, MSGBOX_FREE_TEXT,
|
||||
title, ALIGN_CENTER,
|
||||
@ -1076,7 +1076,7 @@ print_find_error(struct session *ses, enum find_error find_error)
|
||||
hit_top = 1;
|
||||
case FIND_ERROR_HIT_BOTTOM:
|
||||
if (!get_opt_bool("document.browse.search"
|
||||
".show_hit_top_bottom"))
|
||||
".show_hit_top_bottom", NULL))
|
||||
break;
|
||||
|
||||
message = hit_top
|
||||
@ -1187,8 +1187,9 @@ search_link_text(struct document *document, int current_link, int i,
|
||||
unsigned char *text, int direction, int *offset)
|
||||
{
|
||||
int upper_link, lower_link;
|
||||
int case_sensitive = get_opt_bool("document.browse.search.case");
|
||||
int wraparound = get_opt_bool("document.browse.search.wraparound");
|
||||
int case_sensitive = get_opt_bool("document.browse.search.case", NULL);
|
||||
int wraparound = get_opt_bool("document.browse.search.wraparound",
|
||||
NULL);
|
||||
int textlen = strlen(text);
|
||||
|
||||
assert(textlen && direction && offset);
|
||||
@ -1307,14 +1308,15 @@ do_typeahead(struct session *ses, struct document_view *doc_view,
|
||||
direction = -1;
|
||||
i--;
|
||||
if (i >= 0) break;
|
||||
if (!get_opt_bool("document.browse.search.wraparound")) {
|
||||
if (!get_opt_bool("document.browse.search.wraparound", NULL)) {
|
||||
search_hit_boundary:
|
||||
if (match_link_text(&document->links[current],
|
||||
text, strlen(text),
|
||||
get_opt_bool("document"
|
||||
".browse"
|
||||
".search"
|
||||
".case"))
|
||||
".case",
|
||||
NULL))
|
||||
>= 0) {
|
||||
return TYPEAHEAD_ERROR_NO_FURTHER;
|
||||
}
|
||||
@ -1330,7 +1332,8 @@ search_hit_boundary:
|
||||
direction = 1;
|
||||
i++;
|
||||
if (i < doc_view->document->nlinks) break;
|
||||
if (!get_opt_bool("document.browse.search.wraparound"))
|
||||
if (!get_opt_bool("document.browse.search.wraparound",
|
||||
NULL))
|
||||
goto search_hit_boundary;
|
||||
|
||||
i = 0;
|
||||
@ -1464,7 +1467,7 @@ link_typeahead_handler(struct input_line *line, int action_id)
|
||||
offset = match_link_text(&doc_view->document->links[current],
|
||||
buffer, bufferlen,
|
||||
get_opt_bool("document.browse"
|
||||
".search.case"));
|
||||
".search.case", NULL));
|
||||
|
||||
if (offset >= 0) {
|
||||
draw_typeahead_match(ses->tab->term, doc_view,
|
||||
|
@ -604,7 +604,8 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_,
|
||||
}
|
||||
|
||||
if (op == 0 && !textarea_editor) {
|
||||
unsigned char *ed = get_opt_str("document.browse.forms.editor");
|
||||
unsigned char *ed = get_opt_str("document.browse.forms.editor",
|
||||
NULL);
|
||||
unsigned char *ex;
|
||||
|
||||
fn = save_textarea_file(fs_->value);
|
||||
|
@ -181,7 +181,7 @@ move_link(struct session *ses, struct document_view *doc_view, int direction,
|
||||
} else {
|
||||
/* We only bother this option if there's some links
|
||||
* in document. */
|
||||
wraparound = get_opt_bool("document.browse.links.wraparound");
|
||||
wraparound = get_opt_bool("document.browse.links.wraparound", NULL);
|
||||
}
|
||||
|
||||
count = eat_kbd_repeat_count(ses);
|
||||
@ -309,7 +309,7 @@ horizontal_scroll(struct session *ses, struct document_view *doc_view, int steps
|
||||
|
||||
x = doc_view->vs->x + steps;
|
||||
|
||||
if (get_opt_bool("document.browse.scrolling.horizontal_extended")) {
|
||||
if (get_opt_bool("document.browse.scrolling.horizontal_extended", NULL)) {
|
||||
max = doc_view->document->width - 1;
|
||||
} else {
|
||||
max = int_max(doc_view->vs->x,
|
||||
@ -335,7 +335,7 @@ scroll_up(struct session *ses, struct document_view *doc_view)
|
||||
int steps = eat_kbd_repeat_count(ses);
|
||||
|
||||
if (!steps)
|
||||
steps = get_opt_int("document.browse.scrolling.vertical_step");
|
||||
steps = get_opt_int("document.browse.scrolling.vertical_step", NULL);
|
||||
|
||||
return vertical_scroll(ses, doc_view, -steps);
|
||||
}
|
||||
@ -346,7 +346,7 @@ scroll_down(struct session *ses, struct document_view *doc_view)
|
||||
int steps = eat_kbd_repeat_count(ses);
|
||||
|
||||
if (!steps)
|
||||
steps = get_opt_int("document.browse.scrolling.vertical_step");
|
||||
steps = get_opt_int("document.browse.scrolling.vertical_step", NULL);
|
||||
|
||||
return vertical_scroll(ses, doc_view, steps);
|
||||
}
|
||||
@ -357,7 +357,7 @@ scroll_left(struct session *ses, struct document_view *doc_view)
|
||||
int steps = eat_kbd_repeat_count(ses);
|
||||
|
||||
if (!steps)
|
||||
steps = get_opt_int("document.browse.scrolling.horizontal_step");
|
||||
steps = get_opt_int("document.browse.scrolling.horizontal_step", NULL);
|
||||
|
||||
return horizontal_scroll(ses, doc_view, -steps);
|
||||
}
|
||||
@ -368,7 +368,7 @@ scroll_right(struct session *ses, struct document_view *doc_view)
|
||||
int steps = eat_kbd_repeat_count(ses);
|
||||
|
||||
if (!steps)
|
||||
steps = get_opt_int("document.browse.scrolling.horizontal_step");
|
||||
steps = get_opt_int("document.browse.scrolling.horizontal_step", NULL);
|
||||
|
||||
return horizontal_scroll(ses, doc_view, steps);
|
||||
}
|
||||
@ -377,7 +377,7 @@ scroll_right(struct session *ses, struct document_view *doc_view)
|
||||
static enum frame_event_status
|
||||
scroll_mouse_up(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
int steps = get_opt_int("document.browse.scrolling.vertical_step");
|
||||
int steps = get_opt_int("document.browse.scrolling.vertical_step", NULL);
|
||||
|
||||
return vertical_scroll(ses, doc_view, -steps);
|
||||
}
|
||||
@ -385,7 +385,7 @@ scroll_mouse_up(struct session *ses, struct document_view *doc_view)
|
||||
static enum frame_event_status
|
||||
scroll_mouse_down(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
int steps = get_opt_int("document.browse.scrolling.vertical_step");
|
||||
int steps = get_opt_int("document.browse.scrolling.vertical_step", NULL);
|
||||
|
||||
return vertical_scroll(ses, doc_view, steps);
|
||||
}
|
||||
@ -393,7 +393,7 @@ scroll_mouse_down(struct session *ses, struct document_view *doc_view)
|
||||
static enum frame_event_status
|
||||
scroll_mouse_left(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
int steps = get_opt_int("document.browse.scrolling.horizontal_step");
|
||||
int steps = get_opt_int("document.browse.scrolling.horizontal_step", NULL);
|
||||
|
||||
return horizontal_scroll(ses, doc_view, -steps);
|
||||
}
|
||||
@ -401,7 +401,7 @@ scroll_mouse_left(struct session *ses, struct document_view *doc_view)
|
||||
static enum frame_event_status
|
||||
scroll_mouse_right(struct session *ses, struct document_view *doc_view)
|
||||
{
|
||||
int steps = get_opt_int("document.browse.scrolling.horizontal_step");
|
||||
int steps = get_opt_int("document.browse.scrolling.horizontal_step", NULL);
|
||||
|
||||
return horizontal_scroll(ses, doc_view, steps);
|
||||
}
|
||||
@ -808,7 +808,7 @@ frame_ev_kbd(struct session *ses, struct document_view *doc_view, struct term_ev
|
||||
if (status != FRAME_EVENT_IGNORED)
|
||||
return status;
|
||||
#endif
|
||||
accesskey_priority = get_opt_int("document.browse.accesskey.priority");
|
||||
accesskey_priority = get_opt_int("document.browse.accesskey.priority", NULL);
|
||||
|
||||
if (accesskey_priority >= 2) {
|
||||
status = try_document_key(ses, doc_view, ev);
|
||||
@ -886,7 +886,7 @@ frame_ev_mouse(struct session *ses, struct document_view *doc_view, struct term_
|
||||
if (check_mouse_button(ev, B_LEFT)) {
|
||||
/* Clicking the edge of screen will scroll the document. */
|
||||
|
||||
int scrollmargin = get_opt_int("document.browse.scrolling.margin");
|
||||
int scrollmargin = get_opt_int("document.browse.scrolling.margin", NULL);
|
||||
|
||||
/* XXX: This is code duplication with kbd handlers. But
|
||||
* repeatcount-free here. */
|
||||
@ -1118,7 +1118,7 @@ static void
|
||||
try_typeahead(struct session *ses, struct document_view *doc_view,
|
||||
struct term_event *ev, enum main_action action_id)
|
||||
{
|
||||
switch (get_opt_int("document.browse.search.typeahead")) {
|
||||
switch (get_opt_int("document.browse.search.typeahead", NULL)) {
|
||||
case 0:
|
||||
return;
|
||||
case 1:
|
||||
@ -1195,7 +1195,7 @@ quit:
|
||||
|
||||
if (doc_view
|
||||
&& get_opt_int("document.browse.accesskey"
|
||||
".priority") <= 0
|
||||
".priority", NULL) <= 0
|
||||
&& try_document_key(ses, doc_view, ev)
|
||||
== FRAME_EVENT_REFRESH) {
|
||||
/* The document ate the key! */
|
||||
|
@ -45,7 +45,8 @@ count_down(void *xxx)
|
||||
}
|
||||
/* The expired timer ID has now been erased. */
|
||||
|
||||
keybinding = kbd_nm_lookup(KEYMAP_MAIN, get_opt_str("ui.timer.action"));
|
||||
keybinding = kbd_nm_lookup(KEYMAP_MAIN,
|
||||
get_opt_str("ui.timer.action", NULL));
|
||||
if (keybinding) {
|
||||
struct terminal *terminal;
|
||||
struct term_event ev;
|
||||
@ -66,9 +67,9 @@ reset_timer(void)
|
||||
{
|
||||
kill_timer(&countdown);
|
||||
|
||||
if (!get_opt_int("ui.timer.enable")) return;
|
||||
if (!get_opt_int("ui.timer.enable", NULL)) return;
|
||||
|
||||
timer_duration = get_opt_int("ui.timer.duration");
|
||||
timer_duration = get_opt_int("ui.timer.duration", NULL);
|
||||
install_timer(&countdown, COUNT_DOWN_DELAY, count_down, NULL);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user