Skip to content

Commit

Permalink
sdk: c: add option to set address in example
Browse files Browse the repository at this point in the history
  • Loading branch information
auyer committed May 13, 2024
1 parent 0b6e95a commit c6737af
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion sdks/c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
11 changes: 9 additions & 2 deletions sdks/c/example.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down

0 comments on commit c6737af

Please sign in to comment.