diff options
author | gramanas <anastasis.gramm2@gmail.com> | 2019-01-24 23:44:58 +0200 |
---|---|---|
committer | gramanas <anastasis.gramm2@gmail.com> | 2019-01-24 23:44:58 +0200 |
commit | 138e95eec2483851a5b5ac2b2ceb0a813dbd49d8 (patch) | |
tree | fc57c6a46de6a7f61bd67de186d1f5fa167ec850 | |
parent | cfa0a7b2bddf7f0ed29b5c0413809ab10153a6bf (diff) | |
download | ck-138e95eec2483851a5b5ac2b2ceb0a813dbd49d8.tar.gz ck-138e95eec2483851a5b5ac2b2ceb0a813dbd49d8.tar.bz2 ck-138e95eec2483851a5b5ac2b2ceb0a813dbd49d8.zip |
Return 0 when printing version info
-rw-r--r-- | src/ck.c | 1 | ||||
-rw-r--r-- | src/clparser.c | 2 | ||||
-rw-r--r-- | src/clparser.h | 1 |
3 files changed, 4 insertions, 0 deletions
@@ -43,6 +43,7 @@ int main(int argc, const char **argv) { /* get user opt */ if (parse_action(argc, argv, &opt)) { + if(opt.version) rc = 0; goto error; } /* If the action is init or help don't load the config, skip to running it*/ diff --git a/src/clparser.c b/src/clparser.c index 3a2a9a6..fbcd3ee 100644 --- a/src/clparser.c +++ b/src/clparser.c @@ -133,6 +133,7 @@ CkAction parser_get_action(const char *name, char *actionName) { static UserOpt make_empty_user_opt() { UserOpt opt; + opt.version = 0; opt.action = CK_WRONG_ACTION; opt.err = PERR_NOERR; opt.confDir = NULL; @@ -293,6 +294,7 @@ int parse_action(int argc, const char **argv, UserOpt *opt) { verbose(); /* handle version info */ if (version()) { + opt->version = 1; return -1; } /* figure what is the config file */ diff --git a/src/clparser.h b/src/clparser.h index 1ba6d00..242f414 100644 --- a/src/clparser.h +++ b/src/clparser.h @@ -53,6 +53,7 @@ typedef enum CkActions CkAction; typedef struct UserOptions UserOpt; struct UserOptions { + int version; ParseError err; CkAction action; char *confDir; |