From c7e7f8e221a7fe606b45302b3f274f1942df1151 Mon Sep 17 00:00:00 2001 From: "W. Eric Norum" Date: Wed, 3 Nov 2004 17:14:48 +0000 Subject: [PATCH] Don't require pdbbase if not linking iocshRegisterCommon commands. --- src/iocsh/iocsh.cpp | 11 ++++++++++- src/iocsh/iocsh.h | 3 +++ src/iocsh/iocshRegisterCommon.c | 2 ++ 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/src/iocsh/iocsh.cpp b/src/iocsh/iocsh.cpp index de98e938c..afb8ed5d7 100644 --- a/src/iocsh/iocsh.cpp +++ b/src/iocsh/iocsh.cpp @@ -35,6 +35,11 @@ extern "C" { +/* + * Global link to pdbbase + */ +epicsShareDef struct dbBase **iocshPpdbbase; + /* * File-local information */ @@ -273,7 +278,11 @@ cvtArg (const char *filename, int lineno, char *arg, iocshArgBuf *argBuf, const case iocshArgPdbbase: /* Argument must be missing or 0 or pdbbase */ if(!arg || !*arg || (*arg == '0') || (strcmp(arg, "pdbbase") == 0)) { - argBuf->vval = pdbbase; + if(!iocshPpdbbase || !*iocshPpdbbase) { + showError (filename, lineno, "pdbbase not present"); + return 0; + } + argBuf->vval = *iocshPpdbbase; break; } showError (filename, lineno, "Expecting `pdbbase' got `%s'", arg); diff --git a/src/iocsh/iocsh.h b/src/iocsh/iocsh.h index e7ac20767..0d252198c 100644 --- a/src/iocsh/iocsh.h +++ b/src/iocsh/iocsh.h @@ -70,6 +70,9 @@ epicsShareFunc void epicsShareAPI iocshFree(void); epicsShareFunc int epicsShareAPI iocsh(const char *pathname); +/* 'weak' link to pdbbase */ +epicsShareExtern struct dbBase **iocshPpdbbase; + #ifdef __cplusplus } #endif diff --git a/src/iocsh/iocshRegisterCommon.c b/src/iocsh/iocshRegisterCommon.c index 41f4e19de..71f1cc68d 100644 --- a/src/iocsh/iocshRegisterCommon.c +++ b/src/iocsh/iocshRegisterCommon.c @@ -15,6 +15,7 @@ #include #include #include +#include #define epicsExportSharedSymbols #include "iocCoreLimitsRegister.h" @@ -34,6 +35,7 @@ void epicsShareAPI iocshRegisterCommon(void) { + iocshPpdbbase = &pdbbase; iocCoreLimitsRegister(); osiRegister(); iocUtilRegister();