gnunet-svn
[Top][All Lists]
Advanced

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

[GNUnet-SVN] r30943 - Extractor/src/main


From: gnunet
Subject: [GNUnet-SVN] r30943 - Extractor/src/main
Date: Thu, 28 Nov 2013 17:06:32 +0100

Author: grothoff
Date: 2013-11-28 17:06:32 +0100 (Thu, 28 Nov 2013)
New Revision: 30943

Modified:
   Extractor/src/main/extractor_plugpath.c
Log:
-fix plugpath calculation

Modified: Extractor/src/main/extractor_plugpath.c
===================================================================
--- Extractor/src/main/extractor_plugpath.c     2013-11-28 15:40:05 UTC (rev 
30942)
+++ Extractor/src/main/extractor_plugpath.c     2013-11-28 16:06:32 UTC (rev 
30943)
@@ -36,7 +36,7 @@
 
 /**
  * Function to call on paths.
- * 
+ *
  * @param cls closure
  * @param path a directory path
  */
@@ -50,8 +50,8 @@
  * @param in input string, modified
  * @return NULL if 'in' is NULL, otherwise 'in' with '/bin/' removed
  */
-static char * 
-cut_bin (char * in) 
+static char *
+cut_bin (char * in)
 {
   size_t p;
 
@@ -64,7 +64,7 @@
        ('\\' == in[p-1]) )
     in[--p] = '\0';
   if (0 == strcmp (&in[p-4],
-                  "/bin")) 
+                  "/bin"))
     {
       in[p-4] = '\0';
       p -= 4;
@@ -88,7 +88,7 @@
  * and the binary linking against it sits elsewhere.
  */
 static char *
-get_path_from_proc_exe () 
+get_path_from_proc_exe ()
 {
   char fn[64];
   char line[1024];
@@ -105,13 +105,13 @@
            getpid ());
   if (NULL != (f = FOPEN (fn, "r")))
     {
-      while (NULL != fgets (line, 1024, f)) 
+      while (NULL != fgets (line, 1024, f))
        {
          if ( (1 == sscanf (line,
                             "%*x-%*x %*c%*c%*c%*c %*x %*2x:%*2x %*u%*[ ]%s",
                             dir)) &&
               (NULL != (lestr = strstr (dir,
-                                        "libextractor")) ) ) 
+                                        "libextractor")) ) )
            {
              lestr[0] = '\0';
              fclose (f);
@@ -178,8 +178,8 @@
 /**
  * Try to determine path with win32-specific function
  */
-static char * 
-get_path_from_module_filename () 
+static char *
+get_path_from_module_filename ()
 {
   char *path;
   char *ret;
@@ -218,7 +218,7 @@
  * @param number of bytes available in 'buf'
  * @return 0 on success, otherwise desired number of bytes is stored in 
'bufsize'
  */
-typedef int (*MyNSGetExecutablePathProto) (char *buf, 
+typedef int (*MyNSGetExecutablePathProto) (char *buf,
                                           size_t *bufsize);
 
 
@@ -280,8 +280,8 @@
  *
  * @return NULL on error
  */
-static char * 
-get_path_from_dyld_image () 
+static char *
+get_path_from_dyld_image ()
 {
   const char *path;
   char *s;
@@ -290,7 +290,7 @@
   int c;
 
   c = _dyld_image_count ();
-  for (i = 0; i < c; i++) 
+  for (i = 0; i < c; i++)
     {
       if (((void *) _dyld_get_image_header (i)) != (void *) &_mh_dylib_header)
        continue;
@@ -321,7 +321,7 @@
  * @return path to binary, NULL if not found
  */
 static char *
-get_path_from_PATH() 
+get_path_from_PATH()
 {
   struct stat sbuf;
   char *path;
@@ -345,11 +345,11 @@
       return NULL;
     }
   pos = path;
-  while (NULL != (end = strchr(pos, ':'))) 
+  while (NULL != (end = strchr(pos, ':')))
     {
       *end = '\0';
       sprintf (buf, "%s/%s", pos, "extract");
-      if (0 == stat(buf, &sbuf)) 
+      if (0 == stat(buf, &sbuf))
        {
          free (buf);
          if (NULL == (pos = strdup (pos)))
@@ -360,19 +360,19 @@
            }
          free (path);
          pos = cut_bin (pos);
-         if (NULL == (ret = realloc (pos, strlen (pos) + 5)))
+         if (NULL == (ret = realloc (pos, strlen (pos) + 6)))
            {
              LOG_STRERROR ("realloc");
              free (pos);
              return NULL;
            }
-         strcat (ret, "lib/");
+         strcat (ret, "/lib/");
          return ret;
        }
       pos = end + 1;
     }
   sprintf (buf, "%s/%s", pos, "extract");
-  if (0 == stat (buf, &sbuf)) 
+  if (0 == stat (buf, &sbuf))
     {
       pos = strdup (pos);
       free (buf);
@@ -380,13 +380,13 @@
       if (NULL == pos)
        return NULL;
       pos = cut_bin (pos);
-      if (NULL == (ret = realloc (pos, strlen (pos) + 5)))
+      if (NULL == (ret = realloc (pos, strlen (pos) + 6)))
        {
          LOG_STRERROR ("realloc");
          free (pos);
          return NULL;
        }
-      strcat (ret, "lib/");
+      strcat (ret, "/lib/");
       return ret;
     }
   free (buf);
@@ -398,7 +398,7 @@
 /**
  * Create a filename by appending 'fname' to 'path'.
  *
- * @param path the base path 
+ * @param path the base path
  * @param fname the filename to append
  * @return '$path/$fname', NULL on error
  */
@@ -420,23 +420,23 @@
   if ('\\' == path[slen-1])
     sprintf (ret,
             "%s%s",
-            path, 
+            path,
             fname);
   else
     sprintf (ret,
             "%s\\%s",
-            path, 
+            path,
             fname);
 #else
   if ('/' == path[slen-1])
     sprintf (ret,
             "%s%s",
-            path, 
+            path,
             fname);
   else
     sprintf (ret,
             "%s/%s",
-            path, 
+            path,
             fname);
 #endif
   return ret;
@@ -471,7 +471,7 @@
       for (prefix = strtok_r (d, PATH_SEPARATOR_STR, &saveptr);
           NULL != prefix;
           prefix = strtok_r (NULL, PATH_SEPARATOR_STR, &saveptr))
-       pp (pp_cls, prefix);    
+       pp (pp_cls, prefix);
       free (d);
       return;
     }
@@ -515,17 +515,17 @@
    * Name of the plugin we are looking for.
    */
   const char *short_name;
-  
+
   /**
    * Location for storing the path to the plugin upon success.
-   */ 
+   */
   char *path;
 };
 
 
 /**
  * Load all plugins from the given directory.
- * 
+ *
  * @param cls pointer to the "struct EXTRACTOR_PluginList*" to extend
  * @param path path to a directory with plugins
  */
@@ -555,7 +555,7 @@
             (0 != strcasecmp (&ent->d_name[dlen-4], ".dll")) ) )
        continue; /* only load '.so' and '.dll' */
       if (NULL == (sym_name = strrchr (ent->d_name, '_')))
