diff --git a/backend.c b/backend.c index 7d53599..2e0de49 100644 --- a/backend.c +++ b/backend.c @@ -86,6 +86,10 @@ void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_conten dir_content[i].file_type = FILE_TYPE_DIR; dir_content[i].color_pair = COLOR_DIR; dir_content[i].file_size = get_dir_size(full_path); + } else if (S_ISLNK(file->st_mode)) { + dir_content[i].file_type = FILE_TYPE_SYMLINK; + dir_content[i].color_pair = COLOR_SYMLINK; + dir_content[i].file_size = get_dir_size(full_path); } else if (file->st_mode & S_IXUSR) { dir_content[i].file_type = FILE_TYPE_EXEC; dir_content[i].color_pair = COLOR_EXEC; @@ -94,10 +98,6 @@ void get_dir_content(char *path, unsigned long *dir_file_count, file *dir_conten 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 = FILE_TYPE_SYMLINK; - dir_content[i].color_pair = COLOR_SYMLINK; - dir_content[i].file_size = get_dir_size(full_path); } else if (S_ISFIFO(file->st_mode)) { dir_content[i].file_type = FILE_TYPE_FIFO; dir_content[i].color_pair = COLOR_FIFO; diff --git a/colors.c b/colors.c index 5f163c3..cf378bb 100644 --- a/colors.c +++ b/colors.c @@ -68,15 +68,15 @@ void colors_init() { } else if (!strcmp(token, "DIR")) { parse_colors(line, &fg, &bg); init_pair(1, fg, bg); /* directory */ - } else if (!strcmp(token, "EXEC")){ - parse_colors(line, &fg, &bg); - init_pair(2, fg, bg); /* exec */ - } else if (!strcmp(token, "RESET")){ - parse_colors(line, &fg, &bg); - init_pair(3, fg, bg); /* regular file */ } else if (!strcmp(token, "LINK")){ parse_colors(line, &fg, &bg); - init_pair(4, fg, bg); /* symlink */ + init_pair(2, fg, bg); /* symlink */ + } else if (!strcmp(token, "EXEC")){ + parse_colors(line, &fg, &bg); + init_pair(3, fg, bg); /* exec */ + } else if (!strcmp(token, "RESET")){ + parse_colors(line, &fg, &bg); + init_pair(4, fg, bg); /* regular file */ } else if (!strcmp(token, "BLK")){ parse_colors(line, &fg, &bg); init_pair(5, fg, bg); /* block device */ diff --git a/defines.h b/defines.h index 6a06765..ceea496 100644 --- a/defines.h +++ b/defines.h @@ -28,9 +28,9 @@ #define COLOR_UNKNOWN 0 #define COLOR_DIR 1 -#define COLOR_EXEC 2 /* not really a filetype, moreso if it is executable */ -#define COLOR_REGULAR 3 -#define COLOR_SYMLINK 4 +#define COLOR_SYMLINK 2 +#define COLOR_EXEC 3 /* not really a filetype, moreso if it is executable */ +#define COLOR_REGULAR 4 #define COLOR_BLOCK 5 #define COLOR_CHARDEV 6 #define COLOR_SOCK 7