aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGerd Hoffmann <kraxel@redhat.com>2020-01-02 12:39:28 +0100
committerGerd Hoffmann <kraxel@redhat.com>2020-01-02 12:39:28 +0100
commitad6c3b36bdc00ecee24c84c2ddf2537786cdd360 (patch)
treed5407903dfdffe8fcd6397271cca8c5943300814
parenta90cc2fc89a0ba63888becbe7e09b5b13fd7c48e (diff)
downloaddrminfo-ad6c3b36bdc00ecee24c84c2ddf2537786cdd360.tar.gz
fbtest: long options
-rw-r--r--fbtest.c41
1 files changed, 35 insertions, 6 deletions
diff --git a/fbtest.c b/fbtest.c
index e946c3b..a8aa930 100644
--- a/fbtest.c
+++ b/fbtest.c
@@ -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) {