aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2015-12-27 01:28:16 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2015-12-27 01:28:16 +0300
commit80395ff9164a0d10d3d0a21db51030f653d0fa1a (patch)
tree6d1fedd49ea6669282c74f77d07108b780c435b8
parentcode style (diff)
downloadaes-tools-80395ff9164a0d10d3d0a21db51030f653d0fa1a.tar.gz
aes-tools-80395ff9164a0d10d3d0a21db51030f653d0fa1a.zip
utils: Boost.Filesystem for usage messages
-rw-r--r--README.md4
-rw-r--r--utils/CMakeLists.txt2
-rw-r--r--utils/block_cmd_parser.hpp5
-rw-r--r--utils/decrypt_block.cpp2
-rw-r--r--utils/decrypt_bmp.cpp2
-rw-r--r--utils/decrypt_file.cpp2
-rw-r--r--utils/encrypt_block.cpp2
-rw-r--r--utils/encrypt_bmp.cpp2
-rw-r--r--utils/encrypt_file.cpp2
-rw-r--r--utils/file_cmd_parser.hpp5
10 files changed, 15 insertions, 13 deletions
diff --git a/README.md b/README.md
index 09361a8..dfc0973 100644
--- a/README.md
+++ b/README.md
@@ -11,8 +11,8 @@ I've used the compiler and the assembler shipped with Visual Studio Express
You can generate the solution using CMake and build it using Visual Studio.
Some of the utilities also depend on a few Boost libraries.
-In particular, Boost.ProgramOptions has to be built prior to building these
-utilities.
+In particular, Boost.Filesystem, Boost.ProgramOptions, and Boost.System has to
+be built prior to building these utilities.
To enable CMake to find Boost libraries, pass the path to the root Boost
directory like this:
diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
index 4643c5e..97ecfb6 100644
--- a/utils/CMakeLists.txt
+++ b/utils/CMakeLists.txt
@@ -1,4 +1,4 @@
-find_package(Boost REQUIRED COMPONENTS program_options)
+find_package(Boost REQUIRED COMPONENTS filesystem program_options system)
add_executable(util_encrypt_block encrypt_block.cpp block_cmd_parser.hpp block_dumper.hpp data_parsers.hpp)
target_include_directories(util_encrypt_block PRIVATE ${Boost_INCLUDE_DIRS})
diff --git a/utils/block_cmd_parser.hpp b/utils/block_cmd_parser.hpp
index 708c241..3468d58 100644
--- a/utils/block_cmd_parser.hpp
+++ b/utils/block_cmd_parser.hpp
@@ -13,6 +13,7 @@
#include <aesnixx/all.hpp>
#include <boost/config.hpp>
+#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include <ostream>
@@ -42,8 +43,8 @@ namespace
class CommandLineParser
{
public:
- CommandLineParser(const char* prog_name)
- : prog_name(prog_name)
+ CommandLineParser(const std::string& argv0)
+ : prog_name(boost::filesystem::path(argv0).filename().string())
, options("Options")
{
namespace po = boost::program_options;
diff --git a/utils/decrypt_block.cpp b/utils/decrypt_block.cpp
index b9f9d19..30409e0 100644
--- a/utils/decrypt_block.cpp
+++ b/utils/decrypt_block.cpp
@@ -185,7 +185,7 @@ int main(int argc, char** argv)
{
try
{
- CommandLineParser cmd_parser("decrypt_block.exe");
+ CommandLineParser cmd_parser(argv[0]);
try
{
cmd_parser.parse(argc, argv);
diff --git a/utils/decrypt_bmp.cpp b/utils/decrypt_bmp.cpp
index 559b5d5..a326828 100644
--- a/utils/decrypt_bmp.cpp
+++ b/utils/decrypt_bmp.cpp
@@ -129,7 +129,7 @@ int main(int argc, char** argv)
{
try
{
- CommandLineParser cmd_parser("decrypt_bmp.exe");
+ CommandLineParser cmd_parser(argv[0]);
try
{
cmd_parser.parse(argc, argv);
diff --git a/utils/decrypt_file.cpp b/utils/decrypt_file.cpp
index 092b249..96aec62 100644
--- a/utils/decrypt_file.cpp
+++ b/utils/decrypt_file.cpp
@@ -114,7 +114,7 @@ int main(int argc, char** argv)
{
try
{
- CommandLineParser cmd_parser("decrypt_file.exe");
+ CommandLineParser cmd_parser(argv[0]);
try
{
cmd_parser.parse(argc, argv);
diff --git a/utils/encrypt_block.cpp b/utils/encrypt_block.cpp
index 01ea745..022c237 100644
--- a/utils/encrypt_block.cpp
+++ b/utils/encrypt_block.cpp
@@ -185,7 +185,7 @@ int main(int argc, char** argv)
{
try
{
- CommandLineParser cmd_parser("encrypt_block.exe");
+ CommandLineParser cmd_parser(argv[0]);
try
{
cmd_parser.parse(argc, argv);
diff --git a/utils/encrypt_bmp.cpp b/utils/encrypt_bmp.cpp
index 978b954..2f019d8 100644
--- a/utils/encrypt_bmp.cpp
+++ b/utils/encrypt_bmp.cpp
@@ -129,7 +129,7 @@ int main(int argc, char** argv)
{
try
{
- CommandLineParser cmd_parser("encrypt_bmp.exe");
+ CommandLineParser cmd_parser(argv[0]);
try
{
cmd_parser.parse(argc, argv);
diff --git a/utils/encrypt_file.cpp b/utils/encrypt_file.cpp
index 9b5406c..d1dd5e8 100644
--- a/utils/encrypt_file.cpp
+++ b/utils/encrypt_file.cpp
@@ -114,7 +114,7 @@ int main(int argc, char** argv)
{
try
{
- CommandLineParser cmd_parser("encrypt_file.exe");
+ CommandLineParser cmd_parser(argv[0]);
try
{
cmd_parser.parse(argc, argv);
diff --git a/utils/file_cmd_parser.hpp b/utils/file_cmd_parser.hpp
index 15b6a45..cf5d188 100644
--- a/utils/file_cmd_parser.hpp
+++ b/utils/file_cmd_parser.hpp
@@ -13,6 +13,7 @@
#include <aesnixx/all.hpp>
#include <boost/config.hpp>
+#include <boost/filesystem.hpp>
#include <boost/program_options.hpp>
#include <ostream>
@@ -48,8 +49,8 @@ namespace
class CommandLineParser
{
public:
- CommandLineParser(const char* prog_name)
- : prog_name(prog_name)
+ CommandLineParser(const std::string& argv0)
+ : prog_name(boost::filesystem::path(argv0).filename().string())
, options("Options")
{
namespace po = boost::program_options;