diff options
author | Gerd Hoffmann <kraxel@redhat.com> | 2020-01-02 12:09:22 +0100 |
---|---|---|
committer | Gerd Hoffmann <kraxel@redhat.com> | 2020-01-02 12:09:22 +0100 |
commit | a90cc2fc89a0ba63888becbe7e09b5b13fd7c48e (patch) | |
tree | aecc8907308674ab482ced0827d9038ae70b4831 | |
parent | ac687a8107d8c830c05fc5fabbe78816ef222a55 (diff) | |
download | drminfo-a90cc2fc89a0ba63888becbe7e09b5b13fd7c48e.tar.gz |
fbinfo: long options
-rw-r--r-- | fbinfo.c | 25 |
1 files changed, 21 insertions, 4 deletions
@@ -21,21 +21,38 @@ static void usage(FILE *fp) { fprintf(fp, "\n" - "usage: fbtest [ options ]\n" + "usage: fbinfo [ options ]\n" "\n" "options:\n" - " -h print this\n" - " -f <nr> pick framebuffer\n" + " -h | --help print this\n" + " -f | --fbdev <nr> pick framebuffer\n" "\n"); } +struct option long_opts[] = { + { + /* --- no argument --- */ + .name = "help", + .has_arg = false, + .val = 'h', + },{ + + /* --- with argument --- */ + .name = "fbdev", + .has_arg = true, + .val = 'f', + },{ + /* end of list */ + } +}; + int main(int argc, char **argv) { int framebuffer = 0; int c; for (;;) { - c = getopt(argc, argv, "hf:"); + c = getopt_long(argc, argv, "hf:", long_opts, NULL); if (c == -1) break; switch (c) { |