fe
terminal file explorer and picker
git clone https://9o.is/git/fe.git
commit 6fab37bc5e639365d6a96064b4e6d16dfa1e34f3 parent 326424f91c594e3dc3db420161f324aa40637fd6 Author: Jul <jul@9o.is> Date: Mon, 19 Jan 2026 00:19:14 -0500 set const where appropriate Diffstat:
| M | entries.c | | | 2 | +- |
| M | tty.c | | | 6 | +++--- |
| M | tty.h | | | 4 | ++-- |
3 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/entries.c b/entries.c @@ -161,7 +161,7 @@ static int dentfind(struct entry *dents, int n, char *cwd, const char *path) { return 0; } -static int filetype(char *path) { +static int filetype(const char *path) { int fd = open(path, O_RDONLY | O_NONBLOCK); if (fd == -1) return 0; diff --git a/tty.c b/tty.c @@ -9,7 +9,7 @@ #include <errno.h> #include "tty.h" -static void tty_reset(tty_t *tty) { +static void tty_reset(const tty_t *tty) { tcsetattr(tty->fdin, TCSANOW, &tty->original_termios); } @@ -79,7 +79,7 @@ void tty_init(tty_t *tty, const char *tty_filename) { signal(SIGWINCH, handle_sigwinch); } -char tty_getchar(tty_t *tty) { +char tty_getchar(const tty_t *tty) { char ch; int size = read(tty->fdin, &ch, 1); if (size < 0) { @@ -93,7 +93,7 @@ char tty_getchar(tty_t *tty) { } } -int tty_input_ready(tty_t *tty, long int timeout, int return_on_signal) { +int tty_input_ready(const tty_t *tty, long int timeout, int return_on_signal) { fd_set readfs; FD_ZERO(&readfs); FD_SET(tty->fdin, &readfs); diff --git a/tty.h b/tty.h @@ -16,8 +16,8 @@ typedef struct { void tty_close(tty_t *tty); void tty_init(tty_t *tty, const char *tty_filename); -char tty_getchar(tty_t *tty); -int tty_input_ready(tty_t *tty, long int timeout, int return_on_signal); +char tty_getchar(const tty_t *tty); +int tty_input_ready(const tty_t *tty, long int timeout, int return_on_signal); void tty_setfg(tty_t *tty, int fg); void tty_setinvert(tty_t *tty);