aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorgramanas <anastasis.gramm2@gmail.com>2018-10-09 21:08:30 +0300
committergramanas <anastasis.gramm2@gmail.com>2018-10-09 21:08:30 +0300
commit14d030093e599b342acf0e0450bf29c6268d21d7 (patch)
tree0585c98190ca7ae8b096d7095716585c5e16623a /src
parent855c582f5eecaab2cb5637a5157658f7cb71cc1d (diff)
downloadck-14d030093e599b342acf0e0450bf29c6268d21d7.tar.gz
ck-14d030093e599b342acf0e0450bf29c6268d21d7.tar.bz2
ck-14d030093e599b342acf0e0450bf29c6268d21d7.zip
Fix bug with parser
Diffstat (limited to 'src')
-rw-r--r--src/actionparser.c12
-rw-r--r--src/ck.c7
2 files changed, 7 insertions, 12 deletions
diff --git a/src/actionparser.c b/src/actionparser.c
index be96bb3..f348ff6 100644
--- a/src/actionparser.c
+++ b/src/actionparser.c
@@ -378,21 +378,21 @@ int parse_action(int argc, char* argv[], UserOpt *opt) {
/* handle version info */
if (version()) {
- return 1;
+ return -1;
}
/* set verbose level */
verbose();
/* figure what is the config file */
if (get_config(opt)) {
- return 1;
+ return -1;
}
/* If the remaining arguments are < 2
* print help and exit */
- /* if (optNum - pos < 2) { */
- /* print_parser_help(); */
- /* return -1; */
- /* } */
+ if (optNum - pos < 1) {
+ print_parser_help();
+ return -1;
+ }
/* find the action */
determine_action(opt);
diff --git a/src/ck.c b/src/ck.c
index f9a2ad1..a350a5f 100644
--- a/src/ck.c
+++ b/src/ck.c
@@ -39,14 +39,9 @@ int main(int argc, char *argv[]) {
UserOpt opt;
Conf conf = {.vc_dir = NULL, .scrt_dir = NULL};
/* get user opt */
- int rc = parse_action(argc, argv, &opt);
- if (rc < 0) {
+ if (parse_action(argc, argv, &opt)) {
goto error;
}
- else if (rc == 1) {
- goto close;
- }
-
/* If the action is init don't load the config, skip to running init*/
if (opt.action != CKA_INIT) {
/* If the db doesn't exist ck is not initialized in the config