author | František Kučera <franta-hg@frantovo.cz> |
Wed, 30 Oct 2019 16:47:42 +0100 | |
branch | v_0 |
changeset 9 | c28c6eda540f |
parent 8 | 9c8c20c3bd64 |
child 15 | a55f4c95f756 |
permissions | -rw-r--r-- |
0 | 1 |
/** |
2 |
* Relational pipes |
|
3 |
* Copyright © 2019 František Kučera (Frantovo.cz, GlobalCode.info) |
|
4 |
* |
|
5 |
* This program is free software: you can redistribute it and/or modify |
|
6 |
* it under the terms of the GNU General Public License as published by |
|
8
9c8c20c3bd64
fix license version: GNU GPLv3
František Kučera <franta-hg@frantovo.cz>
parents:
0
diff
changeset
|
7 |
* the Free Software Foundation, version 3 of the License. |
0 | 8 |
* |
9 |
* This program is distributed in the hope that it will be useful, |
|
10 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
11 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
12 |
* GNU General Public License for more details. |
|
13 |
* |
|
14 |
* You should have received a copy of the GNU General Public License |
|
15 |
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
16 |
*/ |
|
17 |
#include <cstdlib> |
|
18 |
#include <fstream> |
|
19 |
#include <memory> |
|
20 |
#include <regex> |
|
21 |
#include <algorithm> |
|
22 |
#include <unistd.h> |
|
23 |
||
24 |
#include <relpipe/writer/RelationalWriter.h> |
|
25 |
#include <relpipe/writer/RelpipeWriterException.h> |
|
26 |
#include <relpipe/writer/Factory.h> |
|
27 |
#include <relpipe/writer/TypeId.h> |
|
28 |
||
29 |
#include <relpipe/cli/CLI.h> |
|
30 |
||
31 |
#include "RecfileCommand.h" |
|
32 |
||
33 |
using namespace relpipe::cli; |
|
34 |
using namespace relpipe::writer; |
|
35 |
using namespace relpipe::in::recfile; |
|
36 |
||
37 |
int main(int argc, char** argv) { |
|
38 |
setlocale(LC_ALL, ""); |
|
39 |
CLI::untieStdIO(); |
|
40 |
CLI cli(argc, argv); |
|
41 |
||
42 |
int resultCode = CLI::EXIT_CODE_UNEXPECTED_ERROR; |
|
43 |
||
44 |
try { |
|
45 |
RecfileCommand command; |
|
46 |
command.process(cin, cout); |
|
47 |
resultCode = CLI::EXIT_CODE_SUCCESS; |
|
48 |
} catch (RelpipeWriterException& e) { |
|
49 |
fwprintf(stderr, L"Caught Writer exception: %ls\n", e.getMessge().c_str()); |
|
50 |
fwprintf(stderr, L"Debug: Input stream: eof=%ls, lastRead=%d\n", (cin.eof() ? L"true" : L"false"), cin.gcount()); |
|
51 |
resultCode = CLI::EXIT_CODE_DATA_ERROR; |
|
52 |
} |
|
53 |
||
54 |
return resultCode; |
|
55 |
} |