* extfs.c (extfs_generate_entry): Initialize inode->last_in_subdir.
[midnight-commander.git] / src / dir.h
blobe2acf00ae81c6cecd18e5fdf7cb7fa704d14228c
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, const char *filter);
35 void do_sort (dir_list * list, sortfn * sort, int top, int reverse,
36 int case_sensitive);
37 int do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
38 int reverse, int case_sensitive, 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);
53 int sort_type (const file_entry *a, const file_entry *b);
54 int sort_links (const file_entry *a, const file_entry *b);
55 int sort_nuid (const file_entry *a, const file_entry *b);
56 int sort_ngid (const file_entry *a, const file_entry *b);
57 int sort_owner (const file_entry *a, const file_entry *b);
58 int sort_group (const file_entry *a, const file_entry *b);
60 /* SORT_TYPES is used to build the nice dialog box entries */
61 #define SORT_TYPES 8
63 /* This is the number of sort types not available in that dialog box */
64 #define SORT_TYPES_EXTRA 6
66 /* The total nnumber of sort types */
67 #define SORT_TYPES_TOTAL (SORT_TYPES + SORT_TYPES_EXTRA)
69 typedef struct {
70 const char *sort_name;
71 int (*sort_fn)(const file_entry *, const file_entry *);
72 } sort_orders_t;
74 extern sort_orders_t sort_orders [SORT_TYPES_TOTAL];
76 int link_isdir (const file_entry *);
77 int if_link_is_exe (const char *full_name, const file_entry *file);
79 extern int show_backups;
80 extern int show_dot_files;
81 extern int mix_all_files;
83 #endif