From a49ccb8c0731aa0bba767199dfee1e7e235aeb29 Mon Sep 17 00:00:00 2001 From: nirav Date: Sun, 2 Sep 2018 17:40:59 +0530 Subject: Added option for loading first, last image, added extra key bindings --- file.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'file.c') diff --git a/file.c b/file.c index eebc49d..33d326b 100644 --- a/file.c +++ b/file.c @@ -52,16 +52,30 @@ int scan(const char *file_name) char *get_next_file() { - if (curr_file_index >= file_list_count - 1) { + if (curr_file_index >= file_list_count - 1) return NULL; - } return file_list[++curr_file_index]; } char *get_prev_file() { - if (curr_file_index <= 0) { + if (curr_file_index <= 0) return NULL; - } return file_list[--curr_file_index]; } + +char *get_first_file() +{ + if (curr_file_index == 0) + return NULL; + curr_file_index = 0; + return file_list[curr_file_index]; +} + +char *get_last_file() +{ + if (curr_file_index == file_list_count - 1) + return NULL; + curr_file_index = file_list_count - 1; + return file_list[curr_file_index]; +} -- cgit v1.2.3