Original patch as attached on the bugreport
[midnight-commander.git] / src / dir.h
blob90af8bbe5c102cc68dac68173c653d679062d137
1 #ifndef MC_DIR_H
2 #define MC_DIR_H
4 #define MIN_FILES 128
5 #define RESIZE_STEPS 128
7 #include <sys/stat.h>
9 typedef struct {
11 /* File attributes */
13 int fnamelen;
14 char *fname;
15 struct stat st;
17 /* Flags */
18 struct {
19 unsigned int marked:1; /* File marked in pane window */
20 unsigned int link_to_dir:1; /* If this is a link, does it point to directory? */
21 unsigned int stale_link:1; /* If this is a symlink and points to Charon's land */
22 unsigned int dir_size_computed:1; /* Size of directory was computed with dirsizes_cmd */
23 } f;
24 } file_entry;
26 typedef struct {
27 file_entry *list;
28 int size;
29 } dir_list;
31 typedef int sortfn (const void *, const void *);
33 int do_load_dir (const char *path, dir_list * list, sortfn * sort, int reverse,
34 int case_sensitive, int exec_ff, const char *filter);
35 void do_sort (dir_list * list, sortfn * sort, int top, int reverse,
36 int case_sensitive, int exec_ff);
37 int do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
38 int reverse, int case_sensitive, int exec_ff, const char *filter);
39 void clean_dir (dir_list * list, int count);
40 int set_zero_dir (dir_list * list);
41 int handle_path (dir_list *list, const char *path, struct stat *buf1,
42 int next_free, int *link_to_dir, int *stale_link);
44 /* Sorting functions */
45 int unsorted (const file_entry *a, const file_entry *b);
46 int sort_name (const file_entry *a, const file_entry *b);
47 int sort_ext (const file_entry *a, const file_entry *b);
48 int sort_time (const file_entry *a, const file_entry *b);
49 int sort_atime (const file_entry *a, const file_entry *b);
50 int sort_ctime (const file_entry *a, const file_entry *b);
51 int sort_size (const file_entry *a, const file_entry *b);
52 int sort_inode (const file_entry *a, const file_entry *b);
54 /* SORT_TYPES is used to build the nice dialog box entries */
55 #define SORT_TYPES 8
57 /* This is the number of sort types not available in that dialog box */
58 #define SORT_TYPES_EXTRA 0
60 /* The total nnumber of sort types */
61 #define SORT_TYPES_TOTAL (SORT_TYPES + SORT_TYPES_EXTRA)
63 typedef struct {
64 const char *sort_name;
65 int (*sort_fn)(const file_entry *, const file_entry *);
66 } sort_orders_t;
68 extern sort_orders_t sort_orders [SORT_TYPES_TOTAL];
70 int link_isdir (const file_entry *);
71 int if_link_is_exe (const char *full_name, const file_entry *file);
73 extern int show_backups;
74 extern int show_dot_files;
75 extern int mix_all_files;
77 #endif