2009-02-05 21:28:18 +03:00
|
|
|
/** \file fs.h
|
|
|
|
* \brief Header: fs compatibility definitions
|
|
|
|
*/
|
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
/* Include file to use opendir/closedir/readdir */
|
|
|
|
|
2004-12-03 22:17:46 +03:00
|
|
|
#ifndef MC_FS_H
|
|
|
|
#define MC_FS_H
|
2002-01-22 04:23:18 +03:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#include <sys/types.h>
|
2009-02-06 15:44:53 +03:00
|
|
|
#include <unistd.h>
|
1998-02-27 07:54:42 +03:00
|
|
|
#include <sys/stat.h>
|
2010-11-08 13:21:45 +03:00
|
|
|
#include <dirent.h>
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** typedefs(not structures) and defined constants **********************************************/
|
2002-01-22 04:23:18 +03:00
|
|
|
|
2015-04-05 09:02:37 +03:00
|
|
|
#ifdef S_ISREG
|
|
|
|
#define HAVE_S_ISREG 1
|
|
|
|
#else
|
|
|
|
#define HAVE_S_ISREG 0
|
|
|
|
#define S_ISREG(x) 0
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifdef S_ISDIR
|
|
|
|
#define HAVE_S_ISDIR 1
|
|
|
|
#else
|
|
|
|
#define HAVE_S_ISDIR 0
|
|
|
|
#define S_ISDIR(x) 0
|
|
|
|
#endif
|
|
|
|
|
2002-01-22 04:23:18 +03:00
|
|
|
/* Replacement for permission bits missing in sys/stat.h */
|
2015-04-05 09:02:37 +03:00
|
|
|
#ifdef S_ISLNK
|
|
|
|
#define HAVE_S_ISLNK 1
|
|
|
|
#else
|
|
|
|
#define HAVE_S_ISLNK 0
|
2010-11-22 17:15:28 +03:00
|
|
|
#define S_ISLNK(x) 0
|
2002-01-22 04:23:18 +03:00
|
|
|
#endif
|
|
|
|
|
2015-04-05 09:02:37 +03:00
|
|
|
#ifdef S_ISSOCK
|
|
|
|
#define HAVE_S_ISSOCK 1
|
|
|
|
#else
|
|
|
|
#define HAVE_S_ISSOCK 0
|
2010-11-22 17:15:28 +03:00
|
|
|
#define S_ISSOCK(x) 0
|
2002-01-22 04:23:18 +03:00
|
|
|
#endif
|
|
|
|
|
2015-04-05 09:02:37 +03:00
|
|
|
#ifdef S_ISFIFO
|
|
|
|
#define HAVE_S_ISFIFO 1
|
|
|
|
#else
|
|
|
|
#define HAVE_S_ISFIFO 0
|
2010-11-22 17:15:28 +03:00
|
|
|
#define S_ISFIFO(x) 0
|
2002-01-22 04:23:18 +03:00
|
|
|
#endif
|
|
|
|
|
2015-04-05 09:02:37 +03:00
|
|
|
#ifdef S_ISCHR
|
|
|
|
#define HAVE_S_ISCHR 1
|
|
|
|
#else
|
|
|
|
#define HAVE_S_ISCHR 0
|
2010-11-22 17:15:28 +03:00
|
|
|
#define S_ISCHR(x) 0
|
2002-01-22 04:23:18 +03:00
|
|
|
#endif
|
|
|
|
|
2015-04-05 09:02:37 +03:00
|
|
|
#ifdef S_ISBLK
|
|
|
|
#define HAVE_S_ISBLK 1
|
|
|
|
#else
|
|
|
|
#define HAVE_S_ISBLK 0
|
2010-11-22 17:15:28 +03:00
|
|
|
#define S_ISBLK(x) 0
|
2002-01-22 04:23:18 +03:00
|
|
|
#endif
|
|
|
|
|
2002-09-06 04:47:46 +04:00
|
|
|
/* Door is something that only exists on Solaris */
|
2015-04-05 09:02:37 +03:00
|
|
|
#ifdef S_ISDOOR
|
|
|
|
#define HAVE_S_ISDOOR 1
|
|
|
|
#else
|
|
|
|
#define HAVE_S_ISDOOR 0
|
2010-11-22 17:15:28 +03:00
|
|
|
#define S_ISDOOR(x) 0
|
2002-09-06 04:47:46 +04:00
|
|
|
#endif
|
|
|
|
|
2004-11-03 23:31:59 +03:00
|
|
|
/* Special named files are widely used in QNX6 */
|
2015-04-05 09:02:37 +03:00
|
|
|
#ifdef S_ISNAM
|
|
|
|
#define HAVE_S_ISNAM 1
|
|
|
|
#else
|
|
|
|
#define HAVE_S_ISNAM 0
|
2010-11-22 17:15:28 +03:00
|
|
|
#define S_ISNAM(x) 0
|
2004-11-03 23:31:59 +03:00
|
|
|
#endif
|
2002-09-06 04:47:46 +04:00
|
|
|
|
2010-11-09 21:25:07 +03:00
|
|
|
#ifndef PATH_MAX
|
|
|
|
#ifdef _POSIX_VERSION
|
|
|
|
#define PATH_MAX _POSIX_PATH_MAX
|
|
|
|
#else
|
|
|
|
#ifdef MAXPATHLEN
|
|
|
|
#define PATH_MAX MAXPATHLEN
|
|
|
|
#else
|
|
|
|
#define PATH_MAX 1024
|
|
|
|
#endif
|
|
|
|
#endif
|
|
|
|
#endif
|
2002-01-22 04:23:18 +03:00
|
|
|
|
1998-02-27 07:54:42 +03:00
|
|
|
#ifndef MAXPATHLEN
|
2010-11-22 17:15:28 +03:00
|
|
|
#define MC_MAXPATHLEN 4096
|
1998-02-27 07:54:42 +03:00
|
|
|
#else
|
2010-11-22 17:15:28 +03:00
|
|
|
#define MC_MAXPATHLEN MAXPATHLEN
|
1998-02-27 07:54:42 +03:00
|
|
|
#endif
|
|
|
|
|
|
|
|
/* unistd.h defines _POSIX_VERSION on POSIX.1 systems. */
|
2009-02-06 15:44:53 +03:00
|
|
|
#define NLENGTH(dirent) (strlen ((dirent)->d_name))
|
1998-02-27 07:54:42 +03:00
|
|
|
|
2011-04-06 15:31:52 +04:00
|
|
|
/* DragonFlyBSD doesn't provide MAXNAMLEN macro */
|
2010-10-07 12:29:36 +04:00
|
|
|
#ifndef MAXNAMLEN
|
2011-04-06 15:31:52 +04:00
|
|
|
#define MAXNAMLEN NAME_MAX
|
2010-10-07 12:29:36 +04:00
|
|
|
#endif
|
|
|
|
|
2011-04-06 15:31:52 +04:00
|
|
|
#define MC_MAXFILENAMELEN MAXNAMLEN
|
|
|
|
|
2013-07-13 21:02:34 +04:00
|
|
|
#define DIR_IS_DOT(x) ((x)[0] == '.' && (x)[1] == '\0')
|
|
|
|
#define DIR_IS_DOTDOT(x) ((x)[0] == '.' && (x)[1] == '.' && (x)[2] == '\0')
|
|
|
|
|
2010-11-08 13:21:45 +03:00
|
|
|
/*** enums ***************************************************************************************/
|
|
|
|
|
|
|
|
/*** structures declarations (and typedefs of structures)*****************************************/
|
|
|
|
|
|
|
|
/*** global variables defined in .c file *********************************************************/
|
|
|
|
|
|
|
|
/*** declarations of public functions ************************************************************/
|
|
|
|
|
|
|
|
/*** inline functions ****************************************************************************/
|
|
|
|
|
2004-12-03 22:17:46 +03:00
|
|
|
#endif
|