diff options
author | Anastasis Grammenos <anastasis.gramm2@gmail.com> | 2018-10-16 23:39:34 +0300 |
---|---|---|
committer | Anastasis Grammenos <anastasis.gramm2@gmail.com> | 2018-10-16 23:39:34 +0300 |
commit | 37623394d364b55aa8f949fd8aa51edf65d9da10 (patch) | |
tree | 2d5f2e11cbbc4cbcaa51f2ea6bc1fc51cb9a99c2 /src/confparser.c | |
parent | c67ce86b74fdd06a8779cff14c75fd78d1a50a31 (diff) | |
download | ck-37623394d364b55aa8f949fd8aa51edf65d9da10.tar.gz ck-37623394d364b55aa8f949fd8aa51edf65d9da10.tar.bz2 ck-37623394d364b55aa8f949fd8aa51edf65d9da10.zip |
move init helper to the helper file
Diffstat (limited to 'src/confparser.c')
-rw-r--r-- | src/confparser.c | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/src/confparser.c b/src/confparser.c index 2a11467..2463d79 100644 --- a/src/confparser.c +++ b/src/confparser.c @@ -142,42 +142,3 @@ void free_conf(Conf *conf) { CONFIG_VARIABLES_TABLE #undef X } - -int init_create_config_file(UserOpt *opt) { - char absVCdir[STR_L]; - if (!util_file_exists(list_get_at(opt->args, 0), absVCdir)) { - ERR("Version control directory: %s\ndoes not exist.\n", list_get_at(opt->args, 0)); - return 1; - } - - char absSRdir[STR_L]; - if (!util_file_exists(list_get_at(opt->args, 1), absSRdir)) { - ERR("Secret directory: %s\ndoes not exist.\n", list_get_at(opt->args, 1)); - return 1; - } - - if (!util_file_exists(opt->confDir, NULL)) { - util_mkdir(opt->confDir); - } - - char confName[STR_L]; - make_config_name(confName, opt->confDir); - FILE *f; - if ((f = fopen(confName, "w")) == NULL) { - return 1; - } - - char tmp[200]; - strcpy(tmp, "version_control_dir = "); - strcat(tmp, absVCdir); - strcat(tmp, "\n"); - fputs(tmp, f); - - strcpy(tmp, "secret_dir = "); - strcat(tmp, absSRdir); - strcat(tmp, "\n"); - fputs(tmp, f); - - fclose(f); - return 0; -} |