From 1f30b63db9aeab2332d269939c46c2fd9a0f0f8d Mon Sep 17 00:00:00 2001 From: gramanas Date: Tue, 8 May 2018 03:32:44 +0300 Subject: Some work on lists --- src/actions.c | 38 +++++++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 15 deletions(-) (limited to 'src/actions.c') 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); -- cgit v1.2.3