Thumbnail

rani/cscroll.git

Clone URL: https://git.buni.party/rani/cscroll.git

commit 94c0108f3f74a8b9ea4fbe4426c8d92964bb58e7 Author: Raniconduh <clagv.randomgames@gmail.com> Date: Sat Oct 09 20:06:39 2021 +0000 added support for executable files diff --git a/include/dir.h b/include/dir.h index 123d504..9706e72 100644 --- a/include/dir.h +++ b/include/dir.h @@ -236 +237 @@ enum file_type_t {  struct dir_entry_t {   char * name;   enum file_type_t file_type; + bool exec;  };     diff --git a/src/dir.c b/src/dir.c index d5d984a..57424b0 100644 --- a/src/dir.c +++ b/src/dir.c @@ -736 +7311 @@ int list_dir(char * dir_path) {   dir_entry->file_type = FILE_UNKNOWN;   break;   } + // S_IXUSR + if (dir_entry->file_type != FILE_DIR) + dir_entry->exec = (bool)(buf->st_mode & S_IXUSR); + else dir_entry->exec = false; +   free(buf);     dir_entries[n_dir_entries] = dir_entry; diff --git a/src/io.c b/src/io.c index 69160bc..16e93eb 100644 --- a/src/io.c +++ b/src/io.c @@ -677 +6710 @@ void curses_write_file(struct dir_entry_t * dir_entry, bool highlight) {   break;   default: break;   } - if (cp == -1) { + if (dir_entry->exec) { + f_ident = '*'; + if (cp == -1) cp = HGREEN; + } else if (cp == -1) {   cp = HWHITE;   f_ident = ' ';   } @@ -1007 +10310 @@ void curses_write_file(struct dir_entry_t * dir_entry, bool highlight) {     default: break;   } - if (cp == -1) { + if (dir_entry->exec) { + f_ident = '*'; + if (cp == -1) cp = GREEN; + } else if (cp == -1) {   cp = WHITE;   f_ident = ' ';   }