diff options
author | Carson Howard <cjhoward92@gmail.com> | 2017-10-22 21:23:40 -0700 |
---|---|---|
committer | Carson Howard <tylerw+systemtest@axosoft.com> | 2018-03-27 07:18:31 -0700 |
commit | d2f99e0a7f259511d94a960c54c297db2ec455af (patch) | |
tree | d44e704efe77177a49c2307a9b37542ad166a855 /examples | |
parent | cd39273dbb62d9abf16a08ea4e86efe17ae22b41 (diff) | |
download | libgit2-d2f99e0a7f259511d94a960c54c297db2ec455af.tar.gz |
examples: ls-files: fix compile error
Diffstat (limited to 'examples')
-rw-r--r-- | examples/ls-files.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/examples/ls-files.c b/examples/ls-files.c index eee6842cb..518cc4018 100644 --- a/examples/ls-files.c +++ b/examples/ls-files.c @@ -49,7 +49,7 @@ static void usage(const char *message, const char *arg) exit(1); } -static void parse_options(ls_options *opts, int argc, char *argv[]) +static int parse_options(ls_options *opts, int argc, char *argv[]) { int parsing_files = 0; struct args_info args = ARGS_INFO_INIT; @@ -58,7 +58,7 @@ static void parse_options(ls_options *opts, int argc, char *argv[]) memset(opts, 0, sizeof(ls_options)); if (argc < 2) - return; + return 0; for (args.pos = 1; args.pos < argc; ++args.pos) { char *a = argv[args.pos]; @@ -77,8 +77,11 @@ static void parse_options(ls_options *opts, int argc, char *argv[]) opts->error_unmatch = 1; } else { usage("Unsupported argument", a); + return -1; } } + + return 0; } static int print_paths(ls_options *opts, git_index *index) @@ -113,7 +116,8 @@ int main(int argc, char *argv[]) size_t i = 0; int error; - parse_options(&opts, argc, argv); + if ((error = parse_options(&opts, argc, argv)) < 0) + return error; git_libgit2_init(); |