diff --git a/oodle-cli.cpp b/oodle-cli.cpp index caf2b44..554b0fe 100644 --- a/oodle-cli.cpp +++ b/oodle-cli.cpp @@ -30,6 +30,7 @@ void usage() { "\n" "Options:\n" " -v Increase Oodle's verbosity. May be specified up to three times.\n" + " -c Only check if the library can be found and used.\n" "\n" "The following environmental variables are recognized:\n" " DLL_SEARCH_PATH: A color (':') separated list of directories to search for the Oodle library. May be relative to the current working directory.\n"; @@ -38,6 +39,7 @@ void usage() { int main(int argc, char* argv[]) { int verbosity = 0; + bool check_lib = FALSE; int i = 1; for (; i < argc; i++) { @@ -51,6 +53,9 @@ int main(int argc, char* argv[]) usage(); return 0; } + else if (strcmp(arg, "-c") == 0) { + check_lib = TRUE; + } else if (strcmp(arg, "-v") == 0) { verbosity++; } @@ -96,12 +101,16 @@ int main(int argc, char* argv[]) return 1; } - auto decompress = (decltype(OodleLZ_Decompress)*)GetProcAddress((HMODULE)hDLL, "OodleLZ_Decompress"); + auto decompress = reinterpret_cast(GetProcAddress((HMODULE)hDLL, "OodleLZ_Decompress")); if (decompress == NULL) { std::cerr << "ERROR: The library is incompatible!\n"; return 1; } + if (check_lib) { + std::cout << "INFO: '" << LIB_FILE << "' found and loaded.\n"; + return 0; + } if (argc - i < 3) { std::cerr << "ERROR: Arguments missing!\n\n";