blob: e73940bda925501ff509d0e5b26dfa6bc14f4853 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
// file : tests/sendmail/driver.cxx -*- C++ -*-
// license : MIT; see accompanying LICENSE file
#include <cassert>
#ifndef __cpp_lib_modules_ts
#include <iostream>
#include <system_error>
#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 <libbutl/path.mxx>
#include <libbutl/process.mxx>
#include <libbutl/utility.mxx>
#include <libbutl/sendmail.mxx>
#endif
using namespace std;
using namespace butl;
// Usage: argv[0] <to>
//
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;
}
|