diff options
| author | Jonathan Bauer | 2011-03-05 16:28:18 +0100 |
|---|---|---|
| committer | Jonathan Bauer | 2011-03-05 16:28:18 +0100 |
| commit | 978f4863eb2e95a9520246c28d18fbc4f340f1a5 (patch) | |
| tree | 8ef652c7beffd2e44b342550a4713ef0a214bd1f /src/CommandLineOptions.cpp | |
| parent | Command line options parsing moved to its own class, in preparation for Settings (diff) | |
| download | fbgui-978f4863eb2e95a9520246c28d18fbc4f340f1a5.tar.gz fbgui-978f4863eb2e95a9520246c28d18fbc4f340f1a5.tar.xz fbgui-978f4863eb2e95a9520246c28d18fbc4f340f1a5.zip | |
misc.
Diffstat (limited to 'src/CommandLineOptions.cpp')
| -rw-r--r-- | src/CommandLineOptions.cpp | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/src/CommandLineOptions.cpp b/src/CommandLineOptions.cpp index fae5c29..06b00ae 100644 --- a/src/CommandLineOptions.cpp +++ b/src/CommandLineOptions.cpp @@ -10,17 +10,13 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]){ // Parse command line arguments. int longIndex = 0; - // Declare the short options as a char*, these have exactly one - followed by letter from optString. - // For example: ./fbbrowser -h - // Declare the long options in the const struct, these have two - followed by a string found in longOpts[]. - // Same as: ./fbbrowser --help - // Note: I included 'qwsdiplay' here to not have errors, when setting fbbrowser to be the server app aswell. - static const char *optString = "hqwsdiplay"; + // TODO: clean output... + static const char *optString = "uh"; static const struct option longOpts[] = { // If an option requires parameters, write this number instead of no_argument. // The last argument, is the corresponding char to the option string. - {"debug", no_argument, NULL, 'D'}, + {"url", required_argument, NULL, 'u'}, {"help", no_argument, NULL, 'h'} }; // getopt_long returns the index of the next argument to be read, -1 if there are no more arguments. @@ -29,9 +25,12 @@ CommandLineOptions::CommandLineOptions(int argc, char * const argv[]){ { switch(opt) { - case 'h': - //printUsage(); + case 'u': + options.insert("url", optarg); break; + case 'h': + //printUsage(); + break; } opt = getopt_long(argc, argv, optString, longOpts, &longIndex); } |
