removal of file_size_width
This commit is contained in:
32
backend.c
32
backend.c
@@ -61,8 +61,7 @@ void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_conten
|
|||||||
for (i = 0; i < *dir_file_count; i++ ) {
|
for (i = 0; i < *dir_file_count; i++ ) {
|
||||||
if (entry[i]->d_name[0] == '.' && !(file_modifiers & FILE_MODIFIERS_HIDDEN_FILES)) {
|
if (entry[i]->d_name[0] == '.' && !(file_modifiers & FILE_MODIFIERS_HIDDEN_FILES)) {
|
||||||
} else {
|
} else {
|
||||||
dir_content[i].file_name_width = strlen(entry[i]->d_name);
|
dir_content[i].file_name = malloc(strlen(entry[i]->d_name));
|
||||||
dir_content[i].file_name = malloc(dir_content[i].file_name_width + 1);
|
|
||||||
strcpy(dir_content[i].file_name, entry[i]->d_name);
|
strcpy(dir_content[i].file_name, entry[i]->d_name);
|
||||||
|
|
||||||
struct stat *file;
|
struct stat *file;
|
||||||
@@ -208,16 +207,17 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
|||||||
* example output: aaa~.txt
|
* example output: aaa~.txt
|
||||||
* if no extension is found, the name will truncate */
|
* if no extension is found, the name will truncate */
|
||||||
char *file_name;
|
char *file_name;
|
||||||
if ((dir_content[i].file_name_width + offset_front + is_selected) > offset_back - 1) {
|
unsigned long file_name_width = strlen(dir_content[i].file_name);
|
||||||
|
if ((file_name_width + offset_front + is_selected) > offset_back - 1) {
|
||||||
char *extension = strrchr(dir_content[i].file_name, '.');
|
char *extension = strrchr(dir_content[i].file_name, '.');
|
||||||
if (extension) {
|
if (extension) {
|
||||||
int char_offset = (dir_content[i].file_name_width + offset_front + is_selected) - (offset_back - 1) ;
|
int char_offset = (file_name_width + offset_front + is_selected) - (offset_back - 1) ;
|
||||||
if ((dir_content[i].file_name_width - char_offset - strlen(extension) - 1) > 1) {
|
if ((file_name_width - char_offset - strlen(extension) - 1) > 1) {
|
||||||
file_name = malloc(dir_content[i].file_name_width - char_offset);
|
file_name = malloc(file_name_width - char_offset);
|
||||||
memcpy(file_name, dir_content[i].file_name, dir_content[i].file_name_width - char_offset);
|
memcpy(file_name, dir_content[i].file_name, file_name_width - char_offset);
|
||||||
memcpy(file_name + (dir_content[i].file_name_width - char_offset - strlen(extension)), extension, strlen(extension));
|
memcpy(file_name + (file_name_width - char_offset - strlen(extension)), extension, strlen(extension));
|
||||||
file_name[dir_content[i].file_name_width - char_offset - strlen(extension) - 1] = '~';
|
file_name[file_name_width - char_offset - strlen(extension) - 1] = '~';
|
||||||
file_name[dir_content[i].file_name_width - char_offset] = '\0';
|
file_name[file_name_width - char_offset] = '\0';
|
||||||
} else {
|
} else {
|
||||||
file_name = malloc(strlen(extension)+1);
|
file_name = malloc(strlen(extension)+1);
|
||||||
file_name[0] = '~';
|
file_name[0] = '~';
|
||||||
@@ -225,15 +225,15 @@ void print_dir(WINDOW *win, char print_info, unsigned long *dir_file_count, file
|
|||||||
file_name[strlen(extension)] = '\0';
|
file_name[strlen(extension)] = '\0';
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
file_name = malloc(dir_content[i].file_name_width+1);
|
file_name = malloc(file_name_width+1);
|
||||||
memcpy(file_name, dir_content[i].file_name, dir_content[i].file_name_width);
|
memcpy(file_name, dir_content[i].file_name, file_name_width);
|
||||||
file_name[dir_content[i].file_name_width] = '\0';
|
file_name[file_name_width] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
file_name = malloc(dir_content[i].file_name_width+1);
|
file_name = malloc(file_name_width+1);
|
||||||
memcpy(file_name, dir_content[i].file_name, dir_content[i].file_name_width);
|
memcpy(file_name, dir_content[i].file_name, file_name_width);
|
||||||
file_name[dir_content[i].file_name_width] = '\0';
|
file_name[file_name_width] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
mvwaddstr(win, i, 0, bg);
|
mvwaddstr(win, i, 0, bg);
|
||||||
|
2
colors.c
2
colors.c
@@ -13,7 +13,7 @@ extern file *rgt_content;
|
|||||||
extern unsigned long rgt_file_count;
|
extern unsigned long rgt_file_count;
|
||||||
|
|
||||||
extern unsigned int settings;
|
extern unsigned int settings;
|
||||||
extern volatile unsigned int status;
|
extern unsigned int status;
|
||||||
|
|
||||||
void parse_colors(char *line, short *fg, short *bg){
|
void parse_colors(char *line, short *fg, short *bg){
|
||||||
int tmp;
|
int tmp;
|
||||||
|
@@ -58,8 +58,7 @@ typedef struct File {
|
|||||||
char status;
|
char status;
|
||||||
unsigned char file_type;
|
unsigned char file_type;
|
||||||
unsigned short color_pair;
|
unsigned short color_pair;
|
||||||
unsigned int permissions;
|
unsigned short permissions;
|
||||||
unsigned long file_name_width;
|
|
||||||
unsigned long file_size; /*if its a file, its in bytes, if its a dir, its the count of files within that dir */
|
unsigned long file_size; /*if its a file, its in bytes, if its a dir, its the count of files within that dir */
|
||||||
char *file_name;
|
char *file_name;
|
||||||
} file;
|
} file;
|
||||||
|
@@ -19,10 +19,10 @@ extern unsigned int file_modifiers;
|
|||||||
extern pthread_mutex_t mutex_selection;
|
extern pthread_mutex_t mutex_selection;
|
||||||
extern pthread_mutex_t mutex_rgt;
|
extern pthread_mutex_t mutex_rgt;
|
||||||
extern pthread_mutex_t mutex_mid;
|
extern pthread_mutex_t mutex_mid;
|
||||||
extern volatile file *mid_content;
|
extern file *mid_content;
|
||||||
extern file *lft_content;
|
extern file *lft_content;
|
||||||
extern file *rgt_content;
|
extern file *rgt_content;
|
||||||
extern file *file_current;
|
extern volatile file *file_current;
|
||||||
|
|
||||||
extern unsigned int terminal_height;
|
extern unsigned int terminal_height;
|
||||||
extern unsigned int terminal_width;
|
extern unsigned int terminal_width;
|
||||||
@@ -33,7 +33,7 @@ extern char *rgt_buffer;
|
|||||||
extern char *btm_buffer;
|
extern char *btm_buffer;
|
||||||
extern unsigned long mid_file_count;
|
extern unsigned long mid_file_count;
|
||||||
|
|
||||||
extern volatile unsigned int status;
|
extern unsigned int status;
|
||||||
|
|
||||||
unsigned int timeout_time = 0;
|
unsigned int timeout_time = 0;
|
||||||
extern char *input;
|
extern char *input;
|
||||||
@@ -240,9 +240,6 @@ void move_right(){
|
|||||||
char *cmd = concat(file_extension_default_cmd[i].command, " ./\"");
|
char *cmd = concat(file_extension_default_cmd[i].command, " ./\"");
|
||||||
cmd = concat(cmd, file_current->file_name);
|
cmd = concat(cmd, file_current->file_name);
|
||||||
cmd = concat(cmd, "\"");
|
cmd = concat(cmd, "\"");
|
||||||
btm_buffer = malloc(strlen(cmd));
|
|
||||||
|
|
||||||
strcpy(btm_buffer, cmd-1);
|
|
||||||
|
|
||||||
|
|
||||||
if (system(cmd) == -1) {
|
if (system(cmd) == -1) {
|
||||||
@@ -300,7 +297,7 @@ void open_with(){
|
|||||||
btm_buffer = concat("open \"", file_current->file_name);
|
btm_buffer = concat("open \"", file_current->file_name);
|
||||||
btm_buffer = concat(btm_buffer, "\" with:");
|
btm_buffer = concat(btm_buffer, "\" with:");
|
||||||
|
|
||||||
status = STATUS_UPDATE_SCREEN_0;
|
status |= STATUS_UPDATE_SCREEN_0;
|
||||||
werase(win_b);
|
werase(win_b);
|
||||||
mvwin(win_b, terminal_height-6, 0);
|
mvwin(win_b, terminal_height-6, 0);
|
||||||
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
||||||
@@ -340,7 +337,7 @@ void rename_hovered(){
|
|||||||
btm_buffer = concat("rename \"", file_current->file_name);
|
btm_buffer = concat("rename \"", file_current->file_name);
|
||||||
btm_buffer = concat(btm_buffer, "\" to:");
|
btm_buffer = concat(btm_buffer, "\" to:");
|
||||||
|
|
||||||
status = STATUS_UPDATE_SCREEN_0;
|
status |= STATUS_UPDATE_SCREEN_0;
|
||||||
werase(win_b);
|
werase(win_b);
|
||||||
mvwin(win_b, terminal_height-6, 0);
|
mvwin(win_b, terminal_height-6, 0);
|
||||||
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
||||||
@@ -399,7 +396,7 @@ void delete(){
|
|||||||
btm_buffer = concat(btm_buffer, "\n\n");
|
btm_buffer = concat(btm_buffer, "\n\n");
|
||||||
btm_buffer = concat(btm_buffer, "(y/N)");
|
btm_buffer = concat(btm_buffer, "(y/N)");
|
||||||
|
|
||||||
status = STATUS_UPDATE_SCREEN_0;
|
status |= STATUS_UPDATE_SCREEN_0;
|
||||||
werase(win_b);
|
werase(win_b);
|
||||||
mvwin(win_b, terminal_height-6, 0);
|
mvwin(win_b, terminal_height-6, 0);
|
||||||
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
||||||
@@ -458,7 +455,7 @@ void delete(){
|
|||||||
|
|
||||||
void makedir(){
|
void makedir(){
|
||||||
btm_buffer = "create dir: ";
|
btm_buffer = "create dir: ";
|
||||||
status = STATUS_UPDATE_SCREEN_0;
|
status |= STATUS_UPDATE_SCREEN_0;
|
||||||
werase(win_b);
|
werase(win_b);
|
||||||
mvwin(win_b, terminal_height-6, 0);
|
mvwin(win_b, terminal_height-6, 0);
|
||||||
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
||||||
@@ -480,7 +477,7 @@ void makedir(){
|
|||||||
}
|
}
|
||||||
void makefile(){
|
void makefile(){
|
||||||
btm_buffer = "create file: ";
|
btm_buffer = "create file: ";
|
||||||
status = STATUS_UPDATE_SCREEN_0;
|
status |= STATUS_UPDATE_SCREEN_0;
|
||||||
werase(win_b);
|
werase(win_b);
|
||||||
mvwin(win_b, terminal_height-6, 0);
|
mvwin(win_b, terminal_height-6, 0);
|
||||||
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
||||||
@@ -549,7 +546,7 @@ void cmd_on_selected(int passes, int index){
|
|||||||
btm_buffer = concat(btm_buffer, "\n\n");
|
btm_buffer = concat(btm_buffer, "\n\n");
|
||||||
btm_buffer = concat(btm_buffer, "(y/N)");
|
btm_buffer = concat(btm_buffer, "(y/N)");
|
||||||
|
|
||||||
status = STATUS_UPDATE_SCREEN_0;
|
status |= STATUS_UPDATE_SCREEN_0;
|
||||||
werase(win_b);
|
werase(win_b);
|
||||||
mvwin(win_b, terminal_height-6, 0);
|
mvwin(win_b, terminal_height-6, 0);
|
||||||
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
wresize(win_b, 5, terminal_width/3); /*the div3 just looks cool*/
|
||||||
|
5
main.c
5
main.c
@@ -17,7 +17,7 @@ unsigned int temp_heigth = 0; /*used for screen refresh*/
|
|||||||
unsigned int temp_width = 0;
|
unsigned int temp_width = 0;
|
||||||
unsigned int settings;
|
unsigned int settings;
|
||||||
unsigned int file_modifiers;
|
unsigned int file_modifiers;
|
||||||
volatile unsigned int status;
|
unsigned int status = (STATUS_RUN_BACKEND | STATUS_UPDATE_SCREEN_MASK | STATUS_RELOAD_DIRECTORY);
|
||||||
char *start_path;
|
char *start_path;
|
||||||
|
|
||||||
WINDOW *win_t;
|
WINDOW *win_t;
|
||||||
@@ -75,6 +75,7 @@ int main(){
|
|||||||
pthread_cancel(thread_t);
|
pthread_cancel(thread_t);
|
||||||
}
|
}
|
||||||
if (threading) {
|
if (threading) {
|
||||||
|
status &= ~(STATUS_RELOAD_DIRECTORY);
|
||||||
pthread_join(thread_t, NULL);
|
pthread_join(thread_t, NULL);
|
||||||
pthread_join(thread_l, NULL);
|
pthread_join(thread_l, NULL);
|
||||||
pthread_join(thread_m, NULL);
|
pthread_join(thread_m, NULL);
|
||||||
@@ -88,7 +89,7 @@ int main(){
|
|||||||
pthread_create(&thread_m, NULL, thread_mid, &status); /*current_content slash win_m*/
|
pthread_create(&thread_m, NULL, thread_mid, &status); /*current_content slash win_m*/
|
||||||
pthread_create(&thread_b, NULL, thread_btm, &status); /*bottom bar*/
|
pthread_create(&thread_b, NULL, thread_btm, &status); /*bottom bar*/
|
||||||
pthread_create(&thread_r, NULL, thread_rgt, &status); /*child_content slash win_r*/
|
pthread_create(&thread_r, NULL, thread_rgt, &status); /*child_content slash win_r*/
|
||||||
status &= ~(STATUS_RUN_BACKEND | STATUS_RELOAD_DIRECTORY);
|
status &= ~(STATUS_RUN_BACKEND);
|
||||||
status |= STATUS_UPDATE_SCREEN_0;
|
status |= STATUS_UPDATE_SCREEN_0;
|
||||||
threading = 1;
|
threading = 1;
|
||||||
}
|
}
|
||||||
|
42
threading.c
42
threading.c
@@ -21,13 +21,13 @@ pthread_cond_t cond_wait;
|
|||||||
volatile char wait_count; /* this is used to determine how many threads are waiting for cont_wait */
|
volatile char wait_count; /* this is used to determine how many threads are waiting for cont_wait */
|
||||||
|
|
||||||
file *rgt_content;
|
file *rgt_content;
|
||||||
volatile file *mid_content;
|
file *mid_content;
|
||||||
file *lft_content;
|
file *lft_content;
|
||||||
char *rgt_buffer; /* used for file previews, unlike rgt_content, which is used for directory previews */
|
char *rgt_buffer; /* used for file previews, unlike rgt_content, which is used for directory previews */
|
||||||
char *btm_buffer;
|
char *btm_buffer;
|
||||||
char *top_buffer; /* current path */
|
char *top_buffer; /* current path */
|
||||||
|
|
||||||
file *file_current;
|
volatile file *file_current;
|
||||||
|
|
||||||
|
|
||||||
unsigned long rgt_file_count;
|
unsigned long rgt_file_count;
|
||||||
@@ -43,14 +43,13 @@ extern unsigned int terminal_width;
|
|||||||
|
|
||||||
|
|
||||||
void *thread_mid(void *data){
|
void *thread_mid(void *data){
|
||||||
volatile unsigned int status = *(unsigned int*)data;
|
unsigned int status = *(unsigned int*)data;
|
||||||
pthread_mutex_lock(&mutex_mid);
|
pthread_mutex_lock(&mutex_mid);
|
||||||
|
|
||||||
|
|
||||||
char *path;
|
char *path;
|
||||||
if((path=getcwd(NULL, 0)) == NULL) {
|
if((path=getcwd(NULL, 0)) == NULL) {
|
||||||
mid_content = malloc(sizeof(file));
|
mid_content = malloc(sizeof(file));
|
||||||
mid_content->file_name_width = sizeof("cannot open directory");
|
|
||||||
mid_content->file_name = "cannot open directory";
|
mid_content->file_name = "cannot open directory";
|
||||||
mid_file_count = 1;
|
mid_file_count = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -58,10 +57,10 @@ void *thread_mid(void *data){
|
|||||||
|
|
||||||
if (status & STATUS_RELOAD_DIRECTORY) {
|
if (status & STATUS_RELOAD_DIRECTORY) {
|
||||||
free(mid_content);
|
free(mid_content);
|
||||||
mid_file_count = (unsigned long)get_dir_size(path);
|
mid_file_count = get_dir_size(path);
|
||||||
if (mid_file_count > 0) {
|
if (mid_file_count > 0) {
|
||||||
mid_content = malloc(mid_file_count * sizeof(file));
|
mid_content = malloc(mid_file_count * sizeof(file));
|
||||||
memset(mid_content, ' ', mid_file_count * sizeof(file));
|
memset(mid_content, '\0', mid_file_count * sizeof(file));
|
||||||
get_dir_content(path, &mid_file_count, mid_content);
|
get_dir_content(path, &mid_file_count, mid_content);
|
||||||
} else {
|
} else {
|
||||||
selected_file_current = 0;
|
selected_file_current = 0;
|
||||||
@@ -71,18 +70,14 @@ void *thread_mid(void *data){
|
|||||||
mid_content->file_size = 0;
|
mid_content->file_size = 0;
|
||||||
mid_content->permissions = 0;
|
mid_content->permissions = 0;
|
||||||
mid_content->color_pair = 0;
|
mid_content->color_pair = 0;
|
||||||
mid_content->file_name_width = sizeof("empty dir");
|
|
||||||
mid_content->file_name = "empty dir";
|
mid_content->file_name = "empty dir";
|
||||||
/*
|
|
||||||
|
|
||||||
file_current->file_name = mid_content->file_name;
|
file_current->file_name = mid_content->file_name;
|
||||||
file_current->file_name_width = mid_content->file_name_width;
|
|
||||||
file_current->file_size = mid_content->file_size;
|
file_current->file_size = mid_content->file_size;
|
||||||
file_current->file_type = mid_content->file_type;
|
file_current->file_type = mid_content->file_type;
|
||||||
file_current->color_pair = mid_content->color_pair;
|
file_current->color_pair = mid_content->color_pair;
|
||||||
file_current->permissions = mid_content->permissions;
|
file_current->permissions = mid_content->permissions;
|
||||||
file_current->status = mid_content->status;
|
file_current->status = mid_content->status;
|
||||||
*/
|
|
||||||
mid_file_count = 0;
|
mid_file_count = 0;
|
||||||
|
|
||||||
while(wait_count < 2){
|
while(wait_count < 2){
|
||||||
@@ -107,12 +102,10 @@ void *thread_mid(void *data){
|
|||||||
mid_content[selected_file_last].status &= ~FILE_STATUS_HOVER;
|
mid_content[selected_file_last].status &= ~FILE_STATUS_HOVER;
|
||||||
}
|
}
|
||||||
selected_file_last = selected_file_current;
|
selected_file_last = selected_file_current;
|
||||||
free(file_current);
|
free(file_current->file_name);
|
||||||
file_current = malloc(sizeof(file));
|
|
||||||
|
|
||||||
file_current->file_name_width = mid_content[selected_file_current].file_name_width;
|
file_current->file_name = malloc(strlen(mid_content[selected_file_current].file_name));
|
||||||
file_current->file_name = malloc(file_current->file_name_width);
|
strcpy(file_current->file_name, mid_content[selected_file_current].file_name);
|
||||||
memcpy(file_current->file_name, mid_content[selected_file_current].file_name, file_current->file_name_width);
|
|
||||||
file_current->file_size = mid_content[selected_file_current].file_size;
|
file_current->file_size = mid_content[selected_file_current].file_size;
|
||||||
file_current->file_type = mid_content[selected_file_current].file_type;
|
file_current->file_type = mid_content[selected_file_current].file_type;
|
||||||
file_current->color_pair = mid_content[selected_file_current].color_pair;
|
file_current->color_pair = mid_content[selected_file_current].color_pair;
|
||||||
@@ -141,7 +134,6 @@ void *thread_lft(void *data){
|
|||||||
char *path;
|
char *path;
|
||||||
if((path=getcwd(NULL, 0)) == NULL) {
|
if((path=getcwd(NULL, 0)) == NULL) {
|
||||||
lft_content = malloc(sizeof(file));
|
lft_content = malloc(sizeof(file));
|
||||||
lft_content[0].file_name_width = sizeof("cannot open directory");
|
|
||||||
lft_content[0].file_name = "cannot open directory";
|
lft_content[0].file_name = "cannot open directory";
|
||||||
lft_file_count = 1;
|
lft_file_count = 1;
|
||||||
} else {
|
} else {
|
||||||
@@ -150,10 +142,10 @@ void *thread_lft(void *data){
|
|||||||
path[0] = '/';
|
path[0] = '/';
|
||||||
|
|
||||||
if (status & STATUS_RELOAD_DIRECTORY) {
|
if (status & STATUS_RELOAD_DIRECTORY) {
|
||||||
|
lft_file_count = get_dir_size(path);
|
||||||
free(lft_content);
|
free(lft_content);
|
||||||
lft_file_count = (unsigned long)get_dir_size(path);
|
|
||||||
lft_content = malloc(lft_file_count * sizeof(file));
|
lft_content = malloc(lft_file_count * sizeof(file));
|
||||||
memset(lft_content, ' ', lft_file_count * sizeof(file));
|
memset(lft_content, '\0', lft_file_count * sizeof(file));
|
||||||
get_dir_content(path, &lft_file_count, lft_content);
|
get_dir_content(path, &lft_file_count, lft_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,17 +169,15 @@ void *thread_rgt(void *data){
|
|||||||
pthread_mutex_lock(&mutex_selection);
|
pthread_mutex_lock(&mutex_selection);
|
||||||
free(rgt_content);
|
free(rgt_content);
|
||||||
rgt_content = malloc(sizeof(file));
|
rgt_content = malloc(sizeof(file));
|
||||||
rgt_content->file_name = malloc(file_current->file_name_width + 1);
|
rgt_content->file_name = malloc(strlen(file_current->file_name));
|
||||||
memcpy(rgt_content->file_name, file_current->file_name, file_current->file_name_width);
|
strcpy(rgt_content->file_name, file_current->file_name);
|
||||||
rgt_content->file_name[file_current->file_name_width] = '\0';
|
|
||||||
rgt_content->file_name_width = file_current->file_name_width;
|
|
||||||
rgt_content->file_size = file_current->file_size;
|
rgt_content->file_size = file_current->file_size;
|
||||||
rgt_content->file_type = file_current->file_type;
|
rgt_content->file_type = file_current->file_type;
|
||||||
rgt_content->status = file_current->status;
|
rgt_content->status = file_current->status;
|
||||||
pthread_mutex_unlock(&mutex_selection);
|
pthread_mutex_unlock(&mutex_selection);
|
||||||
|
|
||||||
if (rgt_content->file_type == FILE_TYPE_DIR || rgt_content->file_type == FILE_TYPE_SYMLINK) {
|
if (rgt_content->file_type == FILE_TYPE_DIR || rgt_content->file_type == FILE_TYPE_SYMLINK) {
|
||||||
char *path = malloc(rgt_content[0].file_name_width + 1);
|
char *path = malloc(strlen(rgt_content[0].file_name) + 1);
|
||||||
strcpy(path, rgt_content[0].file_name);
|
strcpy(path, rgt_content[0].file_name);
|
||||||
free(rgt_content);
|
free(rgt_content);
|
||||||
rgt_file_count = get_dir_size(path);
|
rgt_file_count = get_dir_size(path);
|
||||||
@@ -277,17 +267,19 @@ void threading_init(){
|
|||||||
memset(rgt_buffer, '\0', sizeof(char));
|
memset(rgt_buffer, '\0', sizeof(char));
|
||||||
memset(btm_buffer, '\0', sizeof(char));
|
memset(btm_buffer, '\0', sizeof(char));
|
||||||
|
|
||||||
|
mid_content->file_type = 0;
|
||||||
|
mid_content->file_size = 0;
|
||||||
|
mid_content->file_name = malloc(sizeof(char));
|
||||||
|
mid_content->file_name[0] = '\0';
|
||||||
|
|
||||||
rgt_content->file_type = 0;
|
rgt_content->file_type = 0;
|
||||||
rgt_content->file_size = 0;
|
rgt_content->file_size = 0;
|
||||||
rgt_content->file_name_width = 0;
|
|
||||||
rgt_content->file_name = malloc(sizeof(char));
|
rgt_content->file_name = malloc(sizeof(char));
|
||||||
rgt_content->file_name[0] = '\0';
|
rgt_content->file_name[0] = '\0';
|
||||||
|
|
||||||
file_current = malloc(sizeof(file));
|
file_current = malloc(sizeof(file));
|
||||||
file_current->file_type = 0;
|
file_current->file_type = 0;
|
||||||
file_current->file_size = 0;
|
file_current->file_size = 0;
|
||||||
file_current->file_name_width = 0;
|
|
||||||
file_current->file_name = malloc(sizeof(char));
|
file_current->file_name = malloc(sizeof(char));
|
||||||
file_current->file_name[0] = '\0';
|
file_current->file_name[0] = '\0';
|
||||||
|
|
||||||
|
4
window.c
4
window.c
@@ -3,14 +3,14 @@
|
|||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include "defines.h"
|
#include "defines.h"
|
||||||
|
|
||||||
extern volatile unsigned int status;
|
extern unsigned int status;
|
||||||
extern char *input;
|
extern char *input;
|
||||||
|
|
||||||
extern unsigned int timeout_time;
|
extern unsigned int timeout_time;
|
||||||
extern unsigned int color_count;
|
extern unsigned int color_count;
|
||||||
extern color *colors;
|
extern color *colors;
|
||||||
|
|
||||||
extern volatile file *mid_content;
|
extern file *mid_content;
|
||||||
extern file *lft_content;
|
extern file *lft_content;
|
||||||
extern file *rgt_content;
|
extern file *rgt_content;
|
||||||
extern char *top_buffer;
|
extern char *top_buffer;
|
||||||
|
Reference in New Issue
Block a user