CORSIKA add-on package IACT/ATMO:  Version 1.63 (November 2020)
fileopen.h
Go to the documentation of this file.
1 /* ============================================================================
2 
3  Copyright (C) 2000, 2009, 2010, 2014 Konrad Bernloehr
4 
5  This file is part of the eventio/hessio library.
6 
7  The eventio/hessio library is free software; you can redistribute it and/or
8  modify it under the terms of the GNU Lesser General Public
9  License as published by the Free Software Foundation; either
10  version 2.1 of the License, or (at your option) any later version.
11 
12  This library is distributed in the hope that it will be useful,
13  but WITHOUT ANY WARRANTY; without even the implied warranty of
14  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15  Lesser General Public License for more details.
16 
17  You should have received a copy of the GNU Lesser General Public License
18  along with this library. If not, see <http://www.gnu.org/licenses/>.
19 
20 ============================================================================ */
21 
30 #ifndef FILEOPEN_H__LOADED
31 #define FILEOPEN_H__LOADED 1
32 
33 #ifdef __cplusplus
34 extern "C" {
35 #endif
36 
37 /* fileopen.c */
39 struct incpath
40 {
41  char *path;
42  struct incpath *next;
43 };
44 
45 void initpath(const char *default_path);
46 void initexepath(const char *default_path);
47 void listpath (char *buffer, size_t bufsize);
48 void addpath(const char *name);
49 void addexepath(const char *name);
50 FILE *fileopen(const char *fname, const char *mode);
51 int fileclose(FILE *f);
52 struct incpath *get_include_path(void);
53 
54 void set_permissive_pipes(int p);
55 void enable_permissive_pipes(void);
56 void disable_permissive_pipes(void);
57 
58 #ifdef __cplusplus
59 }
60 
61 # if defined(_BASIC_STRING_H) || defined(_LIBCPP_STRING)
62 /* Alternative only available if <string> was included earlier. */
63 inline FILE *fileopen(const std::string& fname, const char *mode)
64 { return fileopen(fname.c_str(),mode); }
65 # endif
66 #endif
67 
68 #endif
void disable_permissive_pipes(void)
Disable the permissive execution of pipes.
Definition: fileopen.c:200
int fileclose(FILE *f)
Close a file or fifo but not if it is one of the standard streams.
Definition: fileopen.c:1231
void enable_permissive_pipes(void)
Enable the permissive execution of pipes.
Definition: fileopen.c:191
FILE * fileopen(const char *fname, const char *mode)
Search for a file in the include path list and open it if possible.
Definition: fileopen.c:982
void listpath(char *buffer, size_t bufsize)
Show the list of include paths.
Definition: fileopen.c:297
void addexepath(const char *name)
Add a path to the list of execution paths, if not already there.
Definition: fileopen.c:379
void addpath(const char *name)
Add a path to the list of include paths, if not already there.
Definition: fileopen.c:327
struct incpath * next
The next element.
Definition: fileopen.h:42
char * path
The path name.
Definition: fileopen.h:41
An element in a linked list of include paths.
Definition: fileopen.h:39
void set_permissive_pipes(int p)
Enable or disable the permissive execution of pipes.
Definition: fileopen.c:181
void initpath(const char *default_path)
Init the path list, with default_path as the only entry.
Definition: fileopen.c:215