htpp

htrdr-image post-processing
git clone git://git.meso-star.fr/htpp.git
Log | Files | Refs | README | LICENSE

commit 6d2c37ea82f163aa2ca2ce297aff6b285e36e992
parent 8e0dc049d6251eeca6feaa55319f456c2c494c41
Author: Vincent Forest <vincent.forest@meso-star.com>
Date:   Wed, 13 Sep 2023 16:13:46 +0200

Change the --version option to the -V short option

This makes it compliant with the POSIX getopt function

Diffstat:
Msrc/htpp.c | 21++++++++-------------
1 file changed, 8 insertions(+), 13 deletions(-)

diff --git a/src/htpp.c b/src/htpp.c @@ -334,23 +334,11 @@ static res_T args_init(struct args* args, const int argc, char** argv) { int opt; - int i; res_T res = RES_OK; ASSERT(args && argc && argv); - FOR_EACH(i, 1, argc) { - if(!strcmp(argv[i], "--version")) { - printf("High-Tune: Post-Process %d.%d.%d\n", - HTPP_VERSION_MAJOR, - HTPP_VERSION_MINOR, - HTPP_VERSION_PATCH); - args->quit = 1; - goto exit; - } - } - /* Begin the optstring by ':' to make silent getopt */ - while((opt = getopt(argc, argv, "fhi:m:o:t:v")) != -1) { + while((opt = getopt(argc, argv, "fhi:m:o:t:vV")) != -1) { switch(opt) { case 'f': args->force_overwrite = 1; break; case 'h': @@ -372,6 +360,13 @@ args_init(struct args* args, const int argc, char** argv) if(res == RES_OK && args->nthreads <= 0) res = RES_BAD_ARG; break; case 'v': args->verbose = 1; break; + case 'V': + printf("High-Tune: Post-Process %d.%d.%d\n", + HTPP_VERSION_MAJOR, + HTPP_VERSION_MINOR, + HTPP_VERSION_PATCH); + args->quit = 1; + goto exit; default: res = RES_BAD_ARG; break; } if(res != RES_OK) {