2 * \brief Header: directory routines
10 #include "lib/global.h"
12 /*** typedefs(not structures) and defined constants **********************************************/
15 #define RESIZE_STEPS 128
17 typedef int sortfn (const void *, const void *);
19 /*** enums ***************************************************************************************/
21 /*** structures declarations (and typedefs of structures)*****************************************/
23 /* keys are set only during sorting */
30 /* key used for comparing names */
32 /* key used for comparing extensions */
33 char *second_sort_key
;
38 unsigned int marked
:1; /* File marked in pane window */
39 unsigned int link_to_dir
:1; /* If this is a link, does it point to directory? */
40 unsigned int stale_link
:1; /* If this is a symlink and points to Charon's land */
41 unsigned int dir_size_computed
:1; /* Size of directory was computed with dirsizes_cmd */
51 /*** global variables defined in .c file *********************************************************/
53 /*** declarations of public functions ************************************************************/
55 int do_load_dir (const char *path
, dir_list
* list
, sortfn
* sort
, gboolean reverse
,
56 gboolean case_sensitive
, gboolean exec_ff
, const char *fltr
);
57 void do_sort (dir_list
* list
, sortfn
* sort
, int top
, gboolean reverse
,
58 gboolean case_sensitive
, gboolean exec_ff
);
59 int do_reload_dir (const char *path
, dir_list
* list
, sortfn
* sort
, int count
,
60 gboolean reverse
, gboolean case_sensitive
, gboolean exec_ff
, const char *fltr
);
61 void clean_dir (dir_list
* list
, int count
);
62 gboolean
set_zero_dir (dir_list
* list
);
63 int handle_path (dir_list
* list
, const char *path
, struct stat
*buf1
,
64 int next_free
, int *link_to_dir
, int *stale_link
);
66 /* Sorting functions */
67 int unsorted (file_entry
* a
, file_entry
* b
);
68 int sort_name (file_entry
* a
, file_entry
* b
);
69 int sort_vers (file_entry
* a
, file_entry
* b
);
70 int sort_ext (file_entry
* a
, file_entry
* b
);
71 int sort_time (file_entry
* a
, file_entry
* b
);
72 int sort_atime (file_entry
* a
, file_entry
* b
);
73 int sort_ctime (file_entry
* a
, file_entry
* b
);
74 int sort_size (file_entry
* a
, file_entry
* b
);
75 int sort_inode (file_entry
* a
, file_entry
* b
);
77 gboolean
if_link_is_exe (const char *full_name
, const file_entry
* file
);
79 /*** inline functions ****************************************************************************/
81 static inline gboolean
82 link_isdir (const file_entry
* file
)
84 return (gboolean
) file
->f
.link_to_dir
;
87 #endif /* MC__DIR_H */