diff options
-rw-r--r-- | ivi-layermanagement-examples/EGLWLInputEventExample/src/main.cpp | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/ivi-layermanagement-examples/EGLWLInputEventExample/src/main.cpp b/ivi-layermanagement-examples/EGLWLInputEventExample/src/main.cpp index 6584c42..685f8f0 100644 --- a/ivi-layermanagement-examples/EGLWLInputEventExample/src/main.cpp +++ b/ivi-layermanagement-examples/EGLWLInputEventExample/src/main.cpp @@ -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); |