summaryrefslogtreecommitdiff
path: root/src/vars.c
diff options
context:
space:
mode:
authorLukas Fleischer <calcurse@cryptocrack.de>2011-11-04 15:48:36 +0100
committerLukas Fleischer <calcurse@cryptocrack.de>2011-11-14 11:08:14 +0100
commit41c33eeb44d1b1a4b476810757f7b91032950439 (patch)
tree2f38da227b9f554d0eab35fdb7c8cfd18e9d88d2 /src/vars.c
parent14b6ae79a25106501a30693889b1c03abd56c8c1 (diff)
downloadcalcurse-41c33eeb44d1b1a4b476810757f7b91032950439.zip
Use a global configuration variable
This is one of the few valid use cases for a global variable. No need to make it pseudo-local and pass it from one function to another. Signed-off-by: Lukas Fleischer <calcurse@cryptocrack.de>
Diffstat (limited to 'src/vars.c')
-rw-r--r--src/vars.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/vars.c b/src/vars.c
index 5155683..10c87a0 100644
--- a/src/vars.c
+++ b/src/vars.c
@@ -102,6 +102,9 @@ char path_cpid[] = "";
char path_dpid[] = "";
char path_dmon_log[] = "";
+/* Variable to store global configuration. */
+struct conf conf;
+
/* Variable to handle pads. */
struct pad apad;
@@ -115,20 +118,20 @@ struct dmon_conf dmon;
* Variables init
*/
void
-vars_init (struct conf *conf)
+vars_init (void)
{
char *ed, *pg;
/* Variables for user configuration */
- conf->confirm_quit = 1;
- conf->confirm_delete = 1;
- conf->auto_save = 1;
- conf->auto_gc = 0;
- conf->periodic_save = 0;
- conf->skip_system_dialogs = 0;
- conf->skip_progress_bar = 0;
- strncpy (conf->output_datefmt, "%D", 3);
- conf->input_datefmt = 1;
+ conf.confirm_quit = 1;
+ conf.confirm_delete = 1;
+ conf.auto_save = 1;
+ conf.auto_gc = 0;
+ conf.periodic_save = 0;
+ conf.skip_system_dialogs = 0;
+ conf.skip_progress_bar = 0;
+ strncpy (conf.output_datefmt, "%D", 3);
+ conf.input_datefmt = 1;
/* Default external editor and pager */
ed = getenv ("VISUAL");
@@ -136,12 +139,12 @@ vars_init (struct conf *conf)
ed = getenv ("EDITOR");
if (ed == NULL || ed[0] == '\0')
ed = DEFAULT_EDITOR;
- conf->editor = ed;
+ conf.editor = ed;
pg = getenv ("PAGER");
if (pg == NULL || pg[0] == '\0')
pg = DEFAULT_PAGER;
- conf->pager = pg;
+ conf.pager = pg;
wins_set_layout (1);