From 8b620dc4f532c1aa6f93f23328059676cd91c58d Mon Sep 17 00:00:00 2001 From: Danny Robson Date: Sat, 27 Apr 2019 10:44:33 +1000 Subject: [PATCH] tools/emory: add stub loader executable --- CMakeLists.txt | 14 ++++++++++---- tools/emory.cpp | 45 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 55 insertions(+), 4 deletions(-) create mode 100644 tools/emory.cpp diff --git a/CMakeLists.txt b/CMakeLists.txt index 2de46d7..48937e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,7 +11,7 @@ include_directories(.) ############################################################################### -add_library(emory +add_library(libemory acl.cpp acl.hpp emory/chunk/fwd.cpp @@ -34,8 +34,8 @@ add_library(emory emory/fs/xattr.hpp ) - -target_link_libraries(emory cruft acl) +target_link_libraries(libemory cruft acl) +set_target_properties(libemory PROPERTIES OUTPUT_NAME emory) ############################################################################### @@ -53,5 +53,11 @@ add_subdirectory(cruft/crypto) ############################################################################### foreach (t analyse compare stat) add_executable ("${t}" "tools/${t}.cpp") - target_link_libraries("${t}" emory cruft-crypto cruft) + target_link_libraries ("${t}" libemory cruft-crypto cruft) + set_target_properties ("${t}" PROPERTIES + OUTPUT_NAME "emory-${t}" + ) endforeach() + +add_executable (emory tools/emory.cpp) +target_link_libraries (emory libemory) diff --git a/tools/emory.cpp b/tools/emory.cpp new file mode 100644 index 0000000..04b6206 --- /dev/null +++ b/tools/emory.cpp @@ -0,0 +1,45 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * Copyright 2019 Danny Robson + */ + +#include +#include +#include + +#include + +#include +#include + + +enum { + ARG_SELF, + ARG_CHILD, + + NUM_ARGS +}; + + +static void print_usage (std::ostream &os, int argc, char **argv) +{ + (void)argc; + os << "Usage: " << argv[ARG_SELF] << " [args] ...\n"; +} + + +int main (int argc, char **argv) +{ + if (argc < NUM_ARGS) { + print_usage (std::cerr, argc, argv); + return EXIT_FAILURE; + } + + std::ostringstream os; + os << argv[ARG_SELF] << '-' << argv[ARG_CHILD]; + cruft::posix::error::try_call (execv, os.str ().c_str (), argv + 1); + unreachable (); +} \ No newline at end of file