diff --git a/GCryptCLI/src/CommandlineInterface.cpp b/GCryptCLI/src/CommandlineInterface.cpp index 2b1d6af..14936d9 100644 --- a/GCryptCLI/src/CommandlineInterface.cpp +++ b/GCryptCLI/src/CommandlineInterface.cpp @@ -105,6 +105,9 @@ void CommandlineInterface::Init(int argc, const char* const* argv) { nupp.RegisterDescription("--puffer-output", "Will digest the entire data before initiating any output."); nupp.RegisterConstraint("--puffer-output", ParamConstraint(true, DATA_TYPE::VOID, {}, false, {})); + nupp.RegisterDescription("--no-newline", "Don't postfix stdout output with a newline"); + nupp.RegisterConstraint("--no-newline", ParamConstraint(true, DATA_TYPE::VOID, {}, false, {})); + /* Now parse */ nupp.Parse(argc, argv); diff --git a/GCryptCLI/src/DataOutputLayer.cpp b/GCryptCLI/src/DataOutputLayer.cpp index 4760ea1..2959af0 100644 --- a/GCryptCLI/src/DataOutputLayer.cpp +++ b/GCryptCLI/src/DataOutputLayer.cpp @@ -24,7 +24,7 @@ void DataOutputLayer::Init() { // Open the file ofs.open( - Configuration::inputFilename, + Configuration::outputFilename, std::ios::out | std::ios::binary ); @@ -102,6 +102,16 @@ void DataOutputLayer::WriteBlock() { *out << " "; } + // If we are finished, and are outputting to stdout, + // and the user didn't specifically opt out, print a newline + if ( + (IsFinished()) && + (Configuration::outputTo == Configuration::OUTPUT_TO::STDOUT) && + (!CommandlineInterface::Get().HasParam("--no-newline")) + ) { + *out << std::endl; + } + } return;