From d81310d55b9b7d07904c19f879f50e52fd7be489 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Mon, 06 Nov 2023 16:52:08 +0800 Subject: [PATCH] Add new code --- app_ddns/ddns_client.c | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app_ddns/ddns_client.c b/app_ddns/ddns_client.c index ede812a..ff5650d 100644 --- a/app_ddns/ddns_client.c +++ b/app_ddns/ddns_client.c @@ -52,10 +52,12 @@ char *str; int val; char *domain; + char *id; char *serverip; int port; int i; char key[64]; + char msg[512]; struct option long_options[] = { {"conf", required_argument, NULL, 'c'}, @@ -95,12 +97,17 @@ return -1; } + id=iniparser_getstring(ini, "common:id", NULL); domain=iniparser_getstring(ini, "common:domain", NULL); + if( !domain ) { - printf("ERROR: cannot parse domain in '%s'\n", conf_file); + printf("ERROR: cannot parse domain/id in '%s'\n", conf_file); return -1; } + + memset(msg, 0, sizeof(msg)); + snprintf(msg, sizeof(msg), "[%s]: '%s'", id, domain); for(i=0; i<MAX_HOSTS; i++) { @@ -118,7 +125,7 @@ } printf("==> Start send domain '%s' to [%s:%d]\n", domain, serverip, port); - socket_send_domain(serverip, port, domain); + socket_send_domain(serverip, port, msg); printf("\n"); } -- Gitblit v1.9.1