diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2018-05-08 03:32:44 +0300 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2018-05-08 03:32:44 +0300 |
commit | 1f30b63db9aeab2332d269939c46c2fd9a0f0f8d (patch) | |
tree | a0ec8aae21f42be4716ecb6fa5b685583c01e2cd /src/actions.c | |
parent | 3a3424774944a421e1b93cbaf533a3500a4d613c (diff) | |
download | ck-1f30b63db9aeab2332d269939c46c2fd9a0f0f8d.tar.gz ck-1f30b63db9aeab2332d269939c46c2fd9a0f0f8d.tar.bz2 ck-1f30b63db9aeab2332d269939c46c2fd9a0f0f8d.zip |
Some work on lists
Diffstat (limited to 'src/actions.c')
-rw-r--r-- | src/actions.c | 38 |
1 files changed, 23 insertions, 15 deletions
diff --git a/src/actions.c b/src/actions.c index 3a4d8ac..e72e2b5 100644 --- a/src/actions.c +++ b/src/actions.c @@ -9,6 +9,7 @@ * * -------------------------------------------------------------------------- */ #include "actions.h" +#include "actionhelper.h" #include "dblayer.h" #include "ckutil.h" #include "engine.h" @@ -57,21 +58,16 @@ AddOpt make_add_options(const int argc, char **argv) { return addOpt; } } else if (argc == 4) { - if (strcmp(argv[2], "-s") == 0) { - addOpt.secret = 1; - } else if (strcmp(argv[2], "-p") == 0) { - addOpt.prime = 1; - } else { - addOpt.err = ADD_ERR_WRONG_FLAGS; - return addOpt; - } - if (strcmp(argv[3], "-s") == 0) { - addOpt.secret = 1; - } else if (strcmp(argv[3], "-p") == 0) { - addOpt.prime = 1; - } else { - addOpt.err = ADD_ERR_WRONG_FLAGS; - return addOpt; + int i; + for (i = 2; i < 4; i++) { + if (strcmp(argv[i], "-s") == 0) { + addOpt.secret = 1; + } else if (strcmp(argv[i], "-p") == 0) { + addOpt.prime = 1; + } else { + addOpt.err = ADD_ERR_WRONG_FLAGS; + return addOpt; + } } } return addOpt; @@ -151,6 +147,18 @@ int run_EDIT(UserOpt *opt, Conf *conf) { close_DB(&db); return 0; } + } else { + close_DB(&db); + char confName[STR_L]; + switch (edit_get_config_or_suggestions(opt->argc, + opt->argv, + confName)) { + case ERC_OK: + return 0; + case ERC_ERR: + return 1; + } + return 1; } close_DB(&db); |