summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp39
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;
}
}