summaryrefslogtreecommitdiffstats
path: root/src/inkview.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/inkview.cpp')
-rw-r--r--src/inkview.cpp29
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();
+ }
}
}