aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/utils/decrypt_bmp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'utils/decrypt_bmp.cpp')
-rw-r--r--utils/decrypt_bmp.cpp32
1 files changed, 16 insertions, 16 deletions
diff --git a/utils/decrypt_bmp.cpp b/utils/decrypt_bmp.cpp
index a68b1d3..fc0b14a 100644
--- a/utils/decrypt_bmp.cpp
+++ b/utils/decrypt_bmp.cpp
@@ -31,7 +31,7 @@ namespace
file::write_file(plaintext_path, bmp.get_buffer(), bmp.get_size());
}
- void decrypt_bmp(const Settings& settings)
+ void decrypt_bmp(const FileSettings& settings)
{
const auto& algorithm = settings.algorithm;
const auto& mode = settings.mode;
@@ -59,30 +59,30 @@ int main(int argc, char** argv)
{
try
{
- CommandLineParser cmd_parser(argv[0]);
+ FileSettings settings{argv[0]};
+
try
{
- const auto settings = cmd_parser.parse(argc, argv);
-
- if (cmd_parser.exit_with_usage())
- {
- std::cout << cmd_parser;
- return 0;
- }
-
- decrypt_bmp(settings);
+ settings.parse(argc, argv);
}
catch (const boost::program_options::error& e)
{
- std::cerr << "Usage error: " << e.what() << "\n";
- std::cerr << cmd_parser;
+ settings.usage_error(e);
return 1;
}
- catch (const aes::Error& e)
+
+ if (settings.exit_with_usage)
{
- std::cerr << e;
- return 1;
+ settings.usage();
+ return 0;
}
+
+ decrypt_bmp(settings);
+ }
+ catch (const aes::Error& e)
+ {
+ std::cerr << e;
+ return 1;
}
catch (const std::exception& e)
{