Debian Codegraph @

dune/uggrid/low/fileopen.h

raw
1 // -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
2 // vi: set et ts=4 sw=2 sts=2:
3 // SPDX-FileCopyrightInfo: Copyright © DUNE Project contributors, see file LICENSE.md in module root
4 // SPDX-License-Identifier: LGPL-2.1-or-later
5 /****************************************************************************/
6 /* */
7 /* File: fileopen.h */
8 /* */
9 /* Author: Henrik Rentz-Reichert */
10 /* Institut fuer Computeranwendungen III */
11 /* Universitaet Stuttgart */
12 /* Pfaffenwaldring 27 */
13 /* 70569 Stuttgart */
14 /* email: [email protected] */
15 /* */
16 /* History: 13.02.95 begin, ug version 3.0 */
17 /* */
18 /* Remarks: */
19 /* */
20 /****************************************************************************/
21
22
23
24 /****************************************************************************/
25 /* */
26 /* auto include mechanism and other include files */
27 /* */
28 /****************************************************************************/
29
30 #ifndef __FILEOPEN__
31 #define __FILEOPEN__
32
33 #include <cstdio>
34 #include <fcntl.h>
35
36 #include <filesystem>
37
38 #include "ugtypes.h"
39 #include "namespace.h"
40
41 START_UG_NAMESPACE
42
43 /****************************************************************************/
44 /* */
45 /* defines in the following order */
46 /* */
47 /* compile time constants defining static data size (i.e. arrays) */
48 /* other constants */
49 /* macros */
50 /* */
51 /****************************************************************************/
52
53
54 /* return constants for filetype() */
55 enum FileTypes { FT_UNKNOWN, FT_FILE, FT_DIR, FT_LINK };
56
57 #define fileopen(fname,mode) fopen_r(BasedConvertedFilename(fname),(mode),0)
58 #define fileopen_r(fname,mode,r) fopen_r(BasedConvertedFilename(fname),(mode),(r))
59
60 /****************************************************************************/
61 /* */
62 /* data structures exported by the corresponding source file */
63 /* */
64 /****************************************************************************/
65
66 /****************************************************************************/
67 /* */
68 /* definition of exported global variables */
69 /* */
70 /****************************************************************************/
71
72 /****************************************************************************/
73 /* */
74 /* function declarations */
75 /* */
76 /****************************************************************************/
77
78 const char* BasedConvertedFilename (const char *fname);
79 int filetype (const char *fname);
80 INT ReadSearchingPaths (const char *filename, const char *pathsvar);
81 int DirCreateUsingSearchPaths (const char *fname, const char *paths);
82 int DirCreateUsingSearchPaths_r (const char *fname, const char *paths, int rename);
83 FILE *FileOpenUsingSearchPaths (const char *fname, const char *mode, const char *pathsvar);
84 FILE *FileOpenUsingSearchPaths_r (const char *fname, const char *mode, const char *pathsvar, int rename);
85 FILE *FileOpenUsingSearchPath (const char *fname, const char *mode, const char *path);
86 FILE *FileOpenUsingSearchPath_r (const char *fname, const char *mode, const char *path, int rename);
87 int FileTypeUsingSearchPaths (const char *fname, const char *pathsvar);
88 FILE *fopen_r (const char *fname, const char *mode, int do_rename);
89 int mkdir_r (const char *fname, std::filesystem::perms mode, int do_rename);
90
91 bool AppendTrailingSlash (char *path);
92 char* SimplifyPath (char *path);
93
94 INT InitFileOpen (void);
95
96 END_UG_NAMESPACE
97
98 #endif