aboutsummaryrefslogtreecommitdiffstats
path: root/src/confparser.c
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-05-14 01:14:15 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-05-14 01:14:15 +0300
commit68efbf97390ddac355c3b54a5d825e74fb4b208d (patch)
treee5884bf3650708c683b134792db3756d28c5b697 /src/confparser.c
parentfb7e3e1352aeca03909ae3720c8cae90fcd57186 (diff)
downloadck-68efbf97390ddac355c3b54a5d825e74fb4b208d.tar.gz
ck-68efbf97390ddac355c3b54a5d825e74fb4b208d.tar.bz2
ck-68efbf97390ddac355c3b54a5d825e74fb4b208d.zip
small fixes
Diffstat (limited to 'src/confparser.c')
-rw-r--r--src/confparser.c18
1 files changed, 6 insertions, 12 deletions
diff --git a/src/confparser.c b/src/confparser.c
index 2d17c81..5754dfa 100644
--- a/src/confparser.c
+++ b/src/confparser.c
@@ -139,16 +139,13 @@ void free_conf(Conf *conf) {
}
int init_create_config_file(UserOpt *opt) {
- list_rewind(opt->args);
-
- if (!util_file_exists(list_get(opt->args))) {
- printf("Version control directory: %s\ndoes not exist.\n", list_get(opt->args));
+ if (!util_file_exists(list_get_at(opt->args, 0))) {
+ printf("Version control directory: %s\ndoes not exist.\n", list_get_at(opt->args, 0));
return 1;
}
- list_next(opt->args);
- if (!util_file_exists(list_get(opt->args))) {
- printf("Secret directory: %s\ndoes not exist.\n", list_get(opt->args));
+ if (!util_file_exists(list_get_at(opt->args, 1))) {
+ printf("Secret directory: %s\ndoes not exist.\n", list_get_at(opt->args, 1));
return 1;
}
@@ -163,20 +160,17 @@ int init_create_config_file(UserOpt *opt) {
return 1;
}
- list_rewind(opt->args);
char tmp[200];
strcpy(tmp, "version_control_dir = ");
- strcat(tmp, list_get(opt->args));
+ strcat(tmp, list_get_at(opt->args, 0));
strcat(tmp, "\n");
fputs(tmp, f);
- list_next(opt->args);
strcpy(tmp, "secret_dir = ");
- strcat(tmp, list_get(opt->args));
+ strcat(tmp, list_get_at(opt->args, 1));
strcat(tmp, "\n");
fputs(tmp, f);
fclose(f);
- list_rewind(opt->args);
return 0;
}