55 SymNode_t *symbols,
int n_symbols)
62 for (i = 0; i < n_symbols; i++) {
63 if (!strcmp(symbols[i].name, name)) {
64 node = & (symbols[i]);
70 MSG(
"prefs: {%s} is not a recognized token.\n", name);
80 *(int32_t *)node->pref =
a_Color_parse(value, *(int32_t*)node->pref,&st);
82 MSG(
"prefs: Color '%s' not recognized.\n", value);
85 dFree(*(
char **)node->pref);
86 *(
char **)node->pref =
dStrdup(value);
91 if (node->count == 0) {
107 *(int32_t *)node->pref = strtol(value, NULL, 10);
110 *(
double *)node->pref = strtod(value, NULL);
114 double d = strtod (value, NULL);
117 *(
int*)node->pref = INT_MAX;
119 *(
int*)node->pref = INT_MIN;
121 *(
int*)node->pref = 100 * d;
137 MSG_WARN(
"prefs: {%s} IS recognized but not handled!\n", name);
148void PrefsParser::parse(FILE *fp)
150 char *line, *name, *value, *oldLocale;
151 int st, line_number = 1;
154 static SymNode_t symbols[] = {
254 oldLocale =
dStrdup(setlocale(LC_NUMERIC, NULL));
255 setlocale(LC_NUMERIC,
"C");
258 while ((line =
dGetline(fp)) != NULL) {
262 _MSG(
"prefsparser: name=%s, value=%s\n", name, value);
263 parseOption(name, value, symbols,
sizeof(symbols) /
sizeof(symbols[0]));
265 MSG_ERR(
"prefsparser: Syntax error in dillorc line %d:"
266 " name=\"%s\" value=\"%s\"\n", line_number, name, value);
274 setlocale(LC_NUMERIC, oldLocale);
int32_t a_Color_parse(const char *str, int32_t default_color, int *err)
Parse a color string.
char * dGetline(FILE *stream)
Get a line from a FILE stream.
int dStrAsciiCasecmp(const char *s1, const char *s2)
char * dStrdup(const char *s)
int dList_length(Dlist *lp)
For completing the ADT.
void * dList_nth_data(Dlist *lp, int n0)
Return the nth data item, NULL when not found or 'n0' is out of range.
void dList_append(Dlist *lp, void *data)
Append a data item to the list.
int dParser_parse_rc_line(char **line, char **name, char **value)
Take a dillo rc line and return 'name' and 'value' pointers to it.
void dList_remove(Dlist *lp, const void *data)
int a_Misc_parse_geometry(char *str, int *x, int *y, int *w, int *h)
Parse a geometry string.
DilloPrefs prefs
Global Data.
static int parseOption(char *name, char *value, SymNode_t *symbols, int n_symbols)
Parse a name/value pair and set preferences accordingly.
bool_t http_persistent_conns
bool_t enterpress_forces_submit
bool_t parse_embedded_css
int32_t ui_button_highlight_color
int32_t ui_tab_active_bg_color
int32_t ui_selection_color
int32_t white_bg_replacement
bool_t show_extra_warnings
bool_t load_background_images
int penalty_em_dash_right
int32_t ui_tab_active_fg_color
bool_t middle_click_drags_page
bool_t right_click_closes_tab
bool_t adjust_table_min_width
bool_t http_strict_transport_security
bool_t scrollbar_page_mode
int32_t scroll_page_overlap
bool_t contrast_visited_color
bool_t scroll_switches_tabs
int penalty_em_dash_right_2
int stretchability_factor
bool_t scroll_switches_tabs_reverse
bool_t middle_click_opens_new_tab
void a_Url_free(DilloUrl *url)
Free a DilloUrl.
DilloUrl * a_Url_new(const char *url_str, const char *base_url)
Transform (and resolve) an URL string into the respective DilloURL.