ELinks 0.16.1.1
conf.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/stat.h>
#include "elinks.h"
#include "config/conf.h"
#include "config/dialogs.h"
#include "config/domain.h"
#include "config/home.h"
#include "config/kbdbind.h"
#include "config/options.h"
#include "config/opttypes.h"
#include "intl/libintl.h"
#include "osdep/osdep.h"
#include "terminal/terminal.h"
#include "util/error.h"
#include "util/memory.h"
#include "util/qs_parse/qs_parse.h"
#include "util/secsave.h"
#include "util/string.h"
Include dependency graph for conf.c:

Data Structures

struct  conf_parsing_pos
struct  conf_parsing_state
struct  parse_handler

Macros

#define FILE_BUF   1024
#define NUMKVPAIRS   16

Functions

static enum parse_error show_parse_error (const struct conf_parsing_state *state, enum parse_error err)
 Tell the user about an error in the configuration file.
static void skip_white (struct conf_parsing_pos *pos)
 Skip comments and whitespace.
static void skip_quoted (struct conf_parsing_pos *pos)
 Skip a quoted string.
static void skip_option_value (struct conf_parsing_pos *pos)
 Skip the value of an option.
static void skip_to_unquoted_newline_or_comment (struct conf_parsing_pos *pos)
 Skip to the next newline or comment that is not part of a quoted string.
