From 937cb95ee88ce4f57cb4510be459a72033fbbb94 Mon Sep 17 00:00:00 2001 From: guowenxue <guowenxue@gmail.com> Date: Wed, 26 Jun 2019 12:59:06 +0800 Subject: [PATCH] update mqttd program, add ID support --- pj1_mqttd/etc/conf.c | 17 ++++++++++++++++- 1 files changed, 16 insertions(+), 1 deletions(-) diff --git a/pj1_mqttd/etc/conf.c b/pj1_mqttd/etc/conf.c index 19b4dea..ed05e55 100644 --- a/pj1_mqttd/etc/conf.c +++ b/pj1_mqttd/etc/conf.c @@ -25,9 +25,11 @@ if( !conf_file ) { + strncpy(ctx->id, "\"x86host02\"", sizeof(ctx->id)); /* logger settings */ - strncpy(ctx->logfile, "/tmp/mqttd.log", sizeof(ctx->logfile)); + //strncpy(ctx->logfile, "/tmp/mqttd.log", sizeof(ctx->logfile)); + strncpy(ctx->logfile, DBG_LOG_FILE, sizeof(ctx->logfile)); ctx->loglevel = LOG_LEVEL_DEBUG; ctx->logsize = 1024; @@ -92,6 +94,19 @@ log_nrml("Logger system initialise ok\n"); + /*+------------------------------------------------------+ + *| parser production ID | + *+------------------------------------------------------+*/ + + if( !(str=iniparser_getstring(ini, "common:id", NULL)) ) + { + log_err("ERROR: Parser production ID failure\n"); + return -2; + } + snprintf(ctx->id, sizeof(ctx->id), "\"%s\"", str); + //strncpy(ctx->id, str, sizeof(ctx->id) ); + + log_nrml("Parser production ID [%s]\n", ctx->id); /*+------------------------------------------------------+ -- Gitblit v1.9.1