diff options
author | Egor Tensin <Egor.Tensin@gmail.com> | 2015-08-04 04:37:12 +0300 |
---|---|---|
committer | Egor Tensin <Egor.Tensin@gmail.com> | 2015-08-04 04:37:12 +0300 |
commit | 0c593583dccd88e90450972e6a1b9e6bc67e0911 (patch) | |
tree | d38de5fb6255fec9424bf9694c1cf3fcfd8b9c39 /utils/decrypt_bmp.cpp | |
parent | test/toolkit.py: fix utility names (diff) | |
download | aes-tools-0c593583dccd88e90450972e6a1b9e6bc67e0911.tar.gz aes-tools-0c593583dccd88e90450972e6a1b9e6bc67e0911.zip |
utils: bugfix & refactoring
Diffstat (limited to 'utils/decrypt_bmp.cpp')
-rw-r--r-- | utils/decrypt_bmp.cpp | 17 |
1 files changed, 12 insertions, 5 deletions
diff --git a/utils/decrypt_bmp.cpp b/utils/decrypt_bmp.cpp index 3b075a4..aafde38 100644 --- a/utils/decrypt_bmp.cpp +++ b/utils/decrypt_bmp.cpp @@ -6,7 +6,7 @@ * See LICENSE.txt for details. */ -#include "file_common.hpp" +#include "file_cmd_parser.hpp" #include <aesni/all.h> @@ -21,8 +21,8 @@ #include <exception> #include <fstream> #include <iostream> +#include <iterator> #include <string> -#include <utility> #include <vector> #include <Windows.h> @@ -175,13 +175,20 @@ int main(int argc, char** argv) try { CommandLineParser cmd_parser("decrypt_bmp.exe"); + cmd_parser.parse(argc, argv); - if (!cmd_parser.parse_options(argc, argv)) + if (cmd_parser.requested_help()) + { + std::cout << cmd_parser; return 0; + } + + std::deque<std::string> args{ std::make_move_iterator(cmd_parser.args.begin()), + std::make_move_iterator(cmd_parser.args.end()) }; - if (!decrypt_bmp(cmd_parser.get_algorithm(), cmd_parser.get_mode(), cmd_parser.get_args())) + if (!decrypt_bmp(cmd_parser.algorithm, cmd_parser.mode, args)) { - cmd_parser.print_usage(); + std::cout << cmd_parser; return 1; } |