diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2020-01-02 12:39:28 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-01-02 12:39:28 +0100 |
commit | ad6c3b36bdc00ecee24c84c2ddf2537786cdd360 (patch) | |
tree | d5407903dfdffe8fcd6397271cca8c5943300814 | |
parent | a90cc2fc89a0ba63888becbe7e09b5b13fd7c48e (diff) | |
download | drminfo-ad6c3b36bdc00ecee24c84c2ddf2537786cdd360.tar.gz |
fbtest: long options
-rw-r--r-- | fbtest.c | 41 |
1 files changed, 35 insertions, 6 deletions
@@ -64,14 +64,43 @@ static void usage(FILE *fp) "usage: fbtest [ options ]\n" "\n" "options:\n" - " -h print this\n" - " -a autotest mode (don't print hardware info)\n" - " -f <nr> pick framebuffer\n" - " -s <secs> set sleep time (default: 60)\n" - " -i <file> load and display image <file>\n" + " -h | --help print this\n" + " -a | --autotest autotest mode (don't print hardware info)\n" + " -f | --fbdev <nr> pick framebuffer\n" + " -s | --sleep <secs> set sleep time (default: 60)\n" + " -i | --image <file> load and display image <file>\n" "\n"); } +struct option long_opts[] = { + { + /* --- no argument --- */ + .name = "help", + .has_arg = false, + .val = 'h', + },{ + .name = "autotest", + .has_arg = false, + .val = 'a', + },{ + + /* --- with argument --- */ + .name = "fbdev", + .has_arg = true, + .val = 'f', + },{ + .name = "sleep", + .has_arg = true, + .val = 's', + },{ + .name = "image", + .has_arg = true, + .val = 'i', + },{ + /* end of list */ + } +}; + int main(int argc, char **argv) { int framebuffer = 0; @@ -80,7 +109,7 @@ int main(int argc, char **argv) int c; for (;;) { - c = getopt(argc, argv, "has:i:f:"); + c = getopt_long(argc, argv, "has:i:f:", long_opts, NULL); if (c == -1) break; switch (c) { |