r1996: Cope slightly better with invalid filenames in various places (reported by
[rox-filer.git] / ROX-Filer / src / my_vfs.h
blobf6f20f84cdf05954b2dee8179c9c84d6a38da5c7
1 /*
2 * $Id$
4 * ROX-Filer, filer for the ROX desktop project
5 * By Thomas Leonard, <tal197@users.sourceforge.net>.
6 */
8 #ifndef _MY_VFS_H
9 #define _MY_VFS_H
11 #ifdef HAVE_LIBVFS
13 /* We have the VFS library. Include the header file if possible, or define
14 * stuff ourselves if not.
17 # define VFS_STANDALONE 1
18 # ifdef HAVE_VFS_H
19 # include "vfs.h"
20 # else
21 # include <sys/stat.h>
22 # include <unistd.h>
23 # include <sys/types.h>
24 # include <dirent.h>
25 void mc_vfs_init(void);
26 DIR *mc_opendir (char *dirname);
27 struct dirent *mc_readdir(DIR *dirp);
28 int mc_closedir (DIR *dir);
29 int mc_telldir (DIR *dir);
30 void mc_seekdir (DIR *dir, int offset);
32 int mc_open (const char *filename, int flags, ...);
33 int mc_close (int handle);
34 int mc_read (int handle, char *buffer, int count);
35 int mc_write (int hanlde, char *buffer, int count);
37 int mc_stat (char *path, struct stat *buf);
38 int mc_lstat (char *path, struct stat *buf);
39 int mc_fstat (int fd, struct stat *buf);
40 # endif
42 #else /* HAVE_LIBVFS */
44 /* We don't have VFS installed. Just use the normal functions instead. */
46 /* Include these here so that we don't get code that compiles with
47 * VFS but not without.
49 # include <sys/stat.h>
50 # include <unistd.h>
51 # include <sys/types.h>
52 # include <dirent.h>
54 # define mc_open open
55 # define mc_close close
56 # define mc_read read
57 # define mc_write write
59 # define mc_stat(x, y) stat(x, y)
60 # define mc_lstat(x, y) lstat(x, y)
61 # define mc_fstat(x, y) fstat(x, y)
62 # define mc_opendir(x) opendir(x)
63 # define mc_closedir(x) closedir(x)
64 # define mc_readdir(x) readdir(x)
65 # define mc_seekdir(x, o) seekdir(x, o)
66 # define mc_telldir(x) telldir(x)
68 #endif
70 #endif /* _MY_VFS_H */