Commit aea70b20 authored by Birte Kristina Friesel's avatar Birte Kristina Friesel
Browse files

--filelist: Support reading from /dev/stdin ("-" as shortcut)

Note that read_filelist used to check if its argument was an image (for people
accidentaly typing "feh -df *" instead of "feh -dF *"); this was removed
because it failed on /dev/stdin.

I might re-add it, but I'm not yet sure about the future of feh's automatic
filelist saving.
parent 9fcf2580
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -6,6 +6,7 @@ git HEAD
      better readable
      <https://github.com/derf/feh/issues/60>
    * The --collage option (aka collage mode) is now deprecated
    * The --filelist option now supports /dev/stdin (or "-" as shortcut)

Tue, 16 Aug 2011 22:48:06 +0200  Daniel Friesel <derf@finalrewind.org>

+19 −2
Original line number Diff line number Diff line
@@ -195,12 +195,20 @@ This option is similar to the playlists used by music software. If
.Ar file
exists, it will be read for a list of files to load, in the order they appear.
The format is a list of image filenames, absolute or relative to the current
directory, one filename per line.  If
directory, one filename per line.
.
.Pp
.
If
.Ar file
doesn't exist, it will be created from the internal filelist at the end of a
viewing session.  This is best used to store the results of complex sorts
.Pq Cm -Spixels No for example
for later viewing.  Any changes to the internal filelist
for later viewing.
.
.Pp
.
Any changes to the internal filelist
.Pq such as deleting a file or it being pruned for being unloadable
will be saved to
.Ar file
@@ -209,6 +217,15 @@ when
exits.  You can add files to filelists by specifying them on the commandline
when also specifying the list.
.
.Pp
.
If
.Ar file
is
.Qq - ,
.Nm
will read the filelist from its standard input.
.
.It Cm -e , --font Ar font
.
Set global font.  Should be a truetype font, resident in the current directory
+1 −14
Original line number Diff line number Diff line
@@ -440,7 +440,7 @@ int feh_write_filelist(gib_list * list, char *filename)
	FILE *fp;
	gib_list *l;

	if (!list || !filename)
	if (!list || !filename || !strcmp(filename, "/dev/stdin"))
		return(0);

	errno = 0;
@@ -467,19 +467,6 @@ gib_list *feh_read_filelist(char *filename)
	if (!filename)
		return(NULL);

	/* try and load the given filelist as an image, cowardly refuse to
	 * overwrite an image with a filelist. (requested by user who did feh -df *
	 * when he meant feh -dF *, as it overwrote the first image with the
	 * filelist).
	 */
	if (feh_load_image_char(&im1, filename)) {
		weprintf(
				"The file you specified as a filelist to read - %s - appears to be an image. Ignoring it (this is a common mistake).\n",
				filename);
		opt.filelistfile = NULL;
		return(NULL);
	}

	errno = 0;
	if ((fp = fopen(filename, "r")) == NULL) {
		/* return quietly, as it's okay to specify a filelist file that doesn't
+4 −1
Original line number Diff line number Diff line
@@ -627,6 +627,9 @@ static void feh_parse_option_array(int argc, char **argv, int finalrun)
			opt.alpha_level = 255 - atoi(optarg);
			break;
		case 'f':
			if (!strcmp(optarg, "-"))
				opt.filelistfile = estrdup("/dev/stdin");
			else
				opt.filelistfile = estrdup(optarg);
			break;
		case '0':