summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJonathan Bauer2011-06-20 17:10:11 +0200
committerJonathan Bauer2011-06-20 17:10:11 +0200
commitaa2cee16810277212dd8e9354a63cfe572207158 (patch)
tree0e96960f957c0b8f9f9d8a3ffd67a3707d0c4d32
parentminor changes... (diff)
downloadfbsplash-aa2cee16810277212dd8e9354a63cfe572207158.tar.gz
fbsplash-aa2cee16810277212dd8e9354a63cfe572207158.tar.xz
fbsplash-aa2cee16810277212dd8e9354a63cfe572207158.zip
started command line parsing..
-rwxr-xr-xrun.sh3
-rw-r--r--src/main.cpp31
2 files changed, 32 insertions, 2 deletions
diff --git a/run.sh b/run.sh
index 1c3d15f..3baee26 100755
--- a/run.sh
+++ b/run.sh
@@ -1,5 +1,6 @@
#!/bin/bash
-# set your QT version here
+# All args are passed to fbsplash.
+# Set your QT version here
QT_VERSION=4.7.2
# qvfb's width
diff --git a/src/main.cpp b/src/main.cpp
index fd171ce..cd1f5e0 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,13 +1,42 @@
#include <QApplication>
+#include <getopt.h>
#include "fbsplash.h"
+void printHelp(){
+ QTextStream qout(stdout);
+ qout << "Usage: ./fbsplash [OPTIONS]\n";
+ qout << "Options:\n";
+ qout << "-h, --help " << "Prints this help.\n";
+ qout.flush();
+ exit(EXIT_SUCCESS);
+}
+
int main(int argc, char *argv[]) {
QApplication app(argc, argv, QApplication::GuiServer);
app.setOrganizationName("OpenSLX");
app.setApplicationName("fbsplash");
- fbsplash bs;
+ // Command line arguements parsing
+ QMap<QString, QString> clOpts;
+ int longIndex = 0;
+ static const char *optString = "c:u:d:s:t:D:hl:";
+ static const struct option longOpts[] = { { "help", no_argument, NULL, 'h' } };
+ int opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
+ while (opt != -1) {
+ switch (opt) {
+ case 'h':
+ clOpts.insert("help", "help");
+ break;
+ }
+ opt = getopt_long(argc, argv, optString, longOpts, &longIndex);
+ }
+ if (clOpts.contains("help"))
+ printHelp();
+
+
+ // fbsplash init
+ fbsplash bs;
app.exec();
}