static enum parse_error parse_set_common (struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf, int want_domain)
static enum parse_error parse_set_domain (struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
static enum parse_error parse_set (struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
static enum parse_error parse_unset (struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
static enum parse_error parse_bind (struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
static int load_config_file (const char *, const char *, struct option *, struct string *, int)
static enum parse_error parse_include (struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
static enum parse_error parse_config_command (struct option *options, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
enum parse_error parse_config_exmode_command (char *cmd)
void parse_config_file (struct option *options, const char *name, char *file, struct string *mirror, int is_system_conf)
static char * read_config_file (char *name)
static void load_config_from (char *file, struct option *tree)
void load_config (void)
static const char * conf_i18n (const char *s, int i18n)
static void add_indent_to_string (struct string *string, int depth)
struct stringwrap_option_desc (struct string *out, const char *src, const struct string *indent, int maxwidth)
static void output_option_desc_as_comment (struct string *out, const struct option *option, int i18n, int depth)
static void smart_config_output_fn (struct string *string, struct option *option, char *path, int depth, int do_print_comment, int action, int i18n)
static void smart_config_output_fn_html (struct string *string, struct option *option, char *path, int depth, int do_print_comment, int action, int i18n)
static void add_cfg_header_to_string (struct string *string, const char *text)
char * create_about_config_string (void)
char * create_config_string (const char *prefix, const char *name)
static int write_config_file (char *prefix, char *name, struct terminal *term)
int write_config (struct terminal *term)
void set_option_or_save (const char *str)

Variables

static const struct parse_handler parse_handlers []
static int indentation = 2
static int comments = 3
static char * smart_config_output_fn_domain

Macro Definition Documentation

◆ FILE_BUF

#define FILE_BUF   1024

◆ NUMKVPAIRS

#define NUMKVPAIRS   16

Function Documentation

◆ add_cfg_header_to_string()

void add_cfg_header_to_string ( struct string * string,
const char * text )
static

◆ add_indent_to_string()

void add_indent_to_string ( struct string * string,
int depth )
static

◆ conf_i18n()

const char * conf_i18n ( const char * s,
int i18n )
inlinestatic

◆ create_about_config_string()

char * create_about_config_string ( void )

◆ create_config_string()

char * create_config_string ( const char * prefix,
const char * name )

◆ load_config()

void load_config ( void )

◆ load_config_file()

int load_config_file ( const char * prefix,
const char * name,
struct option * options,
struct string * mirror,
int is_system_conf )
static

◆ load_config_from()

void load_config_from ( char * file,
struct option * tree )
static

◆ output_option_desc_as_comment()

void output_option_desc_as_comment ( struct string * out,
const struct option * option,
int i18n,
int depth )
static

◆ parse_bind()

enum parse_error parse_bind ( struct option * opt_tree,
struct conf_parsing_state * state,
struct string * mirror,
int is_system_conf )
static

◆ parse_config_command()

enum parse_error parse_config_command ( struct option * options,
struct conf_parsing_state * state,
struct string * mirror,
int is_system_conf )
static

◆ parse_config_exmode_command()

enum parse_error parse_config_exmode_command ( char * cmd)

◆ parse_config_file()

void parse_config_file ( struct option * options,
const char * name,
char * file,
struct string * mirror,
int is_system_conf )

◆ parse_include()

enum parse_error parse_include ( struct option * opt_tree,
struct conf_parsing_state * state,
struct string * mirror,
int is_system_conf )
static

◆ parse_set()

enum parse_error parse_set ( struct option * opt_tree,
struct conf_parsing_state * state,
struct string * mirror,
int is_system_conf )
static

◆ parse_set_common()

enum parse_error parse_set_common ( struct option * opt_tree,
struct conf_parsing_state * state,
struct string * mirror,
int is_system_conf,
int want_domain )
static

◆ parse_set_domain()

enum parse_error parse_set_domain ( struct option * opt_tree,
struct conf_parsing_state * state,
struct string * mirror,
int is_system_conf )
static

◆ parse_unset()

enum parse_error parse_unset ( struct option * opt_tree,
struct conf_parsing_state * state,
struct string * mirror,
int is_system_conf )
static

◆ read_config_file()

char * read_config_file ( char * name)
static

◆ set_option_or_save()

void set_option_or_save ( const char * str)

◆ show_parse_error()

enum parse_error show_parse_error ( const struct conf_parsing_state * state,
enum parse_error err )
static

Tell the user about an error in the configuration file.

Returns
err, for convenience.

◆ skip_option_value()

void skip_option_value ( struct conf_parsing_pos * pos)
static

Skip the value of an option.

This job is normally done by the reader function that corresponds to the type of the option. However, if ELinks does not recognize the name of the option, it cannot look up the type and has to use this function instead.

◆ skip_quoted()

void skip_quoted ( struct conf_parsing_pos * pos)
static

Skip a quoted string.

This function allows "mismatching quotes' because str_rd() does so.

◆ skip_to_unquoted_newline_or_comment()

void skip_to_unquoted_newline_or_comment ( struct conf_parsing_pos * pos)
static

Skip to the next newline or comment that is not part of a quoted string.

When ELinks hits a parse error in the configuration file, it calls this in order to find the place where is should resume parsing. This is intended to prevent ELinks from treating words in strings as commands.

◆ skip_white()

void skip_white ( struct conf_parsing_pos * pos)
static

Skip comments and whitespace.

◆ smart_config_output_fn()

void smart_config_output_fn ( struct string * string,
struct option * option,
char * path,
int depth,
int do_print_comment,
int action,
int i18n )
static

◆ smart_config_output_fn_html()

void smart_config_output_fn_html ( struct string * string,
struct option * option,
char * path,
int depth,
int do_print_comment,
int action,
int i18n )
static

◆ wrap_option_desc()

struct string * wrap_option_desc ( struct string * out,
const char * src,
const struct string * indent,
int maxwidth )

◆ write_config()

int write_config ( struct terminal * term)

◆ write_config_file()

int write_config_file ( char * prefix,
char * name,
struct terminal * term )
static

Variable Documentation

◆ comments

int comments = 3
static

◆ indentation

int indentation = 2
static

◆ parse_handlers

const struct parse_handler parse_handlers[]
static
Initial value:
= {
{ "set_domain", parse_set_domain },
{ "set", parse_set },
{ "unset", parse_unset },
{ "bind", parse_bind },
{ "include", parse_include },
{ NULL, NULL }
}
static enum parse_error parse_bind(struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
Definition conf.c:485
static enum parse_error parse_set(struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
Definition conf.c:400
static enum parse_error parse_set_domain(struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
Definition conf.c:393
static enum parse_error parse_unset(struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
Definition conf.c:408
static enum parse_error parse_include(struct option *opt_tree, struct conf_parsing_state *state, struct string *mirror, int is_system_conf)
Definition conf.c:578
#define NULL
Definition explodename.c:35

◆ smart_config_output_fn_domain

char* smart_config_output_fn_domain
static