From: Bastian Dehn Date: Wed, 24 Sep 2025 08:45:14 +0000 (+0200) Subject: add long opts X-Git-Url: https://gitweb.hhaalo.de/?a=commitdiff_plain;h=d2e315e4265f3876a688e78eeb1fc277e1656b75;p=discspan.git add long opts --- diff --git a/src/discspan.c b/src/discspan.c index 1b631b7..1d29a64 100644 --- a/src/discspan.c +++ b/src/discspan.c @@ -58,9 +58,26 @@ int main(int argc, char* argv[]) char* output = NULL; uint64_t split = 0; - uint32_t c = 0; - while ((c = getopt(argc, argv, ":59bcf:hi:o:v")) != -1) { - switch (c) { + struct option loption[] = { + { "input", required_argument, 0, 'i' }, + { "output", required_argument, 0, 'o' }, + { "dvd5", no_argument, 0, '5' }, + { "dvd9", no_argument, 0, '9' }, + { "bluray", no_argument, 0, 'b' }, + { "cd", no_argument, 0, 'c' }, + { "help", no_argument, 0, 'h' }, + { "version", no_argument, 0, 'v' }, + { "free-size", required_argument, 0, 'f' } + }; + + int32_t opt_index = 0; + int32_t opt_value = 0; + for (uint32_t i = 0; i < argc; i++) { + opt_index = 0; + opt_value = getopt_long(argc, argv, "i:o:59bcfhv", loption, &opt_index); + switch (opt_value) { + case -1: + break; case 'i': input = optarg; break;