gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[GNUnet-SVN] r8427 - GNUnet/src/util/os


From: gnunet
Subject: [GNUnet-SVN] r8427 - GNUnet/src/util/os
Date: Wed, 22 Apr 2009 07:26:07 -0600

Author: holindho
Date: 2009-04-22 07:26:06 -0600 (Wed, 22 Apr 2009)
New Revision: 8427

Modified:
   GNUnet/src/util/os/installpath.c
Log:
support lib32/lib64 biarch weirdos


Modified: GNUnet/src/util/os/installpath.c
===================================================================
--- GNUnet/src/util/os/installpath.c    2009-04-22 01:34:45 UTC (rev 8426)
+++ GNUnet/src/util/os/installpath.c    2009-04-22 13:26:06 UTC (rev 8427)
@@ -344,6 +344,7 @@
   const char *dirname;
   char *execpath = NULL;
   char *tmp;
+  int isbasedir;
 
   /* if wanted, try to get the current app's bin/ */
   if (dirkind == GNUNET_IPK_SELF_PREFIX)
@@ -367,15 +368,35 @@
   while (n > 1 && execpath[n - 1] == DIR_SEPARATOR)
     execpath[--n] = '\0';
 
-  if ((n > 3) && ((0 == strcasecmp (&execpath[n - 3], "bin")) ||
+  isbasedir = 1;
+  if ((n > 5) && ((0 == strcasecmp (&execpath[n - 5], "lib32")) ||
+                  (0 == strcasecmp (&execpath[n - 5], "lib64"))))
+    {
+      if (dirkind != GNUNET_IPK_LIBDIR)
+        {
+          /* strip '/lib32/' or '/lib64/' */
+          execpath[n - 5] = '\0';
+          n -= 5;
+        }
+      else
+        isbasedir = 0;
+    }
+  else if ((n > 3) && ((0 == strcasecmp (&execpath[n - 3], "bin")) ||
                   (0 == strcasecmp (&execpath[n - 3], "lib"))))
     {
-      /* strip '/bin/' or '/lib/' */
-      execpath[n - 3] = '\0';
-      n -= 3;
-      while (n > 1 && execpath[n - 1] == DIR_SEPARATOR)
-        execpath[--n] = '\0';
+      if (dirkind != GNUNET_IPK_LIBDIR || 
+          (0 != strcasecmp (&execpath[n - 3], "lib")) )
+        {
+          /* strip '/bin/' or '/lib/' */
+          execpath[n - 3] = '\0';
+          n -= 3;
+        }
+      else
+        isbasedir = 0;
     }
+  while (n > 1 && execpath[n - 1] == DIR_SEPARATOR)
+    execpath[--n] = '\0';
+
   switch (dirkind)
     {
     case GNUNET_IPK_PREFIX:
@@ -386,8 +407,12 @@
       dirname = DIR_SEPARATOR_STR "bin" DIR_SEPARATOR_STR;
       break;
     case GNUNET_IPK_LIBDIR:
-      dirname =
-        DIR_SEPARATOR_STR "lib" DIR_SEPARATOR_STR "GNUnet" DIR_SEPARATOR_STR;
+      if (isbasedir)
+        dirname =
+          DIR_SEPARATOR_STR "lib" DIR_SEPARATOR_STR "GNUnet" DIR_SEPARATOR_STR;
+      else
+        dirname =
+          DIR_SEPARATOR_STR "GNUnet" DIR_SEPARATOR_STR;
       break;
     case GNUNET_IPK_DATADIR:
       dirname =





reply via email to

[Prev in Thread] Current Thread [Next in Thread]