-       continue;       
+       continue;
       sym_name++;
       if (NULL == (sym = strdup (sym_name)))
        {
@@ -586,7 +586,7 @@
 EXTRACTOR_find_plugin_ (const char *short_name)
 {
   struct SearchContext sc;
-  
+
   sc.path = NULL;
   sc.short_name = short_name;
   get_installation_paths (&find_plugin_in_path,
@@ -595,14 +595,14 @@
 }
 
 
-/** 
+/**
  * Closure for 'load_plugins_from_dir'.
  */
 struct DefaultLoaderContext
 {
   /**
    * Accumulated result list.
-   */ 
+   */
   struct EXTRACTOR_PluginList *res;
 
   /**
@@ -614,7 +614,7 @@
 
 /**
  * Load all plugins from the given directory.
- * 
+ *
  * @param cls pointer to the "struct EXTRACTOR_PluginList*" to extend
  * @param path path to a directory with plugins
  */
@@ -672,7 +672,7 @@
  * @param flags options for all of the plugins loaded
  * @return the default set of plugins, NULL if no plugins were found
  */
-struct EXTRACTOR_PluginList * 
+struct EXTRACTOR_PluginList *
 EXTRACTOR_plugin_add_defaults (enum EXTRACTOR_Options flags)
 {
   struct DefaultLoaderContext dlc;




reply via email to

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