[Pkg-electronics-commits] [gnucap] 05/43: plupath-2: refinement .. and use either environment GNUCAP_PLUGPATH or gnucap-conf

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 d70ee03abe28bd92076a4aba311bec29aa4abea5
Author: al davis <ad211 at freeelectron.net>
Date:   Thu Jan 26 01:19:18 2017 -0500

    plupath-2: refinement .. and use either environment GNUCAP_PLUGPATH or gnucap-conf
---
 include/patchlev.h |  2 +-
 lib/c_attach.cc    | 34 +++++++++++++++++++++-------------
 2 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/include/patchlev.h b/include/patchlev.h
index 17fc05c..a3ea014 100644
--- a/include/patchlev.h
+++ b/include/patchlev.h
@@ -1 +1 @@
-#define PATCHLEVEL "plugpath-2 2017.01.24"
+#define PATCHLEVEL "plugpath-2 2017.01.25"
diff --git a/lib/c_attach.cc b/lib/c_attach.cc
index bf254e2..113939a 100644
--- a/lib/c_attach.cc
+++ b/lib/c_attach.cc
@@ -29,14 +29,20 @@ namespace {
 /*--------------------------------------------------------------------------*/
 std::map<const std::string, void*> attach_list;
 /*--------------------------------------------------------------------------*/
-std::string conf()
+std::string plug_path()
 {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);
+  std::string path = OS::getenv("GNUCAP_PLUGPATH");
+  if (path == "") {
+    // not spec in environment, use gnucap-conf
+    FILE* f = popen("gnucap-conf --pkglibdir", "r");
+    char s[200];
+    fgets(s, 200, f);
+    *strchr(s, '\n') = '\0';
+    path = s;
+  }else{
+    // from environment
+  }
+  return path;
 }  
 /*--------------------------------------------------------------------------*/
 class CMD_ATTACH : public CMD {
@@ -78,18 +84,20 @@ public:
     }else{
     }
 
-    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;
+      // no '/' in name
+      std::string full_file_name = findfile(short_file_name, plug_path(), R_OK);
+      if (full_file_name != "") {untested();
+	handle = dlopen(full_file_name.c_str(), check | dl_scope);
       }else{untested();
+	cmd.reset(here);
+	throw Exception_CS("plugin not found in " + plug_path(), cmd);
       }
     }else{untested();
-      full_file_name = short_file_name;
+      // has '/' in name
+      handle = dlopen(short_file_name.c_str(), check | dl_scope);
     }
 
-    handle = dlopen(full_file_name.c_str(), check | dl_scope);
     if (handle) {
       attach_list[short_file_name] = handle;
     }else{itested();

-- 
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