diff options
| author | Bryce Harrington <bryce@bryceharrington.org> | 2016-02-25 18:48:51 +0000 |
|---|---|---|
| committer | bryce <bryce@bryceharrington.org> | 2016-02-25 18:48:51 +0000 |
| commit | a380bbcafa8d6ef58fa4149db9987d6a69b4b6f0 (patch) | |
| tree | e5f693b9eb36d1a08f1c53e7e0f9a52b8154c0ab /src/inkview.cpp | |
| parent | packaging: Note if there are uncommitted changes when trying to make a release (diff) | |
| download | inkscape-a380bbcafa8d6ef58fa4149db9987d6a69b4b6f0.tar.gz inkscape-a380bbcafa8d6ef58fa4149db9987d6a69b4b6f0.zip | |
inkview: Drop use of obsolete getopt
This lets us drop getopt as a cmake requirement.
Patch from rindolf, thanks!
http://www.shlomifish.org/Files/files/code/inkscape-cmake-get-rid-of-getopt-check-2.diff
(bzr r14668)
Diffstat (limited to 'src/inkview.cpp')
| -rw-r--r-- | src/inkview.cpp | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/src/inkview.cpp b/src/inkview.cpp index aab4b4a20..c0c6f0b2c 100644 --- a/src/inkview.cpp +++ b/src/inkview.cpp @@ -30,10 +30,6 @@ # include "config.h" #endif -#ifdef HAVE_GETOPT_H -#include <getopt.h> -#endif - #include <cstring> #include <sys/stat.h> #include <locale.h> @@ -179,17 +175,22 @@ main (int argc, const char **argv) num_parsed_options = 0; // the list of arguments is in the net line - while ((option = getopt(argc, (char* const* )argv, "t:")) != -1) - { - switch(option) { - case 't': // for timer - // fprintf(stderr, "set timer arg %s\n", optarg ); - ss.timer = atoi(optarg); - num_parsed_options += 2; // 2 because of flag + option + for (int i = 1; i < argc; i++) { + if ((argv[i][0] == '-')) { + if (!strcmp(argv[i], "--")) { break; - case '?': - default: - usage(); + } + else if ((!strcmp(argv[i], "-t"))) { + if (i + 1 >= argc) { + usage(); + } + ss.timer = atoi(argv[i+1]); + num_parsed_options = i+1; + i++; + } + else { + usage(); + } } } |
