]> gitweb.hhaalo.de Git - discspan.git/commitdiff
add: version of discspan
authorBastian Dehn <hhaalo@arcor.de>
Fri, 27 Aug 2021 06:58:58 +0000 (08:58 +0200)
committerBastian Dehn <hhaalo@arcor.de>
Fri, 27 Aug 2021 07:09:10 +0000 (09:09 +0200)
CMakeLists.txt
src/config.h.in [new file with mode: 0644]
src/discspan.c
src/help.c

index 802e4ac1d3d14bb58902fea92d02045fd1829f20..3bcad09ea4f31ded05cd2d3c7e1e09a584b06348 100644 (file)
@@ -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 (file)
index 0000000..27aefe8
--- /dev/null
@@ -0,0 +1,6 @@
+#ifndef DISCSPAN_CONFIG_IN_H
+#define DISCSPAN_CONFIG_IN_H
+
+#define VERSION "@PROJECT_VERSION@"
+
+#endif
index abbaddbe6f3f20c7f151aad8795328b7c710a1ff..741d221601ed103f8c0c495b5606036d09cbd92d 100644 (file)
@@ -2,6 +2,7 @@
 #include <stdlib.h>
 #include <unistd.h>
 
+#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;
index eb018f092657f5d73f22c604a659130942056ebf..2be4019bb8dfffe78a1bdfe47b0d346c138add17 100644 (file)
@@ -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 <size>\tsize in bytes\n");
+       printf("   -v\t\tshow version\n");
        printf("   -h\t\tshow this help\n\n");
 }