Mercurial > trustbridge
annotate common/portpath.h @ 817:6de4adb32668 0.8
Removed tag 0.8
author | Andre Heinecke <andre.heinecke@intevation.de> |
---|---|
date | Tue, 15 Jul 2014 17:50:11 +0200 |
parents | 17e1c8f37d72 |
children | b3695a3399de |
rev | line source |
---|---|
404 | 1 /* Copyright (C) 2014 by Bundesamt für Sicherheit in der Informationstechnik |
2 * Software engineering by Intevation GmbH | |
3 * | |
4 * This file is Free Software under the GNU GPL (v>=2) | |
5 * and comes with ABSOLUTELY NO WARRANTY! | |
6 * See LICENSE.txt for details. | |
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 */ |
306e4db11761
Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
38 char *port_realpath(char *path); |
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 */ |
70d627e9e801
New portability function to test if a file is an directory.
Sascha Wilde <wilde@intevation.de>
parents:
168
diff
changeset
|
56 bool port_isdir(char *path); |
70d627e9e801
New portability function to test if a file is an directory.
Sascha Wilde <wilde@intevation.de>
parents:
168
diff
changeset
|
57 |
146
306e4db11761
Added portable path name handling functions.
Sascha Wilde <wilde@intevation.de>
parents:
diff
changeset
|
58 #endif |