aboutsummaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
authornirav <nirav@teisuu.com>2018-09-02 17:40:59 +0530
committerDandelion <nirav@teisuu.com>2018-09-02 17:40:59 +0530
commita49ccb8c0731aa0bba767199dfee1e7e235aeb29 (patch)
tree727e8e1c2f40ad4d0683eaf52aeb2bd70b0e6b53 /file.c
parent8472e02a212af0be07b19127db313e8e7523711a (diff)
downloadim-a49ccb8c0731aa0bba767199dfee1e7e235aeb29.tar.gz
im-a49ccb8c0731aa0bba767199dfee1e7e235aeb29.zip
Added option for loading first, last image, added extra key bindings
Diffstat (limited to 'file.c')
-rw-r--r--file.c22
1 files changed, 18 insertions, 4 deletions
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];
+}