* @brief get paths used by the program
* @author Milan
*/
-
-#ifdef __cplusplus
-extern "C"
-{
-#if 0 /* keep Emacsens' auto-indent happy */
-}
-#endif
-#endif
-
#include <sys/stat.h>
#include <stdlib.h>
#include <string.h>
GNUNET_snprintf (fn,
sizeof(fn), "/proc/%u/exe", getpid ());
size = readlink (fn, lnk, sizeof (lnk)-1);
- if ((size == 0) || (size >= sizeof(lnk)-1))
+ if (size <= 0)
{
GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "readlink", fn);
return NULL;
}
+ GNUNET_assert (size < sizeof (lnk));
lnk[size] = '\0';
while ((lnk[size] != '/') && (size > 0))
size--;
buf = GNUNET_malloc (strlen (path) + 20);
pos = path;
- while (NULL != (end = strchr (pos, ':')))
+ while (NULL != (end = strchr (pos, PATH_SEPARATOR)))
{
*end = '\0';
- sprintf (buf, "%s/%s", pos, "gnunetd");
+ sprintf (buf, "%s/%s", pos, "gnunet-arm");
if (GNUNET_DISK_file_test (buf) == GNUNET_YES)
{
pos = GNUNET_strdup (pos);
}
pos = end + 1;
}
- sprintf (buf, "%s/%s", pos, "gnunetd");
+ sprintf (buf, "%s/%s", pos, "gnunet-arm");
if (GNUNET_DISK_file_test (buf) == GNUNET_YES)
{
pos = GNUNET_strdup (pos);
/* other attempts here */
GNUNET_log (GNUNET_ERROR_TYPE_ERROR,
_
- ("Could not determine installation path for GNUnet. Set `%s' environment variable.\n"),
+ ("Could not determine installation path for %s. Set `%s' environment variable.\n"),
+ "GNUnet",
"GNUNET_PREFIX");
return NULL;
}
DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR "locale"
DIR_SEPARATOR_STR;
break;
+ case GNUNET_OS_IPK_ICONDIR:
+ dirname =
+ DIR_SEPARATOR_STR "share" DIR_SEPARATOR_STR "icons" DIR_SEPARATOR_STR;
+ break;
default:
GNUNET_free (execpath);
return NULL;
return tmp;
}
-#if 0 /* keep Emacsens' auto-indent happy */
-{
-#endif
-#ifdef __cplusplus
-}
-#endif
/* end of os_installation.c */