Skip to content
Snippets Groups Projects
Commit 925d7b13 authored by Marek Vavrusa's avatar Marek Vavrusa
Browse files

Package name and version is now set from config.h

parent b6ff54bb
No related branches found
No related tags found
No related merge requests found
......@@ -32,8 +32,8 @@
#ifndef _KNOT_COMMON_H_
#define _KNOT_COMMON_H_
#define KNOT_NAME "libknot" // Project name
#define KNOT_VER 0x000100 // 0xMMIIRR (MAJOR,MINOR,REVISION)
#define KNOT_NAME "lib" PACKAGE_NAME // Project name
#define KNOT_VER PACKAGE_VERSION // 0xMMIIRR (MAJOR,MINOR,REVISION)
#ifndef UINT_DEFINED
typedef unsigned int uint; /*!< \brief Unsigned. */
......@@ -75,7 +75,7 @@ typedef unsigned int uint; /*!< \brief Unsigned. */
#endif
/*! \todo Refactor theese. We should have an allocator function handling this.*/
#ifndef ERR_ALLOC_FAILED
#define ERR_ALLOC_FAILED fprintf(stderr, "Allocation failed at %s:%d (%s ver.%x)\n", \
#define ERR_ALLOC_FAILED fprintf(stderr, "Allocation failed at %s:%d (%s ver.%s)\n", \
__FILE__, __LINE__, KNOT_NAME, KNOT_VER)
#endif
......
......@@ -25,8 +25,6 @@ typedef unsigned int uint; /*!< \brief Unsigned. */
#define UINT_DEFINED
#endif
#define PROJECT_NAME PACKAGE /*!< \brief Project name. */
#define PROJECT_VER 0x000100 /*!< \brief 0xMMIIRR (MAJOR,MINOR,REVISION). */
#define PROJECT_EXEC SBINDIR "/" "knotd" /*!< \brief Project executable. */
#define ZONEPARSER_EXEC LIBEXECDIR "/" "knot-zcompile" /*!< \brief Zoneparser executable. */
#define PID_FILE "knot.pid" /*!< \brief Server PID file name. */
......@@ -92,8 +90,8 @@ typedef unsigned int uint; /*!< \brief Unsigned. */
/*! \todo Refactor theese. We should have an allocator function handling this.*/
#ifndef ERR_ALLOC_FAILED
#define ERR_ALLOC_FAILED fprintf(stderr, "Allocation failed at %s:%d (%s ver.%x)\n", \
__FILE__, __LINE__, PROJECT_NAME, PROJECT_VER)
#define ERR_ALLOC_FAILED fprintf(stderr, "Allocation failed at %s:%d (%s)\n", \
__FILE__, __LINE__, PACKAGE_STRING)
#endif
#ifndef CHECK_ALLOC_LOG
......
......@@ -34,7 +34,7 @@ void help(int argc, char **argv)
" -w\tWait for the server to finish start/stop operations.\n"
" -i\tInteractive mode (do not daemonize).\n"
" -h\tPrint help and usage.\n",
PROJECT_NAME);
PACKAGE_NAME);
printf("Actions:\n"
" start [zone] Start %s server with given zone (no-op if running).\n"
" stop Stop %s server (no-op if not running).\n"
......@@ -43,7 +43,7 @@ void help(int argc, char **argv)
" running Check if server is running.\n"
"\n"
" compile Compile zone file.\n",
PROJECT_NAME, PROJECT_NAME, PROJECT_NAME, PROJECT_NAME);
PACKAGE_NAME, PACKAGE_NAME, PACKAGE_NAME, PACKAGE_NAME);
}
/*!
......@@ -425,10 +425,7 @@ int main(int argc, char **argv)
interactive = 1;
break;
case 'V':
printf("%s, version %d.%d.%d\n", PROJECT_NAME,
PROJECT_VER >> 16 & 0x000000ff,
PROJECT_VER >> 8 & 0x000000ff,
PROJECT_VER >> 0 & 0x000000ff);
printf("%s, version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
return 0;
case 'h':
case '?':
......
......@@ -73,10 +73,7 @@ int main(int argc, char **argv)
verbose = 1;
break;
case 'V':
printf("%s, version %d.%d.%d\n", PROJECT_NAME,
PROJECT_VER >> 16 & 0x000000ff,
PROJECT_VER >> 8 & 0x000000ff,
PROJECT_VER >> 0 & 0x000000ff);
printf("%s, version %s\n", PACKAGE_NAME, PACKAGE_VERSION);
return 0;
case 'h':
case '?':
......
......@@ -22,8 +22,8 @@
//#define DT_DEBUG
//#define JOURNAL_DEBUG
//#define NET_DEBUG
//#define ZONES_DEBUG
//#define XFR_DEBUG
#define ZONES_DEBUG
#define XFR_DEBUG
//#define NOTIFY_DEBUG
//#define KNOT_ZDUMP_DEBUG
//#define KNOT_ZLOAD_DEBUG
......
......@@ -82,7 +82,7 @@ int log_init()
/// \todo May change to LOG_DAEMON.
setlogmask(LOG_UPTO(LOG_DEBUG));
openlog(PROJECT_NAME, LOG_PID, LOG_DAEMON);
openlog(PACKAGE_NAME, LOG_PID, LOG_DAEMON);
return ret;
}
......
......@@ -971,10 +971,7 @@ int zone_dump_text(knot_zone_contents_t *zone, const char *filename)
return KNOT_EBADARG;
}
fprintf(f, ";Dumped using %s v. %d.%d.%d\n", KNOT_NAME,
KNOT_VER / 10000,
(KNOT_VER / 100) % 100,
KNOT_VER % 100);
fprintf(f, ";Dumped using %s v. %s\n", PACKAGE_NAME, PACKAGE_VERSION);
struct dump_param param;
param.f = f;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment