aboutsummaryrefslogtreecommitdiff
path: root/file.c
diff options
context:
space:
mode:
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];
+}