1
0
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:
Miciah Dashiel Butler Masters 2007-08-28 16:41:18 +00:00 committed by Miciah Dashiel Butler Masters
parent 3975d28bce
commit ea372bd0cd
89 changed files with 425 additions and 375 deletions

View File

@ -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 hk_pos = widget_data->widget->info.button.hotkey_pos;
int attr; 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; ? SCREEN_ATTR_UNDERLINE : 0;
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8

View File

@ -297,7 +297,7 @@ select_button_by_key(struct dialog_data *dlg_data)
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
key = unicode_fold_label_case(get_kbd_key(ev)); 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 #else
key = toupper(get_kbd_key(ev)); key = toupper(get_kbd_key(ev));
#endif #endif
@ -659,7 +659,7 @@ draw_dialog(struct dialog_data *dlg_data, int width, int height)
draw_box(term, &dlg_data->box, ' ', 0, draw_box(term, &dlg_data->box, ' ', 0,
get_bfu_color(term, "dialog.generic")); 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 */
draw_shadow(term, &dlg_data->box, draw_shadow(term, &dlg_data->box,
get_bfu_color(term, "dialog.shadow"), 2, 1); get_bfu_color(term, "dialog.shadow"), 2, 1);

View File

@ -939,7 +939,8 @@ search_hierbox_browser(void *data, unsigned char *text)
scan_for_matches, context); scan_for_matches, context);
if (!context->item && *text) { 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: case 2:
info_box(term, MSGBOX_FREE_TEXT, info_box(term, MSGBOX_FREE_TEXT,
N_("Search"), ALIGN_CENTER, N_("Search"), ALIGN_CENTER,

View File

@ -127,7 +127,7 @@ check_hotkeys_common(struct menu *menu, term_event_char_T hotkey, struct termina
{ {
#ifdef CONFIG_UTF8 #ifdef CONFIG_UTF8
unicode_val_T key = unicode_fold_label_case(hotkey); 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 #else
unsigned char key = toupper(hotkey); unsigned char key = toupper(hotkey);
#endif #endif

View File

@ -692,7 +692,8 @@ kbd_field(struct dialog_data *dlg_data, struct widget_data *widget_data)
* is in the terminal's charset. */ * is in the terminal's charset. */
ins = u2cp_no_nbsp(get_kbd_key(ev), ins = u2cp_no_nbsp(get_kbd_key(ev),
get_opt_codepage_tree(term->spec, get_opt_codepage_tree(term->spec,
"charset")); "charset",
NULL));
inslen = strlen(ins); inslen = strlen(ins);
#endif /* CONFIG_UTF8 */ #endif /* CONFIG_UTF8 */

View File

@ -193,7 +193,7 @@ draw_leds(struct session *ses)
/* This should be done elsewhere, but this is very nice place where we /* This should be done elsewhere, but this is very nice place where we
* could do that easily. */ * 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"); led_color = get_bfu_color(term, "status.status-text");
if (!led_color) goto end; if (!led_color) goto end;
@ -276,7 +276,7 @@ redraw_leds(void *xxx)
struct session *ses; struct session *ses;
if (!get_leds_panel_enable() 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; redraw_timer = TIMER_ID_UNDEF;
return; return;
} }

View File

@ -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. */ /* This is only weird heuristic, it could scale well I hope. */
optimal_h = max_height * 7 / 10 - VERTICAL_LISTBOX_MARGIN; 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) { if (max_height - VERTICAL_LISTBOX_MARGIN < min) {
/* Big trouble: can't satisfy even the minimum :-(. */ /* Big trouble: can't satisfy even the minimum :-(. */

View File

@ -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 = get_bfu_color(term, "menu.hotkey.normal");
struct color_pair *hk_color_sel = get_bfu_color(term, "menu.hotkey.selected"); 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; ? SCREEN_ATTR_UNDERLINE : 0;
unsigned char c; unsigned char c;
int xbase = x + L_TEXT_SPACE; 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_box(term, &box, ' ', 0, normal_color);
draw_border(term, &box, frame_color, 1); 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 */
draw_shadow(term, &menu->box, draw_shadow(term, &menu->box,
get_bfu_color(term, "dialog.shadow"), 2, 1); get_bfu_color(term, "dialog.shadow"), 2, 1);

View File

@ -38,7 +38,7 @@ get_bfu_color(struct terminal *term, unsigned char *stylename)
if (!term) return NULL; 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) { if (!bfu_colors) {
/* Initialize the style hash. */ /* Initialize the style hash. */
@ -86,8 +86,8 @@ get_bfu_color(struct terminal *term, unsigned char *stylename)
return NULL; return NULL;
} }
entry->foreground = &get_opt_color_tree(opt, "text"); entry->foreground = &get_opt_color_tree(opt, "text", NULL);
entry->background = &get_opt_color_tree(opt, "background"); entry->background = &get_opt_color_tree(opt, "background", NULL);
} }
/* Always update the color pair. */ /* Always update the color pair. */

View File

@ -45,7 +45,7 @@ static int loaded_backend_num = -1;
void void
bookmarks_read(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]; struct bookmarks_backend *backend = bookmarks_backends[backend_num];
unsigned char *file_name; unsigned char *file_name;
FILE *f; FILE *f;
@ -76,7 +76,7 @@ bookmarks_read(void)
void void
bookmarks_write(LIST_OF(struct bookmark) *bookmarks_list) 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 bookmarks_backend *backend = bookmarks_backends[backend_num];
struct secure_save_info *ssi; struct secure_save_info *ssi;
unsigned char *file_name; unsigned char *file_name;

View File

@ -130,7 +130,7 @@ static void
write_bookmarks_default(struct secure_save_info *ssi, write_bookmarks_default(struct secure_save_info *ssi,
LIST_OF(struct bookmark) *bookmarks_list) 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; struct bookmark *bm;
foreach (bm, *bookmarks_list) { foreach (bm, *bookmarks_list) {

View File

@ -136,7 +136,7 @@ static void
write_bookmarks_xbel(struct secure_save_info *ssi, write_bookmarks_xbel(struct secure_save_info *ssi,
LIST_OF(struct bookmarks) *bookmarks_list) 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(). */ /* We check for readok in filename_bookmarks_xbel(). */
secure_fputs(ssi, secure_fputs(ssi,

View File

@ -109,7 +109,7 @@ static void bookmark_snapshot();
static enum evhook_status static enum evhook_status
bookmark_write_hook(va_list ap, void *data) 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")) && !get_cmd_opt_bool("anonymous"))
bookmark_snapshot(); bookmark_snapshot();
@ -534,10 +534,10 @@ bookmark_auto_save_tabs(struct terminal *term)
unsigned char *foldername; unsigned char *foldername;
if (get_cmd_opt_bool("anonymous") if (get_cmd_opt_bool("anonymous")
|| !get_opt_bool("ui.sessions.auto_save")) || !get_opt_bool("ui.sessions.auto_save", NULL))
return; return;
foldername = get_opt_str("ui.sessions.auto_save_foldername"); foldername = get_opt_str("ui.sessions.auto_save_foldername", NULL);
if (!*foldername) return; if (!*foldername) return;
/* Ensure uniqueness of the auto save folder, so it is possible to /* Ensure uniqueness of the auto save folder, so it is possible to
@ -559,7 +559,8 @@ bookmark_snapshot(void)
#ifdef HAVE_STRFTIME #ifdef HAVE_STRFTIME
add_to_string(&folderstring, " - "); 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 #endif
folder = add_bookmark(NULL, 1, folderstring.source, NULL); folder = add_bookmark(NULL, 1, folderstring.source, NULL);

View File

@ -698,7 +698,7 @@ bookmark_terminal_tabs_dialog(struct terminal *term)
#ifdef HAVE_STRFTIME #ifdef HAVE_STRFTIME
add_to_string(&string, " - "); 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 #endif
input_dialog(term, NULL, input_dialog(term, NULL,

10
src/cache/cache.c vendored
View File

@ -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. * remove the redirect or the entry expired. Please enlighten me.
* --jonas */ * --jonas */
if ((cached->cache_mode == CACHE_MODE_NEVER && cache_mode != CACHE_MODE_ALWAYS) 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))) { || (cached->expire && cache_entry_has_expired(cached))) {
if (!is_object_used(cached)) delete_cache_entry(cached); if (!is_object_used(cached)) delete_cache_entry(cached);
return NULL; 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 if (cached->cache_mode <= CACHE_MODE_CHECK_IF_MODIFIED
&& cache_mode <= CACHE_MODE_CHECK_IF_MODIFIED && cache_mode <= CACHE_MODE_CHECK_IF_MODIFIED
&& (cached->last_modified || cached->etag) && (cached->last_modified || cached->etag)
&& get_opt_int("document.cache.revalidation_interval") >= 0) { && get_opt_int("document.cache.revalidation_interval", NULL) >= 0) {
if (cached->seconds + get_opt_int("document.cache.revalidation_interval") < time(NULL)) if (cached->seconds + get_opt_int("document.cache.revalidation_interval", NULL) < time(NULL))
return NULL; return NULL;
} }
@ -753,7 +753,7 @@ garbage_collection(int whole)
/* The maximal cache size tolerated by user. Note that this is only /* The maximal cache size tolerated by user. Note that this is only
* size of the "just stored" unused cache entries, used cache entries * size of the "just stored" unused cache entries, used cache entries
* are not counted to that. */ * 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 /* 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 * 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 * 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, " DBG("garbage collection doesn't work, cache size %ld > %ld, "
"document.cache.memory.size set to: %ld bytes", "document.cache.memory.size set to: %ld bytes",
cache_size, gc_cache_size, cache_size, gc_cache_size,
get_opt_long("document.cache.memory.size")); get_opt_long("document.cache.memory.size", NULL));
} }
#endif #endif
} }

2
src/cache/dialogs.c vendored
View File

@ -123,7 +123,7 @@ get_cache_entry_info(struct listbox_item *item, struct terminal *term)
time_t expires = timeval_to_seconds(&cached->max_age); time_t expires = timeval_to_seconds(&cached->max_age);
add_format_to_string(&msg, "\n%s: ", _("Expires", term)); 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 #endif
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG

View File

@ -144,7 +144,7 @@ eval_cmd(struct option *o, unsigned char ***argv, int *argc)
static unsigned char * static unsigned char *
forcehtml_cmd(struct option *o, unsigned char ***argv, int *argc) 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; return NULL;
} }
@ -685,7 +685,7 @@ printconfigdump_cmd(struct option *option, unsigned char ***argv, int *argc)
unsigned char *config_string; unsigned char *config_string;
/* Print all. */ /* Print all. */
get_opt_int("config.saving_style") = 2; get_opt_int("config.saving_style", NULL) = 2;
config_string = create_config_string("", "", config_options); config_string = create_config_string("", "", config_options);
if (config_string) { if (config_string) {

View File

@ -692,8 +692,8 @@ create_config_string(unsigned char *prefix, unsigned char *name,
/* Don't write headers if nothing will be added anyway. */ /* Don't write headers if nothing will be added anyway. */
struct string tmpstring; struct string tmpstring;
int origlen; int origlen;
int savestyle = get_opt_int("config.saving_style"); int savestyle = get_opt_int("config.saving_style", NULL);
int i18n = get_opt_bool("config.i18n"); int i18n = get_opt_bool("config.i18n", NULL);
if (!init_string(&config)) return 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; if (savestyle == 0) goto get_me_out;
indentation = get_opt_int("config.indentation"); indentation = get_opt_int("config.indentation", NULL);
comments = get_opt_int("config.comments"); comments = get_opt_int("config.comments", NULL);
if (!init_string(&tmpstring)) goto get_me_out; if (!init_string(&tmpstring)) goto get_me_out;

View File

@ -34,7 +34,7 @@
static void static void
disable_success_msgbox(void *dummy) 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")); 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; unsigned char *strerr;
if (secsave_error == SS_ERR_NONE && !stdio_error) { 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, msg_box(term, NULL, MSGBOX_FREE_TEXT,
N_("Write config success"), ALIGN_CENTER, N_("Write config success"), ALIGN_CENTER,

View File

@ -248,9 +248,17 @@ get_opt_(
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
unsigned char *file, int line, enum option_type option_type, unsigned char *file, int line, enum option_type option_type,
#endif #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 #ifdef CONFIG_DEBUG
errfile = file; errfile = file;
@ -397,7 +405,7 @@ add_opt_rec(struct option *tree, unsigned char *path, struct option *option)
object_nolock(option, "option"); object_nolock(option, "option");
if (option->box_item && option->name && !strcmp(option->name, "_template_")) 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) { if (tree->flags & OPT_AUTOCREATE && !option->desc) {
struct option *template = get_opt_rec(tree, "_template_"); struct option *template = get_opt_rec(tree, "_template_");
@ -656,25 +664,25 @@ static inline void
register_autocreated_options(void) register_autocreated_options(void)
{ {
/* TODO: Use table-driven initialization. --jonas */ /* TODO: Use table-driven initialization. --jonas */
get_opt_int("terminal.linux.type") = 2; get_opt_int("terminal.linux.type", NULL) = 2;
get_opt_int("terminal.linux.colors") = 1; get_opt_int("terminal.linux.colors", NULL) = 1;
get_opt_bool("terminal.linux.m11_hack") = 1; get_opt_bool("terminal.linux.m11_hack", NULL) = 1;
get_opt_int("terminal.vt100.type") = 1; get_opt_int("terminal.vt100.type", NULL) = 1;
get_opt_int("terminal.vt110.type") = 1; get_opt_int("terminal.vt110.type", NULL) = 1;
get_opt_int("terminal.xterm.type") = 1; get_opt_int("terminal.xterm.type", NULL) = 1;
get_opt_bool("terminal.xterm.underline") = 1; get_opt_bool("terminal.xterm.underline", NULL) = 1;
get_opt_int("terminal.xterm-color.type") = 1; get_opt_int("terminal.xterm-color.type", NULL) = 1;
get_opt_int("terminal.xterm-color.colors") = COLOR_MODE_16; get_opt_int("terminal.xterm-color.colors", NULL) = COLOR_MODE_16;
get_opt_bool("terminal.xterm-color.underline") = 1; get_opt_bool("terminal.xterm-color.underline", NULL) = 1;
#ifdef CONFIG_88_COLORS #ifdef CONFIG_88_COLORS
get_opt_int("terminal.xterm-88color.type") = 1; get_opt_int("terminal.xterm-88color.type", NULL) = 1;
get_opt_int("terminal.xterm-88color.colors") = COLOR_MODE_88; get_opt_int("terminal.xterm-88color.colors", NULL) = COLOR_MODE_88;
get_opt_bool("terminal.xterm-88color.underline") = 1; get_opt_bool("terminal.xterm-88color.underline", NULL) = 1;
#endif #endif
#ifdef CONFIG_256_COLORS #ifdef CONFIG_256_COLORS
get_opt_int("terminal.xterm-256color.type") = 1; get_opt_int("terminal.xterm-256color.type", NULL) = 1;
get_opt_int("terminal.xterm-256color.colors") = COLOR_MODE_256; get_opt_int("terminal.xterm-256color.colors", NULL) = COLOR_MODE_256;
get_opt_bool("terminal.xterm-256color.underline") = 1; get_opt_bool("terminal.xterm-256color.underline", NULL) = 1;
#endif #endif
} }
@ -945,7 +953,7 @@ void
update_options_visibility(void) update_options_visibility(void)
{ {
update_visibility(config_options->value.tree, update_visibility(config_options->value.tree,
get_opt_bool("config.show_template")); get_opt_bool("config.show_template", NULL));
} }
void void

View File

@ -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 /* 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() 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(struct option *, const unsigned char *);
extern struct option *get_opt_rec_real(struct option *, const unsigned char *); extern struct option *get_opt_rec_real(struct option *, const unsigned char *);
#ifdef CONFIG_DEBUG #ifdef CONFIG_DEBUG
extern union option_value *get_opt_(unsigned char *, int, enum option_type, struct option *, unsigned char *); extern union option_value *get_opt_(unsigned char *, int, enum option_type, struct option *, unsigned char *, struct session *);
#define get_opt(tree, name, type) get_opt_(__FILE__, __LINE__, type, tree, name) #define get_opt(tree, name, ses, type) get_opt_(__FILE__, __LINE__, type, tree, name, ses)
#else #else
extern union option_value *get_opt_(struct option *, unsigned char *); extern union option_value *get_opt_(struct option *, unsigned char *, struct session *);
#define get_opt(tree, name, type) get_opt_(tree, name) #define get_opt(tree, name, ses, type) get_opt_(tree, name, ses)
#endif #endif
#define get_opt_bool_tree(tree, name) get_opt(tree, name, OPT_BOOL)->number #define get_opt_bool_tree(tree, name, ses) get_opt(tree, name, ses, OPT_BOOL)->number
#define get_opt_int_tree(tree, name) get_opt(tree, name, OPT_INT)->number #define get_opt_int_tree(tree, name, ses) get_opt(tree, name, ses, OPT_INT)->number
#define get_opt_long_tree(tree, name) get_opt(tree, name, OPT_LONG)->big_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) get_opt(tree, name, OPT_STRING)->string #define get_opt_str_tree(tree, name, ses) get_opt(tree, name, ses, OPT_STRING)->string
#define get_opt_codepage_tree(tree, name) get_opt(tree, name, OPT_CODEPAGE)->number #define get_opt_codepage_tree(tree, name, ses) get_opt(tree, name, ses, OPT_CODEPAGE)->number
#define get_opt_color_tree(tree, name) get_opt(tree, name, OPT_COLOR)->color #define get_opt_color_tree(tree, name, ses) get_opt(tree, name, ses, OPT_COLOR)->color
#define get_opt_tree_tree(tree_, name) get_opt(tree_, name, OPT_TREE)->tree #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_bool(name, ses) get_opt_bool_tree(config_options, name, ses)
#define get_opt_int(name) get_opt_int_tree(config_options, name) #define get_opt_int(name, ses) get_opt_int_tree(config_options, name, ses)
#define get_opt_long(name) get_opt_long_tree(config_options, name) #define get_opt_long(name, ses) get_opt_long_tree(config_options, name, ses)
#define get_opt_str(name) get_opt_str_tree(config_options, name) #define get_opt_str(name, ses) get_opt_str_tree(config_options, name, ses)
#define get_opt_codepage(name) get_opt_codepage_tree(config_options, name) #define get_opt_codepage(name, ses) get_opt_codepage_tree(config_options, name, ses)
#define get_opt_color(name) get_opt_color_tree(config_options, name) #define get_opt_color(name, ses) get_opt_color_tree(config_options, name, ses)
#define get_opt_tree(name) get_opt_tree_tree(config_options, name) #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_bool(name) get_opt_bool_tree(cmdline_options, name, NULL)
#define get_cmd_opt_int(name) get_opt_int_tree(cmdline_options, name) #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) #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) #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) #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) #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) #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 *, extern struct option *add_opt(struct option *, unsigned char *, unsigned char *,
unsigned char *, enum option_flags, enum option_type, unsigned char *, enum option_flags, enum option_type,

View File

@ -381,12 +381,13 @@ tree_dup(struct option *opt, struct option *template)
if (!new_opt) continue; if (!new_opt) continue;
object_nolock(new_opt, "option"); object_nolock(new_opt, "option");
add_to_list_end(*new, new_opt); add_to_list_end(*new, new_opt);
object_lock(new_opt);
new_opt->root = opt; new_opt->root = opt;
if (!new_opt->box_item) continue; if (!new_opt->box_item) continue;
if (new_opt->name && !strcmp(new_opt->name, "_template_")) 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) { if (opt->box_item) {
add_to_list(opt->box_item->child, add_to_list(opt->box_item->child,

View File

@ -34,7 +34,7 @@ periodic_save_handler(void *xxx)
else else
trigger_event(periodic_save_event_id); 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) { if (!interval) {
/* We should get here only if @periodic_save_handler /* We should get here only if @periodic_save_handler
* is being called from @periodic_save_change_hook or * is being called from @periodic_save_change_hook or

View File

@ -42,7 +42,7 @@ add_cookie_info_to_string(struct string *string, struct cookie *cookie,
#ifdef HAVE_STRFTIME #ifdef HAVE_STRFTIME
} else { } else {
add_format_to_string(string, "\n%s: ", _("Expires", term)); 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 #endif
} }

View File

@ -578,7 +578,7 @@ query_file(struct session *ses, struct uri *uri, void *data,
if (!init_string(&def)) return; 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])) if (def.length && !dir_sep(def.source[def.length - 1]))
add_char_to_string(&def, '/'); 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, pass_uri_to_command(struct session *ses, struct document_view *doc_view,
int which_type) 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; enum pass_uri_type type = which_type;
struct menu_item *items; struct menu_item *items;
struct option *option; struct option *option;
@ -887,7 +888,8 @@ void
add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type, add_uri_command_to_menu(struct menu_item **mi, enum pass_uri_type type,
unsigned char *text) 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; struct option *option;
int commands = 0; int commands = 0;
enum menu_item_flags flags = NO_FLAG; enum menu_item_flags flags = NO_FLAG;

View File

@ -50,7 +50,7 @@ charset_list(struct terminal *term, void *xxx, void *ses_)
int i, items; int i, items;
int sel = 0; int sel = 0;
const unsigned char *const sel_mime = get_cp_mime_name( 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); struct menu_item *mi = new_menu(FREE_LIST);
if (!mi) return; if (!mi) return;

View File

@ -64,15 +64,16 @@ get_download_msg(struct download *download, struct terminal *term,
void void
update_status(void) update_status(void)
{ {
int show_title_bar = get_opt_bool("ui.show_title_bar"); int show_title_bar = get_opt_bool("ui.show_title_bar", NULL);
int show_status_bar = get_opt_bool("ui.show_status_bar"); int show_status_bar = get_opt_bool("ui.show_status_bar", NULL);
int show_tabs_bar = get_opt_int("ui.tabs.show_bar"); int show_tabs_bar = get_opt_int("ui.tabs.show_bar", NULL);
int show_tabs_bar_at_top = get_opt_bool("ui.tabs.top"); int show_tabs_bar_at_top = get_opt_bool("ui.tabs.top", NULL);
#ifdef CONFIG_LEDS #ifdef CONFIG_LEDS
int show_leds = get_opt_bool("ui.leds.enable"); int show_leds = get_opt_bool("ui.leds.enable", NULL);
#endif #endif
int set_window_title = get_opt_bool("ui.window_title"); int set_window_title = get_opt_bool("ui.window_title", NULL);
int insert_mode = get_opt_bool("document.browse.forms.insert_mode"); int insert_mode = get_opt_bool("document.browse.forms.insert_mode",
NULL);
struct session *ses; struct session *ses;
int tabs_count = 1; int tabs_count = 1;
struct terminal *term = NULL; struct terminal *term = NULL;
@ -390,7 +391,7 @@ display_title_bar(struct session *ses, struct terminal *term)
int height; int height;
/* Clear the old title */ /* 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; struct box box;
set_box(&box, 0, 0, term->width, 1); set_box(&box, 0, 0, term->width, 1);

View File

@ -111,7 +111,7 @@ struct css_stylesheet default_stylesheet = INIT_CSS_STYLESHEET(default_styleshee
static void static void
import_default_css(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)) if (!css_selector_set_empty(&default_stylesheet.selectors))
done_css_stylesheet(&default_stylesheet); done_css_stylesheet(&default_stylesheet);

View File

@ -217,12 +217,12 @@ update_cached_document_options(void)
struct active_link_options active_link; struct active_link_options active_link;
memset(&active_link, 0, sizeof(active_link)); /* Safer. */ memset(&active_link, 0, sizeof(active_link)); /* Safer. */
active_link.fg = get_opt_color("document.browse.links.active_link.colors.text"); 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"); 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"); 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"); 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"); 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"); active_link.bold = get_opt_bool("document.browse.links.active_link.bold", NULL);
foreach (document, format_cache) { foreach (document, format_cache) {
copy_struct(&document->options.active_link, &active_link); copy_struct(&document->options.active_link, &active_link);
@ -263,7 +263,7 @@ void
shrink_format_cache(int whole) shrink_format_cache(int whole)
{ {
struct document *document, *next; 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; int format_cache_entries = 0;
foreachsafe (document, next, format_cache) { foreachsafe (document, next, format_cache) {

View File

@ -360,7 +360,7 @@ process_head(struct html_context *html_context, unsigned char *head)
mem_free(refresh); 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; unsigned char *d;
int no_cache = 0; int no_cache = 0;
time_t expires = 0; time_t expires = 0;

View File

@ -286,7 +286,7 @@ not_processed:
unsigned char *import_url; unsigned char *import_url;
struct uri *uri; struct uri *uri;
if (!get_opt_bool("ecmascript.enable")) { if (!get_opt_bool("ecmascript.enable", NULL)) {
mem_free(src); mem_free(src);
goto not_processed; 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 /* We shouldn't throw <noscript> away until our ECMAScript support is
* halfway decent. */ * halfway decent. */
#ifdef CONFIG_ECMASCRIPT #ifdef CONFIG_ECMASCRIPT
if (get_opt_bool("ecmascript.enable") if (get_opt_bool("ecmascript.enable", NULL)
&& get_opt_bool("ecmascript.ignore_noscript")) && get_opt_bool("ecmascript.ignore_noscript", NULL))
html_skip(html_context, a); html_skip(html_context, a);
#endif #endif
} }

View File

@ -22,73 +22,73 @@
void 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. */ /* Ensure that any padding bytes are cleared. */
memset(doo, 0, sizeof(*doo)); memset(doo, 0, sizeof(*doo));
doo->assume_cp = get_opt_codepage("document.codepage.assume"); doo->assume_cp = get_opt_codepage("document.codepage.assume", NULL);
doo->hard_assume = get_opt_bool("document.codepage.force_assumed"); doo->hard_assume = get_opt_bool("document.codepage.force_assumed", NULL);
doo->use_document_colors = get_opt_int("document.colors.use_document_colors"); doo->use_document_colors = get_opt_int("document.colors.use_document_colors", NULL);
doo->margin = get_opt_int("document.browse.margin_width"); doo->margin = get_opt_int("document.browse.margin_width", NULL);
doo->num_links_key = get_opt_int("document.browse.links.number_keys_select_link"); 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"); 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"); doo->default_form_input_size = get_opt_int("document.browse.forms.input_size", NULL);
/* Color options. */ /* Color options. */
doo->default_fg = get_opt_color("document.colors.text"); doo->default_fg = get_opt_color("document.colors.text", NULL);
doo->default_bg = get_opt_color("document.colors.background"); doo->default_bg = get_opt_color("document.colors.background", NULL);
doo->default_link = get_opt_color("document.colors.link"); doo->default_link = get_opt_color("document.colors.link", NULL);
doo->default_vlink = get_opt_color("document.colors.vlink"); doo->default_vlink = get_opt_color("document.colors.vlink", NULL);
#ifdef CONFIG_BOOKMARKS #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 #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.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"); 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; 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; doo->color_flags |= COLOR_ENSURE_CONTRAST;
/* Boolean options. */ /* Boolean options. */
#ifdef CONFIG_CSS #ifdef CONFIG_CSS
doo->css_enable = get_opt_bool("document.css.enable"); doo->css_enable = get_opt_bool("document.css.enable", NULL);
doo->css_import = get_opt_bool("document.css.import"); doo->css_import = get_opt_bool("document.css.import", NULL);
#endif #endif
doo->plain_display_links = get_opt_bool("document.plain.display_links"); 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"); doo->plain_compress_empty_lines = get_opt_bool("document.plain.compress_empty_lines", NULL);
doo->underline_links = get_opt_bool("document.html.underline_links"); doo->underline_links = get_opt_bool("document.html.underline_links", NULL);
doo->wrap_nbsp = get_opt_bool("document.html.wrap_nbsp"); doo->wrap_nbsp = get_opt_bool("document.html.wrap_nbsp", NULL);
doo->use_tabindex = get_opt_bool("document.browse.links.use_tabindex"); doo->use_tabindex = get_opt_bool("document.browse.links.use_tabindex", NULL);
doo->links_numbering = get_opt_bool("document.browse.links.numbering"); 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.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"); 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"); 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"); 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->table_order = get_opt_bool("document.browse.table_move_order", NULL);
doo->tables = get_opt_bool("document.html.display_tables"); doo->tables = get_opt_bool("document.html.display_tables", NULL);
doo->frames = get_opt_bool("document.html.display_frames"); doo->frames = get_opt_bool("document.html.display_frames", NULL);
doo->images = get_opt_bool("document.browse.images.show_as_links"); doo->images = get_opt_bool("document.browse.images.show_as_links", NULL);
doo->display_subs = get_opt_bool("document.html.display_subs"); doo->display_subs = get_opt_bool("document.html.display_subs", NULL);
doo->display_sups = get_opt_bool("document.html.display_sups"); doo->display_sups = get_opt_bool("document.html.display_sups", NULL);
doo->framename = ""; doo->framename = "";
doo->image_link.prefix = ""; doo->image_link.prefix = "";
doo->image_link.suffix = ""; doo->image_link.suffix = "";
doo->image_link.filename_maxlen = get_opt_int("document.browse.images.filename_maxlen"); 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"); 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"); 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"); 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"); doo->image_link.show_any_as_links = get_opt_bool("document.browse.images.show_any_as_links", NULL);
} }
int int
@ -109,8 +109,8 @@ copy_opt(struct document_options *o1, struct document_options *o2)
{ {
copy_struct(o1, o2); copy_struct(o1, o2);
o1->framename = stracpy(o2->framename); o1->framename = stracpy(o2->framename);
o1->image_link.prefix = stracpy(get_opt_str("document.browse.images.image_link_prefix")); 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")); o1->image_link.suffix = stracpy(get_opt_str("document.browse.images.image_link_suffix", NULL));
} }
void void

View File

@ -139,7 +139,7 @@ struct document_options {
/** Fills the structure with values from the option system. /** Fills the structure with values from the option system.
* @relates document_options */ * @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. /** Free allocated document options.
* @relates document_options */ * @relates document_options */

View File

@ -97,7 +97,7 @@ do_document_refresh(void *data)
void void
start_document_refresh(struct document_refresh *refresh, struct session *ses) 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 refresh_delay = sec_to_ms(refresh->seconds);
milliseconds_T time = ms_max(refresh_delay, minimum); milliseconds_T time = ms_max(refresh_delay, minimum);
struct type_query *type_query; struct type_query *type_query;

View File

@ -62,7 +62,8 @@ add_snippets(struct ecmascript_interpreter *interpreter,
unset_led_value(interpreter->vs->doc_view->session->status.ecmascript_led); unset_led_value(interpreter->vs->doc_view->session->status.ecmascript_led);
#endif #endif
if (list_empty(*doc_snippets) || !get_opt_bool("ecmascript.enable")) if (list_empty(*doc_snippets)
|| !get_opt_bool("ecmascript.enable", NULL))
return; return;
/* We do this all only once per view_state now. */ /* 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; 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, set_box(&doc_opts.box, 0, 0,
ses->tab->term->width, ses->tab->term->height); 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++; 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"); doc_opts.color_mode = get_opt_int_tree(ses->tab->term->spec, "colors",
if (!get_opt_bool_tree(ses->tab->term->spec, "underline")) NULL);
if (!get_opt_bool_tree(ses->tab->term->spec, "underline", NULL))
doc_opts.color_flags |= COLOR_ENHANCE_UNDERLINE; 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.no_cache = no_cache & 1;
doc_opts.gradual_rerendering = !!(no_cache & 2); doc_opts.gradual_rerendering = !!(no_cache & 2);

View File

@ -13,7 +13,7 @@ struct terminal;
struct uri; struct uri;
struct view_state; 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 ecmascript_interpreter {
struct view_state *vs; struct view_state *vs;

View File

@ -75,7 +75,7 @@ see_get_interpreter(struct ecmascript_interpreter *interpreter)
struct SEE_interpreter *interp = &g->interp; struct SEE_interpreter *interp = &g->interp;
interpreter->backend_data = g; 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); g->exec_start = time(NULL);
/* used by setTimeout */ /* used by setTimeout */
g->interpreter = interpreter; g->interpreter = interpreter;

View File

@ -112,13 +112,14 @@ document_get(struct SEE_interpreter *interp, struct SEE_object *o,
} else if (p == s_location) { } else if (p == s_location) {
SEE_OBJECT_GET(interp, interp->Global, s_location, res); SEE_OBJECT_GET(interp, interp->Global, s_location, res);
} else if (p == s_referrer) { } 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: case REFERER_NONE:
SEE_SET_UNDEFINED(res); SEE_SET_UNDEFINED(res);
break; break;
case REFERER_FAKE: case REFERER_FAKE:
str = string_to_SEE_string(interp, 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); SEE_SET_STRING(res, str);
break; break;
case REFERER_TRUE: case REFERER_TRUE:

View File

@ -79,7 +79,7 @@ navigator_get(struct SEE_interpreter *interp, struct SEE_object *o,
SEE_SET_STRING(res, str); SEE_SET_STRING(res, str);
} else if (p == s_language) { } else if (p == s_language) {
#ifdef CONFIG_NLS #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, str = string_to_SEE_string(interp,
language_to_iso639(current_language)); language_to_iso639(current_language));
SEE_SET_STRING(res, str); SEE_SET_STRING(res, str);
@ -90,7 +90,8 @@ navigator_get(struct SEE_interpreter *interp, struct SEE_object *o,
SEE_SET_STRING(res, str); SEE_SET_STRING(res, str);
} else if (p == s_userAgent) { } else if (p == s_userAgent) {
/* FIXME: Code duplication. */ /* 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, " ")) { if (*optstr && strcmp(optstr, " ")) {
unsigned char *ustr, ts[64] = ""; unsigned char *ustr, ts[64] = "";

View File

@ -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_check_class(interp, thisobj, &js_window_object_class);
SEE_SET_OBJECT(res, (struct SEE_object *)win); 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 #ifdef CONFIG_LEDS
set_led_value(ses->status.popup_led, 'P'); set_led_value(ses->status.popup_led, 'P');
#endif #endif

View File

@ -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'); set_led_value(interpreter->vs->doc_view->session->status.ecmascript_led, 'J');
#endif #endif
if (!get_opt_bool("ecmascript.error_reporting") if (!get_opt_bool("ecmascript.error_reporting", NULL)
|| !init_string(&msg)) || !init_string(&msg))
goto reported; goto reported;
@ -113,7 +113,7 @@ static JSBool
safeguard(JSContext *ctx, JSScript *script) safeguard(JSContext *ctx, JSScript *script)
{ {
struct ecmascript_interpreter *interpreter = JS_GetContextPrivate(ctx); 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) { if (time(NULL) - interpreter->exec_start > max_exec_time) {
struct terminal *term = interpreter->vs->doc_view->session->tab->term; struct terminal *term = interpreter->vs->doc_view->session->tab->term;

View File

@ -145,14 +145,14 @@ document_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
JS_GetProperty(ctx, parent_win, "location", vp); JS_GetProperty(ctx, parent_win, "location", vp);
break; break;
case JSP_DOC_REF: case JSP_DOC_REF:
switch (get_opt_int("protocol.http.referer.policy")) { switch (get_opt_int("protocol.http.referer.policy", NULL)) {
case REFERER_NONE: case REFERER_NONE:
/* oh well */ /* oh well */
undef_to_jsval(ctx, vp); undef_to_jsval(ctx, vp);
break; break;
case REFERER_FAKE: 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; break;
case REFERER_TRUE: case REFERER_TRUE:

View File

@ -102,7 +102,7 @@ navigator_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
break; break;
case JSP_NAVIGATOR_LANGUAGE: case JSP_NAVIGATOR_LANGUAGE:
#ifdef CONFIG_NLS #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)); string_to_jsval(ctx, vp, language_to_iso639(current_language));
#endif #endif
@ -113,7 +113,8 @@ navigator_get_property(JSContext *ctx, JSObject *obj, jsval id, jsval *vp)
case JSP_NAVIGATOR_USER_AGENT: case JSP_NAVIGATOR_USER_AGENT:
{ {
/* FIXME: Code duplication. */ /* 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, " ")) { if (*optstr && strcmp(optstr, " ")) {
unsigned char *ustr, ts[64] = ""; unsigned char *ustr, ts[64] = "";

View File

@ -353,7 +353,7 @@ window_open(JSContext *ctx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
doc_view = vs->doc_view; doc_view = vs->doc_view;
ses = doc_view->session; ses = doc_view->session;
if (get_opt_bool("ecmascript.block_window_opening")) { if (get_opt_bool("ecmascript.block_window_opening", NULL)) {
#ifdef CONFIG_LEDS #ifdef CONFIG_LEDS
set_led_value(ses->status.popup_led, 'P'); set_led_value(ses->status.popup_led, 'P');
#endif #endif

View File

@ -293,7 +293,7 @@ read_encoded_file(struct string *filename, struct string *page)
int fd = open(filename->source, O_RDONLY | O_NOCTTY); int fd = open(filename->source, O_RDONLY | O_NOCTTY);
enum connection_state state = -errno; 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); encoding = try_encoding_extensions(filename, &fd);
} else if (fd != -1) { } else if (fd != -1) {
@ -316,7 +316,7 @@ read_encoded_file(struct string *filename, struct string *page)
/* Leave @state being the saved errno */ /* Leave @state being the saved errno */
} else if (!S_ISREG(stt.st_mode) && !is_stdin_pipe(&stt, filename) } 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; state = S_FILE_TYPE;
} else if (!(stream = open_encoded(fd, encoding))) { } else if (!(stream = open_encoded(fd, encoding))) {

View File

@ -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 global_history_item *item = box_item->udata;
struct string info; struct string info;
if (get_opt_int("document.history.global.display_type") if (get_opt_int("document.history.global.display_type", NULL)
&& *item->title) && *item->title)
return stracpy(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; 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; *display_type = !*display_type;
update_hierbox_browser(&globhist_browser); update_hierbox_browser(&globhist_browser);

View File

@ -61,7 +61,7 @@ extern int current_charset;
static inline void static inline void
intl_set_charset(struct terminal *term) 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. */ /* Prevent useless switching. */
if (current_charset != new_charset) { if (current_charset != new_charset) {

View File

@ -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 /* Only start reading from stdin if no URL was given on the
* command line. */ * command line. */
if (url_list && list_empty(*url_list)) { 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); add_to_string_list(url_list, "file:///dev/stdin", 17);
} }
get_cmd_opt_bool("no-connect") = 1; 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 /* The ECMAScript code is not good at coping with this. And it
* makes currently no sense to evaluate ECMAScript in this * makes currently no sense to evaluate ECMAScript in this
* context anyway. */ * context anyway. */
get_opt_bool("ecmascript.enable") = 0; get_opt_bool("ecmascript.enable", NULL) = 0;
#endif #endif
if (!list_empty(url_list)) { if (!list_empty(url_list)) {
dump_next(&url_list); dump_next(&url_list);

View File

@ -198,11 +198,11 @@ get_mime_handler_default(unsigned char *type, int have_x)
handler_opt = get_mime_handler_option(type_opt, have_x); handler_opt = get_mime_handler_option(type_opt, have_x);
if (!handler_opt) return NULL; 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, type_opt->value.string,
default_mime_module.name, default_mime_module.name,
get_opt_bool_tree(handler_opt, "ask"), get_opt_bool_tree(handler_opt, "ask", NULL),
get_opt_bool_tree(handler_opt, "block")); get_opt_bool_tree(handler_opt, "block", NULL));
} }

View File

@ -90,7 +90,7 @@ add_mime_extension(void *data)
add_optname_to_string(&name, ext->ext, strlen(ext->ext)); add_optname_to_string(&name, ext->ext, strlen(ext->ext));
really_del_ext(ext->ext_orig); /* ..or rename ;) */ 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); done_string(&name);
} }
@ -146,7 +146,7 @@ void
menu_list_ext(struct terminal *term, void *fn_, void *xxx) menu_list_ext(struct terminal *term, void *fn_, void *xxx)
{ {
menu_func_T fn = fn_; 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 option *opt;
struct menu_item *mi = NULL; struct menu_item *mi = NULL;

View File

@ -759,7 +759,7 @@ abort_connection(struct connection *conn, enum connection_state state)
void void
retry_connection(struct connection *conn, enum connection_state state) 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), assertm(is_in_result_state(state),
"connection didn't end in result state (%d)", state); "connection didn't end in result state (%d)", state);
@ -813,8 +813,8 @@ static void
check_queue(void) check_queue(void)
{ {
struct connection *conn; struct connection *conn;
int max_conns_to_host = get_opt_int("connection.max_connections_to_host"); int max_conns_to_host = get_opt_int("connection.max_connections_to_host", NULL);
int max_conns = get_opt_int("connection.max_connections"); int max_conns = get_opt_int("connection.max_connections", NULL);
again: again:
conn = connection_queue.next; conn = connection_queue.next;
@ -1106,7 +1106,8 @@ detach_connection(struct download *download, off_t pos)
total_len = (conn->est_length == -1) ? conn->from total_len = (conn->est_length == -1) ? conn->from
: conn->est_length; : 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)) { * MAX_CACHED_OBJECT_PERCENT / 100)) {
/* This whole thing will fit to the memory anyway, so /* This whole thing will fit to the memory anyway, so
* there's no problem in detaching the connection. */ * there's no problem in detaching the connection. */
@ -1158,8 +1159,8 @@ connection_timeout_1(struct connection *conn)
{ {
install_timer(&conn->timer, (milliseconds_T) install_timer(&conn->timer, (milliseconds_T)
((conn->unrestartable ((conn->unrestartable
? get_opt_int("connection.unrestartable_receive_timeout") ? get_opt_int("connection.unrestartable_receive_timeout", NULL)
: get_opt_int("connection.receive_timeout")) : get_opt_int("connection.receive_timeout", NULL))
* 500), (void (*)(void *)) connection_timeout, conn); * 500), (void (*)(void *)) connection_timeout, conn);
/* The expired timer ID has now been erased. */ /* The expired timer ID has now been erased. */
} }
@ -1171,8 +1172,8 @@ set_connection_timeout(struct connection *conn)
install_timer(&conn->timer, (milliseconds_T) install_timer(&conn->timer, (milliseconds_T)
((conn->unrestartable ((conn->unrestartable
? get_opt_int("connection.unrestartable_receive_timeout") ? get_opt_int("connection.unrestartable_receive_timeout", NULL)
: get_opt_int("connection.receive_timeout")) : get_opt_int("connection.receive_timeout", NULL))
* 500), (void (*)(void *)) connection_timeout_1, conn); * 500), (void (*)(void *)) connection_timeout_1, conn);
} }

View File

@ -348,7 +348,7 @@ async_dns_error(struct dnsquery *query)
static int static int
init_async_dns_lookup(struct dnsquery *dnsquery, int force_async) 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; dnsquery->h = -1;
return 0; return 0;
} }

View File

@ -492,9 +492,9 @@ connect_socket(struct socket *csocket, enum connection_state state)
int saved_errno = 0; int saved_errno = 0;
int at_least_one_remote_ip = 0; int at_least_one_remote_ip = 0;
#ifdef CONFIG_IPV6 #ifdef CONFIG_IPV6
int try_ipv6 = get_opt_bool("connection.try_ipv6"); int try_ipv6 = get_opt_bool("connection.try_ipv6", NULL);
#endif #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 /* We tried something but we failed in such a way that we would rather
* prefer the connection to retain the information about previous * prefer the connection to retain the information about previous
* failures. That is, we i.e. decided we are forbidden to even think * failures. That is, we i.e. decided we are forbidden to even think

View File

@ -91,7 +91,7 @@ ssl_want_read(struct socket *socket)
switch (ssl_do_connect(socket)) { switch (ssl_do_connect(socket)) {
case SSL_ERROR_NONE: case SSL_ERROR_NONE:
#ifdef CONFIG_GNUTLS #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))) { && gnutls_certificate_verify_peers(*((ssl_t *) socket->ssl))) {
socket->ops->retry(socket, S_SSL_ERROR); socket->ops->retry(socket, S_SSL_ERROR);
return; return;
@ -129,15 +129,16 @@ ssl_connect(struct socket *socket)
#ifdef CONFIG_OPENSSL #ifdef CONFIG_OPENSSL
SSL_set_fd(socket->ssl, socket->fd); 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_set_verify(socket->ssl, SSL_VERIFY_PEER
| SSL_VERIFY_FAIL_IF_NO_PEER_CERT, | SSL_VERIFY_FAIL_IF_NO_PEER_CERT,
NULL); NULL);
if (get_opt_bool("connection.ssl.client_cert.enable")) { if (get_opt_bool("connection.ssl.client_cert.enable", NULL)) {
unsigned char *client_cert; 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) { if (!*client_cert) {
client_cert = getenv("X509_CLIENT_CERT"); client_cert = getenv("X509_CLIENT_CERT");
if (client_cert && !*client_cert) if (client_cert && !*client_cert)
@ -172,7 +173,7 @@ ssl_connect(struct socket *socket)
case SSL_ERROR_NONE: case SSL_ERROR_NONE:
#ifdef CONFIG_GNUTLS #ifdef CONFIG_GNUTLS
if (!get_opt_bool("connection.ssl.cert_verify")) if (!get_opt_bool("connection.ssl.cert_verify", NULL))
break; break;
if (!gnutls_certificate_verify_peers(*((ssl_t *) socket->ssl))) if (!gnutls_certificate_verify_peers(*((ssl_t *) socket->ssl)))

View File

@ -216,14 +216,14 @@ uint32_t
get_bittorrent_peerwire_max_message_length(void) get_bittorrent_peerwire_max_message_length(void)
{ {
return get_opt_int_tree(&bittorrent_protocol_options[0].option, return get_opt_int_tree(&bittorrent_protocol_options[0].option,
"peerwire.max_message_length"); "peerwire.max_message_length", NULL);
} }
uint32_t uint32_t
get_bittorrent_peerwire_max_request_length(void) get_bittorrent_peerwire_max_request_length(void)
{ {
return get_opt_int_tree(&bittorrent_protocol_options[0].option, return get_opt_int_tree(&bittorrent_protocol_options[0].option,
"peerwire.max_request_length"); "peerwire.max_request_length", NULL);
} }

View File

@ -42,7 +42,7 @@ static void
set_bittorrent_connection_timer(struct connection *conn) set_bittorrent_connection_timer(struct connection *conn)
{ {
struct bittorrent_connection *bittorrent = conn->info; 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, install_timer(&bittorrent->timer, interval,
(void (*)(void *)) update_bittorrent_connection_state, (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_connection *bittorrent = conn->info;
struct bittorrent_peer_connection *peer, *next_peer; struct bittorrent_peer_connection *peer, *next_peer;
int peer_conns, max_peer_conns; int peer_conns, max_peer_conns;
int min_uploads = get_opt_int("protocol.bittorrent.min_uploads"); int min_uploads = get_opt_int("protocol.bittorrent.min_uploads", NULL);
int max_uploads = get_opt_int("protocol.bittorrent.max_uploads"); int max_uploads = get_opt_int("protocol.bittorrent.max_uploads", NULL);
set_bittorrent_connection_timer(conn); set_bittorrent_connection_timer(conn);
/* The expired timer ID has now been erased. */ /* The expired timer ID has now been erased. */
set_connection_timeout(conn); set_connection_timeout(conn);
peer_conns = list_size(&bittorrent->peers); 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. */ /* First ``age'' the peer rates _before_ the sorting. */
foreach (peer, bittorrent->peers) foreach (peer, bittorrent->peers)
@ -168,7 +168,7 @@ update_bittorrent_connection_state(struct connection *conn)
/* Shrink the peer pool. */ /* Shrink the peer pool. */
if (!list_empty(bittorrent->peers)) { if (!list_empty(bittorrent->peers)) {
struct bittorrent_peer *peer_info, *next_peer_info; 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; int pool_peers = 0;
foreachsafe (peer_info, next_peer_info, bittorrent->peer_pool) { foreachsafe (peer_info, next_peer_info, bittorrent->peer_pool) {

View File

@ -150,7 +150,7 @@ add_bittorrent_meta_to_string(struct string *msg, struct bittorrent_meta *meta,
add_format_to_string(msg, "\n%s: ", add_format_to_string(msg, "\n%s: ",
_("Creation date", term)); _("Creation date", term));
add_date_to_string(msg, add_date_to_string(msg,
get_opt_str("ui.date_format"), get_opt_str("ui.date_format", NULL),
&meta->creation_date); &meta->creation_date);
} }
#endif #endif

View File

@ -72,7 +72,7 @@ check_bittorrent_peer_blacklisting(struct bittorrent_peer_connection *peer,
enum bittorrent_blacklist_flags flags = BITTORRENT_BLACKLIST_NONE; enum bittorrent_blacklist_flags flags = BITTORRENT_BLACKLIST_NONE;
if (bittorrent_id_is_empty(peer->id) 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; return;
switch (state) { switch (state) {
@ -120,7 +120,7 @@ bittorrent_peer_connection_timeout(struct bittorrent_peer_connection *peer)
void void
set_bittorrent_peer_connection_timeout(struct bittorrent_peer_connection *peer) 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); kill_timer(&peer->timer);
install_timer(&peer->timer, timeout, 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 /* Number of connections to keep in the listening backlog before dropping new
* ones. */ * ones. */
#define LISTEN_BACKLOG \ #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. */ /* Called when we receive a connection on the listening socket. */
static void static void
@ -383,8 +383,8 @@ init_bittorrent_listening_socket(struct connection *conn)
/* Bind it to some port */ /* Bind it to some port */
port = get_opt_int("protocol.bittorrent.ports.min"); port = get_opt_int("protocol.bittorrent.ports.min", NULL);
max_port = get_opt_int("protocol.bittorrent.ports.max"); max_port = get_opt_int("protocol.bittorrent.ports.max", NULL);
memset(&addr, 0, sizeof(addr)); memset(&addr, 0, sizeof(addr));
addr.sin_port = htons(port); addr.sin_port = htons(port);

View File

@ -75,7 +75,7 @@ do_read_bittorrent_peer_handshake(struct socket *socket, struct read_buffer *buf
static void static void
queue_bittorrent_peer_connection_requests(struct bittorrent_peer_connection *peer) 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); int queue_size = list_size(&peer->local.requests);
for ( ; queue_size < size; queue_size++) { for ( ; queue_size < size; queue_size++) {

View File

@ -95,7 +95,8 @@ handle_bittorrent_mode_changes(struct bittorrent_connection *bittorrent)
} else if (bittorrent->mode == BITTORRENT_MODE_PIECELESS) { } else if (bittorrent->mode == BITTORRENT_MODE_PIECELESS) {
int cutoff; 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) if (cache->completed_pieces >= cutoff)
bittorrent->mode = BITTORRENT_MODE_NORMAL; bittorrent->mode = BITTORRENT_MODE_NORMAL;
} }
@ -348,7 +349,7 @@ add_piece_to_bittorrent_free_list(struct bittorrent_piece_cache *cache,
piece_offset = 0; piece_offset = 0;
piece_length = get_bittorrent_piece_length(&bittorrent->meta, piece); 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) if (request_length > piece_length)
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; 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; if (!name) return NULL;
add_to_strn(&name, "/"); 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 *cache = bittorrent->cache;
struct bittorrent_piece_cache_entry *entry, *next; 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; off_t current_size = 0;
if (!cache_size) return; if (!cache_size) return;

View File

@ -37,7 +37,8 @@ static void
set_bittorrent_tracker_interval(struct connection *conn) set_bittorrent_tracker_interval(struct connection *conn)
{ {
struct bittorrent_connection *bittorrent = conn->info; 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 /* The default HTTP_KEEPALIVE_TIMEOUT is set to 60 seconds so it
* probably makes sense to have a default tracker interval that is below * 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 /* Sending no IP-address is valid. The tracker figures it out
* automatically which is much easier. However, the user might want to * automatically which is much easier. However, the user might want to
* configure a specific IP-address to send. */ * 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); if (*ip) add_format_to_string(&request, "&ip=%s", ip);
/* This one is required for each request. */ /* This one is required for each request. */
add_format_to_string(&request, "&port=%u", bittorrent->port); 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) { if (*key) {
add_to_string(&request, "&key="); add_to_string(&request, "&key=");
encode_uri_string(&request, key, strlen(key), 1); 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); 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) { 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? */ /* Should the server default be used? */
if (numwant == 0) if (numwant == 0)
numwant = -1; numwant = -1;
@ -239,7 +242,7 @@ do_send_bittorrent_tracker_request(struct connection *conn)
if (numwant >= 0) if (numwant >= 0)
add_format_to_string(&request, "&numwant=%d", numwant); 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"); add_to_string(&request, "&compact=1");
uri = get_uri(request.source, 0); uri = get_uri(request.source, 0);

View File

@ -185,7 +185,7 @@ set_vars(struct connection *conn, unsigned char *script)
* standard, so we already filled our environment with we have to have * 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. */ * 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, " ")) { if (*str && strcmp(str, " ")) {
unsigned char *ustr, ts[64] = ""; 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: case REFERER_NONE:
/* oh well */ /* oh well */
break; break;
case REFERER_FAKE: 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); env_set("HTTP_REFERER", str, -1);
break; 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 /* 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. */ * 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) { if (*str) {
env_set("HTTP_ACCEPT_LANGUAGE", str, -1); env_set("HTTP_ACCEPT_LANGUAGE", str, -1);
} }
#ifdef CONFIG_NLS #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", env_set("HTTP_ACCEPT_LANGUAGE",
language_to_iso639(current_language), -1); language_to_iso639(current_language), -1);
} }
@ -279,7 +279,7 @@ set_vars(struct connection *conn, unsigned char *script)
static int static int
test_path(unsigned char *path) 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 **path_ptr;
unsigned char *filename; unsigned char *filename;
@ -312,7 +312,7 @@ execute_cgi(struct connection *conn)
enum connection_state state = S_OK; enum connection_state state = S_OK;
int pipe_read[2], pipe_write[2]; 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 */ /* Not file referrer */
if (conn->referrer && conn->referrer->protocol != PROTOCOL_FILE) { if (conn->referrer && conn->referrer->protocol != PROTOCOL_FILE) {

View File

@ -156,8 +156,8 @@ add_dir_entries(struct directory_entry *entries, unsigned char *dirpath,
int i; int i;
/* Setup @dircolor so it's easy to check if we should color dirs. */ /* Setup @dircolor so it's easy to check if we should color dirs. */
if (get_opt_bool("document.browse.links.color_dirs")) { if (get_opt_bool("document.browse.links.color_dirs", NULL)) {
color_to_string(get_opt_color("document.colors.dirs"), color_to_string(get_opt_color("document.colors.dirs", NULL),
(unsigned char *) &dircolor); (unsigned char *) &dircolor);
} else { } else {
dircolor[0] = 0; dircolor[0] = 0;
@ -180,7 +180,8 @@ static inline enum connection_state
list_directory(struct connection *conn, unsigned char *dirpath, list_directory(struct connection *conn, unsigned char *dirpath,
struct string *page) 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; struct directory_entry *entries;
enum connection_state state; enum connection_state state;

View File

@ -220,12 +220,12 @@ fsp_directory(FSP_SESSION *ses, struct uri *uri)
puts(buf.source); puts(buf.source);
if (get_opt_bool("document.browse.links.color_dirs")) { if (get_opt_bool("document.browse.links.color_dirs", NULL)) {
color_to_string(get_opt_color("document.colors.dirs"), color_to_string(get_opt_color("document.colors.dirs", NULL),
dircolor); dircolor);
} }
if (get_opt_bool("protocol.fsp.sort")) { if (get_opt_bool("protocol.fsp.sort", NULL)) {
sort_and_display_entries(dir, dircolor); sort_and_display_entries(dir, dircolor);
} else { } else {
FSP_RDENTRY fentry, *fresult; FSP_RDENTRY fentry, *fresult;

View File

@ -466,7 +466,8 @@ ftp_pass(struct connection *conn)
add_to_string(&cmd, auth->password); add_to_string(&cmd, auth->password);
} else { } 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); 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; 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 #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 (conn->socket->protocol_family == EL_PF_INET6) {
if (ftp->use_epsv) { if (ftp->use_epsv) {
@ -1401,10 +1402,10 @@ out_of_mem:
if (ftp->dir) { if (ftp->dir) {
format.libc_codepage = get_cp_index("System"); 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) { 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); format.dircolor);
} }
} }

View File

@ -172,7 +172,7 @@ show_http_error_document(struct session *ses, void *data)
/* The codepage that _("foo", term) used when it was /* The codepage that _("foo", term) used when it was
* called by get_http_error_document. */ * called by get_http_error_document. */
const int gettext_codepage 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); if (cached) delete_entry_content(cache);

View File

@ -449,7 +449,7 @@ check_http_server_bugs(struct uri *uri, struct http_connection_info *http,
NULL 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)) || HTTP_1_0(http->sent_version))
return 0; 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 if (conn->info && !((struct http_connection_info *) conn->info)->close
&& (!conn->socket->ssl) /* We won't keep alive ssl connections */ && (!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)) { || !conn->uri->post)) {
if (state == S_OK && conn->cached) if (state == S_OK && conn->cached)
normalize_cache_entry(conn->cached, !notrunc ? conn->from : -1); 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); http->bl_flags = get_blacklist_flags(conn->proxied_uri);
if (http->bl_flags & SERVER_BLACKLIST_HTTP10 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.major = 1;
http->sent_version.minor = 0; http->sent_version.minor = 0;
} }
@ -550,7 +550,7 @@ http_send_header(struct socket *socket)
{ {
struct connection *conn = socket->conn; struct connection *conn = socket->conn;
struct http_connection_info *http; 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; struct string header;
unsigned char *post_data = NULL; unsigned char *post_data = NULL;
struct auth_entry *entry = 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. */ /* CONNECT: Proxy-Authorization is intended to be seen by the proxy. */
if (talking_to_proxy) { if (talking_to_proxy) {
unsigned char *user = get_opt_str("protocol.http.proxy.user"); unsigned char *user = get_opt_str("protocol.http.proxy.user", NULL);
unsigned char *passwd = get_opt_str("protocol.http.proxy.passwd"); unsigned char *passwd = get_opt_str("protocol.http.proxy.passwd", NULL);
if (proxy_auth.digest) { if (proxy_auth.digest) {
unsigned char *response; unsigned char *response;
@ -676,7 +676,7 @@ http_send_header(struct socket *socket)
/* CONNECT: User-Agent does not reveal anything about the /* CONNECT: User-Agent does not reveal anything about the
* resource we're fetching, and it may help the proxy return * resource we're fetching, and it may help the proxy return
* better error messages. */ * better error messages. */
optstr = get_opt_str("protocol.http.user_agent"); optstr = get_opt_str("protocol.http.user_agent", NULL);
if (*optstr && strcmp(optstr, " ")) { if (*optstr && strcmp(optstr, " ")) {
unsigned char *ustr, ts[64] = ""; 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 /* CONNECT: Referer probably is a secret page in the HTTPS
* server, so don't reveal it to the proxy. */ * server, so don't reveal it to the proxy. */
if (!use_connect) { if (!use_connect) {
switch (get_opt_int("protocol.http.referer.policy")) { switch (get_opt_int("protocol.http.referer.policy", NULL)) {
case REFERER_NONE: case REFERER_NONE:
/* oh well */ /* oh well */
break; break;
case REFERER_FAKE: case REFERER_FAKE:
optstr = get_opt_str("protocol.http.referer.fake"); optstr = get_opt_str("protocol.http.referer.fake", NULL);
if (!optstr[0]) break; if (!optstr[0]) break;
add_to_string(&header, "Referer: "); add_to_string(&header, "Referer: ");
add_to_string(&header, optstr); add_to_string(&header, optstr);
@ -769,19 +769,19 @@ http_send_header(struct socket *socket)
} }
if (!(http->bl_flags & SERVER_BLACKLIST_NO_CHARSET) 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) { && accept_charset) {
add_to_string(&header, 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]) { if (optstr[0]) {
add_to_string(&header, "Accept-Language: "); add_to_string(&header, "Accept-Language: ");
add_to_string(&header, optstr); add_to_string(&header, optstr);
add_crlf_to_string(&header); add_crlf_to_string(&header);
} }
#ifdef CONFIG_NLS #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); unsigned char *code = language_to_iso639(current_language);
if (code) { if (code) {
@ -805,7 +805,7 @@ http_send_header(struct socket *socket)
add_to_string(&header, "Proxy-Connection: "); 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"); add_to_string(&header, "Keep-Alive");
} else { } else {
add_to_string(&header, "close"); add_to_string(&header, "close");
@ -1576,7 +1576,7 @@ again:
} }
mem_free_set(&conn->cached->head, head); 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; struct cache_entry *cached = conn->cached;
/* I am not entirely sure in what order we should process these /* 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 /* So POST must not be redirected to GET, but some
* BUGGY message boards rely on it :-( */ * BUGGY message boards rely on it :-( */
if (h == 302 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; use_get_method = 1;
redirect_cache(conn->cached, d, use_get_method, -1); redirect_cache(conn->cached, d, use_get_method, -1);

View File

@ -105,7 +105,7 @@ get_protocol_proxy(unsigned char *opt,
{ {
unsigned char *proxy; unsigned char *proxy;
proxy = get_opt_str(opt); proxy = get_opt_str(opt, NULL);
if (!*proxy) proxy = getenv(env1); if (!*proxy) proxy = getenv(env1);
if (!proxy || !*proxy) proxy = getenv(env2); if (!proxy || !*proxy) proxy = getenv(env2);
@ -172,7 +172,7 @@ get_proxy_worker(struct uri *uri, unsigned char *proxy,
if (slash) *slash = 0; 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 = getenv("NO_PROXY");
if (!no_proxy || !*no_proxy) no_proxy = getenv("no_proxy"); if (!no_proxy || !*no_proxy) no_proxy = getenv("no_proxy");

View File

@ -340,7 +340,7 @@ goto_url_hook(va_list ap, void *data)
&& !strchr(*url, ':') && !strchr(*url, ':')
&& !strchr(*url, '.') && !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) { if (uu && *uu) {
arg = *url; arg = *url;
} else { } else {

View File

@ -258,8 +258,8 @@ smb_directory(int dir, struct uri *uri)
puts(buf.source); puts(buf.source);
if (get_opt_bool("document.browse.links.color_dirs")) { if (get_opt_bool("document.browse.links.color_dirs", NULL)) {
color_to_string(get_opt_color("document.colors.dirs"), color_to_string(get_opt_color("document.colors.dirs", NULL),
dircolor); dircolor);
} }

View File

@ -296,7 +296,7 @@ write_cache_entry_to_file(struct cache_entry *cached, struct file_download *file
static void static void
abort_download_and_beep(struct file_download *file_download, struct terminal *term) 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) { + file_download->notify >= 2) {
beep_terminal(term); beep_terminal(term);
} }
@ -403,7 +403,7 @@ download_data_store(struct download *download, struct file_download *file_downlo
} }
if (file_download->remotetime if (file_download->remotetime
&& get_opt_bool("document.download.set_original_time")) { && get_opt_bool("document.download.set_original_time", NULL)) {
struct utimbuf foo; struct utimbuf foo;
foo.actime = foo.modtime = file_download->remotetime; 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 /* !overwrite means always silently overwrite, which may be admitelly
* indeed a little confusing ;-) */ * indeed a little confusing ;-) */
overwrite = get_opt_int("document.download.overwrite"); overwrite = get_opt_int("document.download.overwrite", NULL);
if (!overwrite) { if (!overwrite) {
/* Nothing special to do... */ /* Nothing special to do... */
callback(term, ofile, data, resume); callback(term, ofile, data, resume);
@ -695,7 +695,7 @@ create_download_file_do(struct terminal *term, unsigned char *file, void *data,
set_bin(h); set_bin(h);
if (!cdf_hop->safe) { 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; int i;
safe_strncpy(download_dir, file, MAX_STR_LEN); safe_strncpy(download_dir, file, MAX_STR_LEN);

View File

@ -132,7 +132,7 @@ ses_history_move(struct session *ses)
/* Maybe trash the unhistory. */ /* 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); clean_unhistory(&ses->history);
} }

View File

@ -592,7 +592,7 @@ doc_loading_callback(struct download *download, struct session *ses)
if (ses->doc_view if (ses->doc_view
&& ses->doc_view->document && ses->doc_view->document
&& ses->doc_view->document->refresh && 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, start_document_refresh(ses->doc_view->document->refresh,
ses); ses);
} }
@ -751,7 +751,7 @@ setup_first_session(struct session *ses, struct uri *uri)
/* [gettext_accelerator_context(setup_first_session)] */ /* [gettext_accelerator_context(setup_first_session)] */
struct terminal *term = ses->tab->term; 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, info_box(term, 0,
N_("Warning"), ALIGN_CENTER, N_("Warning"), ALIGN_CENTER,
N_("You have empty string in protocol.http.user_agent - " 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.")); "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"); struct option *opt = get_opt_rec(config_options, "config.saving_style_w");
opt->value.number = 1; opt->value.number = 1;
option_changed(ses, opt); 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, info_box(term, 0,
N_("Warning"), ALIGN_CENTER, N_("Warning"), ALIGN_CENTER,
N_("You have option config.saving_style set to " 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; if (!uri) return 1;
#ifdef CONFIG_BOOKMARKS #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; 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); open_bookmark_folder(ses, folder);
return 1; return 1;
#endif #endif
@ -844,7 +844,7 @@ setup_session(struct session *ses, struct uri *uri, struct session *base)
goto_uri(ses, uri); goto_uri(ses, uri);
} else if (!goto_url_home(ses)) { } 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); dialog_goto_url_open(ses);
} }
} }

View File

@ -170,7 +170,7 @@ ses_goto(struct session *ses, struct uri *uri, unsigned char *target_frame,
int referrer_incomplete = 0; int referrer_incomplete = 0;
int malicious_uri = 0; int malicious_uri = 0;
int confirm_submit = uri->form && get_opt_bool("document.browse.forms" int confirm_submit = uri->form && get_opt_bool("document.browse.forms"
".confirm_submit"); ".confirm_submit", NULL);
unsigned char *m1 = NULL, *message = NULL; unsigned char *m1 = NULL, *message = NULL;
if (ses->doc_view 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. */ * posting form data so this should be more correct. */
if (uri->user && uri->userlen 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)) { && check_malicious_uri(uri)) {
malicious_uri = 1; malicious_uri = 1;
confirm_submit = 1; confirm_submit = 1;
@ -388,9 +388,9 @@ ses_imgmap(struct session *ses)
&menu, &ml, ses->loading_uri, &menu, &ml, ses->loading_uri,
&doc_view->document->options, &doc_view->document->options,
ses->task.target.frame, ses->task.target.frame,
get_opt_codepage_tree(ses->tab->term->spec, "charset"), get_opt_codepage_tree(ses->tab->term->spec, "charset", NULL),
get_opt_codepage("document.codepage.assume"), get_opt_codepage("document.codepage.assume", NULL),
get_opt_bool("document.codepage.force_assumed"))) get_opt_bool("document.codepage.force_assumed", NULL)))
return; return;
add_empty_window(ses->tab->term, (void (*)(void *)) freeml, ml); 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")) { 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 if (mode == 3
&& !get_cmd_opt_bool("anonymous") && !get_cmd_opt_bool("anonymous")
@ -753,7 +754,7 @@ goto_url_with_hook(struct session *ses, unsigned char *url)
int int
goto_url_home(struct session *ses) 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 = getenv("WWW_HOME");
if (!homepage || !*homepage) homepage = WWW_HOME_URL; if (!homepage || !*homepage) homepage = WWW_HOME_URL;

View File

@ -75,7 +75,7 @@ draw_border_cross(struct terminal *term, int x, int y,
} }
set_term_color(screen_char, color, 0, set_term_color(screen_char, color, 0,
get_opt_int_tree(term->spec, "colors")); get_opt_int_tree(term->spec, "colors", NULL));
} }
void void
@ -89,7 +89,7 @@ draw_border_char(struct terminal *term, int x, int y,
screen_char->data = (unsigned char) border; screen_char->data = (unsigned char) border;
screen_char->attr = SCREEN_ATTR_FRAME; screen_char->attr = SCREEN_ATTR_FRAME;
set_term_color(screen_char, color, 0, 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); 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; if (!screen_char) return;
set_term_color(screen_char, color, 0, 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); 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->data = data;
screen_char->attr = attr; screen_char->attr = attr;
set_term_color(screen_char, color, 0, 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); set_screen_dirty(term->screen, y, y);
} }
@ -378,7 +378,7 @@ draw_box(struct terminal *term, struct box *box,
end->data = data; end->data = data;
if (color) { if (color) {
set_term_color(end, color, 0, set_term_color(end, color, 0,
get_opt_int_tree(term->spec, "colors")); get_opt_int_tree(term->spec, "colors", NULL));
} else { } else {
clear_screen_char_color(end); clear_screen_char_color(end);
} }
@ -440,7 +440,7 @@ draw_text_utf8(struct terminal *term, int x, int y,
if (color) { if (color) {
start->attr = attr; start->attr = attr;
set_term_color(start, color, 0, 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) 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. */ /* Use the last char as template. */
end->attr = attr; end->attr = attr;
set_term_color(end, color, 0, 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++) { for (; pos < end && *text; text++, pos++) {
end->data = *text; end->data = *text;
@ -564,7 +564,7 @@ set_cursor(struct terminal *term, int x, int y, int blockable)
assert(term && term->screen); assert(term && term->screen);
if_assert_failed return; 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; x = term->width - 1;
y = term->height - 1; y = term->height - 1;
} }

View File

@ -148,7 +148,8 @@ term_send_ucs(struct terminal *term, unicode_val_T u,
const unsigned char *recoded; const unsigned char *recoded;
set_kbd_term_event(&ev, KBD_UNDEF, modifier); 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 = "*"; if (!recoded) recoded = "*";
while (*recoded) { while (*recoded) {
ev.info.keyboard.key = *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. * term->spec and term->utf8 should be set before decode session info.
* --Scrool */ * --Scrool */
term->utf8_cp = is_cp_utf8(get_opt_codepage_tree(term->spec, 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 /* Force UTF-8 I/O if the UTF-8 charset is selected. Various
* places assume that the terminal's charset is unibyte if * places assume that the terminal's charset is unibyte if
* UTF-8 I/O is disabled. (bug 827) */ * UTF-8 I/O is disabled. (bug 827) */
term->utf8_io = term->utf8_cp 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 */ #endif /* CONFIG_UTF8 */
} }
@ -323,7 +324,7 @@ handle_interlink_event(struct terminal *term, struct interlink_event *ilev)
* this codepage cannot be UTF-8. * this codepage cannot be UTF-8.
* - Otherwise, handle_interlink_event() passes the * - Otherwise, handle_interlink_event() passes the
* bytes straight through. */ * 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 */ #endif /* CONFIG_UTF8 */
/* In UTF-8 byte sequences that have more than one byte, the /* 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. */ * recode from the terminal charset to UCS-4. */
key = cp2u(get_opt_codepage_tree(term->spec, key = cp2u(get_opt_codepage_tree(term->spec,
"charset"), "charset",
NULL),
key); key);
term_send_ucs(term, key, modifier); term_send_ucs(term, key, modifier);
break; break;

View File

@ -316,8 +316,8 @@ static INIT_LIST_OF(struct screen_driver, active_screen_drivers);
static void static void
set_screen_driver_opt(struct screen_driver *driver, struct option *term_spec) set_screen_driver_opt(struct screen_driver *driver, struct option *term_spec)
{ {
const int cp = get_opt_codepage_tree(term_spec, "charset"); const int cp = get_opt_codepage_tree(term_spec, "charset", NULL);
int utf8_io = get_opt_bool_tree(term_spec, "utf_8_io"); int utf8_io = get_opt_bool_tree(term_spec, "utf_8_io", NULL);
/* Copy all the original options from constants, so that this /* Copy all the original options from constants, so that this
* function need not carefully restore options one by one. */ * 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 */ #endif /* CONFIG_UTF8 */
driver->opt.color_mode = get_opt_int_tree(term_spec, "colors"); driver->opt.color_mode = get_opt_int_tree(term_spec, "colors", NULL);
driver->opt.transparent = get_opt_bool_tree(term_spec, "transparency"); 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; driver->opt.underline = underline_seqs;
} else { } else {
driver->opt.underline = NULL; 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; driver->opt.frame_seqs = NULL;
if (driver->type == TERM_LINUX) { 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.frame = frame_restrict;
driver->opt.charsets[1] = get_cp_index("cp437"); 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; driver->opt.charsets[0] = -1;
if (driver->type == TERM_LINUX) { 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.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; driver->opt.frame_seqs = m11_hack_frame_seqs;
} else if (driver->type == TERM_FREEBSD) { } 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; driver->opt.frame_seqs = m11_hack_frame_seqs;
} else if (driver->type == TERM_VT100) { } else if (driver->type == TERM_VT100) {
@ -404,7 +405,7 @@ static int
screen_driver_change_hook(struct session *ses, struct option *term_spec, screen_driver_change_hook(struct session *ses, struct option *term_spec,
struct option *changed) 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; struct screen_driver *driver;
unsigned char *name = term_spec->name; 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 * static inline struct screen_driver *
get_screen_driver(struct terminal *term) 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; unsigned char *name = term->spec->name;
int len = strlen(name); int len = strlen(name);
struct screen_driver *driver; struct screen_driver *driver;

View File

@ -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 < 0) tabs_count = number_of_tabs(term);
if (tabs_count > 1) { if (tabs_count > 1) {
if (get_opt_bool("ui.tabs.wraparound")) { if (get_opt_bool("ui.tabs.wraparound", NULL)) {
tab %= tabs_count; tab %= tabs_count;
if (tab < 0) tab += tabs_count; if (tab < 0) tab += tabs_count;
} else } else
@ -196,7 +196,7 @@ close_tab(struct terminal *term, struct session *ses)
return; return;
} }
if (!get_opt_bool("ui.tabs.confirm_close")) { if (!get_opt_bool("ui.tabs.confirm_close", NULL)) {
really_close_tab(ses); really_close_tab(ses);
return; return;
} }
@ -240,7 +240,7 @@ close_all_tabs_but_current(struct session *ses)
assert(ses); assert(ses);
if_assert_failed return; 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); really_close_tabs(ses);
return; return;
} }
@ -309,7 +309,7 @@ move_current_tab(struct session *ses, int direction)
new_pos = term->current_tab + 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; new_pos %= tabs;
if (new_pos < 0) new_pos = tabs + new_pos; if (new_pos < 0) new_pos = tabs + new_pos;
} else { } else {

View File

@ -171,7 +171,7 @@ static void
check_if_no_terminal(void) check_if_no_terminal(void)
{ {
program.terminate = list_empty(terminals) program.terminate = list_empty(terminals)
&& !get_opt_bool("ui.sessions.keep_session_active"); && !get_opt_bool("ui.sessions.keep_session_active", NULL);
} }
void void

View File

@ -94,7 +94,7 @@ secure_open_umask(unsigned char *file_name)
goto end; 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); ssi->file_name = stracpy(file_name);
if (!ssi->file_name) { if (!ssi->file_name) {
@ -252,7 +252,7 @@ secure_close(struct secure_save_info *ssi)
#endif #endif
#ifdef HAVE_FSYNC #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)); fail = fsync(fileno(ssi->fp));
#endif #endif

View File

@ -164,7 +164,7 @@ do_action(struct session *ses, enum main_action action_id, int verbose)
case ACT_MAIN_COOKIES_LOAD: case ACT_MAIN_COOKIES_LOAD:
#ifdef CONFIG_COOKIES #ifdef CONFIG_COOKIES
if (!get_opt_bool("cookies.save")) break; if (!get_opt_bool("cookies.save", NULL)) break;
load_cookies(); load_cookies();
#endif #endif
break; break;

View File

@ -114,15 +114,15 @@ dump_formatted(int fd, struct download *download, struct cache_entry *cached)
memset(&formatted, 0, sizeof(formatted)); memset(&formatted, 0, sizeof(formatted));
init_document_options(&o); init_document_options(NULL, &o);
width = get_opt_int("document.dump.width"); width = get_opt_int("document.dump.width", NULL);
set_box(&o.box, 0, 1, width, DEFAULT_TERMINAL_HEIGHT); set_box(&o.box, 0, 1, width, DEFAULT_TERMINAL_HEIGHT);
o.cp = get_opt_codepage("document.dump.codepage"); o.cp = get_opt_codepage("document.dump.codepage", NULL);
o.color_mode = get_opt_int("document.dump.color_mode"); o.color_mode = get_opt_int("document.dump.color_mode", NULL);
o.plain = 0; o.plain = 0;
o.frames = 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); init_vs(&vs, cached->uri, -1);
@ -217,7 +217,7 @@ subst_url(unsigned char *str, struct string *url)
static void static void
dump_print(unsigned char *option, struct string *url) 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) { if (str) {
unsigned char *realstr = subst_url(str, url); unsigned char *realstr = subst_url(str, url);
@ -479,7 +479,7 @@ dump_to_file_16(struct document *document, int fd)
int bptr = 0; int bptr = 0;
unsigned char *buf = mem_alloc(D_BUF); unsigned char *buf = mem_alloc(D_BUF);
unsigned char color = 0; 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; if (!buf) return -1;
@ -538,7 +538,8 @@ fail:
return -1; return -1;
} }
if (document->nlinks && get_opt_bool("document.dump.references")) { if (document->nlinks
&& get_opt_bool("document.dump.references", NULL)) {
int x; int x;
unsigned char *header = "\nReferences\n\n Visible links\n"; unsigned char *header = "\nReferences\n\n Visible links\n";
int headlen = strlen(header); 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 *buf = mem_alloc(D_BUF);
unsigned char foreground = 0; unsigned char foreground = 0;
unsigned char background = 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; if (!buf) return -1;
@ -670,7 +671,8 @@ fail:
return -1; return -1;
} }
if (document->nlinks && get_opt_bool("document.dump.references")) { if (document->nlinks
&& get_opt_bool("document.dump.references", NULL)) {
int x; int x;
unsigned char *header = "\nReferences\n\n Visible links\n"; unsigned char *header = "\nReferences\n\n Visible links\n";
int headlen = strlen(header); 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 *buf = mem_alloc(D_BUF);
unsigned char *foreground = &color[0]; unsigned char *foreground = &color[0];
unsigned char *background = &color[3]; 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; if (!buf) return -1;
@ -802,7 +804,8 @@ fail:
return -1; return -1;
} }
if (document->nlinks && get_opt_bool("document.dump.references")) { if (document->nlinks
&& get_opt_bool("document.dump.references", NULL)) {
int x; int x;
unsigned char *header = "\nReferences\n\n Visible links\n"; unsigned char *header = "\nReferences\n\n Visible links\n";
int headlen = strlen(header); int headlen = strlen(header);
@ -949,7 +952,8 @@ fail:
return -1; return -1;
} }
if (document->nlinks && get_opt_bool("document.dump.references")) { if (document->nlinks
&& get_opt_bool("document.dump.references", NULL)) {
int x; int x;
unsigned char *header = "\nReferences\n\n Visible links\n"; unsigned char *header = "\nReferences\n\n Visible links\n";
int headlen = strlen(header); int headlen = strlen(header);

View File

@ -73,7 +73,8 @@ check_document_fragment(struct session *ses, struct document_view *doc_view)
return -2; 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, info_box(ses->tab->term, MSGBOX_FREE_TEXT,
N_("Missing fragment"), ALIGN_CENTER, N_("Missing fragment"), ALIGN_CENTER,
msg_text(ses->tab->term, N_("The requested fragment " 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 color.background = doc_view->document->height
? doc_view->document->bgcolor ? doc_view->document->bgcolor
: get_opt_color("document.colors.background"); : get_opt_color("document.colors.background", NULL);
vs = doc_view->vs; vs = doc_view->vs;
if (!vs) { if (!vs) {
@ -354,7 +355,7 @@ draw_formatted(struct session *ses, int rerender)
if (ses->doc_view if (ses->doc_view
&& ses->doc_view->document && ses->doc_view->document
&& ses->doc_view->document->refresh && 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, start_document_refresh(ses->doc_view->document->refresh,
ses); ses);
} }

View File

@ -164,7 +164,7 @@ init_form_state(struct document_view *doc_view,
doc_cp = doc_view->document->cp; doc_cp = doc_view->document->cp;
term = doc_view->session->tab->term; 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); 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); 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; cp_to = doc_view->document->cp;
switch (form->method) { switch (form->method) {
case FORM_METHOD_GET: 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 * a file that is to be uploaded. TODO: Distinguish between
* these two classes of errors (is it worth it?). -- Miciah */ * these two classes of errors (is it worth it?). -- Miciah */
if (data.source 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); memorize_form(ses, &submit, form);
#endif #endif
@ -1562,7 +1562,7 @@ field_op(struct session *ses, struct document_view *doc_view,
* submit the form or the posting fails. */ * submit the form or the posting fails. */
/* FIXME: We should maybe have ACT_EDIT_ENTER_RELOAD */ /* FIXME: We should maybe have ACT_EDIT_ENTER_RELOAD */
if ((has_form_submit(fc->form) 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)) { || goto_current_link(ses, doc_view, 0)) {
if (ses->insert_mode == INSERT_MODE_ON) if (ses->insert_mode == INSERT_MODE_ON)
ses->insert_mode = INSERT_MODE_OFF; 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. */ /* fs->value is in the charset of the terminal. */
ctext = u2cp_no_nbsp(get_kbd_key(ev), ctext = u2cp_no_nbsp(get_kbd_key(ev),
get_opt_codepage_tree(ses->tab->term->spec, get_opt_codepage_tree(ses->tab->term->spec,
"charset")); "charset",
NULL));
length = strlen(ctext); length = strlen(ctext);
if (strlen(fs->value) + length > fc->maxlength 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 if (!fc->form->action
|| (has_form_submit(fc->form) || (has_form_submit(fc->form)
&& !get_opt_bool("document.browse.forms.auto_submit"))) && !get_opt_bool("document.browse.forms.auto_submit",
NULL)))
break; break;
uri = get_uri(fc->form->action, 0); 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 if (link->accesskey
&& get_opt_bool("document.browse.accesskey.display")) { && get_opt_bool("document.browse.accesskey.display", NULL)) {
add_to_string(&str, " ("); add_to_string(&str, " (");
add_accesskey_to_string(&str, link->accesskey); add_accesskey_to_string(&str, link->accesskey);
add_char_to_string(&str, ')'); add_char_to_string(&str, ')');

View File

@ -1171,7 +1171,7 @@ goto_link_number_do(struct session *ses, struct document_view *doc_view, int n)
link = &doc_view->document->links[n]; link = &doc_view->document->links[n];
if (!link_is_textinput(link) 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); 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); key = get_kbd_key(ev);
#else /* !CONFIG_UTF8 */ #else /* !CONFIG_UTF8 */
key = cp2u(get_opt_codepage_tree(ses->tab->term->spec, key = cp2u(get_opt_codepage_tree(ses->tab->term->spec,
"charset"), "charset", NULL),
get_kbd_key(ev)); get_kbd_key(ev));
#endif /* !CONFIG_UTF8 */ #endif /* !CONFIG_UTF8 */
/* If @key now is 0 (which is used in link.accesskey if there /* 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 the uri with password and post info stripped */
add_string_uri_to_string(&str, uristring, URI_PUBLIC); add_string_uri_to_string(&str, uristring, URI_PUBLIC);
if (link->accesskey > 0 if (link->accesskey > 0
&& get_opt_bool("document.browse.accesskey.display")) { && get_opt_bool("document.browse.accesskey.display",
NULL)) {
add_to_string(&str, " ("); add_to_string(&str, " (");
add_accesskey_to_string(&str, link->accesskey); add_accesskey_to_string(&str, link->accesskey);
add_char_to_string(&str, ')'); add_char_to_string(&str, ')');

View File

@ -310,10 +310,10 @@ init_regex(regex_t *regex, unsigned char *pattern)
int regex_flags = REG_NEWLINE; int regex_flags = REG_NEWLINE;
int reg_err; 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; 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; regex_flags |= REG_ICASE;
reg_err = regcomp(regex, pattern, regex_flags); 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; int yy = y + height;
UCHAR *txt; UCHAR *txt;
int found = 0; 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); txt = case_sensitive ? memacpy_u(text, textlen, utf8) : lowered_string(text, textlen, utf8);
if (!txt) return -1; if (!txt) return -1;
@ -591,7 +591,7 @@ is_in_range(struct document *document, int y, int height,
return 0; return 0;
#ifdef HAVE_REGEX_H #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, return is_in_range_regex(document, y, height, text, textlen,
min, max, s1, s2); min, max, s1, s2);
#endif #endif
@ -611,7 +611,7 @@ get_searched_plain(struct document_view *doc_view, struct point **pt, int *pl,
struct box *box; struct box *box;
int xoffset, yoffset; int xoffset, yoffset;
int len = 0; 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) txt = case_sensitive ? memacpy_u(*doc_view->search_word, l, utf8)
: lowered_string(*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 #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); get_searched_regex(doc_view, pt, pl, l, s1, s2);
else else
#endif #endif
@ -1049,7 +1049,7 @@ static void
print_find_error_not_found(struct session *ses, unsigned char *title, print_find_error_not_found(struct session *ses, unsigned char *title,
unsigned char *message, unsigned char *search_string) 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: case 2:
info_box(ses->tab->term, MSGBOX_FREE_TEXT, info_box(ses->tab->term, MSGBOX_FREE_TEXT,
title, ALIGN_CENTER, title, ALIGN_CENTER,
@ -1076,7 +1076,7 @@ print_find_error(struct session *ses, enum find_error find_error)
hit_top = 1; hit_top = 1;
case FIND_ERROR_HIT_BOTTOM: case FIND_ERROR_HIT_BOTTOM:
if (!get_opt_bool("document.browse.search" if (!get_opt_bool("document.browse.search"
".show_hit_top_bottom")) ".show_hit_top_bottom", NULL))
break; break;
message = hit_top 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) unsigned char *text, int direction, int *offset)
{ {
int upper_link, lower_link; int upper_link, lower_link;
int case_sensitive = get_opt_bool("document.browse.search.case"); int case_sensitive = get_opt_bool("document.browse.search.case", NULL);
int wraparound = get_opt_bool("document.browse.search.wraparound"); int wraparound = get_opt_bool("document.browse.search.wraparound",
NULL);
int textlen = strlen(text); int textlen = strlen(text);
assert(textlen && direction && offset); assert(textlen && direction && offset);
@ -1307,14 +1308,15 @@ do_typeahead(struct session *ses, struct document_view *doc_view,
direction = -1; direction = -1;
i--; i--;
if (i >= 0) break; if (i >= 0) break;
if (!get_opt_bool("document.browse.search.wraparound")) { if (!get_opt_bool("document.browse.search.wraparound", NULL)) {
search_hit_boundary: search_hit_boundary:
if (match_link_text(&document->links[current], if (match_link_text(&document->links[current],
text, strlen(text), text, strlen(text),
get_opt_bool("document" get_opt_bool("document"
".browse" ".browse"
".search" ".search"
".case")) ".case",
NULL))
>= 0) { >= 0) {
return TYPEAHEAD_ERROR_NO_FURTHER; return TYPEAHEAD_ERROR_NO_FURTHER;
} }
@ -1330,7 +1332,8 @@ search_hit_boundary:
direction = 1; direction = 1;
i++; i++;
if (i < doc_view->document->nlinks) break; 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; goto search_hit_boundary;
i = 0; 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], offset = match_link_text(&doc_view->document->links[current],
buffer, bufferlen, buffer, bufferlen,
get_opt_bool("document.browse" get_opt_bool("document.browse"
".search.case")); ".search.case", NULL));
if (offset >= 0) { if (offset >= 0) {
draw_typeahead_match(ses->tab->term, doc_view, draw_typeahead_match(ses->tab->term, doc_view,

View File

@ -604,7 +604,8 @@ textarea_edit(int op, struct terminal *term_, struct form_state *fs_,
} }
if (op == 0 && !textarea_editor) { 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; unsigned char *ex;
fn = save_textarea_file(fs_->value); fn = save_textarea_file(fs_->value);

View File

@ -181,7 +181,7 @@ move_link(struct session *ses, struct document_view *doc_view, int direction,
} else { } else {
/* We only bother this option if there's some links /* We only bother this option if there's some links
* in document. */ * 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); 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; 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; max = doc_view->document->width - 1;
} else { } else {
max = int_max(doc_view->vs->x, 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); int steps = eat_kbd_repeat_count(ses);
if (!steps) 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); 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); int steps = eat_kbd_repeat_count(ses);
if (!steps) 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); 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); int steps = eat_kbd_repeat_count(ses);
if (!steps) 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); 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); int steps = eat_kbd_repeat_count(ses);
if (!steps) 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); 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 static enum frame_event_status
scroll_mouse_up(struct session *ses, struct document_view *doc_view) 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); 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 static enum frame_event_status
scroll_mouse_down(struct session *ses, struct document_view *doc_view) 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); 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 static enum frame_event_status
scroll_mouse_left(struct session *ses, struct document_view *doc_view) 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); 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 static enum frame_event_status
scroll_mouse_right(struct session *ses, struct document_view *doc_view) 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); 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) if (status != FRAME_EVENT_IGNORED)
return status; return status;
#endif #endif
accesskey_priority = get_opt_int("document.browse.accesskey.priority"); accesskey_priority = get_opt_int("document.browse.accesskey.priority", NULL);
if (accesskey_priority >= 2) { if (accesskey_priority >= 2) {
status = try_document_key(ses, doc_view, ev); 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)) { if (check_mouse_button(ev, B_LEFT)) {
/* Clicking the edge of screen will scroll the document. */ /* 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 /* XXX: This is code duplication with kbd handlers. But
* repeatcount-free here. */ * repeatcount-free here. */
@ -1118,7 +1118,7 @@ static void
try_typeahead(struct session *ses, struct document_view *doc_view, try_typeahead(struct session *ses, struct document_view *doc_view,
struct term_event *ev, enum main_action action_id) 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: case 0:
return; return;
case 1: case 1:
@ -1195,7 +1195,7 @@ quit:
if (doc_view if (doc_view
&& get_opt_int("document.browse.accesskey" && get_opt_int("document.browse.accesskey"
".priority") <= 0 ".priority", NULL) <= 0
&& try_document_key(ses, doc_view, ev) && try_document_key(ses, doc_view, ev)
== FRAME_EVENT_REFRESH) { == FRAME_EVENT_REFRESH) {
/* The document ate the key! */ /* The document ate the key! */

View File

@ -45,7 +45,8 @@ count_down(void *xxx)
} }
/* The expired timer ID has now been erased. */ /* 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) { if (keybinding) {
struct terminal *terminal; struct terminal *terminal;
struct term_event ev; struct term_event ev;
@ -66,9 +67,9 @@ reset_timer(void)
{ {
kill_timer(&countdown); 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); install_timer(&countdown, COUNT_DOWN_DELAY, count_down, NULL);
} }