view src/util.h @ 36:92bb9687d716

(issue12) Count from 1 to max + 1 This is more intutive then counting from zero
author Andre Heinecke <andre.heinecke@intevation.de>
date Wed, 06 May 2015 16:10:01 +0200
parents 147b08bc7d64
children 098a10fc2e83
line wrap: on
line source
/* 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
This site is hosted by Intevation GmbH (Datenschutzerklärung und Impressum | Privacy Policy and Imprint)