diff options
Diffstat (limited to 'src/actionparser.c')
-rw-r--r-- | src/actionparser.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/actionparser.c b/src/actionparser.c index 5c6abf7..9ca2867 100644 --- a/src/actionparser.c +++ b/src/actionparser.c @@ -10,6 +10,7 @@ * -------------------------------------------------------------------------- */ #include "ckutil.h" #include "actionparser.h" +#include "confparser.h" #include "ckinfo.h" #include "ckerrlog.h" @@ -236,10 +237,9 @@ void free_user_opt(UserOpt *opt) { list_free(opt->args); } -/* If the used has specified a config file other - * than the default get it now */ +/* find the correct config */ int get_config(UserOpt *opt) { - /* get first token */ + /* If it's a cli option */ if (next_token()) { for (int i = 1; i < atoi(strConfDir[0]) + 1; i++) { if (strcmp(token, strConfDir[i]) == 0) { @@ -262,16 +262,12 @@ int get_config(UserOpt *opt) { return 0; } } - // rewind + /* rewind */ pos = pos - 1; token = opts[pos]; } - char defaultConf[STR_S] = ".ck"; - char * home = getenv("HOME"); - opt->confDir = malloc(strlen(defaultConf) + 1 /* '/' */ + strlen(home) + 1); - str_join_dirname_with_basename(opt->confDir, home, defaultConf); - return 0; + return find_config(opt); } int version() { |