5 * by JH <jheinonen@bigfoot.com>
7 * Copyright (C) Jaakko Heinonen
13 #include "abook_curses.h"
20 struct conff_node *abook_config;
22 static int rcfile_exist();
23 static void default_options();
28 abook_opt_conff_get_val(char *key)
34 for(tried = 0; tried < 2; ) {
35 if( ( value = conff_get_value(abook_config, key) )
38 default_options(); /* try with defaults */
46 options_get_int(char *key)
51 if( ( value = abook_opt_conff_get_val(key) )
55 if( !strcasecmp(value, "true") )
58 if( !strcasecmp(value, "false") )
61 ret = safe_atoi(value);
67 options_get_str(char *key)
69 return abook_opt_conff_get_val(key);
88 conff_free_nodes(abook_config);
96 * edit your ~/.abook.conf manually
103 return ( (0 == access(SYSWIDE_RCFILE, F_OK)) ||
104 (0 == access(rcfile, F_OK)) );
112 if( (ret = conff_load_file(&abook_config, rcfile,
114 fprintf(stderr, "%s: parse error at line %d\n", rcfile, ret);
118 if( (ret = conff_load_file(&abook_config, SYSWIDE_RCFILE,
119 DONT_REPLACE_KEY )) > 0) {
120 fprintf(stderr, "%s: parse error at line %d\n",
121 SYSWIDE_RCFILE, ret);
129 if( rcfile_exist() ) /* don't overwrite existing config */
132 conff_save_file(abook_config, rcfile);
136 options_add_key(char *key, char *value)
138 const int flags = DONT_REPLACE_KEY;
140 conff_add_key(&abook_config, key, value, flags);
146 options_add_key("autosave", "true");
148 options_add_key("show_all_emails", "true");
149 options_add_key("emailpos", "25");
150 options_add_key("extra_column", "7");
151 options_add_key("extra_alternative", "-1");
152 options_add_key("extrapos", "65");
154 options_add_key("mutt_command", "mutt");
155 options_add_key("mutt_return_all_emails", "true");
157 options_add_key("print_command", "lpr");
159 options_add_key("filesel_sort", "false");
161 options_add_key("www_command", "lynx");
163 options_add_key("address_style", "eu");