* lib/mc.ext.in: Add a few sound formats that "play" and "mikmod"
[midnight-commander.git] / src / dir.h
blob68e2a4fdc0a15f94d16b1a56dd73f785513b2e27
1 #ifndef __DIR_H
2 #define __DIR_H
4 #define MIN_FILES 128
5 #define RESIZE_STEPS 128
7 #include <sys/stat.h>
8 typedef struct {
10 /* File attributes */
12 int fnamelen;
13 char *fname;
14 struct stat st;
16 /* Flags */
17 struct {
18 unsigned int marked:1; /* File marked in pane window */
19 unsigned int link_to_dir:1; /* If this is a link, does it point to directory? */
20 unsigned int stale_link:1; /* If this is a symlink and points to Charon's land */
21 unsigned int dir_size_computed:1; /* Size of directory was computed with dirsizes_cmd */
22 } f;
23 } file_entry;
25 typedef struct {
26 file_entry *list;
27 int size;
28 } dir_list;
30 typedef int sortfn (const void *, const void *);
32 int do_load_dir (const char *path, dir_list * list, sortfn * sort, int reverse,
33 int case_sensitive, const char *filter);
34 void do_sort (dir_list * list, sortfn * sort, int top, int reverse,
35 int case_sensitive);
36 int do_reload_dir (const char *path, dir_list * list, sortfn * sort, int count,
37 int reverse, int case_sensitive, const char *filter);
38 void clean_dir (dir_list * list, int count);
39 int set_zero_dir (dir_list * list);
40 int handle_path (dir_list *list, const char *path, struct stat *buf1,
41 int next_free, int *link_to_dir, int *stale_link);
43 /* Sorting functions */
44 int unsorted (const file_entry *a, const file_entry *b);
45 int sort_name (const file_entry *a, const file_entry *b);
46 int sort_ext (const file_entry *a, const file_entry *b);
47 int sort_time (const file_entry *a, const file_entry *b);
48 int sort_atime (const file_entry *a, const file_entry *b);
49 int sort_ctime (const file_entry *a, const file_entry *b);
50 int sort_size (const file_entry *a, const file_entry *b);
51 int sort_inode (const file_entry *a, const file_entry *b);
52 int sort_type (const file_entry *a, const file_entry *b);
53 int sort_links (const file_entry *a, const file_entry *b);
54 int sort_nuid (const file_entry *a, const file_entry *b);
55 int sort_ngid (const file_entry *a, const file_entry *b);
56 int sort_owner (const file_entry *a, const file_entry *b);
57 int sort_group (const file_entry *a, const file_entry *b);
59 /* SORT_TYPES is used to build the nice dialog box entries */
60 #define SORT_TYPES 8
62 /* This is the number of sort types not available in that dialog box */
63 #define SORT_TYPES_EXTRA 6
65 /* The total nnumber of sort types */
66 #define SORT_TYPES_TOTAL (SORT_TYPES + SORT_TYPES_EXTRA)
68 typedef struct {
69 const char *sort_name;
70 int (*sort_fn)(const file_entry *, const file_entry *);
71 } sort_orders_t;
73 extern sort_orders_t sort_orders [SORT_TYPES_TOTAL];
75 int link_isdir (const file_entry *);
76 int if_link_is_exe (const char *full_name, const file_entry *file);
78 extern int show_backups;
79 extern int show_dot_files;
80 extern int mix_all_files;
82 #endif /* __DIR_H */