From c6737af1733a66846b7ddbccebc196e422291eda Mon Sep 17 00:00:00 2001 From: auyer Date: Mon, 13 May 2024 00:25:02 -0300 Subject: [PATCH] sdk: c: add option to set address in example --- sdks/c/CMakeLists.txt | 2 +- sdks/c/example.c | 11 +++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/sdks/c/CMakeLists.txt b/sdks/c/CMakeLists.txt index 56186c6..8e0d483 100644 --- a/sdks/c/CMakeLists.txt +++ b/sdks/c/CMakeLists.txt @@ -7,7 +7,7 @@ add_executable(${PROJECT_NAME} example.c) set_property(TARGET ${PROJECT_NAME} PROPERTY C_STANDARD 23) find_package(PkgConfig REQUIRED) -pkg_check_modules(libcurl REQUIRED IMPORTED_TARGET libcurl>=7.17.0) +pkg_check_modules(libcurl REQUIRED IMPORTED_TARGET libcurl>=8.5.0) add_subdirectory(libMemoryKV) diff --git a/sdks/c/example.c b/sdks/c/example.c index daaf8f5..072d391 100644 --- a/sdks/c/example.c +++ b/sdks/c/example.c @@ -15,10 +15,17 @@ void print_memkv_result(memkv_result *response) { free(response); } -int main(void) { +int main(int argc, char **argv) { + memkv_client *client; - client = memkv_client_new("http://localhost:8080"); + static char defalt_address[] = "http://localhost:8080"; + + if (argc == 1) { + client = memkv_client_new(argv[1]); + } else { + client = memkv_client_new(defalt_address); + } memkv_result *response;