mirror of
https://github.com/MidnightCommander/mc
synced 2024-12-22 20:36:50 +03:00
if_link_is_exe() and link_is_dir() now return gboolean
...and link_is_dir() is inline now. Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
parent
50c128a01f
commit
141926344d
19
src/dir.c
19
src/dir.c
@ -573,30 +573,17 @@ do_load_dir (const char *path, dir_list * list, sortfn * sort, int lc_reverse,
|
|||||||
return next_free;
|
return next_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
|
||||||
|
|
||||||
int
|
|
||||||
link_isdir (const file_entry * file)
|
|
||||||
{
|
|
||||||
if (file->f.link_to_dir)
|
|
||||||
return 1;
|
|
||||||
else
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
|
||||||
int
|
gboolean
|
||||||
if_link_is_exe (const char *full_name, const file_entry * file)
|
if_link_is_exe (const char *full_name, const file_entry * file)
|
||||||
{
|
{
|
||||||
struct stat b;
|
struct stat b;
|
||||||
|
|
||||||
if (S_ISLNK (file->st.st_mode) && !mc_stat (full_name, &b))
|
if (S_ISLNK (file->st.st_mode) && mc_stat (full_name, &b) == 0)
|
||||||
{
|
|
||||||
return is_exe (b.st_mode);
|
return is_exe (b.st_mode);
|
||||||
}
|
return TRUE;
|
||||||
else
|
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* --------------------------------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------------------------------- */
|
||||||
|
10
src/dir.h
10
src/dir.h
@ -74,8 +74,14 @@ int sort_ctime (file_entry * a, file_entry * b);
|
|||||||
int sort_size (file_entry * a, file_entry * b);
|
int sort_size (file_entry * a, file_entry * b);
|
||||||
int sort_inode (file_entry * a, file_entry * b);
|
int sort_inode (file_entry * a, file_entry * b);
|
||||||
|
|
||||||
int link_isdir (const file_entry *);
|
gboolean if_link_is_exe (const char *full_name, const file_entry * file);
|
||||||
int if_link_is_exe (const char *full_name, const file_entry * file);
|
|
||||||
|
|
||||||
/*** inline functions ****************************************************************************/
|
/*** inline functions ****************************************************************************/
|
||||||
|
|
||||||
|
static inline gboolean
|
||||||
|
link_isdir (const file_entry *file)
|
||||||
|
{
|
||||||
|
return (gboolean) file->f.link_to_dir;
|
||||||
|
}
|
||||||
|
|
||||||
#endif /* MC__DIR_H */
|
#endif /* MC__DIR_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user