Check-in Number:
|
915 | |
Date: |
2001-Sep-10 12:16:05 (local)
2001-Sep-10 10:16:05 (UTC) |
User: | thl |
Branch: | |
Comment: |
add library version checks (compile-time and run-time) |
Tickets: |
|
Inspections: |
|
Files: |
|
ossp-pkg/lmtp2nntp/00TODO 1.28 -> 1.29
--- 00TODO 2001/09/10 06:50:56 1.28
+++ 00TODO 2001/09/10 10:16:05 1.29
@@ -14,12 +14,6 @@
FIXME
-check str library version
-- openpkg (package time)
-- autoconf, (autoconf time)
-- str.h, #err (compile time)
-- STR_VERSION (run time)
-
check gcc3 compatiblity
**** DEVELOPMENT INFORMATION ****
|
|
ossp-pkg/lmtp2nntp/lmtp2nntp.c 1.46 -> 1.47
--- lmtp2nntp.c 2001/09/10 06:54:06 1.46
+++ lmtp2nntp.c 2001/09/10 10:16:05 1.47
@@ -39,6 +39,22 @@
#include "shpat_match.h"
#include "l2.h"
+/* library version check (compile-time) */
+#define L2_VERSION_HEX_REQ 0x001200
+#define L2_VERSION_STR_REQ "0.1.0"
+#define STR_VERSION_HEX_REQ 0x009205
+#define STR_VERSION_STR_REQ "0.9.5"
+#ifdef L2_VERSION_HEX
+#if L2_VERSION_HEX < L2_VERSION_HEX_REQ
+#error "require a newer version of OSSP L2"
+#endif
+#endif
+#ifdef STR_VERSION_HEX
+#if STR_VERSION_HEX < STR_VERSION_HEX_REQ
+#error "require a newer version of OSSP Str"
+#endif
+#endif
+
/* own headers */
#include "lmtp2nntp.h"
#ifdef HAVE_CONFIG_H
@@ -257,6 +273,16 @@
l2_channel_t *chBuf;
l2_channel_t *chFile;
+ /* library version check (run-time) */
+ if (l2_version.v_hex < L2_VERSION_HEX_REQ) {
+ fprintf(stderr, "require at least OSSP L2 >= %s\n", L2_VERSION_STR_REQ);
+ exit(ERR_EXECUTION);
+ }
+ if (str_version.v_hex < STR_VERSION_HEX_REQ + 1) {
+ fprintf(stderr, "require at least OSSP Str >= %s\n", STR_VERSION_STR_REQ);
+ exit(ERR_EXECUTION);
+ }
+
/* create application context */
if ((ctx = (lmtp2nntp_t *)malloc(sizeof(lmtp2nntp_t))) == NULL)
exit(ERR_EXECUTION);
|
|