sfm

simple file manager
git clone git://git.afify.dev/sfm
Log | Files | Refs | README | LICENSE

commit 4039a5692dea460689bca2aa882052b9e9ac9f74
parent 367398f33aac9e28a8a093c4de4446d9f5b35db2
Author: afify <hassan@afify.dev>
Date:   Wed,  8 Jul 2020 07:49:24 +0300

[feat] color exec files

Diffstat:
Mconfig.def.h | 1+
Msfm.c | 13+++++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/config.def.h b/config.def.h @@ -22,6 +22,7 @@ static const uint16_t search_b = 166; static const uint16_t search_f = 255; static const uint16_t status_b = 234; static const uint16_t status_f = TB_DEFAULT; +static const uint16_t exec_f = 2; /* bookmarks */ static Bookmark bmarks[] = { diff --git a/sfm.c b/sfm.c @@ -87,6 +87,7 @@ static int delete_ent(char *fullpath); static int delete_file(char*); static int delete_dir(char*, int); static int check_dir(char*); +static int chech_execf(mode_t mode); static int open_files(char*); static int sort_name(const void *const, const void *const); static void float_to_string(float, char*); @@ -623,6 +624,14 @@ check_dir(char *path) } static int +chech_execf(mode_t mode) +{ + if (S_ISREG(mode)) + return ((S_IXUSR | S_IXGRP | S_IXOTH) & mode); + return 0; +} + +static int open_files(char *filename) { // TODO @@ -856,6 +865,10 @@ print_col(Entry *entry, size_t hdir, size_t x, size_t y, int dyn_y, int width, c fg = other_f; } + /* highlight executable files */ + if (chech_execf(entry->mode)) + fg = exec_f; + /* highlighted (cursor) */ if (y + dyn_y == hdir) { bg = bg | TB_REVERSE;