summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 20af5cf)
raw | patch | inline | side by side (parent: 20af5cf)
author | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 18 Aug 2018 09:59:42 +0000 (12:59 +0300) | ||
committer | DeaDDooMER <deaddoomer@deadsoftware.ru> | |
Sat, 18 Aug 2018 09:59:42 +0000 (12:59 +0300) |
main/odcread.cc | patch | blob | history |
diff --git a/main/odcread.cc b/main/odcread.cc
index 9a7f95af5a2a17e27d6275da53e298c16e927252..e6e174899125370fffc9d2bb0ea337e972f3dd56 100644 (file)
--- a/main/odcread.cc
+++ b/main/odcread.cc
}
int main(int argc, char *argv[]) {
- if (argc < 2) {
- return 1;
- }
-
// Set the locale according to the terminal's environment
setlocale(LC_ALL, "");
- std::ifstream in(argv[1], std::ios::in | std::ios::binary);
odc::Store* s;
try {
- s = odc::importDocument(in);
+ if (argc < 2) {
+ s = odc::importDocument(std::cin);
+ } else if (argc = 2) {
+ std::ifstream in(argv[1], std::ios::in | std::ios::binary);
+ s = odc::importDocument(in);
+ } else {
+ return 1;
+ }
} catch (int trap) {
std::cerr << "Exception in parsing file: BlackBox trap no. " << trap << std::endl;
return 2;
// std::cout << s->toPlainText() << std::endl;
// std::cout << std::endl << std::endl;
+ if (s == nullptr) {
+ return 1;
+ }
+
try {
odc::MyVisitor visitor;
s->accept(visitor);