diff options
author | Jonathan Bauer | 2011-06-20 17:10:11 +0200 |
---|---|---|
committer | Jonathan Bauer | 2011-06-20 17:10:11 +0200 |
commit | aa2cee16810277212dd8e9354a63cfe572207158 (patch) | |
tree | 0e96960f957c0b8f9f9d8a3ffd67a3707d0c4d32 /src | |
parent | minor changes... (diff) | |
download | fbsplash-aa2cee16810277212dd8e9354a63cfe572207158.tar.gz fbsplash-aa2cee16810277212dd8e9354a63cfe572207158.tar.xz fbsplash-aa2cee16810277212dd8e9354a63cfe572207158.zip |
started command line parsing..
Diffstat (limited to 'src')
-rw-r--r-- | src/main.cpp | 31 |
1 files changed, 30 insertions, 1 deletions
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(); } |