Skip to content
Snippets Groups Projects
Commit 3d10ff93 authored by Simon Rose's avatar Simon Rose
Browse files

Remove <args> from require

parent 52a88d04
No related branches found
No related tags found
No related merge requests found
...@@ -723,10 +723,9 @@ it calls epicsExit to abort the application. ...@@ -723,10 +723,9 @@ it calls epicsExit to abort the application.
*/ */
/* wrapper to abort statup script */ /* wrapper to abort statup script */
static int require_priv(const char *module, const char *version, static int require_priv(const char *module, const char *version);
const char *args);
int require(const char *module, const char *version, const char *args) { int require(const char *module, const char *version) {
int status; int status;
static int firstTime = 1; static int firstTime = 1;
...@@ -742,12 +741,9 @@ int require(const char *module, const char *version, const char *args) { ...@@ -742,12 +741,9 @@ int require(const char *module, const char *version, const char *args) {
} }
if (module == NULL) { if (module == NULL) {
printf( printf("Usage: require \"<module>\" [, \"<version>\" ]\n");
"Usage: require \"<module>\" [, \"<version>\" ] [, "
"\"<args>\"]\n");
printf("Loads " PREFIX "<module>" INFIX EXT " and <libname>.dbd\n"); printf("Loads " PREFIX "<module>" INFIX EXT " and <libname>.dbd\n");
printf("And calls <module>_registerRecordDeviceDriver\n"); printf("And calls <module>_registerRecordDeviceDriver\n");
printf("If available, runs startup script snippet (only before iocInit)\n");
return -1; return -1;
} }
...@@ -756,14 +752,6 @@ int require(const char *module, const char *version, const char *args) { ...@@ -756,14 +752,6 @@ int require(const char *module, const char *version, const char *args) {
return -1; return -1;
} }
/* either order for version and args, either may be empty or NULL */
if (version && strchr(version, '=')) {
const char *v = version;
version = args;
args = v;
if (requireDebug) printf("require: swap version and args\n");
}
if (version && version[0] == 0) version = NULL; if (version && version[0] == 0) version = NULL;
if (version && strcmp(version, "none") == 0) { if (version && strcmp(version, "none") == 0) {
...@@ -771,7 +759,7 @@ int require(const char *module, const char *version, const char *args) { ...@@ -771,7 +759,7 @@ int require(const char *module, const char *version, const char *args) {
return 0; return 0;
} }
status = require_priv(module, version, args); status = require_priv(module, version);
if (status == 0) return 0; if (status == 0) return 0;
if (status != -1) perror("require"); if (status != -1) perror("require");
...@@ -861,7 +849,7 @@ static int handleDependencies(const char *module, char *depfilename) { ...@@ -861,7 +849,7 @@ static int handleDependencies(const char *module, char *depfilename) {
*end = 0; *end = 0;
} }
printf("Module %s depends on %s %s\n", module, rmodule, rversion); printf("Module %s depends on %s %s\n", module, rmodule, rversion);
if (require(rmodule, rversion, NULL) != 0) { if (require(rmodule, rversion) != 0) {
fclose(depfile); fclose(depfile);
return -1; return -1;
} }
...@@ -870,8 +858,7 @@ static int handleDependencies(const char *module, char *depfilename) { ...@@ -870,8 +858,7 @@ static int handleDependencies(const char *module, char *depfilename) {
return 0; return 0;
} }
static int require_priv(const char *module, const char *version, static int require_priv(const char *module, const char *version) {
const char *args) {
int status; int status;
int returnvalue = 0; int returnvalue = 0;
const char *loaded = NULL; const char *loaded = NULL;
...@@ -894,8 +881,7 @@ static int require_priv(const char *module, const char *version, ...@@ -894,8 +881,7 @@ static int require_priv(const char *module, const char *version,
static char *globalTemplates = NULL; static char *globalTemplates = NULL;
if (requireDebug) if (requireDebug)
printf("require: module=\"%s\" version=\"%s\" args=\"%s\"\n", module, printf("require: module=\"%s\" version=\"%s\"\n", module, version);
version, args);
#if defined __GNUC__ && __GNUC__ < 3 #if defined __GNUC__ && __GNUC__ < 3
#define TRY_FILE(offs, args...) \ #define TRY_FILE(offs, args...) \
...@@ -1194,7 +1180,7 @@ static int require_priv(const char *module, const char *version, ...@@ -1194,7 +1180,7 @@ static int require_priv(const char *module, const char *version,
if (founddir) free(founddir); if (founddir) free(founddir);
/* no need to execute startup script twice if not with new arguments */ /* no need to execute startup script twice if not with new arguments */
if (loaded && args == NULL) { if (loaded) {
return 0; return 0;
} }
...@@ -1206,15 +1192,14 @@ require_priv_error: ...@@ -1206,15 +1192,14 @@ require_priv_error:
} }
static const iocshFuncDef requireDef = { static const iocshFuncDef requireDef = {
"require", 3, "require", 2,
(const iocshArg *[]){ (const iocshArg *[]){
&(iocshArg){"module", iocshArgString}, &(iocshArg){"module", iocshArgString},
&(iocshArg){"[version]", iocshArgString}, &(iocshArg){"[version]", iocshArgString},
&(iocshArg){"[substitutions]", iocshArgString},
}}; }};
static void requireFunc(const iocshArgBuf *args) { static void requireFunc(const iocshArgBuf *args) {
require(args[0].sval, args[1].sval, args[2].sval); require(args[0].sval, args[1].sval);
} }
static const iocshFuncDef libversionShowDef = { static const iocshFuncDef libversionShowDef = {
......
...@@ -13,7 +13,7 @@ extern "C" { ...@@ -13,7 +13,7 @@ extern "C" {
#define __attribute__(dummy) #define __attribute__(dummy)
#endif // __GNUC__ #endif // __GNUC__
int require(const char *libname, const char *version, const char *args); int require(const char *libname, const char *version);
size_t foreachLoadedLib(size_t (*func)(const char *name, const char *version, size_t foreachLoadedLib(size_t (*func)(const char *name, const char *version,
const char *path, void *arg), const char *path, void *arg),
void *arg); void *arg);
......
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