File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed
modules/database/src/std/softIoc Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -96,10 +96,11 @@ void errIf(int ret, const std::string& msg)
96
96
throw std::runtime_error (msg);
97
97
}
98
98
99
+ bool lazy_dbd_loaded;
100
+
99
101
void lazy_dbd (const std::string& dbd_file) {
100
- static bool loaded;
101
- if (loaded) return ;
102
- loaded = true ;
102
+ if (lazy_dbd_loaded) return ;
103
+ lazy_dbd_loaded = true ;
103
104
104
105
errIf (dbLoadDatabase (dbd_file.c_str (), NULL , NULL ),
105
106
std::string (" Failed to load DBD file: " )+dbd_file);
@@ -142,7 +143,7 @@ int main(int argc, char *argv[])
142
143
143
144
int opt;
144
145
145
- while ((opt = getopt (argc, argv, " ha:d:m:Ssx:" )) != -1 ) {
146
+ while ((opt = getopt (argc, argv, " ha:D: d:m:Ssx:" )) != -1 ) {
146
147
switch (opt) {
147
148
case ' h' : /* Print usage */
148
149
usage (argv[0 ], dbd_file);
@@ -164,6 +165,12 @@ int main(int argc, char *argv[])
164
165
throw std::bad_alloc ();
165
166
std::cout<<" asSetFilename(\" " <<optarg<<" \" )\n " ;
166
167
break ;
168
+ case ' D' :
169
+ if (lazy_dbd_loaded) {
170
+ throw std::runtime_error (" -D specified too late. softIoc.dbd already loaded.\n " );
171
+ }
172
+ dbd_file = optarg;
173
+ break ;
167
174
case ' d' :
168
175
lazy_dbd (dbd_file);
169
176
errIf (dbLoadRecords (optarg, macros.c_str ()),
You can’t perform that action at this time.
0 commit comments