Mercurial > projects > pwm
diff pwm.c @ 29:00d782cb45fa
Read configuration file on startup
author | Guido Berhoerster <guido+pwm@berhoerster.name> |
---|---|
date | Thu, 28 Sep 2017 10:06:59 +0200 |
parents | e3db02d7f1f4 |
children | 2552eec9b913 |
line wrap: on
line diff
--- a/pwm.c Wed Sep 27 19:44:05 2017 +0200 +++ b/pwm.c Thu Sep 28 10:06:59 2017 +0200 @@ -44,6 +44,7 @@ #include "io.h" #include "macro.h" #include "pwfile.h" +#include "pwmrc.h" #include "tok.h" #include "util.h" @@ -365,6 +366,8 @@ ctx.is_interactive = isatty(STDIN_FILENO); + macro_init(&ctx.macro_head); + while (!errflag && (c = getopt(argc, argv, "P:Rh")) != -1) { switch (c) { case 'P': @@ -417,9 +420,12 @@ goto out; } + /* read ~/.pwm/pwmrc */ + if (pwmrc_read(&ctx) != 0) { + goto out; + } + pwfile_init(&ctx); - macro_init(&ctx.macro_head); - fp = fopen(ctx.filename, "r"); if ((fp == NULL) && (errno != ENOENT)) { warn("failed to open password database");