summaryrefslogtreecommitdiff
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
parent308031b69cd440534ee076dcaabba93e489b4faf (diff)
Make --start-at work with filenames instead of list positions
-rw-r--r--ChangeLog5
-rw-r--r--man/feh.116
-rw-r--r--src/options.c3
-rw-r--r--src/options.h2
-rw-r--r--src/slideshow.c19
5 files changed, 31 insertions, 14 deletions
diff --git a/ChangeLog b/ChangeLog
index f294840..749d0f6 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+git HEAD
+
+ * Fix memory leak related to the menu
+ * Make --start-at work with filenames instead of list positions
+
Thu Apr 22 22:28:09 CEST 2010 Daniel Friesel <derf@chaosdorf.de>
* Release v1.4.3
diff --git a/man/feh.1 b/man/feh.1
index 476b6bb..9d1bea0 100644
--- a/man/feh.1
+++ b/man/feh.1
@@ -123,10 +123,11 @@ when
.Nm
exits. You can add files to filelists by specifying them on the commandline
when also specifying the list.
-.It Cm -| , --start-at Ar position
-Start at
-.Ar position
-in the filelist.
+.It Cm -| , --start-at Ar filename
+Start the filelist at
+.Ar filename .
+See
+.Sx USAGE EXAMPLES .
.It Cm -p , --preload
Preload images. This doesn't mean hold them in RAM, it means run through
them and eliminate unloadable images first. Otherwise they will be removed
@@ -670,7 +671,12 @@ Show the images in .../presentation, sorted by name, in fullscreen,
automatically change to the next image after 5 seconds
.It feh -rSwidth -A Qo mv '%f' ~/images/'%n' Qc /opt/images
View all images in /opt/images and below, sorted by width, move an image to
-~/image/image_name when enter is pressed.
+~/image/image_name when enter is pressed
+.It feh --start-at ./foo.jpg \&.
+View all images in the current directory, starting with foo.jpg. All other
+images are still in the slideshow and can be viewed normally
+.It feh --start-at foo.jpg *
+Same as above
.El
.
.Sh BUGS
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) {