summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDaniel Friesel <derf@derf.homelinux.org>2010-05-03 20:12:46 +0200
committerDaniel Friesel <derf@derf.homelinux.org>2010-05-03 20:12:46 +0200
commit51802b3732716e02a719d2dbd86fbac109851b06 (patch)
treebbb8d6201361593d9e15a082668686f3d8ff95c5 /src
parent308031b69cd440534ee076dcaabba93e489b4faf (diff)
Make --start-at work with filenames instead of list positions
Diffstat (limited to 'src')
-rw-r--r--src/options.c3
-rw-r--r--src/options.h2
-rw-r--r--src/slideshow.c19
3 files changed, 15 insertions, 9 deletions
diff --git a/src/options.c b/src/options.c
index 9afa33a..224af59 100644
--- a/src/options.c
+++ b/src/options.c
@@ -72,6 +72,7 @@ void init_parse_options(int argc, char **argv)
opt.blur_button = 1;
opt.no_blur_ctrl_mask = 0;
+ opt.start_list_at = NULL;
opt.no_jump_on_resort = 0;
opt.builtin_http = 0;
@@ -627,7 +628,7 @@ static void feh_parse_option_array(int argc, char **argv)
opt.blur_button = atoi(optarg);
break;
case '|':
- opt.start_list_at = atoi(optarg);
+ opt.start_list_at = estrdup(optarg);
break;
case 't':
opt.thumbs = 1;
diff --git a/src/options.h b/src/options.h
index 55b997f..4a275e9 100644
--- a/src/options.h
+++ b/src/options.h
@@ -87,6 +87,7 @@ struct __fehoptions {
char *rcfile;
char *menu_style;
char *caption_path;
+ char *start_list_at;
gib_style *menu_style_l;
@@ -119,7 +120,6 @@ struct __fehoptions {
int default_zoom;
int menu_border;
unsigned char adjust_reload;
- unsigned int start_list_at;
unsigned char mode;
unsigned char paused;
diff --git a/src/slideshow.c b/src/slideshow.c
index 0d509e4..e3791a1 100644
--- a/src/slideshow.c
+++ b/src/slideshow.c
@@ -34,18 +34,23 @@ void init_slideshow_mode(void)
winwidget w = NULL;
int success = 0;
char *s = NULL;
- gib_list *l = NULL, *last = NULL;
+ gib_list *l = filelist, *last = NULL;
feh_file *file = NULL;
D_ENTER(3);
- mode = "slideshow";
- if (opt.start_list_at) {
- l = gib_list_nth(filelist, opt.start_list_at);
- opt.start_list_at = 0; /* for next time */
- } else {
- l = filelist;
+ for (l = filelist; l && opt.start_list_at; l = l->next) {
+ if (!strcmp(opt.start_list_at, FEH_FILE(l->data)->filename)) {
+ opt.start_list_at = NULL;
+ break;
+ }
}
+
+ if (opt.start_list_at)
+ eprintf("--start-at %s: File not found in filelist",
+ opt.start_list_at);
+
+ mode = "slideshow";
for (; l; l = l->next) {
file = FEH_FILE(l->data);
if (last) {