// file : tests/sendmail/driver.cxx -*- C++ -*- // copyright : Copyright (c) 2014-2019 Code Synthesis Ltd // license : MIT; see accompanying LICENSE file #include #ifndef __cpp_lib_modules_ts #include #include #endif // Other includes. #ifdef __cpp_modules_ts #ifdef __cpp_lib_modules_ts import std.core; import std.io; #endif import butl.path; import butl.process; import butl.utility; // operator<<(ostream, exception) import butl.sendmail; import butl.fdstream; import butl.optional; // @@ MOD Clang should not be necessary. import butl.small_vector; // @@ MOD Clang should not be necessary. #else #include #include #include #include #endif using namespace std; using namespace butl; // Usage: argv[0] // int main (int argc, const char* argv[]) try { assert (argc == 2); sendmail sm ([] (const char* c[], std::size_t n) { process::print (cerr, c, n); cerr << endl; }, 2, "", "tests/sendmail/driver", {argv[1]}); sm.out << cin.rdbuf (); sm.out.close (); if (!sm.wait ()) return 1; // Assume diagnostics has been issued. } catch (const system_error& e) { cerr << argv[0] << ": " << e << endl; return 1; }