Repository navigation
Expand file tree
/
Copy pathtypes.h
More file actions
152 lines (130 loc) · 3.44 KB
/
Copy pathtypes.h
File metadata and controls
152 lines (130 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
#define CMD_MAX 16384
#define KEY_ALT_ENTER 0507 /* custom alt-enter key */
#define KEY_ALT_a 0506 /* custom alt-a key */
#define KEY_ALT_s 0505 /* custom alt-s key */
#define KEY_ALT_p 0x1001
#define KEY_ALT_n 0x1002
#define KEY_ALT_g 0x1003
#define KEY_SHIFT_F5 KEY_F(17)
#define KEY_SHIFT_F6 KEY_F(18)
#define KEY_SHIFT_F7 KEY_F(19)
typedef enum {
SORT_BY_NAME_ASC = 0,
SORT_BY_SIZE_ASC,
SORT_BY_TIME_ASC,
SORT_BY_NAME_DESC,
SORT_BY_SIZE_DESC,
SORT_BY_TIME_DESC,
SORT_BY_NAME_DIRSFIRST_ASC,
SORT_BY_SIZE_DIRSFIRST_ASC,
SORT_BY_TIME_DIRSFIRST_ASC,
SORT_BY_NAME_DIRSFIRST_DESC,
SORT_BY_SIZE_DIRSFIRST_DESC,
SORT_BY_TIME_DIRSFIRST_DESC
} SortOrders;
typedef struct FileNode {
char* name;
time_t mtime;
off_t size;
mode_t chmod;
uid_t chown;
int is_dir;
int is_executable;
int is_link;
int is_link_to_dir; // link points to a directory
int is_link_broken; // invalid link
int is_device;
char* link_target;
int is_selected; // with Insert key
struct FileNode *next;
} FileNode;
typedef struct PanelProp {
int selected_index;
int scroll_index;
SortOrders sort_order;
char path[CMD_MAX];
char file_under_cursor[CMD_MAX];
int num_selected_files;
off_t bytes_selected_files;
int files_count;
int search_mode;
char search_text[CMD_MAX];
char prev_search_text[CMD_MAX];
FileNode *files;
} PanelProp;
typedef struct {
PanelProp *drag_panel, *click_panel;
int button, mark, last_index, dragged, click_index;
struct timeval click_time;
} PanelMouse;
typedef struct file_lines {
char *line; // NUL-terminated for display; line_length also preserves embedded NULs.
int line_length;
struct file_lines *next;
} file_lines;
enum Color {
COLOR_WHITE_ON_BLACK = 1,
COLOR_WHITE_ON_BLUE,
COLOR_WHITE_ON_RED,
COLOR_BLACK_ON_WHITE,
COLOR_BLACK_ON_CYAN,
COLOR_BLACK_ON_CYAN_BTN,
COLOR_BLACK_ON_CYAN_PMPT,
COLOR_YELLOW_ON_CYAN,
COLOR_YELLOW_ON_BLUE,
COLOR_GREEN_ON_BLUE,
COLOR_MAGENTA_ON_BLUE,
COLOR_CYAN_ON_BLUE,
COLOR_CYAN_ON_BLACK,
COLOR_RED_ON_BLUE,
COLOR_BLUE_ON_WHITE,
COLOR_BLUE_ON_CYAN
};
typedef struct operationContext {
off_t current_size;
off_t current_items;
off_t total_size;
off_t total_items;
int confirm_all_yes;
int confirm_all_no;<
60E3
/div>
int skip_all;
int keep_item_selected;
char confirm_yes_prefix[CMD_MAX];
int abort;
int moving;
} operationContext;
enum operationResult {
OPERATION_OK = 0,
OPERATION_RETRY,
OPERATION_PARENT_OK_PROCESS_CHILDS,
OPERATION_RETRY_AFTER_CHILDS,
OPERATION_SKIP,
OPERATION_ABORT
};
typedef int (*OperationFunc)(const char *, const char *, operationContext *);
enum chmodAction {
CHMOD_CANCEL = 0,
CHMOD_SET,
CHMOD_SET_ALL,
CHMOD_MARKED_ALL,
CHMOD_SET_MARKED,
CHMOD_CLEAR_MARKED
};
// Both rule sets apply to C files that also start with a shell shebang.
enum { SYNTAX_C=1, SYNTAX_SHELL=2 };
extern PanelProp left_panel;
extern PanelProp right_panel;
extern PanelProp* active_panel;
// Global windows
extern WINDOW *win1;
extern WINDOW *win2;
extern WINDOW *progress;
extern struct utsname unameData;
extern struct passwd *pw;
extern const char *username;
extern int cursor_pos;
extern int cmd_offset;
extern int prompt_length;
extern char cmd[CMD_MAX];
extern int cmd_len;
extern int color_enabled;