From 122200d3fd9f2329516dffadff6f0ca96833383e Mon Sep 17 00:00:00 2001 From: Olaf Bergmann Date: Tue, 18 Feb 2014 13:38:34 +0100 Subject: [PATCH] Defined two functions that return the library name and version string. --- debug.c | 10 +++++++++- debug.h | 8 +++++++- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/debug.c b/debug.c index bff3f11c..adff3c21 100644 --- a/debug.c +++ b/debug.c @@ -1,6 +1,6 @@ /* debug.c -- debug utilities * - * Copyright (C) 2010--2012 Olaf Bergmann + * Copyright (C) 2010--2012,2014 Olaf Bergmann * * This file is part of the CoAP library libcoap. Please see * README for terms of use. @@ -37,6 +37,14 @@ static coap_log_t maxlog = LOG_WARNING; /* default maximum log level */ +const char *coap_package_name() { + return PACKAGE_NAME; +} + +const char *coap_package_version() { + return PACKAGE_STRING; +} + coap_log_t coap_get_log_level() { return maxlog; diff --git a/debug.h b/debug.h index dde660d2..d18558fb 100644 --- a/debug.h +++ b/debug.h @@ -1,6 +1,6 @@ /* debug.h -- debug utilities * - * Copyright (C) 2010,2011 Olaf Bergmann + * Copyright (C) 2010,2011,2014 Olaf Bergmann * * This file is part of the CoAP library libcoap. Please see * README for terms of use. @@ -35,6 +35,12 @@ coap_log_t coap_get_log_level(); /** Sets the log level to the specified value. */ void coap_set_log_level(coap_log_t level); +/** Returns a zero-terminated string with the name of this library. */ +const char *coap_package_name(); + +/** Returns a zero-terminated string with the library version. */ +const char *coap_package_version(); + /** * Writes the given text to @c COAP_ERR_FD (for @p level <= @c * LOG_CRIT) or @c COAP_DEBUG_FD (for @p level >= @c LOG_WARNING). The