From d0dba8f4838691f2aade3fdd5de3c24a0dd451a2 Mon Sep 17 00:00:00 2001 From: Bastian Dehn Date: Fri, 27 Aug 2021 08:58:58 +0200 Subject: [PATCH] add: version of discspan --- CMakeLists.txt | 2 ++ src/config.h.in | 6 ++++++ src/discspan.c | 7 ++++++- src/help.c | 1 + 4 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 src/config.h.in diff --git a/CMakeLists.txt b/CMakeLists.txt index 802e4ac..3bcad09 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,8 @@ set(PROJECT_VERSION_PATCH 0) set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") file(GLOB SOURCES src/*.c) +configure_file(src/config.h.in src/config.h) +include_directories(${CMAKE_CURRENT_BINARY_DIR}/src) include_directories(libs/spandisc/include) add_subdirectory(libs/spandisc) diff --git a/src/config.h.in b/src/config.h.in new file mode 100644 index 0000000..27aefe8 --- /dev/null +++ b/src/config.h.in @@ -0,0 +1,6 @@ +#ifndef DISCSPAN_CONFIG_IN_H +#define DISCSPAN_CONFIG_IN_H + +#define VERSION "@PROJECT_VERSION@" + +#endif diff --git a/src/discspan.c b/src/discspan.c index abbaddb..741d221 100644 --- a/src/discspan.c +++ b/src/discspan.c @@ -2,6 +2,7 @@ #include #include +#include "config.h" #include "spandisc.h" #include "logic.h" #include "help.h" @@ -23,7 +24,7 @@ param_t read_argument(int argc, char *argv[]) const unsigned long long cd = 734003200; int c = 0; - while ((c = getopt(argc, argv, ":59bcf:hi:o:")) != -1) { + while ((c = getopt(argc, argv, ":59bcf:hi:o:v")) != -1) { switch (c) { case 'i': parameter.input = optarg; @@ -50,6 +51,10 @@ param_t read_argument(int argc, char *argv[]) useage(); exit(0); break; + case 'v': + printf("discspan %s\n", VERSION); + exit(0); + break; default: fprintf(stderr, "WARNING: %c unknown option\n", optopt); break; diff --git a/src/help.c b/src/help.c index eb018f0..2be4019 100644 --- a/src/help.c +++ b/src/help.c @@ -12,5 +12,6 @@ void useage() printf(" -5\t\tsize of sigle layer DVD: 4.700.000.000 bytes\n"); printf(" -c\t\tsize of CD: 734.003.200 bytes\n"); printf(" -f \tsize in bytes\n"); + printf(" -v\t\tshow version\n"); printf(" -h\t\tshow this help\n\n"); } -- 2.39.5