improvenment to color managenment
This commit is contained in:
15
backend.c
15
backend.c
@ -54,24 +54,27 @@ void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_conten
|
||||
lstat(dir_content[i].file_name, file);
|
||||
|
||||
if (S_ISDIR(file->st_mode)) {
|
||||
dir_content[i].file_type = COLOR_DIR;
|
||||
dir_content[i].file_type = FILE_TYPE_DIR;
|
||||
dir_content[i].color_pair = COLOR_DIR;
|
||||
} else if (file->st_mode & S_IXUSR) {
|
||||
dir_content[i].file_type = FILE_TYPE_EXEC;
|
||||
dir_content[i].color_pair = COLOR_EXEC;
|
||||
} else if (S_ISBLK(file->st_mode)) {
|
||||
dir_content[i].file_type = COLOR_BLOCK;
|
||||
dir_content[i].file_type = FILE_TYPE_BLOCK;
|
||||
dir_content[i].color_pair = COLOR_BLOCK;
|
||||
/*} else if (S_ISCHR(file->st_mode)) {
|
||||
dir_content[i].file_type = COLOR_CHARDEV; */
|
||||
} else if (S_ISLNK(file->st_mode)) {
|
||||
dir_content[i].file_type = COLOR_SYMLINK;
|
||||
dir_content[i].file_type = FILE_TYPE_SYMLINK;
|
||||
dir_content[i].color_pair = COLOR_SYMLINK;
|
||||
} else if (S_ISFIFO(file->st_mode)) {
|
||||
dir_content[i].file_type = COLOR_FIFO;
|
||||
dir_content[i].file_type = FILE_TYPE_FIFO;
|
||||
dir_content[i].color_pair = COLOR_FIFO;
|
||||
} else if (S_ISSOCK(file->st_mode)) {
|
||||
dir_content[i].file_type = COLOR_SOCK;
|
||||
dir_content[i].file_type = FILE_TYPE_SOCK;
|
||||
dir_content[i].color_pair = COLOR_SOCK;
|
||||
} else if (S_ISREG(file->st_mode)) {
|
||||
dir_content[i].file_type = COLOR_REGULAR;
|
||||
dir_content[i].file_type = FILE_TYPE_REGULAR;
|
||||
dir_content[i].color_pair = COLOR_REGULAR;
|
||||
unsigned long j = 0;
|
||||
char *extension = strrchr(entry[i]->d_name, '.');
|
||||
|
Reference in New Issue
Block a user