remove trailing whitespace at end of lines
[reactos.git] / rosapps / mc / src / dir.h
1 #ifndef __DIR_H
2 #define __DIR_H
3
4 #define MIN_FILES 128
5 #define RESIZE_STEPS 128
6
7 typedef struct {
8
9 /* File attributes */
10
11 int fnamelen;
12 char *fname;
13 struct stat buf;
14
15 /* Flags */
16 struct {
17 unsigned int marked:1; /* File marked in pane window */
18 unsigned int exists:1; /* Use for rereading file */
19 unsigned int link_to_dir:1; /* If this is a link, does it point to directory? */
20 unsigned int stalled_link:1; /* If this is a symlink and points to Charon's land */
21 } f;
22 char *cache;
23 } file_entry;
24
25 typedef struct {
26 file_entry *list;
27 int size;
28 } dir_list;
29
30 typedef int sortfn (const void *, const void *);
31 int do_load_dir (dir_list *list, sortfn *sort, int reverse, int case_sensitive, char *filter);
32 void do_sort (dir_list *list, sortfn *sort, int top, int reverse, int case_sensitive);
33 dir_list *do_collect_stat (dir_list *dir, int top);
34 int do_reload_dir (dir_list *list, sortfn *sort, int count, int reverse, int case_sensitive, char *filter);
35 void clean_dir (dir_list *list, int count);
36 int set_zero_dir (dir_list *list);
37
38 #ifdef DIR_H_INCLUDE_HANDLE_DIRENT
39 int handle_dirent (dir_list *list, char *filter, struct dirent *dp,
40 struct stat *buf1, int next_free, int *link_to_dir, int *stalled_link);
41 int handle_path (dir_list *list, char *path, struct stat *buf1, int next_free,
42 int *link_to_dir, int *stalled_link);
43 #endif
44
45 /* Sorting functions */
46 int unsorted (const file_entry *a, const file_entry *b);
47 int sort_name (const file_entry *a, const file_entry *b);
48 int sort_ext (const file_entry *a, const file_entry *b);
49 int sort_time (const file_entry *a, const file_entry *b);
50 int sort_atime (const file_entry *a, const file_entry *b);
51 int sort_ctime (const file_entry *a, const file_entry *b);
52 int sort_size (const file_entry *a, const file_entry *b);
53 int sort_inode (const file_entry *a, const file_entry *b);
54 int sort_type (const file_entry *a, const file_entry *b);
55 int sort_links (const file_entry *a, const file_entry *b);
56 int sort_nuid (const file_entry *a, const file_entry *b);
57 int sort_ngid (const file_entry *a, const file_entry *b);
58 int sort_owner (const file_entry *a, const file_entry *b);
59 int sort_group (const file_entry *a, const file_entry *b);
60
61 /* SORT_TYPES is used to build the nice dialog box entries */
62 #define SORT_TYPES 8
63
64 /* This is the number of sort types not available in that dialog box */
65 #define SORT_TYPES_EXTRA 6
66
67 /* The total, used by Tk version */
68 #define SORT_TYPES_TOTAL (SORT_TYPES + SORT_TYPES_EXTRA)
69
70 typedef struct {
71 char *sort_name;
72 int (*sort_fn)(const file_entry *, const file_entry *);
73 } sort_orders_t;
74
75 extern sort_orders_t sort_orders [SORT_TYPES_TOTAL];
76
77 int link_isdir (file_entry *);
78 int if_link_is_exe (file_entry *file);
79
80 extern int show_backups;
81 extern int show_dot_files;
82 extern int show_backups;
83 extern int mix_all_files;
84
85 char *sort_type_to_name (sortfn *);
86 sortfn *sort_name_to_type (char *type);
87
88 #endif /* __DIR_H */