From d2e315e4265f3876a688e78eeb1fc277e1656b75 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Wed, 24 Sep 2025 10:45:14 +0200 Subject: [PATCH] add long opts --- src/discspan.c | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) 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; -- 2.47.3