|
void | addexepath (const char *name) |
| Add a path to the list of execution paths, if not already there. More...
|
|
void | addpath (const char *name) |
| Add a path to the list of include paths, if not already there. More...
|
|
static FILE * | cmp_popen (const char *fname, const char *mode, int compression) |
| Helper function for opening a compressed file through a fifo. More...
|
|
void | disable_permissive_pipes () |
| Disable the permissive execution of pipes. More...
|
|
void | enable_permissive_pipes () |
| Enable the permissive execution of pipes. More...
|
|
static FILE * | exe_popen (const char *fname, const char *mode) |
| Helper function for opening a pipe from or to a given program. More...
|
|
int | fileclose (FILE *f) |
| Close a file or fifo but not if it is one of the standard streams. More...
|
|
FILE * | fileopen (const char *fname, const char *mode) |
| Search for a file in the include path list and open it if possible. More...
|
|
static void | fileopen_env_init (void) |
|
static FILE * | fopenx (const char *fname, const char *mode) |
|
static void | freeexepath () |
| Free a whole list of execution path elements. More...
|
|
static void | freepath () |
| Free a whole list of include path elements. More...
|
|
struct incpath * | get_include_path (void) |
|
void | initexepath (const char *default_exe_path) |
|
void | initpath (const char *default_path) |
| Init the path list, with default_path as the only entry. More...
|
|
void | listpath (char *buffer, size_t bufsize) |
| Show the list of include paths. More...
|
|
static FILE * | popenx (const char *fname, const char *mode) |
|
void | set_permissive_pipes (int p) |
| Enable or disable the permissive execution of pipes. More...
|
|
static FILE * | ssh_popen (const char *fname, const char *mode, int compression) |
| Helper function for opening a file on a remote SSH server.
|
|
static FILE * | uri_popen (const char *fname, const char *mode, int compression) |
| Helper function for opening a file with a URI (http:// etc.). More...
|
|
The functions provided in this file provide an enhanced replacement fileopen()
for the C standard library's fopen()
function. The enhancements are in several areas:
- Where possible files are opened such that more than 2 gigabytes of data can be accessed on 32-bit systems when suitably compiled. This also works with software where a
'-D_FILE_OFFSET_BITS=64'
at compile-time cannot be used (of which ROOT is an infamous example).
- For reading files, a list of paths can be configured before the the first fileopen() call and all files without absolute paths will be searched in these paths. Writing always strictly follows the given file name and will not search in the path list.
- Files compressed with
gzip
or bzip2
can be handled on the fly. Files with corresponding file name extensions (
.gz and
.bz2 ) will be automatically decompressed when reading or compressed when writing (in a pipe, i.e. without producing temporary copies).
- In the same way, files compressed with
lzop
(for extension
.lzo ), lzma
(for extension
.lzma ) as well as xz
(for extension @ .xz ) and lz4
(for extension
.lz4 ) are handled on the fly. No check is made if these programs are installed.
- URIs (uniform resource identifiers) starting with
http:,
https:,
or ftp:
will also be opened in a pipe, with optional decompression, depending on the ending of the URI name. You can therefore easily process files located on a web or ftp server. Access is limited to reading.
- Files on any SSH server where you can login without a password can be read as
'ssh://user@host
:filepath' where filepath can be an absolute path (starting with '/'
) or one relative to the users home directory.
- Input and output can also be from/to a user-defined program. Restrictions apply there which prevent execution of any program by default. Either a list of accepted execution paths has to be set up beforehand with initexepath()/addexepath() or permissive mode can be enabled, allowing execution of any given program.
- Author
- Konrad Bernloehr
- Date
- Nov. 2000
-
CVS $Date: 2019/01/10 14:40:51 $
- Version
CVS $Revision: 1.31 $