andre@0: /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik andre@0: * Software engineering by Intevation GmbH andre@0: * andre@0: * This file is Free Software under the GNU GPL (v>=2) andre@0: * and comes with ABSOLUTELY NO WARRANTY! andre@0: * See LICENSE.txt for details. andre@0: */ andre@0: #ifndef COMMON_UTIL_H andre@0: #define COMMON_UTIL_H andre@66: /** @file util.h andre@0: * @brief The usual useful stuff that fit nowhere else andre@0: */ andre@0: #include andre@0: andre@0: #ifdef __cplusplus andre@0: extern "C" { andre@0: #endif andre@0: andre@0: /**@brief Get the directory in which the current process resides in andre@0: * andre@0: * Look up the directory in which the current process is placed. andre@0: * If the path is longer then MAX_PATH NULL is returned. andre@0: * andre@0: * Returns a utf-8 encoded string that has to be freed by the caller andre@0: * on linux the path is returned as is including the last /. andre@0: * andre@0: * @returns The directory of the current process andre@0: */ andre@0: char * get_install_dir(); andre@0: andre@112: #ifndef _WIN32 andre@0: /**@def Some value to use as equivalent as MAX_PATH on windows */ andre@0: #define MAX_PATH_LINUX 4000 andre@0: andre@0: /**@brief Get the directory in which the process proc resides in andre@0: * andre@0: * Look up the directory in which the process proc is placed. andre@0: * If the path is longer then MAX_PATH NULL is returned. andre@0: * andre@0: * Returns a utf-8 encoded string that has to be freed by the caller andre@0: * on linux the path is returned as is including the last /. andre@0: * andre@0: * @param[in] A process id or special name from the proc file system. andre@0: * andre@0: * @returns The directory of the process andre@0: */ andre@0: char * get_proc_install_dir(const char *proc); andre@0: #endif andre@0: andre@0: #ifdef __cplusplus andre@0: } andre@0: #endif andre@0: andre@0: #endif // COMMON_UTIL_H