Skip to content

Commit

Permalink
args: add version command
Browse files Browse the repository at this point in the history
  • Loading branch information
ConnorRigby committed Oct 16, 2022
1 parent b162e5d commit f728d4b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
9 changes: 5 additions & 4 deletions src/args.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ size_t getCommandArgs(int argc, char** argv, ecudump_args_t* args)
if (c == -1) break;
switch(c) {
case 0: {
if (strcmp(long_options[option_index].name, "version") == 0) {
fprintf(stderr, "%s Version 0.9.0\n", argv[0] ? argv[0] : "ecudump");
return 0;
}

if(strcmp(long_options[option_index].name, "start-address") == 0) {
signed long long ret = decodeHex(optarg, 0xffffffff);
if(ret < 0) {
Expand Down Expand Up @@ -192,10 +197,6 @@ size_t getCommandArgs(int argc, char** argv, ecudump_args_t* args)
args->verbose = true;
break;
}
if(strcmp(long_options[option_index].name, "version") == 0) {
fprintf(stderr, "ecudump version = 0.2.0");
break;
}

if(strcmp(long_options[option_index].name, "version") == 0) {
command = 0;
Expand Down
2 changes: 2 additions & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,8 @@ int main(int argc, char** argv)
chunkRemainder
);
}
if (command == 0)
return 1;

if (j2534Initialize()) {
LOGE(TAG, "j2534Initialize() failed");
Expand Down

0 comments on commit f728d4b

Please sign in to comment.