[Pkg-electronics-commits] [gnucap] 04/43: plugpath-2: use gnucap-conf to find plugins
felix salfelder
felix-guest at moszumanska.debian.org
Wed Oct 4 03:21:43 UTC 2017
This is an automated email from the git hooks/post-receive script.
felix-guest pushed a commit to branch master
in repository gnucap.
commit 627456082c1bc35fbdd30c0e12ebaad2c61c9e60
Author: al davis <ad211 at freeelectron.net>
Date: Tue Jan 24 15:04:46 2017 -0500
plugpath-2: use gnucap-conf to find plugins
---
include/patchlev.h | 2 +-
lib/c_attach.cc | 36 +++++++++++++++++++++++++++++-------
2 files changed, 30 insertions(+), 8 deletions(-)
diff --git a/include/patchlev.h b/include/patchlev.h
index c291b68..17fc05c 100644
--- a/include/patchlev.h
+++ b/include/patchlev.h
@@ -1 +1 @@
-#define PATCHLEVEL "unstable 2016.11.17"
+#define PATCHLEVEL "plugpath-2 2017.01.24"
diff --git a/lib/c_attach.cc b/lib/c_attach.cc
index ac57a12..bf254e2 100644
--- a/lib/c_attach.cc
+++ b/lib/c_attach.cc
@@ -29,6 +29,16 @@ namespace {
/*--------------------------------------------------------------------------*/
std::map<const std::string, void*> attach_list;
/*--------------------------------------------------------------------------*/
+std::string conf()
+{untested();
+ FILE* f = popen("gnucap-conf --pkglibdir", "r");
+ char s[200];
+ fgets(s, 200, f);
+ *strchr(s, '\n') = '\0';
+ std::cout << s << '\n';
+ return std::string(s);
+}
+/*--------------------------------------------------------------------------*/
class CMD_ATTACH : public CMD {
public:
void do_it(CS& cmd, CARD_LIST*)
@@ -52,24 +62,36 @@ public:
}
} while (cmd.more() && !cmd.stuck(&here));
- std::string file_name;
- cmd >> file_name;
+ std::string short_file_name;
+ cmd >> short_file_name;
- void* handle = attach_list[file_name];
+ void* handle = attach_list[short_file_name];
if (handle) {
if (CARD_LIST::card_list.is_empty()) {
- cmd.warn(bDANGER, here, "\"" + file_name + "\": already loaded, replacing");
+ cmd.warn(bDANGER, here, "\"" + short_file_name + "\": already loaded, replacing");
dlclose(handle);
- attach_list[file_name] = NULL;
+ attach_list[short_file_name] = NULL;
}else{untested();
cmd.reset(here);
throw Exception_CS("already loaded, cannot replace when there is a circuit", cmd);
}
}else{
}
- handle = dlopen(file_name.c_str(), check | dl_scope);
+
+ std::string full_file_name;
+ if (short_file_name.find('/') == std::string::npos) {untested();
+ full_file_name = findfile(short_file_name, conf(), R_OK);
+ if (full_file_name == "") {untested();
+ full_file_name = short_file_name;
+ }else{untested();
+ }
+ }else{untested();
+ full_file_name = short_file_name;
+ }
+
+ handle = dlopen(full_file_name.c_str(), check | dl_scope);
if (handle) {
- attach_list[file_name] = handle;
+ attach_list[short_file_name] = handle;
}else{itested();
cmd.reset(here);
throw Exception_CS(dlerror(), cmd);
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-electronics/gnucap.git
More information about the Pkg-electronics-commits
mailing list