Note that this is the infrastructure, but all relevant get_opt_* calls must be changed to pass the session so that the domain-specific options are looked up.
Add @want_domain parameter to parse_set_common and read in the domain-name if the flag is set.
Add parse_set_domain wrapper for parse_set_common.
Add "set_domain" configuration directive with the following syntax: set_domain domain option = value
Modify create_config_string and smart_config_output_fn to spit out domain-specific option trees.
Add @smart_config_output_fn_domain global variable to facilitate this.
Define structure domain_tree and define list @domain_trees.
Add routine get_domain_tree to find or, if necessary, create the shadow tree for the given domain name.
Add routine get_domain_option search for an option in all domain shadow-trees and return the option in the best matching domain tree.
Modify get_opt_ to use get_domain_option to check for domain-specific options.
Add clean-up routine done_domain_trees, called on exit, to free any domain trees.
The parsing in parse_set and parse_unset saves, overwrites with a NUL, and restores a character in the string that is being parsed. If there is a malloc failure between overwriting and restoring, the restore is not done. This commit changes that behaviour to restore before returning.
straconcat reads the args with va_arg(ap, const unsigned char *),
and the NULL macro may have the wrong type (e.g. int).
Many places pass string literals of type char * to straconcat. This
is in principle also a violation, but I'm ignoring it for now because
if it becomes a problem with some C implementation, then so will the
use of unsigned char * with printf "%s", which is so widespread in
ELinks that I'm not going to try fixing it now.