diff options
| author | nirav <nirav@teisuu.com> | 2018-09-02 17:40:59 +0530 |
|---|---|---|
| committer | Dandelion <nirav@teisuu.com> | 2018-09-02 17:40:59 +0530 |
| commit | a49ccb8c0731aa0bba767199dfee1e7e235aeb29 (patch) | |
| tree | 727e8e1c2f40ad4d0683eaf52aeb2bd70b0e6b53 /file.c | |
| parent | 8472e02a212af0be07b19127db313e8e7523711a (diff) | |
| download | im-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.c | 22 |
1 files changed, 18 insertions, 4 deletions
@@ -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]; +} |
