ivi-layermnagement-examples: Add command-line option for surface to EGLWLInputEventEx...
authorJonathan Maw <jonathan.maw@codethink.co.uk>
Wed, 6 Aug 2014 13:53:09 +0000 (13:53 +0000)
committerNobuhiko Tanibata <NOBUHIKO_TANIBATA@xddp.denso.co.jp>
Wed, 12 Nov 2014 23:34:25 +0000 (08:34 +0900)
Signed-off-by: James Thomas <james.thomas@codethink.co.uk>
ivi-layermanagement-examples/EGLWLInputEventExample/src/main.cpp

index 6584c42..685f8f0 100644 (file)
@@ -22,6 +22,7 @@
 #include <string.h>
 #include <signal.h>
 #include <unistd.h>
+#include <getopt.h>
 #include "WLContext.h"
 #include "WLEGLSurface.h"
 #include "WLEyes.h"
@@ -49,6 +50,29 @@ int main(int argc, char **argv)
     argc = argc; // avoid warning
     argv = argv;
 
+
+    // Get command-line options
+    while (true){
+        int c;
+        static struct option opts[] = {
+            {"surface", required_argument, NULL, 's'},
+            {0, 0, 0, 0}
+        };
+
+        c = getopt_long(argc, argv, "s:", opts, NULL);
+
+        if (c == -1)
+            break;
+
+        switch(c){
+        case 's':
+            surfaceId = strtol(optarg, NULL, 0);
+            break;
+        default:
+            fprintf(stderr, "Unrecognized option '%s'\n", optarg);
+        }
+    }
+
     // signal handling
     signal(SIGINT,SigFunc);