annotate common/portpath.h @ 1035:a22527da188f

Added tag 0.91 for changeset b1c8ac65f782
author Andre Heinecke <andre.heinecke@intevation.de>
date Thu, 04 Sep 2014 14:38:22 +0200
parents faf58e9f518b
children f110a3f6e387
rev   line source
404
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 176
diff changeset
1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 176
diff changeset
2 * Software engineering by Intevation GmbH
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 176
diff changeset
3 *
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 176
diff changeset
4 * This file is Free Software under the GNU GPL (v>=2)
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 176
diff changeset
5 * and comes with ABSOLUTELY NO WARRANTY!
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 176
diff changeset
6 * See LICENSE.txt for details.
17e1c8f37d72 Add License
Andre Heinecke <aheinecke@intevation.de>
parents: 176
diff changeset
7 */
146
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
8 #ifndef PORTPATH_H
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
9 #define PORTPATH_H
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
10
168
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
11 #include <stdbool.h>
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
12
146
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
13 /**
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
14 * @file portpath.h
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
15 * @brief Platform independent functions for file and path handling.
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
16 * @details portpath contains functions to handle file and path names
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
17 * in a platform independent way. The code unsing this functions
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
18 * should be protable between GNU/Linux and Windows32 systems.
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
19 */
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
20
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
21 /**
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
22 * @brief portable version of dirname
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
23 * @details return the directory component of the given path.
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
24 * The argument path may be altered by the function.
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
25 * @param[inout] path the pathname
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
26 * @returns a pointer to the string containing the directory component
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
27 */
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
28 char *port_dirname(char *path);
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
29
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
30 /**
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
31 * @brief portable version of realpath
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
32 * @details return the expanded absolute pathname for the given path.
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
33 * The buffer for the resolved path is allocated by this function and
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
34 * should be freed by the caller.
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
35 * @param[in] path the original pathname
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
36 * @returns a pointer to the resolved path or NULL on error
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
37 */
975
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
38 char *port_realpath(const char *path);
146
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
39
168
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
40 /**
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
41 * @brief test if a file exists
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
42 * @details uses a platform specific stat call to test if the given
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
43 * file exists.
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
44 * @param[in] path the path to the file
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
45 * @returns true if the file exists and false otherwise
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
46 */
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
47 bool port_fileexits(char *path);
f100861dad8f Added simple portable function to test if an file exists.
Sascha Wilde <wilde@intevation.de>
parents: 167
diff changeset
48
176
70d627e9e801 New portability function to test if a file is an directory.
Sascha Wilde <wilde@intevation.de>
parents: 168
diff changeset
49 /**
70d627e9e801 New portability function to test if a file is an directory.
Sascha Wilde <wilde@intevation.de>
parents: 168
diff changeset
50 * @brief test if a file is a directory
70d627e9e801 New portability function to test if a file is an directory.
Sascha Wilde <wilde@intevation.de>
parents: 168
diff changeset
51 * @details uses a platform specific stat call to test if the given
70d627e9e801 New portability function to test if a file is an directory.
Sascha Wilde <wilde@intevation.de>
parents: 168
diff changeset
52 * file is an directory.
70d627e9e801 New portability function to test if a file is an directory.
Sascha Wilde <wilde@intevation.de>
parents: 168
diff changeset
53 * @param[in] path the path to the file
70d627e9e801 New portability function to test if a file is an directory.
Sascha Wilde <wilde@intevation.de>
parents: 168
diff changeset
54 * @returns true if the file is an directory and false otherwise
70d627e9e801 New portability function to test if a file is an directory.
Sascha Wilde <wilde@intevation.de>
parents: 168
diff changeset
55 */
984
faf58e9f518b Add recursive mkdir and mkdir for windows
Andre Heinecke <andre.heinecke@intevation.de>
parents: 975
diff changeset
56 bool port_isdir(const char *path);
176
70d627e9e801 New portability function to test if a file is an directory.
Sascha Wilde <wilde@intevation.de>
parents: 168
diff changeset
57
975
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
58 /**
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
59 * @brief create a directory
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
60 * @details uses a platform specific mkdir / access rights setup
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
61 * to create a directory that is world readable and
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
62 * writable by the current user / group
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
63 * @param[in] path the path to the directory
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
64 * @returns true if the directory was created
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
65 */
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
66 bool port_mkdir(const char *path);
b3695a3399de (issue86) Install into default directories on Linux
Andre Heinecke <andre.heinecke@intevation.de>
parents: 404
diff changeset
67
984
faf58e9f518b Add recursive mkdir and mkdir for windows
Andre Heinecke <andre.heinecke@intevation.de>
parents: 975
diff changeset
68 /**
faf58e9f518b Add recursive mkdir and mkdir for windows
Andre Heinecke <andre.heinecke@intevation.de>
parents: 975
diff changeset
69 * @brief create a directory and its parent directores
faf58e9f518b Add recursive mkdir and mkdir for windows
Andre Heinecke <andre.heinecke@intevation.de>
parents: 975
diff changeset
70 * @param[in] path the path to the directory
faf58e9f518b Add recursive mkdir and mkdir for windows
Andre Heinecke <andre.heinecke@intevation.de>
parents: 975
diff changeset
71 * @returns true if the directory was created
faf58e9f518b Add recursive mkdir and mkdir for windows
Andre Heinecke <andre.heinecke@intevation.de>
parents: 975
diff changeset
72 */
faf58e9f518b Add recursive mkdir and mkdir for windows
Andre Heinecke <andre.heinecke@intevation.de>
parents: 975
diff changeset
73 bool port_mkdir_p(const char *path);
faf58e9f518b Add recursive mkdir and mkdir for windows
Andre Heinecke <andre.heinecke@intevation.de>
parents: 975
diff changeset
74
146
306e4db11761 Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff changeset
75 #endif

http://wald.intevation.org/projects/trustbridge/