Skip to content

Commit

Permalink
terminate if libddcutil version < 2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
rockowitz committed Feb 8, 2024
1 parent 0244b15 commit 622abfe
Showing 1 changed file with 18 additions and 7 deletions.
25 changes: 18 additions & 7 deletions src/main/main.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** \file main.cpp */

// Copyright (C) 2018-2023 Sanford Rockowitz <rockowitz@minsoft.com>
// Copyright (C) 2018-2024 Sanford Rockowitz <rockowitz@minsoft.com>
// SPDX-License-Identifier: GPL-2.0-or-later

#include <glib-2.0/glib.h>
Expand Down Expand Up @@ -279,11 +279,6 @@ static bool init_ddcutil_library(Parsed_Ddcui_Cmd * parsed_cmd) {
if (debug)
printf("(main.cpp:%s) ddca_init() returned %d\n", __func__, rc);

// printf("(%s) WOLF 0\n", __func__);
// if (infomsgs)
// ntsa_show(infomsgs);
// printf("WOLF A\n");

if (infomsgs) {
// printf("Null_Terminated_String_Array at %p:\n", (void*) infomsgs);
int ndx = 0;
Expand All @@ -296,7 +291,6 @@ static bool init_ddcutil_library(Parsed_Ddcui_Cmd * parsed_cmd) {
ntsa_free(infomsgs, true);
}


if (rc) {
DDCA_Error_Detail * erec = ddca_get_error_detail();
if (debug)
Expand Down Expand Up @@ -363,6 +357,23 @@ int main(int argc, char *argv[])
exit(0);
}

DDCA_Ddcutil_Version_Spec vspec = ddca_ddcutil_version();
bool ok_vspec = false;
if (vspec.major >= 3)
ok_vspec = true;
else if (vspec.major == 2) {
if (vspec.minor >=2)
ok_vspec = true;
else if (vspec.minor == 1) {
if (vspec.micro >= 3)
ok_vspec = true;
}
}
if (!ok_vspec) {
printf("ddcui requires at least libddcutil version 2.1.3\n");
exit(1);
}

// bool enable_syslog = true;
// if ( ntsa_find(argv, "--disable-syslog") >= 0 || ntsa_find(argv, "--nosyslog") >= 0 )
// enable_syslog = false;
Expand Down

0 comments on commit 622abfe

Please sign in to comment.