Better use of S_IS* macros.
Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
Этот коммит содержится в:
родитель
8a2f9e253d
Коммит
d0d7d412a7
@ -49,7 +49,7 @@
|
|||||||
inline static gboolean
|
inline static gboolean
|
||||||
mc_fhl_is_file (file_entry_t * fe)
|
mc_fhl_is_file (file_entry_t * fe)
|
||||||
{
|
{
|
||||||
#if S_ISREG == 0
|
#if HAVE_S_ISREG == 0
|
||||||
(void) fe;
|
(void) fe;
|
||||||
#endif
|
#endif
|
||||||
return S_ISREG (fe->st.st_mode);
|
return S_ISREG (fe->st.st_mode);
|
||||||
@ -64,7 +64,7 @@ mc_fhl_is_file_exec (file_entry_t * fe)
|
|||||||
inline static gboolean
|
inline static gboolean
|
||||||
mc_fhl_is_dir (file_entry_t * fe)
|
mc_fhl_is_dir (file_entry_t * fe)
|
||||||
{
|
{
|
||||||
#if S_ISDIR == 0
|
#if HAVE_S_ISDIR == 0
|
||||||
(void) fe;
|
(void) fe;
|
||||||
#endif
|
#endif
|
||||||
return S_ISDIR (fe->st.st_mode);
|
return S_ISDIR (fe->st.st_mode);
|
||||||
@ -73,7 +73,7 @@ mc_fhl_is_dir (file_entry_t * fe)
|
|||||||
inline static gboolean
|
inline static gboolean
|
||||||
mc_fhl_is_link (file_entry_t * fe)
|
mc_fhl_is_link (file_entry_t * fe)
|
||||||
{
|
{
|
||||||
#if S_ISLNK == 0
|
#if HAVE_S_ISLNK == 0
|
||||||
(void) fe;
|
(void) fe;
|
||||||
#endif
|
#endif
|
||||||
return S_ISLNK (fe->st.st_mode);
|
return S_ISLNK (fe->st.st_mode);
|
||||||
@ -100,7 +100,7 @@ mc_fhl_is_stale_link (file_entry_t * fe)
|
|||||||
inline static gboolean
|
inline static gboolean
|
||||||
mc_fhl_is_device_char (file_entry_t * fe)
|
mc_fhl_is_device_char (file_entry_t * fe)
|
||||||
{
|
{
|
||||||
#if S_ISCHR == 0
|
#if HAVE_S_ISCHR == 0
|
||||||
(void) fe;
|
(void) fe;
|
||||||
#endif
|
#endif
|
||||||
return S_ISCHR (fe->st.st_mode);
|
return S_ISCHR (fe->st.st_mode);
|
||||||
@ -109,7 +109,7 @@ mc_fhl_is_device_char (file_entry_t * fe)
|
|||||||
inline static gboolean
|
inline static gboolean
|
||||||
mc_fhl_is_device_block (file_entry_t * fe)
|
mc_fhl_is_device_block (file_entry_t * fe)
|
||||||
{
|
{
|
||||||
#if S_ISBLK == 0
|
#if HAVE_S_ISBLK == 0
|
||||||
(void) fe;
|
(void) fe;
|
||||||
#endif
|
#endif
|
||||||
return S_ISBLK (fe->st.st_mode);
|
return S_ISBLK (fe->st.st_mode);
|
||||||
@ -118,7 +118,7 @@ mc_fhl_is_device_block (file_entry_t * fe)
|
|||||||
inline static gboolean
|
inline static gboolean
|
||||||
mc_fhl_is_special_socket (file_entry_t * fe)
|
mc_fhl_is_special_socket (file_entry_t * fe)
|
||||||
{
|
{
|
||||||
#if S_ISSOCK == 0
|
#if HAVE_S_ISSOCK == 0
|
||||||
(void) fe;
|
(void) fe;
|
||||||
#endif
|
#endif
|
||||||
return S_ISSOCK (fe->st.st_mode);
|
return S_ISSOCK (fe->st.st_mode);
|
||||||
@ -127,7 +127,7 @@ mc_fhl_is_special_socket (file_entry_t * fe)
|
|||||||
inline static gboolean
|
inline static gboolean
|
||||||
mc_fhl_is_special_fifo (file_entry_t * fe)
|
mc_fhl_is_special_fifo (file_entry_t * fe)
|
||||||
{
|
{
|
||||||
#if S_ISFIFO == 0
|
#if HAVE_S_ISFIFO == 0
|
||||||
(void) fe;
|
(void) fe;
|
||||||
#endif
|
#endif
|
||||||
return S_ISFIFO (fe->st.st_mode);
|
return S_ISFIFO (fe->st.st_mode);
|
||||||
@ -136,7 +136,7 @@ mc_fhl_is_special_fifo (file_entry_t * fe)
|
|||||||
inline static gboolean
|
inline static gboolean
|
||||||
mc_fhl_is_special_door (file_entry_t * fe)
|
mc_fhl_is_special_door (file_entry_t * fe)
|
||||||
{
|
{
|
||||||
#if S_ISDOOR == 0
|
#if HAVE_S_ISDOOR == 0
|
||||||
(void) fe;
|
(void) fe;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
49
lib/fs.h
49
lib/fs.h
@ -14,34 +14,69 @@
|
|||||||
|
|
||||||
/*** typedefs(not structures) and defined constants **********************************************/
|
/*** typedefs(not structures) and defined constants **********************************************/
|
||||||
|
|
||||||
|
#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
|
||||||
|
|
||||||
/* Replacement for permission bits missing in sys/stat.h */
|
/* Replacement for permission bits missing in sys/stat.h */
|
||||||
#ifndef S_ISLNK
|
#ifdef S_ISLNK
|
||||||
|
#define HAVE_S_ISLNK 1
|
||||||
|
#else
|
||||||
|
#define HAVE_S_ISLNK 0
|
||||||
#define S_ISLNK(x) 0
|
#define S_ISLNK(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef S_ISSOCK
|
#ifdef S_ISSOCK
|
||||||
|
#define HAVE_S_ISSOCK 1
|
||||||
|
#else
|
||||||
|
#define HAVE_S_ISSOCK 0
|
||||||
#define S_ISSOCK(x) 0
|
#define S_ISSOCK(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef S_ISFIFO
|
#ifdef S_ISFIFO
|
||||||
|
#define HAVE_S_ISFIFO 1
|
||||||
|
#else
|
||||||
|
#define HAVE_S_ISFIFO 0
|
||||||
#define S_ISFIFO(x) 0
|
#define S_ISFIFO(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef S_ISCHR
|
#ifdef S_ISCHR
|
||||||
|
#define HAVE_S_ISCHR 1
|
||||||
|
#else
|
||||||
|
#define HAVE_S_ISCHR 0
|
||||||
#define S_ISCHR(x) 0
|
#define S_ISCHR(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef S_ISBLK
|
#ifdef S_ISBLK
|
||||||
|
#define HAVE_S_ISBLK 1
|
||||||
|
#else
|
||||||
|
#define HAVE_S_ISBLK 0
|
||||||
#define S_ISBLK(x) 0
|
#define S_ISBLK(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Door is something that only exists on Solaris */
|
/* Door is something that only exists on Solaris */
|
||||||
#ifndef S_ISDOOR
|
#ifdef S_ISDOOR
|
||||||
|
#define HAVE_S_ISDOOR 1
|
||||||
|
#else
|
||||||
|
#define HAVE_S_ISDOOR 0
|
||||||
#define S_ISDOOR(x) 0
|
#define S_ISDOOR(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Special named files are widely used in QNX6 */
|
/* Special named files are widely used in QNX6 */
|
||||||
#ifndef S_ISNAM
|
#ifdef S_ISNAM
|
||||||
|
#define HAVE_S_ISNAM 1
|
||||||
|
#else
|
||||||
|
#define HAVE_S_ISNAM 0
|
||||||
#define S_ISNAM(x) 0
|
#define S_ISNAM(x) 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user