Mercurial > retraceit
diff src/util.h @ 0:147b08bc7d64
Initial commit of a basic Application framework.
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Mon, 23 Mar 2015 12:41:52 +0100 |
parents | |
children | 098a10fc2e83 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/util.h Mon Mar 23 12:41:52 2015 +0100 @@ -0,0 +1,54 @@ +/* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik + * Software engineering by Intevation GmbH + * + * This file is Free Software under the GNU GPL (v>=2) + * and comes with ABSOLUTELY NO WARRANTY! + * See LICENSE.txt for details. + */ +#ifndef COMMON_UTIL_H +#define COMMON_UTIL_H +/* @file util.h + * @brief The usual useful stuff that fit nowhere else + */ +#include <stdbool.h> + +#ifdef __cplusplus +extern "C" { +#endif + +/**@brief Get the directory in which the current process resides in + * + * Look up the directory in which the current process is placed. + * If the path is longer then MAX_PATH NULL is returned. + * + * Returns a utf-8 encoded string that has to be freed by the caller + * on linux the path is returned as is including the last /. + * + * @returns The directory of the current process + */ +char * get_install_dir(); + +#ifndef WIN32 +/**@def Some value to use as equivalent as MAX_PATH on windows */ +#define MAX_PATH_LINUX 4000 + +/**@brief Get the directory in which the process proc resides in + * + * Look up the directory in which the process proc is placed. + * If the path is longer then MAX_PATH NULL is returned. + * + * Returns a utf-8 encoded string that has to be freed by the caller + * on linux the path is returned as is including the last /. + * + * @param[in] A process id or special name from the proc file system. + * + * @returns The directory of the process + */ +char * get_proc_install_dir(const char *proc); +#endif + +#ifdef __cplusplus +} +#endif + +#endif // COMMON_UTIL_H