From ca6fba31fbc44e4b4ed6457b16f3f0d2ee28b7f0 Mon Sep 17 00:00:00 2001 From: Georg Baum Date: Fri, 9 Jan 2015 21:43:45 +0100 Subject: [PATCH] Remove direct calls of exit() This is a preparation for using QCoreApplication. --- src/tex2lyx/tex2lyx.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/tex2lyx/tex2lyx.cpp b/src/tex2lyx/tex2lyx.cpp index 8f9d6ae788..dc46770dd9 100644 --- a/src/tex2lyx/tex2lyx.cpp +++ b/src/tex2lyx/tex2lyx.cpp @@ -482,13 +482,13 @@ void read_environment(Parser & p, string const & begin, * has almost all of them listed. For the same reason the reLyX-specific * reLyXre environment is ignored. */ -void read_syntaxfile(FileName const & file_name) +bool read_syntaxfile(FileName const & file_name) { ifdocstream is(file_name.toFilesystemEncoding().c_str()); if (!is.good()) { cerr << "Could not open syntax file \"" << file_name << "\" for reading." << endl; - exit(2); + return false; } // We can use our TeX parser, since the syntax of the layout file is // modeled after TeX. @@ -514,6 +514,7 @@ void read_syntaxfile(FileName const & file_name) } } } + return true; } @@ -1047,9 +1048,11 @@ int main(int argc, char * argv[]) cerr << "Error: Could not find syntax file \"syntax.default\"." << endl; return EXIT_FAILURE; } - read_syntaxfile(system_syntaxfile); + if (!read_syntaxfile(system_syntaxfile)) + return 2; if (!syntaxfile.empty()) - read_syntaxfile(makeAbsPath(syntaxfile)); + if (!read_syntaxfile(makeAbsPath(syntaxfile))) + return 2; // Read the encodings table. FileName const symbols_path = libFileSearch(string(), "unicodesymbols"); -- 2.39.2