diff options
author | Jan Darmochwal | 2010-10-09 11:58:54 +0200 |
---|---|---|
committer | Jan Darmochwal | 2010-10-09 11:58:54 +0200 |
commit | 931822cb32b82594418095a2d1fc13fdb46b9f68 (patch) | |
tree | 0d1ba73a6d94fd5e8d1b0a560adee64d1c89c17d | |
parent | Support for Utf8 in translations (diff) | |
download | vmchooser-931822cb32b82594418095a2d1fc13fdb46b9f68.tar.gz vmchooser-931822cb32b82594418095a2d1fc13fdb46b9f68.tar.xz vmchooser-931822cb32b82594418095a2d1fc13fdb46b9f68.zip |
Return EXIT_SUCCESS or EXIT_FAILURE in main()
-rw-r--r-- | src/main.cpp | 39 |
1 files changed, 24 insertions, 15 deletions
diff --git a/src/main.cpp b/src/main.cpp index 68f92ef..356b0b6 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1,18 +1,20 @@ -#include <QtGui/QApplication> -#include "dialog.h" - -#include <iostream> -#include <stdlib.h> -#include <QTranslator> #include <QMap> #include <QString> #include <QSettings> +#include <QTranslator> #include <QtAlgorithms> +#include <QtGui/QApplication> + +#include <cstdlib> +#include <iostream> +#include <string> + +#include "command_line_options.h" +#include "dialog.h" +#include "globals.h" #include "save_restore_session.h" -#include "xsession.h" #include "vsession.h" -#include "globals.h" -#include "command_line_options.h" +#include "xsession.h" bool myLessThan(Session* a, Session* b) { return *a < *b; @@ -43,17 +45,17 @@ int main(int argc, char *argv[]) { if (cmdOptions.contains("error")) { std::cerr << usage; - return 1; + return EXIT_FAILURE; } if (cmdOptions.contains("usage")) { std::cout << usage; - return 0; + return EXIT_SUCCESS; } if (cmdOptions.contains("version")) { std::cout << version; - return 0; + return EXIT_SUCCESS; } if (cmdOptions.contains("file")) { @@ -61,15 +63,22 @@ int main(int argc, char *argv[]) { if (file.endsWith(".desktop")) { XSession s; - return s.init(file) && s.run(); + if (s.init(file) && s.run()) { + return EXIT_SUCCESS; + } + // TODO: error message + return EXIT_FAILURE; } else if (file.endsWith(".xml")) { // our XML-files can contain multiple sessions // let's just take the first one Session* s(VSession::readXmlFile(file).value(0)); - return s && s->run(); + if (s && s->run()) { + return EXIT_SUCCESS; + } + return EXIT_FAILURE; } else { std::cerr << "not a valid session file" << std::endl; - return 1; + return EXIT_FAILURE; } } |